About user configuration in freeSwitch - configuration

Here comes a page:
XML User Directory
In the page,there is section 1.1 and 1.2,what is the diffrent,they are both user configure file right,why one is start with include attrubute,another is domain attribute,,when to use the first kind and when to use the second?

The documentation clearly mentions that the domain tag tells FreeSWITCH to which domain the user belongs to. This will come into picture only when you want to provide service to multiple tenants/ companies through your FS. In that case you can create multiple domains in your FS and each domain can have the same extension range. You will have to write different dialplans for each of these domains.
When a domain is not mentioned, FS will consider that user to be part of the default domain. Thus the domain tag is not mandatory. I hope that explains your doubt about the domain tag.
The include tag just means that the xml which follows will be a xml snippet, to be included into the main xml. If you check the directory default.xml in your FS, you will notice the section:
<users>
<X-PRE-PROCESS cmd="include" data="default/*.xml"/>
</users>
Thus will cause FS to go inside the default directory and include all the xml in there. It's a good practice to put these xmls for individual users inside an include tag, but I believe there is no compulsion to do so.

Related

download html attribute does not rename the file using external URL

I am trying to rename a file when downloading it from <a> tag.
Here a simple example:
Download Stackoverflow Logo
As you can see, it never downloads the file with stackoverflow.png name, it does with default name though.
Nevertheless, if I download the image and tried to do the same with a local route, it renames the file properly.
Another example:
Download Stackoverflow Logo
The example above works properly.
Why download html attribute only works using local routes?
Thanks in advance!
The attribute download works only for same origin URLs.
By the way, you really should learn to use proper terminology, or else people won't understand you:
<a href="https://i.stack.imgur.com/440u9.png" download="stackoverflow.png"> is a tag, specifically, an opening tag;
download is an attribute;
stackoverflow.png is the value of the attribute;
https://i.stack.imgur.com/440u9.png is a URL, sometimes called an URI or an address.
The entire construction Download Stackoverflow Logo is an element.
A "route" is something else entirely, and has no relationship with HTML.
I couldn't find any info of it, but seems like external resources aren't allowed renaming.
Have a look here, there's an example linking to google image and that doesn't work either - seems like the specs have changed along the way.
This is a security measure applied to cross-origin download requests where the server hosting the download does not use HTTP headers to explicitly mark the file as being for download.
From the HTML specification:
If the algorithm reaches this step, then a download was begun from a
different origin than the resource being downloaded, and the origin
did not mark the file as suitable for downloading, and the download
was not initiated by the user. This could be because a download
attribute was used to trigger the download, or because the resource in
question is not of a type that the user agent supports.
This could be dangerous, because, for instance, a hostile server could
be trying to get a user to unknowingly download private information
and then re-upload it to the hostile server, by tricking the user into
thinking the data is from the hostile server.
Thus, it is in the user's interests that the user be somehow notified
that the resource in question comes from quite a different source, and
to prevent confusion, any suggested file name from the potentially
hostile interface origin should be ignored.

Database Name not being included in the HREF of imported files in File Resource

I imported some HTML, JS and image files into Resources->Files of my database.
In the index file, I have:
<base href = "/client/hd">
<img src= "/client/hd/images/imagefile.png">
But upon checking the image source, it's accessing the URL below:
http://his90/client/hd/images/imagefile.png excluding the location of database and database name (ex. /fi20/fi20test.nsf)
It should be http://his90/fi20/fi20test.nsf/client/hd/images/imagefile.png
May I ask for a solution for this? HTML files are just imported in the Resource, no forms or views were created.
That is because you start the link URL with a /. That will start at te root of the web server. If you remove it, the link URL will start from your current location, and (assuming that the index file has the URL http://his90/fi20/fi20test.nsf/index.html) you should get the correct link URL.
You can also create a substitution rule for the internet site (using Domino Administrator, under Configuration, Web, Internet Sites). You then substitute / with /fi20/fi20test.nsf/ and it should also work.
Talk to your administrator about which is the proper way in your specific case.
Also, assuming you add the image as an image resource called imagefile.png, the URL should be just http://his90/fi20/fi20test.nsf/imagefile.png, no file structure.
What I sometimes do is to create web substitution rules for /images/, /pages/ and /agents/ to all point to the .nsf file itself. Then in the HTML code (and Javascript) I can reference the different resources with /images/imagefile.png or /agents/getUserList.json, etc. Makes the code much easier to read and understand.

Create link to XML with XSL stylesheet

I have an XML file and 3 xsl files that tranform the same xml. I want to create a home page, with three buttons. Each button will redirect to one of three tranformations. How can I create a link to the xml file with a spesific transformation.
Let's say I have : example.xml and t1.xsl, t2.xsl, t3.xsl and index.html with buttons t1, t2, t3. When I press the t1 button I want to get the XML file transformed by t1.xsl.
From your description ("home page, ...") I infer that all this should happen on the Web; in that case the answer will most likely involve the rules for configuring your Web server, so it's going to be a question about Apache, or IIS, or nginx, or Jetty, or whatever server is actually serving your documents.
There are many ways to achieve the goal; these are the first three or four that occur to me. For concreteness I will assume you are using Apache (many people do), know how to find and edit Apache configuration files, and can adapt relative references to suit your directory layout.
Assuming that what you want is precisely what #Stefan Hegny assumes you do not want.
You save three copies of the XML document. The one named example.1.xml begins
<?xml-stylesheet href="t1.xsl" type="text/xsl"?>
<example>
...
The one named example.2.xml begins
<?xml-stylesheet href="t2.xsl" type="text/xsl"?>
<example>
...
And similarly example.3.xml begins with a reference to t3.xsl.
The three buttons point to these three documents.
If example.xml is still changing, you will want to automate the process of updating the three near-identical copies of it whenever the master document changes; I use Make and sed for such tasks, myself.
Another way to achieve the same thing, with a single copy of example.xml
Another way to achieve the same effect is to maintain a single copy of example.xml, with a reference to t1.xsl (so it looks like the example.1.xml described above), and tell your server
Whenever a user requests the URI example.1.xml, serve document example.xml.
Whenever a user requests the URI example.2.xml, run the command sed -e s/t1.xsl/t2.xsl/ < example.xml and send the result (stdout) to the client.
Whenever a user requests the URI example.3.xml, run the command sed -e s/t1.xsl/t3.xsl/ < example.xml and send the result (stdout) to the client.
In Apache, I use the Rewrite module to redirect these three URIs to a CGI script which inspects the URI by which it was called and runs the appropriate command.
The three buttons continue to point to the three URIs example.1.xml, example.2.xml, and example.3.xml.
Running the stylesheet on the server
If the three displays must work even with browsers that don't support XSLT, then you want to run the stylesheet on the server.
Here, again, I use Rewrite to redirect the URIs to a CGI script, but instead of running sed, the CGI script runs xsltproc, or whatever XSLT processor is available on my server.
Running the stylesheet in the browser
Another way to handle this requirement is to make index.xhtml be an XForms document, suited for a processor which supports the transform() extension function (e.g. XSLTForms). The document example.xml is referred to by an xf:instance element, and the three buttons invoke the three stylesheets on that instance. They might update an auxiliary instance, or they might simply cause different cases in an xf:switch to display. (If this mostly makes sense to you but you need more details, ask a question tagged XForms; if it doesn't make sense to you, then you probably don't know XForms and this is not the simplest path to the goal you describe.)
Some people would use Javascript instead of XForms for this task, but browsers vary a lot in how they want their internal XSLT processor to be invoked, so unless you enjoy working around browser inconsistencies in Javascript, you might not want to go that way, either.

html post from subfolder - post url includes top level site in URL

I have a site:
example.com/index.html
There is a subfolder (subsite):
example.com/subsite/different_index.html
different_index.html contains a form:
<FORM action="different_index.html?action=edit">
However, when the submit input button on this form is clicked, the page attempts to redirect to:
example.com/subsite/subsite/different_index.html
I've tried making the form action the exact url needed:
<FORM action="example.com/subsite/different_index.html?action=edit"> <!-- target self -->
But I still get:
example.com/subsite/subsite/different_index.html
subsite is duplicated within the URL.
Any ideas how to correctly target this form?
The fact that you have a form is actually irrelevant. What you are really asking is about referencing resources and the rules are pretty simple:
If the resource you need is part of the same web site (not talking about folder structure here, talking about domain), you should use relative paths, where:
a. fileName.ext is all you need if the resource is in the same folder as the currently loaded document.
b. folderName/fileName.ext is what you need if the file you need is in a sub-folder of the current folder that the loaded document is in.
c. ../fileName.ext is what to use if the file you need is one directory higher than the current document's folder. The ../ can be repeated if you need to go up more than one level (i.e. ../../fileName.ext).
d. /fileNameext or /folderName/fileName.ext indicates that the file or folder specified should be found starting from the root of the web site, regardless of where the current document is.
If the resource you need is located on another domain, you'd use an Absolute Path (http://something.something/file.ext).
a. DO NOT use absolute paths for local resources! This may work but causes the domain name to have to be resolved again, resulting in a longer load time.
WARNING: Different servers have different configurations and requirements that may affect whether these reference rules work or not. For example, GoDaddy web hosting provides an "httpDocs" folder at the root of a web site. You don't have to use it, but that's where their servers expect the site's content to be placed. Not following those rules result in relative paths not working. Additionally, many servers are hosted on operating systems the have case-sensitive file systems, so always refer to files and folders in the same case that is actually used. Again, not doing this may work for you locally, while you develop (because you haven't moved the files to the remote server yet), but don't let that lull you into thinking that case doesn't matter.

Replace URLs in Typo3 DB

So I have a Site created with Typo3. I also have a domain which is linked to the folder of the Typo3 Installation. www.example.org
I created a Subdomain and linked it to the same folder and used the Main Domain for something else.
But now everything on the Subdomain still has the URL Structure of the main site so when I open up sub.example.org all the Links and Images still have the URL from www.example.org/...
I exported the Database and replaced every URL with notepad++ and imported it again. But that didnt change anything. What do I do wrong?
There are two (three with realurl) places where you need to look if changing the domain of a TYPO3 site, if everything is done by the book and noone hardcoded the domain all over the place or something.
Usually you do not need to work in the database directly.
After doing the changes, make sure to clear the caches (install tool in 6.2+, "all caches" in earlier versions).
First:
There are two TypoScript settings that influence the generated URL: config.baseURL and config.absRefPrefix.
The recommended way to use those is to not set config.baseURL (would result in a <base> tag in the HTML <head>), and set config.absRefPrefix to the subpath where TYPO3 is, relative to the document root. If TYPO3 lies directly in the document root, set it to /.
Second:
In the database, there are "Domain Records". They are usually located on the root page of a site. Change those to the new domain.
Third (with realurl only):
Check the realurl configuration file, usually located in typo3conf/realurl_conf.php. Depending on your setup, the old domain name is used there and needs to be changed.