undef HALF_FREQUENCY_SENDING_TO_CLIENT
[ryzomcore.git] / web / public_php / ams / func / activate_plugin.php
blob27de82ae273b723c5b8d377da4c941783ca12d85
1 <?php
2 /**
3 * This function is used in activating plugins.
4 * This can be done by providing id using $_GET global variable of the plugin which
5 * we want to activate. After getting id we update the respective plugin with status
6 * activate which here means '1' .
8 * @author Shubham Meena, mentored by Matthew Lagoe
9 */
10 function activate_plugin() {
12 // if logged in
13 if ( WebUsers :: isLoggedIn() ) {
15 if ( isset( $_GET['id'] ) )
17 // id of plugin to activate
18 $id = filter_var( $_GET['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS );
19 $db = new DBLayer( 'lib' );
20 $result = $db -> update( "plugins", array( 'Status' => '1' ), "Id = $id" );
21 if ( $result )
23 // if result is successfull it redirects and shows success message
24 header("Cache-Control: max-age=1");
25 header( "Location: index.php?page=plugins&result=3" );
26 throw new SystemExit();
28 else
30 //if result is unsuccessfull it redirects and throws error
31 header("Cache-Control: max-age=1");
32 header( "Location: index.php?page=plugins&result=4" );
33 throw new SystemExit();
36 else
38 //if $_GET variable is not set it redirects and shows error
39 header("Cache-Control: max-age=1");
40 header( "Location: index.php?page=plugins&result=4" );
41 throw new SystemExit();