Enable HTML Tags in PHPBB [closed] - phpbb

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Im trying to find a way to enable HTML Tags in PHPBB (only for administrations).
do you know how can I achieve this?
Thanks

This is not supported out of the box. You should use custom BBCodes instead. If you really, really insist on HTML tags, you can use the Enable HTML MOD.

Lately I was busy porting Snitz 2.x based forum to phpbb3 forum.
The main challenge I had to deal with was around HTML support in the post body.
Snitz allowed HTML inside the post body but phpbb3 forbids HTML tags inside the post.
Since we have ~40000 posts that many of them contains HTML tags we had to find a solution for this.
Here it is: we used Enable HTML MOD but we modify it.
The original function:
function enable_html($text, $uid)
{
if (strpos($text, '[html') === false)
{
return $text;
}
$text = str_replace(array('[html:' . $uid . ']', '[/html:' . $uid . ']'), array('[html]', '[/html]'), $text);
$text_ary = explode('[html]', $text);
$text = '';
foreach ($text_ary as $tmp)
{
if (strpos($tmp, '[/html]'))
{
$tmp = explode('[/html]', $tmp, 2);
$text .= htmlspecialchars_decode(str_replace(array("\r\n", "\n"), ' ', $tmp[0])) . $tmp[1];
}
else
{
$text .= $tmp;
}
}
return str_replace(array('[html]', '[/html]'), '', $text);
}
was modified to
function enable_html($text, $uid)
{
return htmlspecialchars_decode($text);
}
The last step was to give the new permission to the users and we got the HTML rendered as we had it in Snitz.

Related

In Umbraco, how to handle tag datatypes with Examine?

I have made a search page using Examine which for the moment works fine and as intended (still needs to get paging sorted...), but I have run into an issue. I also want the page to function as a related tags page, as in an article can have several tags, and if you click a tag you can see related articles with the same tag. Pretty basic stuff. Only I have found out that Examine cant really handle tag data types because as I understand they are stored in a comma delimited list, something Examine cant handle in this case. I have searched around and found only a few hints of others having the same problem, one with an actual solution but that sadly no longer works in Umbraco 10: Umbraco - Using Examine to search Umbraco.Tags
Also found this more recent one, but kind of a dead end: https://our.umbraco.com/forum/umbraco-8/98761-how-to-match-tags-in-examine-in-v8-theyre-now-stored-as-a-json-string-array
So yeah, what the heck do I do?
For good measure here is my examine code:
#{
Layout = "master.cshtml";
var searchQuery = !string.IsNullOrWhiteSpace(Context.Request.Query["q"].ToString()) ? Context.Request.Query["q"].ToString() : "";
var tags = !string.IsNullOrWhiteSpace(Context.Request.Query["tags"].ToString()) ? Context.Request.Query["tags"].ToString() : "";
var parent = !string.IsNullOrWhiteSpace(Context.Request.Query["parent"].ToString()) ? Convert.ToInt32(Context.Request.Query["parent"].ToString()) : 1088;
if (!examineManager.TryGetIndex(Constants.UmbracoIndexes.ExternalIndexName, out IIndex index))
{
throw new InvalidOperationException($"No index found by name{Constants.UmbracoIndexes.ExternalIndexName}");
}
var searcher = index.Searcher;
var criteria = searcher.CreateQuery(IndexTypes.Content);
var filter = criteria.ParentId(parent).AndNot(x => x.Field("umbracoNaviHide", 1.ToString()));
if (!string.IsNullOrWhiteSpace(tags))
{
filter.And().Field("tags", tags);
}
if (!string.IsNullOrWhiteSpace(searchQuery))
{
filter.And().ManagedQuery(searchQuery);
}
var res = filter.Execute();
}

vBulletin 3.x - How to get custom variable to render template conditionals?

I am trying to make a product that will give me a different header based on the forum I am in, that's no problem and complete. My issue lays with using template conditionals inside of said option.
I am currently using a forum option to insert my custom template additions:
In global_complete hook I am using:
global $vbulletin;
if ($GLOBALS[foruminfo]["forumid"]>0) {
$forum_code = '';
$_fid = $GLOBALS[foruminfo]["forumid"];
$forum_info = $vbulletin->forumcache[$_fid];
if ($forum_info["code"]) {
$forum_code = $forum_info["code"];
} elseif ($forum_info["parentid"]) {
while ($forum_code=='' && $forum_info["parentid"]>0) {
$forum_info = $vbulletin->forumcache[$forum_info["parentid"]];
$forum_code = $forum_info["code"];
}
}
}
Then I place $forum_code into my header temple.
I would like to be able to get the conditionals to work so I can only show things to members or usergroups within the header. Is there a way to get the variable to not ignore the conditions? they are included in the DB entry, just being ignored when rendered to the page.
Sample Conditional:
<if condition="$show['member']">Member<else/>Guest</if>
What is actually being rendered:
MemberGuest

Google feed api deprecated, How can i find rss feed of web site? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I used Google Feed API for finding rss feeds of special keywords or websites, now this api deprecated, so i need alternative way for finding rss of website, I google it but i cannot find any good way..
Find rss from parsing html of website is not good for me because i want to find all rss from any subdomains of it.
For example in the past when with using Google Feed API i give ieee.org and get all rss like:
http://www.ieee.org/rss/index.html?feedId=News_Release
http://spectrum.ieee.org/rss/fulltext
http://spectrum.ieee.org/rss/blog/automaton/fulltext
and ....
So, Is there any api or services that i can find all of rss feeds of website?
Feedly's API could fit your requirements. See https://developer.feedly.com/v3/search/
Pass the site's domain name as query parameter and you'll get rss feed matches:
https://cloud.feedly.com/v3/search/feeds/?query=ieee.org
You can use rss2json API to get feed data same as google feed API did.
var url = "http://www.espncricinfo.com/rss/content/feeds/news/8.xml"; //feed url
var xhr = createCORSRequest("GET","https://api.rss2json.com/v1/api.json?rss_url="+url);
if (!xhr) {
throw new Error('CORS not supported');
} else {
xhr.send();
}
xhr.onreadystatechange = function() {
if (xhr.readyState==4 && xhr.status==200) {
var responseText = xhr.responseText;
var result = JSON.parse(responseText);
console.log(result);
}
}
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
xhr.open(method, url, true);
} else if (typeof XDomainRequest != "undefined") {
xhr = new XDomainRequest();
xhr.open(method, url);
} else {
xhr = null;
}
return xhr;
}

Protractor e2e testing suggestions about code complexity [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
I know my question will get marked as to broad but I didn't think of another place to ask it.I work in QA and month ago i started learning protractor by myself so i can test our projects with protractor there was no one to guide me i learned all by myself and google so I wanted you guys to check the code i made and give me some suggestions. Does it look like it should,because i think its worthless it gets the job done but i feel it is still beginner level, and there is none to guide me so i know the level i am at the moment any suggestions are welcome.My config file pretty basic.
exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['page.js'],
onPrepare: function() {
var jasmineReporters = require('jasmine-reporters');
}
}
My specification file:
/*
##############################################
FUNCTIONS in helper_functons:
getsite();
logIn();
mainPageItem(); | 0 - Recipes | 1 - Collections | 2 - Profiles |
openRecipe(index);
createRecipe (name,description,step,numStep,ingName,numIngr,addToCollections,share);
deleteRecipe(recipeName); //must use getMainPageAndRefresh()
openRecipe(index);
browseRecipe();
openCollection(index);
createCollection(name,description);
openUser(index);
getNotifications();
goToProfile();
browseProfile();
getMainPageAndRefresh();
goToTimeline();
openLegal(index);
useSearch(textString);
createPost(postName);
logOut();
##############################################
*/
var functions = require('./helper_functions.js');
var uName = 'asd';
var pass = 'asd';
describe('Hooray',function(){
it('Gets site',function(){
functions.getSite();
});
it('Logs in ',function(){
functions.logIn(uName,pass);
});
it('Recipe options',function(){
browser.sleep(9000);
});
it('Logs out',function(){
functions.getMainPageAndRefresh();
functions.logOut();
});
});
And I am using another file where i created helper functions so my tests look more readable this is where the main code is http://pastebin.com/KgXCh74m I uploaded on pastebin because it is 500 lines. My idea was to call a function whenever you need it and test it in the page.js file.
By looking at your code, it seems you have put all your elements in a function and accessing them in your specs. In general this way of accessing elements would lead to some Flaky tests and you would not be able to run test scripts confidently and error free.
Protractor's community widely encourages the usage of Page Objects. Protractor has some good documentation,they have specifically mentioned style guide http://www.protractortest.org/#/style-guide to get started.
Some of the tips from my experience while writing protractor tests:
Avoid browser.sleep for page loads , instead use browser.manage().timeouts().pageLoadTimeout(10000);
Use Expected Conditions for interacting with web elements elementToBeClickable, elementToBeSelected etc.
Use Page Objects efficiently. Avoid accessing/performing actions on elements in page objects. It has to be done inside the specs i.e.
your page.js should look like this -
var somePage = function() {
this.username = element(by.id('someId')); //Here we are only defining the elements
this.password = element(by.id('someId'));
this.button = element(by.css('someCss'));
this.login = function(uid,pwd) { // If we are using functions in page objects, we would just access the defined elements above rather than defining them in the function (reusability & decoupling).
this.username.sendKeys(uid);
this.password.sendKeys(pwd);
this.button.click();
};
};
In the above page object if the username or password element changes you only have to change them, no need to touch the login function.
your spec.js should look like this -
var SomePage = require('path to your page.js');
describe('page', function() {
var page = new SomePage();
it('should test page', function() {
page.username.sendKeys('username'); // Here we are performing the action on the elements.
page.password.sendKeys('password');
page.login(username,password);
});
});
Maintaining test data in a separate JSON file.
Set browser.ignoreSynchronization = true while dealing with non-angular pages
Use CssSelectors as much as you can to identify elements.
Since Protractor is community driven --> Follow protractor on GitHub, StackOverflow & Gitter.
You would get all the updates/issues from these platforms so that you can solve your issues or ask for help, these awesome folks would help you!

How to write html custom attribute in less use Mixins [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
how to write html custom attribute in .less Use Mixins for example
[margin="2"]{margin:2px;}
You should explain why you want to use Less in this situation. Notice that Less only compiles static CSS.
You can use a Less mixin to dynamically built your CSS rules:
.createmargins(#i) {
& when (#i > 1) {
.createmargins(#i - 1);
}
[margin="#{i}"] { margin: unit(#i,px); }
}
.createmargins(100);
outputs:
[margin="1"] {
margin: 1;
}
[margin="2"] {
margin: 2;
}
[margin="3"] {
margin: 3;
}
and so on......
Demo: http://codepen.io/anon/pen/yyXEgg
The above possible generates a lot of unused CSS classes. Alternatively consider using jQuery (or jvascript) on DOM ready:
$("[margin]").each(function(){
$(this).css('margin',$(this).attr('margin') + 'px');
});
Demo: http://codepen.io/anon/pen/rawKjz