MediaWIki primaryauthenticationprovider - mediawiki

How to create a primaryauthenticationprovider that autocreates the user?I need know how to make it. Any simple code examples?

Just return the username with a pass response, and it will be autocreated if it does not exist.

Related

How to use a Session's value in html?

Suppose I have Session["myvalue"] which is integer.
Furthermore- I want to use this value in my HTML code (I want to display this value in the view).
Is there any way to do it?
If you are using MVC then you can go for #Session["myvalue"]
If you are using Asp.net then you can go for <%:Session["myvalue"].ToString()%>
To access session in View you can do following thing.
HttpContext.Current.Session["myvalue"].ToString()
if it is object or something then you have to case.
<<your type>> nameofVariable = (<<your type>>)HttpContext.Current.Session["myvalue"]
Apart from this you have to check null and everything.
This is the way
<%:Session["myvalue"]%>
If you get error then use
<%:Session["myvalue"].ToString()%>
just use an # symbol just in front of your session variable and you need to cust the session as an integer like
#(int)Session["myvalue"]

Yii2 #web alias is empty

I don't understand why Yii::getAlias( '#web' ) in my view file returns an empty string. #webroot returns the proper string.
Is there some configuration I'm missing?
#resting: Yii::getAlias( '#web' ) is Predefined Aliases in framework. No such kind of issue that will create. I thing issue is somewhere else.
Go through this link

PHP Running/GET Statements

I need help with Get Statements and Running on a site on PHP
I have this a my PHP code
This is how I save it but it only saves username ...
http://example.com/NC0.php?U=namehere
I have tried this below but it doesn't work
http://example.com/NC0.php?U=namehere?P=passhere
How can I make it like........ NC0.php?U=namehere?P=passhere
or something similar thanks!!!
You are using the ? multiple times. It is meant to start the query! To have multiple parameters in the URL you use the & symbol to differentiate the parameters.
For example,
http://example.com/NC0.php?U=namehere&P=passhere

How to get the model name from the table name in CakePHP

In one of my projects, I have a function :
public function select($table){
$model=Inflector::singularize($table);
$result=$this->$model->find('all'));
...........
...........
}
Here, I tried to get the Model name from the given "table name"($table), and used find function of that model to select all data from that table. But that didn't work.
So, what should I do here ? Can anybody please help me ?
Thanks
You can use my trick. create table name as per model name, or using substr() or strstr() you can extract table prefix, then you can use your model ,
$tableName="myprefix_posts";
$dynamicModelName=strstr($tableName,"myprefix_");
$this->loadmodel($dynamicModelName);
if( $this->$dynamicModelName->save($this->data)){
// your code
}
You can use the Inflector class for the table name to be singularized. Example:
$dynamicModel = Inflector::singularize($table);
When you want to use the model via $this->Model you have to load it first.
$this->loadmodel($dynamicModel);
Just a friendly warning: Try not to use words that might be keywords in PHP or MySQL as variable or function names like you do in the function above (select). You or any other developers might get confused at later stages of development. There is probably no harm, I just don't recommend it.
Enjoy

Removing URL encoding from Active Record query

I'm in over my head as always, but it's the only way I learn. Right now I am trying to query a column in a database for the current user and return the values. I'm using something like:
#tags = current_user.tags.select(:name).each { |p| p.name}
But it returns:
%5B%23%3CTag+name%3A+%22tag1%22%3E%2C+%23%3CTag+name%3A+%22tag2%22%3E%2C+%23%3CTag+name%3A+%22tag+test%22%3E%5D
From what I understand is that's Url Encoding. Is it possible to clean that up? I've tried using .delete or .gsub but I must be doing something wrong. Any insight? All my research on the site yields how to URL encode, but not URL decode.
For URI encoding/decoding you can take a look at rubyonrails.org:URI::Escape
For displaying HTML in Rails views check out the raw() method rubyonrails.org:ActionView::Helpers::OutputSafetyHelper