Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Code Snippet and functions - 8

Post your code snippets and functions for v7 here
989 posts | Last Activity on 05-05-2019 19:38 by Wanabo
Wanabo
Re: user_info_panel with warn if inbox, outbox and archive is full, added entypo, checked default, minor Modified the user_info_panel.
Added entypo, warn if inbox, outbox or archive is full, checkbox checked default, minor layout changes */

Warn if inbox, outbox and archive is full!
Add in section Gauges near line 241 in locale/YOURLANGUAGE/global.php
$locale['UM10A'] = "You have reached the limit! Delete some messages to continue using the system."; // English
$locale['UM10A'] = "U heeft de limiet bereikt! Verwijder enkele berichten om van het syteem gebruik te kunnen blijven maken."; // Dutch
$locale['UM10A'] = "Sie haben das Limit erreicht! Löschen Sie einige Nachrichten, um das System weiterhin verwenden zu können."; // German

See attached pictures for the workings.
Download and overwrite the attachment to infusions/user_info_panel/
douwe_yntema
douwe_yntema 26-04-2019 17:41, 7 months ago
Re: Multi site with one installation I made a multi subdomain site with 1 PHP-Fusion installation, which uses a separate database for each site.

It is V7.03, but can also be V8.xx.

I have multi subdomains like:
www.sub1.mysite.com
www.sub2.mysite.com

On the webserver every subdomain is pointing to the same folder on the webserver.

each site has its own database e.g. databasenames are like mysite_sub1 and mysite_sub2
each site has its own config.php in the root of the site e.g. config_sub1.php and config_sub2.php

In each config.php the settings for the database access are specified for each subdomain.
So in config_sub1.php the name of the database is: mysite_sub1, together with database login credentials, and different cookie prefix to prevent messing up with different login sessions.

In maincore.php I added the following:

Code
function StripSubdomain($Domain) {
 $domain_array = explode('.', $Domain);
 $domain_array = array_reverse($domain_array);
   return $domain_array[2];
}

$subdomain = StripSubdomain($_SERVER['HTTP_HOST']);
define("SUBDOMAIN", $subdomain);
define("CONFIGPHP", "config_".SUBDOMAIN.".php");




and I modified:

Code
// Locate config.php and set the basedir path
$folder_level = "";
$i = 0;
while (!file_exists($folder_level."config.php")) {
   $folder_level .= "";
   $i++;
   if ($i == 7) {
      die("config.php file not found");
   }
}



to

Code
// Locate config.php and set the basedir path
$folder_level = "";
$i = 0;
while (!file_exists($folder_level.CONFIGPHP)) {
   $folder_level .= "";
   $i++;
   if ($i == 7) {
      die("config.php file not found");
   }
}




and

Code
require_once BASEDIR."config.php";
// If config.php is empty, activate setup.php script
if (!isset($db_name)) {
   redirect("setup.php");
}



to

Code
require_once BASEDIR.CONFIGPHP;
// If config.php is empty, activate setup.php script
if (!isset($db_name)) {
   redirect("setup.php");
}



I Tested and this is working OK for me.
So now I can run two different sites from one installation, only different databases.

Question is:
Is this a good practice to do?
It probably need some code to prevent $_SERVER['HTTP_HOST'] containing wrong domain name data.

One thing more to do is: there are some cron-jobs executed also, this needs some modification too, to be sure the cron job is executed with the right database.
This can be done by adding a parameter to the cron-job command line, so the con-job php file 'knows' which database to open, or modify the cron-job php file to run through all the databases after each other.
Falk
Re: Here is a tool for anyone experiencing the blank white page of death Here is a tool for anyone experiencing a blank white page during, after or under an upgrade session.

Extract error_reporting.zip and place the error_reporting.php in your root folder (same as config.php).
Edit your opening page. Most often it is news.php.
Insert
Code
require_once __DIR__."/error_reporting.php";


After
Code
require_once THEMES."templates/header.php";



Save and refresh ( CTRL+F5 ) and you should have some errors displayed.
outlaw16151
outlaw16151 10-07-2018 16:04, 1 year ago
Re: PANEL SNIPPIT:: Some Site Stats Panel i know this is an old thread, but im back. craig, are you around?
Wanabo
Wanabo 09-07-2018 19:29, 1 year ago
Re: Isnum smile
Also in the second preg match?
douwe_yntema
douwe_yntema 09-07-2018 18:44, 1 year ago
Re: Isnum Thanks, It is working now
Wanabo
Wanabo 08-07-2018 11:52, 1 year ago
Re: Isnum
Code
^-?[0-9]+(\.{0,1})[0-9]*$


Just add a -?
See above
Perhaps for the second preg match as well.
douwe_yntema
douwe_yntema 06-07-2018 19:26, 1 year ago
Re: Isnum This is the function isnum from maincore:

Code
// Validate numeric input
function isnum($value, $decimal=false) {
   if (!is_array($value)) {
      if($decimal==true) return (preg_match("/^[0-9]+(\.{0,1})[0-9]*$/", $value));
      return (preg_match("/^[0-9]+$/", $value));
   } else {
      return false;
   }
}



How can it be changed to accept negative numbers ass well?
Sladdaren
Sladdaren 27-06-2018 11:16, 1 year ago
Re: Avatar showing when you logged in Hi

This site looks strange nowdays i think there is som spam posted in the forum angry. Hope this site is going to be alive and active. Anyway a question

I had facebook connect installed and that infusion showed the users avatar on top of the user_info_panel.
Now i unistalled facebook connect beacasuse it dont work.
I would like to have the users avatar showing when loged in. If there is a chance i can get the avatar to showing on the left/upper side when logged in. And if there is a visitor on the site it shows nothing.

The upper/left corner in this picture i would like to have the users avatar showing when logged in.
volvosweden.se/infusions/image_hosting/../../images/6051d21f8338ecd6ef9ae732118138e3.jpg
Homdax
Homdax 04-06-2018 06:22, 1 year ago
Re: GDPR Landing page with some check boxes I stumbled over Sweclockers approach and liked it, but I will not do anything fancy. The more I read about it, the simpler I see it can be done. I only really need to consider our own member registrations and that data, writing a few lines about it.
Falk
Falk 01-06-2018 14:51, 1 year ago
Re: GDPR Landing page with some check boxes I updated our Cookiebar panel on the site to include privacy,it is also very clear on new registred users. seen many do this as well.

Merged on 06/02/2018:
See screen, This is what ive seen most sites do.
Chan
Chan 01-06-2018 12:51, 1 year ago
Re: GDPR Landing page with some check boxes To save the trouble, we just update the privacy policy and send all members a notice. Isn't that easier? All the companies are doing it like this.
Homdax
Homdax 28-05-2018 07:49, 1 year ago
Re: GDPR Landing page with some check boxes I am struggling with a GDPR related landing page or pop up I need to make for a few 7 sites. The page as such can be simple enough, but there are a few requirements I am finding a bit hard to implement

- It has to show on user logon, only
- It should store info in user profile, so it can be verified also with datestamp, thus db entries
- I guess some kind of admin interface to handle this info might be required, thus it must be an infusion.
- maybe other stuff

I do know we have a number of 7 sites out there waiting with the 9 upgrade so I am certain this is needed and wanted for any and all EU based sites that has any kind of member registration.
Falk
Falk 20-05-2018 22:13, 1 year ago
Re: BBCODE on Forum

Quote

When i use just the id after de = it download the swf archive


It is the MIME settings on your server environment to not play instead it downloads it.
B
bobsquad 15-05-2018 23:02, 2 years ago
Re: BBCODE on Forum Hi Guys, i am new on php fusion. And i am having a difficult on post videos with bbcode on my forum

How do i use de bbcode.. both dont work for me.. how do i get the youtube ID


When i use just the id after de = it download the swf archive
[movie=youtube][/movie]
Each one do i use?

thx
Grimloch
Grimloch 14-03-2018 11:57, 2 years ago
Re: Using script code in Custom Pages?

Quote

Thanks very much for the info. I just created a new PHP page and put the code in it but I will remember this for future reference. Also, when using TinyMCE on the Custom Pages, do you put this in HTML or just paste it in the page?
- by FreedomIOPList

Depends: Personally I almost always use html/tables depending on how much control over format I want in the output. And because I like controlling the output I NEVER NEVER EVER use TinyMCE on any of my websites. In my opinion it's a piece of crap cause it changes your code when you save it!
FreedomIOPList
FreedomIOPList 14-03-2018 09:05, 2 years ago
Re: Using script code in Custom Pages?

Quote

Use one of 2 methods. When you do your echo script use single quotes:
echo 'script code'; OR better yet:
Change all the double quotes in the statement to single quotes.
- by Grimloch

Thanks very much for the info. I just created a new PHP page and put the code in it but I will remember this for future reference. Also, when using TinyMCE on the Custom Pages, do you put this in HTML or just paste it in the page?
Grimloch
Grimloch 13-03-2018 03:19, 2 years ago
Re: Using script code in Custom Pages? Use one of 2 methods. When you do your echo script use single quotes:
echo 'script code'; OR better yet:
Change all the double quotes in the statement to single quotes.
FreedomIOPList
FreedomIOPList 12-03-2018 15:07, 2 years ago
Re: Using script code in Custom Pages? I am having trouble embedding codes in Custom Pages. Can you not embed in Custom Pages in Fusion? The code I'm trying to embed is
Code
>   var ifr = document.getElementById("JotFormIFrame-80704605582153"); if(window.location.href && window.location.href.indexOf("?") > -1) { var get = window.location.href.substr(window.location.href.indexOf("?") + 1); if(ifr && get.length > 0) { var src = ifr.src; src = src.indexOf("?") > -1 ? src + "&" + get : src + "?" + get; ifr.src = src; } } window.handleIFrameMessage = function(e) { var args = e.data.split(":"); if (args.length > 2) { iframe = document.getElementById("JotFormIFrame-" + args[(args.length - 1)]); } else { iframe = document.getElementById("JotFormIFrame"); } if (!iframe) { return; } switch (args[0]) { case "scrollIntoView": iframe.scrollIntoView(); break; case "setHeight": iframe.style.height = args[1] + "px"; break; case "collapseErrorPage": if (iframe.clientHeight > window.innerHeight) { iframe.style.height = window.innerHeight + "px"; } break; case "reloadPage": window.location.reload(); break; case "loadScript": var src = args[1]; if (args.length > 3) { src = args[1] + ':' + args[2]; } var script = document.createElement('script'); script.src = src; script.type = 'text/javascript'; document.body.appendChild(script); break; case "exitFullscreen": if (window.document.exitFullscreen) window.document.exitFullscreen(); else if (window.document.mozCancelFullScreen) window.document.mozCancelFullScreen(); else if (window.document.mozCancelFullscreen) window.document.mozCancelFullScreen(); else if (window.document.webkitExitFullscreen) window.document.webkitExitFullscreen(); else if (window.document.msExitFullscreen) window.document.msExitFullscreen(); break; } var isJotForm = (e.origin.indexOf("jotform") > -1) ? true : false; if(isJotForm && "contentWindow" in iframe && "postMessage" in iframe.contentWindow) { var urls = {"docurl":encodeURIComponent(document.URL),"referrer":encodeURIComponent(document.referrer)}; iframe.contentWindow.postMessage(JSON.stringify({"type":"urls","value":urls}), "*"); } }; if (window.addEventListener) { window.addEventListener("message", handleIFrameMessage, false); } else if (window.attachEvent) { window.attachEvent("onmessage", handleIFrameMessage); } 

Falk
Falk 06-01-2018 09:13, 2 years ago
Re: Problem Displaying Flash On Site Introduction Scripts are stripped of JS tags for database injections, you can make a custom file and use that instead.
You can view all discussion threads in this forum.
You can start a new discussion thread in this forum.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.