PHPBB3and super globals? - include

I try to customize my PHPBB3 interface.
For that I need to include a header and a footer.
The header file I try to include has the use of...
$this->_agent = $_SERVER['HTTP_USER_AGENT'];
...wrapped in a function.
Here is the error message when I open the PHPBB3 index page:
Illegal use of $_SERVER. You must use the request class or
request_var() to access input data.
For info, the file I try to include works well in any other context than PHPBB3.
Can someone tell me what I have to do and where I have to do it in order to get rid of this error message and have my included file work properly?
Thank you.

You only have to use the request_var() function to access your datas.
$userAgent = request_var('HTTP_USER_AGENT','');
You can find more information about this function here :
https://wiki.phpbb.com/Function.request_var

Related

“Error no label add or removes specified” when trying to modify labels using Gmail's Ruby API

I've looked at https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/GmailV1/ModifyThreadRequest and the examples https://developers.google.com/gmail/api/v1/reference/users/labels/update for Python and JS but can't figure out how to format the request properly in ruby.
I'm trying:
service.modify_thread('me',thread_id,{'add_label_ids'=>['UNREAD']})
and various other permutations of the object but can't get anything other than Google::Apis::ClientError: invalidArgument: No label add or removes specified in response.
Any help appreciated
modify_thread expects a Google::Apis::GmailV1::ModifyThreadRequest object as third argument according to the documentation.
In the source of the constructor of ModifyThreadRequest you can see that it looks for a key :add_label_ids in its arguments.
So if modify_thread creates the ModifyThreadRequest object itself then
service.modify_thread('me',thread_id, add_label_ids: ['UNREAD'])
should work.
If that fails I would try
mtr = Google::Apis::GmailV1::ModifyThreadRequest.new(add_label_ids: ['UNREAD'])
service.modify_thread('me', thread_id, mtr)

SonarJs still shows warning about postMessage cross-domain issue

The error message is "make sure this cross-domain message is being sent to the intended domain".
This check rule from RSPEC-2819
Authors should not use the wildcard keyword ( *) in the targetOrigin argument in messages that contain any confidential information, as otherwise there is no way to guarantee that the message is only delivered to the recipient to which it was intended.
I assume it demands * cannot be used as targetOrigin, But It still shows warning when I use intended domain as targetOrigin like below:
Please somebody can tell me how to pass this check,
Any help would be appreciated
This rule detects only if a method postMessage is invoked on an object with a name containing window in it. Source code: PostMessageCheck.java. To bypass it, just assign your contentWindow object into different one, like this:
var content = this.elem.contentWindow;
content.postMessage('your message', window.location.origin);
Have faced similar issue in sonarQube. Below fix worked. Just get rid of using window object using directly.
Actual code:
window.parent.postMessage("data", parenturl);
Fix:
var content=window;
content.parent.postMessage("data",parenturl);

Xtext get the absolute path of the generated files

I want to access the file generated by Xtext to compile it automatically. So I need its absolute path. It's enough to get the absolute path of the current project at run-time. Any idea how I can get it?
I am working inside the "MyDslGenerator" Class. I tried to get it from the "resource" in
override void doGenerate(Resource resource, IFileSystemAccess fsa)
but couldn't find it.
Help is highly appreciated.
I ended up using this code:
var uri = (fsa as IFileSystemAccessExtension2).getURI(fileName)
maybe you can use the Interface org.eclipse.xtext.generator.IFileSystemAccessExtension2. the passed IFileSystemAccess may implement this interface too.

CodeIgniter parser addon

Can't load my_parser class.
Added this http://codepad.org/QtHsyRN3 to application/libraries
than in controller i wrote
$this->load->library('my_parser');
but i am getting
Unable to load the requested class: my_parser
What can be? I need something like this
{if 10 > 8}10 is greater then 8<br />{/if}
But without smarty and etc.
The user guide states you shouldn't include the 'MY_' when calling the library, so:
$this->load->library('parser');
should work - see http://codeigniter.com/user_guide/general/creating_libraries.html
.php file was wrong name. Solutions is "class name = .php file name"

Get [Messages] values in InnoSetup's language file

I know I can easily get messages inside
[CustomMessages]
AdditionalIcons=blablabla
using this code:
ExpandConstant('{cm:AdditionalIcons}');
which gets the AdditionalIcons string message. However, how can I get messages inside this?
[Messages]
ButtonNext=huhu
ButtonInstall=bubu
What I need is to get the ButtonNext, ButtonInstall and other values, and it is NOT possible to get those values using code like this:
ExpandConstant('{cm:ButtonNext}');
How can I query those values?
Related links
Inno Setup Script tips
Try
SetupMessage(msgButtonNext);
In general, the name of the constant to use (in this case msgButtonNext) is msg + the name of the message (string concatination).

Resources