Moodle - Quotes and Backslashes when submitting - submit

I have a sinister problem in one Moodle 1.9.9+ server.
On the startup page (logged in or not), I have the Summary, and if I make a link with the HTML Editor, it makes correctly, but when I submit, the link becomes with some backslashes. See my examples above:
1) On the HTML Editor, I write a text: http://www.example.com
2) Choose the link button
3) In the field "URL" I repeated the URL: http://www.example.com
4) Click on OK button.
5) Click on Save Changes button.
And in the summary, the link is shown as: http://www.example.com
and when I click him the browser goes to http://mymoodledomain.com/\"http://www.example.com\"
If I reedit the same Summary and simply press Save Changes, the link becomes with more backslashes:
http://mymoodledomain.com/\"\\\"http://www.example.com\\\"\"
And again:
http://mymoodledomain.com/\"\\\"\\\\\\\"http://www.example.com\\\\\\\"\\\"\"
I don't know what are happening with my Moodle, or my PHP.
I've tried to disable the magic_quotes_gpc, and them defined the constant MOODLE_SANE_INPUT with some value, but works parcially, because the same problem occurs too with Front Page Settings, and disabling the magic_quotes and enabling the constant, for this case not works. If I've a title with quotes, on each submit more backslashes are saved, for example:
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"example\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
Please guys, I need to solve this problem more quickly is possible.
Any sugestions?
Tks for all.

I've encountered the problem and solved it. Was on PostgreSQL.
The 9.1 version becomes with 2 options enabled by default, and the 8.3 was off. These options are called "standard_conforming_strings" and "escape_string_warning" and are encountered on postgresql.conf.
When enabled, these options saves an escape for an escape char, that comes of PHP by the "magic_quotes_gpc" resource when submitting a form.
Tks for all!

Related

In SAP UI5 `List` the "count-indicator" [ item-N / total-M ] is missing below the "More" button

I'm developing software for 40+ years but I'm absolutely new to SAP UI5, so maybe this is very basic or a trivial problem but half a day of searching the internet brought no results:
In a Master-Detail View (defined in xml) I want to display a list of items with growing=true, growingThreshold=50 and growingScrollToLoad=false as a List.
In principle it got everything working OK now. But there is a tiny glitch, not essential, more in the category of a "nice to have":
All the examples I've seen so far show something like "[ 50 / 107 ]" below the "More" button. But in my program it is missing. I'm very sure the reason is __count is not included in the response sent from the Odata-Service implementation.
Testing directly with the SAP Gateway Service Builder (/SEGW) shows to include the count in the response $inlinecount=allpages needs to be appended to the service URI. And here it works fine - once I add this to the URI the count is included, when I leave it out or set it to none there is no count included.
Therefore the problem seems not to be in the service implementation. (At least the __count field is present or not present as expected. And I assume this is what enables the "[ # / # ]" indicator.)
When the request is then sent from the controller (implemented in JavaScript) this part is not added to the service URI, despite the OData-Model is created with defaultCountMode: "sap.ui.model.odata.CountMode.InlineRepeat". On the "Network" page of Chrome's developer tools I don't see the $inlinecount=allpages appended and also the "[ 50 / 107 ]" (or whatever is appropriate) is not shown with the "More" button.
I checked with the Chrome developer tools immediately after creating the Odata-Model if my setting in the OData-Model takes effect – and it does. And I checked once more before a request is made based on this OData-Model – and it is still there.
My only idea now is it might have something to do with the fact the request originates from the XML-view (ie. the JavaScript code created on behalf of it) and it might be using a different Odata model in which that option is not set.
How can I test for this?
Any other ideas?
Maybe an internationalization issue? (The trigger-text for displaying more entries is set to "Weiter" in German language. Maybe also the "[ # / # ]" parts needs to be re-defined elsewhere too?
The answer in the comment of Boghyon Hoffmann solved the problem:
[Use] defaultCountMode: "InlineRepeat" instead of adding a fully qualified name in string.

Strange encoding of non-ASCII character in URL

My mother recently received the following scam message on Whatsapp (I have added multiple extra m's to the end of the link below in case of accidental clicks. Obviously the original link itself ended only with .com):
British Airways is giving free 5000 tickets to celebrate its birthday. Get your free ticket at : http://www.briṭishairways.commmmmmmm/
It seems to be a legitimate link to the British Airways URL, especially since Whatsapp doesn't allow link obfuscation (i.e. sending someone to SO by clicking http://www.google.com isn't possible).
However, a careful look will show that the t is in fact a ṭ (Latin T with dot below). Also, if one either hovers the mouse over the link in Chrome, the URL that appears at the bottom-left corner of the screen is in fact http://www.xn--briishairways-rt1g.commmmmmmm/. This is also the output from doing a right-click > Copy Link Address. (Try it yourself!)
Also, if I edit the body of the link, the rt1g part changes, as if it's a counter for where to put the dot. For example:
briṭishairways = xn--briishairways-rt1g
briṭishairway = xn--briishairway-vk5f
riṭishairway = xn--riishairway-yb9e
rṭishairay = xn--rishairay-5s6d
What's especially odd is that the Wikipedia link I used for Latin T with dot below also uses the same character (well, the capitalized version of it), and the URL shown on mouse-hover does not have this effect. (Try it yourself!)
What is going on here?

Alter Xcode 7 autofill behaviors

With the latest build, or maybe including the builds prior to beta 7.5 I just never noticed, I'm getting annoyed with a little autofill feature Apple implemented for substitute tokens and their objects when creating log messages. I haven't really noticed this with class methods or instance methods or autocompleting anything else really, so far.
Before, in Xcode 6, this would display:
Ahhhhh, nice & crisp. As you can see, everything suffixing the user input is opportunity for autofill. All I had to do was press tab[enter] once to autofill 'error' and include the closing parenthesis, then it would automatically place my cursor after the closing parenthesis, hence ALL I had to do was type a ; for that statement to be complete and I was happy :)
Now, this displays :
Ehhhhh, troublesome & redundant. As you can see in this example, it includes an additional quotation mark. Now when I press tab to autofill 'error', it just autofills 'error' and places the cursor before the closing parenthesis. So it looks like this:
NSLog(#"%#", error|)
And if I were to press tab to go to the next sub word that needs autocomplete it will just indent the closing parenthesis:
NSLog(#"%#", error )
So essentially, I have to either move it with my mouse or press → and then and only then, I'll be able to enter a ;. Side note - pressing ↵ to autofill results in the same behavior as described.
I am a fast typer, don't want to say my speed because I don't want it to rub off the wrong way but it's 70+wpm, so this irritates me, especially since I've been used to a way for so long. Any way to correct the behavior?
I have tried turning off Enable type-over completions in the Xcode preferences pane, but it still places the cursor before the closing parenthesis.
printf resorts to the same behavior with Xcode 7.5

Can't get rid of "via" text for Twitter share button

I'm working in a Rails 3.1.8 app and I'm having a problem creating a Twitter share button that produces the text I want. Here is the erb code for the button:
Tweet
This button appears on a page that contains content produced by a particular user. Let's call the user "sam". The text this code produces to be shared on Twitter is:
[some_text] [url of current page] via #sam
I would like to remove the "via #sam", but I cannot figure out how. If I explicitly set data-via I can change the user that the "via" phrase refers to, but I cannot make it disappear.
This support page suggests that omitting the data-via tag should do the trick, but I have found that it does not.
I've searched around the app to try to find a place where this parameter is being set, but I haven't found anything. However, as I'm pretty green with Twitter stuff, I may not be searching for the right thing.
Thanks in advance for your help, and do let me know if I can provide additional info.
ADDENDUM: I've tried add setting data-via to various values, including false, "false", and "", as well as appending ?via= and analogous values to the share URL. Each of these attempts resulted in a bogus via phrase (e.g. "#false"), or a default to "#sam".
Maybe you have an old version of the Javascript being included or cached.
Taking examples from https://dev.twitter.com/docs/tweet-button works as expected when omitting the data-via attribute.
Tweet
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
Working example: http://jsbin.com/uxopur/2/

Unable to send the TAB key during a Selenium integration test

As part of a Selenium integration test, I wrote the two following lines in Ruby to simulate entering an e-mail address into a text field and "moving the focus away":
#driver.find_element(:id, "user_email").send_keys "user#example.com"
#driver.find_element(:id, "some_other_element").click
The second line is not generic enough, because some_other_element might be unknown or non-existent. Thus, I wanted to replace the action of clicking another element with a TAB keystroke:
#driver.find_element(:id, "user_email").send_keys :tab
However, this does not seem to work, the element user_email does not lose its focus as expected. Also replacing :tab with "\xEE\x80\x84" does not help. Does anyone know what could be wrong here? How can I move the focus away of an element without simulating a click somewhere else?
Thanks for any help,
Dominik
I don't know how to do it without simulating a click, but clicking on <body> worked for me. This solution may be generic enough.
I think this should works well. Give it a try.
find('.myselector_name').native.send_keys(:tab)
Reference to answer is How do I simulate hitting enter in an input field with Capybara and ChromeDriver?

Resources