Disable all MediaWiki special pages for a group of users - mediawiki

I am looking to remove all access to SpecialPages for a new group called "Clients". Any advice would be appreciated. Thanks in advance.
#Clients group
$wgRevokePermissions['Clients']['userrights'] = true;
$wgRevokePermissions['Clients']['edit'] = true;
$wgRevokePermissions['Clients']['delete'] = true;
$wgRevokePermissions['Clients']['upload'] = true;
$wgRevokePermissions['Clients']['move'] = true;
$wgRevokePermissions['Clients']['createtalk'] = true;
$wgRevokePermissions['Clients']['createaccount'] = true;
$wgRevokePermissions['Clients']['writeapi'] = true;
$wgRevokePermissions['Clients']['createpage'] = true;
$wgRevokePermissions['Clients']['sendemail'] = true;
$wgRevokePermissions['Clients']['editinterface'] = true;

The extension Lockdown will do that for you. Add the extension, and then do something like this:
$wgSpecialPageLockdown['Statistics'] = array('sysop');
$wgSpecialPageLockdown['Version'] = array('sysop');
$wgSpecialPageLockdown['Export'] = array('sysop');
...
This will be a long list, and it will change a bit from version to version of MediaWiki, as special pages come and go.

Related

How to update Google Group Settings with Google Apps Script

I have a Google Apps Script which has all the permissions it needs, with the Group Settings API on and working, but does not change certain things. There are no errors given, but the only thing that changes is the name, and the rest does nothing. This is the script:
function modgroup() {
var groupKey = 'finaltest#school.edu.mx';
var resource = {
name: "finalfour",
whoCanContactOwner: "ALL_MEMBERS_CAN_CONTACT",
whoCanJoin: "INVITED_CAN_JOIN",
whoCanViewMembership: "ALL_MEMBERS_CAN_VIEW",
whoCanViewGroup: "ALL_MEMBERS_CAN_VIEW",
whoCanInvite: "ALL_MANAGERS_CAN_INVITE",
whoCanAdd: "ALL_MANAGERS_CAN_ADD",
allowExternalMembers: false,
whoCanPostMessage: "ALL_MEMBERS_CAN_POST",
allowWebPosting: false
}
AdminDirectory.Groups.update(resource, groupKey);
}
Ok, after a bit of investigation and experimentation, I found that there was another API and another format that had to be used so that it will work. You need to activate the Groups Settings API (not the Admin Directory API) and you can see the documentation here.
The format is the following:
function editGroup(){
var groupId = 'finaltest#school.edu.mx';
var group = AdminGroupsSettings.newGroups();
group.name = 'NAME';
group.description = 'DESCRIPTION';
group.whoCanAdd = 'NONE_CAN_ADD';
group.whoCanJoin = 'INVITED_CAN_JOIN';
group.whoCanViewMembership = 'ALL_MEMBERS_CAN_VIEW';
group.whoCanViewGroup = 'ALL_MEMBERS_CAN_VIEW';
group.whoCanInvite = 'ALL_MANAGERS_CAN_INVITE';
group.allowExternalMembers = false;
group.whoCanPostMessage = 'ALL_MEMBERS_CAN_POST';
group.allowWebPosting = true;
group.showInGroupDirectory = false;
group.allowGoogleCommunication = false;
group.membersCanPostAsTheGroup = false;
group.includeInGlobalAddressList = false;
group.whoCanLeaveGroup = 'NONE_CAN_LEAVE';
AdminGroupsSettings.Groups.patch(group, groupId);
}

AS3 Flash How to make text fields required?

I want to know how to put restrictions in the fields like if the user didn't type anything or still has a blank field, then it should not submit but shows *required field or something like that. Examples would be great.
The codes. I don't know where to start from here
var fllname:TextField;
var address:TextField;
var ContactNo:TextField;
var quantity:TextField;
var otrack:TextField;
btnSubmit1.addEventListener(MouseEvent.CLICK, submit);
function submit(e:MouseEvent):void{
var urlvars: URLVariables = new URLVariables;
urlvars.fllname = fllname.text;
urlvars.Oadd = address.text;
urlvars.ContactNo = ContactNo.text;
urlvars.oquantiy = quantity.text;
urlvars.otrack = otrack.text;
urlvars.cake = txtCake.text;
urlvars.frosting = txtFrosting.text;
urlvars.topping = txtToppings.text;
urlvars.topping2 = txtToppings2.text;
urlvars.filling = txtFilling.text;
urlvars.amt = lblAmount.text;
var urlreq:URLRequest = new URLRequest("http://localhost/MCC/order.php");
urlreq.method = URLRequestMethod.POST;
urlreq.data = urlvars;
var loader : URLLoader = new URLLoader;
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(urlreq);
nextFrame();
}
You can use the enabled parameter to control if your btnSubmit1 is clickable, so you will probably need to start with is disabled.
btnSubmit1.enabled = false;
btnSubmit1.addEventListener(MouseEvent.CLICK, submit);
Next you will need to listen to the TextEvent.TEXT_INPUT event on all your TextFields
fllname.addEventListener(TextEvent.TEXT_INPUT,paramChanged);
address.addEventListener(TextEvent.TEXT_INPUT,paramChanged);
//etc etc
This will notify you any-time the user changes their value, you can then create a single function (or a function for each control) to test the values, once they pass you can re-enable the submit button.
function paramChanged(event:TextEvent):void
{
if (fllname.text != "" && address.text != "")//add your other fields here
{
btnSubmit1.enabled = true;
}
else
{
btnSubmit1.enabled = false;//If something changes that means we now fail the test you will want to disable the button again
}
}
You could make custom test functions for each field as needed.

if statement and visible statement dont work but the things inside it work? ACTIONSCRIPT 3

Yeah so here's my code
if(defaultmeter.visible = true)
{
meter1.visible = true;
meter1.x = 124.10;
meter.y = 63.10;
jizz.visible = false;
}
Thing is the things inside the { }
work but the the if statement doesnt apply
Like when defaultmeter is not visible, the stuff inside the {} still applies :C help please
If you do mc.visible = true so you assign the true value to mc.visible so you make mc visible which normally always true.
To compare in this level, we use == (equal) operator to check if two values are equal or the != (not equal, different ) to check if two values are not equal.
So in your case you can do :
if(defaultmeter.visible == true){
// instructions here
}
Or
if(defaultmeter.visible != false){
// instructions here
}
Or simply
if(defaultmeter.visible){
// instructions here
}
Well of course, you need to cover the other case as well, like this:
if(defaultmeter.visible == true)
{
meter1.visible = true;
meter1.x = 124.10;
meter.y = 63.10;
jizz.visible = false;
}else{
meter1.visible = false;
jizz.visible = true; //btw, jizz, seriously?
...
}
use like this if (defaultmeter.visible == true){}

How to Insert data into some other database in codeigniter

I have a requirement I need to insert data into two tables of different databases..
$insert_query = 'INSERT INTO table1 (col1, col2) values(1, 2)';
$insert_otherdb_query= 'INSERT INTO otherdb.table1 (col1, col2) values(1, 2)';
$this->db->query($insert_query); //works fine
$this->db->query($insert_otherdb_query); //doesn't work
Error
Table 'mydb.otherdb.table1' doesn't exist
It does not ignore the mydb which is my default database...
Any suggesstions ?
You have to define a second set of database parameters. CI isn’t developed to really have two DB connections though, it is more for swapping test and production dbases. That said there are some tricks around it. So first define a second set of DB info like so:
/* FORUM */
$active_group = "forum";
$active_record = TRUE;
$db['forum']['hostname'] = "xxxxx";
$db['forum']['username'] = "xxxxx";
$db['forum']['password'] = "xxxxx";
$db['forum']['database'] = "xxxxx";
$db['forum']['dbdriver'] = "mysql";
$db['forum']['dbprefix'] = "";
$db['forum']['pconnect'] = TRUE;
$db['forum']['db_debug'] = TRUE;
$db['forum']['cache_on'] = FALSE;
$db['forum']['cachedir'] = "";
$db['forum']['char_set'] = "utf8";
$db['forum']['dbcollat'] = "utf8_general_ci";
/* TEST SITE */
$active_group = "default";
$active_record = TRUE;
$db['default']['hostname'] = "xxxxx";
$db['default']['username'] = "xxxxx";
$db['default']['password'] = "xxxxx";
$db['default']['database'] = "xxxxx";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
Your active db will be the one you defined LAST.
Once you have done this you can manually connect to the second one (or put it in MY_Controller if you always need to). You can then load your second database like so:
$this->other_db= $this->CI->load->database('forum', TRUE);
Access dbase 1 with $this->db and dbase 2 with $this->other_db (or whatever you called it).
thank you
Codeigniter internally connect to the database using settings from the database.php config file. Also you are using the same db object which has a connection to the first db, it will never work.
You may have several options to do this:
1) You can use Web services. Create a web service for the other database using CI and send data to that webservice. On the webservice side, insert the data in the database table. This is the most good way to use, as both code is separated and communication is only done by the web services. You can use SOAP or REST web services.
2) You can connect to other databases using direct php code. Use mysqli to connect to other db and run your queries in plane PHP code. Please note that doing so, you will be not able to use any db feature of the CI.
In my opinion, the first option will be a good thing, if there are lots of db operations on the second database, else use second.
Thank you
I got a better solution.
$dsn = 'mysql://user:password#localhost/db1';
$this->db1 = $this->load->database($dsn, true);
$dsn = 'mysql://user:password#localhost/db2';
$this->db2= $this->load->database($dsn, true);
$dsn = 'mysql://user:password#localhost/db3';
$this->db3= $this->load->database($dsn, true);
Usage
$this->db1 ->insert('tablename', $insert_array);
$this->db2->insert('tablename', $insert_array);
$this->db3->insert('tablename', $insert_array);
To connect manually to a desired database you can pass an array of values:
$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";
$this->load->database($config, true);
Access your table as usual without using database name.
Hope this helped you.
For more info, visit:
http://ellislab.com/codeigniter/user-guide/database/connecting.html
Any problems, let me know

Upload pre-selected file with actionscript

I'm creating a photoshop extension where I need to save the file people are working on and upload it to a server. So I want the extension to be able to automatically choose the current file and upload it to my server.
Problem is I don't know how to pre-select a file for people. Here's my code so far:
var app:Application = Photoshop.app;
var doc:Document = app.documents.add();
doc.selection.selectAll();
var color:RGBColor = new RGBColor();
color.red = 0;
color.green = 0;
color.blue = 255;
doc.selection.fill(color);
var saveOptions:JPEGSaveOptions = new JPEGSaveOptions();
//Add other PDF save options here.
doc.saveAs(File.applicationStorageDirectory, saveOptions);
var jsonOBJ:Object = {};
jsonOBJ.option = "iphone";
jsonOBJ.title = "c";
jsonOBJ.description = "s";
jsonOBJ.app_store_url = "iphone";
jsonOBJ.tags = "c";
jsonOBJ.temp_number = 1;
var _service:HTTPService = new HTTPService();
_service.url = "http://localhost:3000/designs";
_service.method = "POST";
_service.contentType = "application/json";
_service.resultFormat = "text";
_service.useProxy = false;
_service.makeObjectsBindable = true;
_service.addEventListener(FaultEvent.FAULT,faultRX);
_service.addEventListener(ResultEvent.RESULT,resultRX);
_service.showBusyCursor = true;
_service.send( JSON.encode( jsonOBJ ) );
function resultRX():void
{
trace(ResultEvent.RESULT);
}
function faultRX():void
{
trace(FaultEvent.FAULT);
}
var file:FileReference;
var filefilters:Array;
var req:URLRequest;
filefilters = [ new FileFilter('Images', '*.jpg') ]; // add other file filters
file.browse(filefilters);
It's a photoshop extension. I ended up using FileReference and link to the file. it worked. I dunno how to actually upload the image though. When I use file.upload(requestUrl), it sends along a wrong content type. –