Exemple #1
0
/**
 * Lock settings that can't be changed in other portals
 */
function lockSettings()
{
    $access_url_locked_settings = api_get_locked_settings();
    $table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
    foreach ($access_url_locked_settings as $setting) {
        $sql = "UPDATE {$table} SET access_url_locked = 1 WHERE variable  = '{$setting}'";
        Database::query($sql);
    }
}
Exemple #2
0
 $message = array();
 if ($form->validate()) {
     $values = $form->exportValues();
     $mark_all = false;
     $un_mark_all = false;
     if (api_is_multiple_url_enabled()) {
         if (isset($values['buttons_in_action_right']) && isset($values['buttons_in_action_right']['mark_all'])) {
             $mark_all = true;
         }
         if (isset($values['buttons_in_action_right']) && isset($values['buttons_in_action_right']['unmark_all'])) {
             $un_mark_all = true;
         }
     }
     if ($mark_all || $un_mark_all) {
         if (api_is_global_platform_admin()) {
             $locked_settings = api_get_locked_settings();
             foreach ($values as $key => $value) {
                 if (!in_array($key, $locked_settings)) {
                     $changeable = 0;
                     if ($mark_all) {
                         $changeable = 1;
                     }
                     $params = array('variable = ?' => array($key));
                     $data = api_get_settings_params($params);
                     if (!empty($data)) {
                         foreach ($data as $item) {
                             $params = array('id' => $item['id'], 'access_url_changeable' => $changeable);
                             api_set_setting_simple($params);
                         }
                     }
                 }