public function updateMenu(Request $request, Response $response) { $rs = array('flag' => 'FAIL', 'msg' => ''); $menuConfig = $request->post('menuConfig', ''); $menuConfig = json_decode($menuConfig, TRUE); if (empty($menuConfig)) { $rs['msg'] = '请检查数据'; $response->sendJSON($rs); exit; } config_set('wxmenu', $menuConfig, 'J'); if ((new Weixin('fxm'))->createMenu($menuConfig)) { $rs['flag'] = 'SUC'; $rs['msg'] = 'fxm菜单更新成功'; if ((new Weixin('zfy'))->createMenu($menuConfig)) { $rs['msg'] = 'zfy菜单更新成功'; } else { $rs['flag'] = 'FAIL'; $rs['msg'] = 'zfy菜单更新失败'; } } else { $rs['msg'] = 'fxm菜单更新失败'; } $response->sendJSON($rs); }
function install(){ $custom_group_actions = config_get('custom_group_actions'); $custom_group_actions[] = $this->getAction(); config_set('custom_group_actions', $custom_group_actions); return true; }
public function testSetReplaceArray() { $config = array('one' => array('two' => array('three' => 'value'))); $expected = array('one' => array('two' => array('three' => array('four' => 'hello world')))); $returnVal = config_set($config, 'one.two.three', array('four' => 'hello world')); $this->assertEquals($expected, $returnVal); $this->assertEquals($expected, $config); }
function set_capability_enum($p_threshold, $p_all_projects_only = false) { global $t_access, $t_project; if ($t_access >= config_get_access($p_threshold) && (ALL_PROJECTS == $t_project || !$p_all_projects_only)) { $f_flag = gpc_get('flag_' . $p_threshold); $f_access = gpc_get_int('access_' . $p_threshold); # @@debug @@ echo "<br />for $p_threshold "; var_dump($f_flag, $f_access); echo '<br />'; if ($f_flag != config_get($p_threshold)) { config_set($p_threshold, $f_flag, NO_USER, $t_project, $f_access); } } }
function materialize_ajax_settings_save($form, $form_state) { $config = config('materialize.settings'); $theme = $form_state['build_info']['args'][0]; $theme_settings = config_get('theme_' . $theme . '_settings', array()); $trigger = $form_state['triggering_element']['#name']; $theme_settings[$trigger] = $form_state['input'][$trigger]; if (empty($theme_settings[$trigger])) { $theme_settings[$trigger] = 0; } config_set('theme_' . $theme . '_settings', $theme_settings); backdrop_set_message("configuration saved."); }
$t_project_id = (int) $_POST['project_id']; if ($_POST['project_id'] > 0) { $t_default = null; $t_user_id = NO_USER; $t_view_issues_page_columns = config_get('view_issues_page_columns', $t_default, $t_user_id, $t_src_project_id); // Add Product Backlog Custom Field If Custom Field Is Not In Array $key = array_search('custom_productbacklog', $t_view_issues_page_columns); if ($key == NULL) { $t_view_issues_page_columns[] = 'custom_productbacklog'; } // Add Sprint Custom Field If Custom Field Is Not In Array $key = array_search('custom_sprint', $t_view_issues_page_columns); if ($key == NULL) { $t_view_issues_page_columns[] = 'custom_sprint'; } config_set('view_issues_page_columns', $t_view_issues_page_columns, $t_user_id, $t_project_id); $agilemantis_project->addAdditionalProjectFields($t_project_id); $agilemantis_pb->editProjects($agilemantis_pb->id, $t_project_id); } } if ($t_project_id > 0) { if ($agilemantis_project->backlog_project_is_unique($t_project_id) == false) { $system = plugin_lang_get('edit_product_backlog_error_100600'); } else { $system = ""; } // give access_level 'reporter (25)' to team-user $result = $agilemantis_pb->getTeamUserId($agilemantis_pb->id); if ($result > -1) { $user_id_team_user = $result; $agilemantis_pb->giveDeveloperRightsToTeamUser($user_id_team_user, $t_project_id);
* Notes: * data set from the test may need to be removed from the database manually */ require_once 'test.php'; $t_config = 'main_menu_custom_options'; $t_test = config_get($t_config); print_r($t_config); print_r($t_test); $t_test[0][1] = 20; config_set($t_config, $t_test); $t_test = config_get($t_config); print_r($t_test); $t_config = 'default_home_page'; $t_test = config_get($t_config); print_r($t_config); print_r($t_test); $t_test .= '?test'; config_set($t_config, $t_test); $t_test = config_get($t_config); print_r($t_test); $g_test_config = array(); $t_config = 'test_config'; $t_test = config_get($t_config); print_r($t_config); print_r($t_test); echo " " . (isset($t_test[0]) ? "set" : "not set") . " " . count($t_test) . " "; $t_test[0] = 20; config_set($t_config, $t_test); $t_test = config_get($t_config); print_r($t_test); echo " " . (isset($t_test[0]) ? "set" : "not set") . " " . count($t_test) . " ";
/** * Respond to image style deletion. * * This hook enables modules to update settings when a image style is being * deleted. If a style is deleted, a replacement name may be specified in * $style['name'] and the style being deleted will be specified in * $style['old_name']. * * @param $style * The image style array that being deleted. */ function hook_image_style_delete($style) { // Administrators can choose an optional replacement style when deleting. // Update the modules style variable accordingly. if (isset($style['old_name']) && $style['old_name'] == config_get('mymodule.settings', 'image_style')) { config_set('mymodule.settings', 'image_style', $style['name']); } }
<?php # start libraries foreach (array('array_functions', 'config', 'formatting', 'layout', 'form', 'model', 'backend') as $library) { require_once dirname(__FILE__) . '/lib/' . $library . '.php'; } # end libraries config_set('greenroom_dir', dirname(__FILE__)); class Greenroom { static function admin($backend) { if (!isset($_REQUEST['_v'])) { if (isset($_REQUEST['_m'])) { $_REQUEST['_v'] = 'list'; } else { $_REQUEST['_v'] = 'model'; } } if (!in_array($_REQUEST['_v'], array('model', 'list', 'edit'))) { return; } if ($_REQUEST['_v'] != 'model' && !in_array($_REQUEST['_m'], Model::defined())) { return; } require dirname(__FILE__) . '/admin/' . $_REQUEST['_v'] . '.php'; } }
echo "failed\n"; exit(1); } echo "OK\n"; $g_db_connected = true; # fake out database access routines used by config_get $t_last_update = config_get('database_version', -1, ALL_USERS, ALL_PROJECTS); $lastid = count($upgrade) - 1; $i = $t_last_update + 1; while ($i <= $lastid && !$g_failed) { echo 'Create Schema ( ' . $upgrade[$i][0] . ' on ' . $upgrade[$i][1][0] . ' )'; $dict = NewDataDictionary($g_db); if ($upgrade[$i][0] == 'InsertData') { $sqlarray = call_user_func_array($upgrade[$i][0], $upgrade[$i][1]); } else { $sqlarray = call_user_func_array(array($dict, $upgrade[$i][0]), $upgrade[$i][1]); } $ret = $dict->ExecuteSQLArray($sqlarray); if ($ret == 2) { print_test_result(GOOD); config_set('database_version', $i); } else { print_test_result(BAD, true, $sqlarray[0] . '<br />' . $g_db->ErrorMsg()); } $i++; } if (false == $g_failed) { exit(0); } exit(1); # vim: noexpandtab tabstop=4 softtabstop=0:
$t_split = split('=>', $value, 2); if (count($t_split) == 2) { // associative array $t_new_key = constant_replace(trim($t_split[0])); $t_new_value = constant_replace(trim($t_split[1])); $t_value[$t_new_key] = $t_new_value; } else { // regular array $t_value[$key] = constant_replace(trim($value)); } } } else { // scalar value $t_value = constant_replace(trim($t_full_string)); } } } config_set($f_config_option, $t_value, $f_user_id, $f_project_id); print_successful_redirect('adm_config_report.php'); /** * Check if the passed string is a constant and return its value */ function constant_replace($p_name) { $t_result = $p_name; if (is_string($p_name) && defined($p_name)) { // we have a constant $t_result = constant($p_name); } return $t_result; }
/** * Save the configuration options from hook_block_configure(). * * This hook allows you to save the block-specific configuration settings * defined within your hook_block_configure(). Most settings will automatically * be saved if using the Layout module to position blocks, but if your settings * should be site-wide or saved in the database instead of the Layout * configuration, you may use this hook to save your settings. If you wish * Layout module to *not* save your settings, unset the value from the $edit * array. * * @param $delta * Which block is being configured. This is a unique identifier for the block * within the module, defined in hook_block_info(). * @param $edit * The submitted form data from the configuration form. This is passed by * reference, so values can be changed or removed before they are saved into * the layout configuration. * * @see hook_block_configure() * @see hook_block_info() */ function hook_block_save($delta, &$edit = array()) { if ($delta == 'my_block_delta') { config_set('mymodule.settings', 'my_global_value', $edit['my_global_value']); // Remove the value so it is not saved by Layout module. unset($edit['my_global_value']); } }
$t_notify_flags[$t_action][$t_flag] = isset($t_flags[$t_action][$t_flag]) ? ON : OFF; } } if ($t_default_flags['threshold_min'] != $t_thresholds_min[$t_action]) { $t_notify_flags[$t_action]['threshold_min'] = $t_thresholds_min[$t_action]; } if ($t_default_flags['threshold_max'] != $t_thresholds_max[$t_action]) { $t_notify_flags[$t_action]['threshold_max'] = $t_thresholds_max[$t_action]; } } if (isset($t_notify_flags)) { $t_existing_flags = config_get('notify_flags'); $t_existing_access = config_get_access('notify_flags'); if ($t_existing_flags != $t_notify_flags || $t_existing_access != $f_actions_access) { # only set the flags if they are different config_set('notify_flags', $t_notify_flags, NO_USER, $t_project, $f_actions_access); } } form_security_purge('manage_config_email_set'); ?> <br /> <div align="center"> <?php echo lang_get('operation_successful') . '<br />'; print_bracket_link($t_redirect_url, lang_get('proceed')); ?> </div> <?php html_page_bottom();
function execute() { config_set('database_version', $this->release_name); $this->set_applied(); return true; }
function getUserStoriesByProductBacklogName($product_backlog) { $t_mantis_bug_table = db_get_table('mantis_bug_table'); $t_mantis_custom_field_string_table = db_get_table('mantis_custom_field_string_table'); $t_mantis_project_table = db_get_table('mantis_project_table'); $t_mantis_category_table = db_get_table('mantis_category_table'); $this->getAdditionalProjectFields(); $t_sql = "SELECT\n\t\t\t\ta.id AS id, a.project_id AS project_id, a.summary AS summary, a.status AS status,\n\t\t\t\ta.target_version AS target_version, b.id AS b_category_id, b.name AS category_name,\n\t\t\t\tc.id AS c_project_id, c.name AS project_name, d.value AS productBacklog\n\t\t\tFROM {$t_mantis_bug_table} a\n\t\t\tLEFT JOIN {$t_mantis_category_table} b ON a.category_id = b.id\n\t\t\tLEFT JOIN {$t_mantis_project_table} c ON a.project_id = c.id\n\t\t\tLEFT JOIN {$t_mantis_custom_field_string_table} d ON a.id = d.bug_id\n\t\t\tWHERE d.field_id=" . db_param(0) . " AND d.value=" . db_param(1); $t_params = array($this->pb, $product_backlog); $show_resolved_userstories = $this->getConfigValue('show_resolved_userstories'); $show_closed_userstories = $this->getConfigValue('show_closed_userstories'); if ($show_resolved_userstories == 1 && $show_closed_userstories == 0) { $t_sql .= " AND a.status <= 80"; } if ($show_closed_userstories == 1 && $show_resolved_userstories == 0) { $t_sql .= " AND a.status != 80"; } if ($show_closed_userstories == 1 && $show_resolved_userstories == 1) { $t_sql .= " AND a.status <= 90"; } if ($show_closed_userstories == 0 && $show_resolved_userstories == 0) { $t_sql .= " AND a.status < 80"; } $show_only_project_userstories = $this->getConfigValue('show_only_project_userstories'); if ($show_only_project_userstories == 1 && helper_get_current_project() > 0) { $t_sql .= " AND a.project_id=" . db_param(sizeof($t_params)); $t_params[] = helper_get_current_project(); } $t_sql .= $orderby; $bug_list = $this->executeQuery($t_sql, $t_params); if (!$bug_list || sizeof($bug_list) == 0) { return array(); } foreach ($bug_list as $row) { $row['businessValue'] = $this->getCustomFieldValueById($row['id'], $this->bv); $row['storyPoints'] = $this->getCustomFieldValueById($row['id'], $this->sp); if (config_get('show_only_us_without_storypoints', 0, auth_get_current_user_id()) == 1 && $row['storyPoints'] != "") { continue; } $row['sprint'] = $this->getCustomFieldValueById($row['id'], $this->spr); if (config_get('show_only_userstories_without_sprint', 0, auth_get_current_user_id()) == 1 && !empty($row['sprint'])) { continue; } if (plugin_config_get('gadiv_ranking_order') == '1') { $row['rankingOrder'] = $this->getCustomFieldValueById($row['id'], $this->ro); } if (plugin_config_get('gadiv_tracker_planned_costs') == '1') { $row['plannedWork'] = $this->getCustomFieldValueById($row['id'], $this->pw); } $user_stories[] = $row; } $sort_by = config_get('current_user_product_backlog_filter', null, auth_get_current_user_id()); if (!empty($_GET['sort_by']) && isset($_GET['sort_by'])) { config_set('current_user_product_backlog_filter', $_GET['sort_by'], auth_get_current_user_id()); $sort_by = $_GET['sort_by']; } $direction = config_get('current_user_product_backlog_filter_direction', null, auth_get_current_user_id()); if (!empty($_GET['direction']) && isset($_GET['direction'])) { config_set('current_user_product_backlog_filter_direction', $_GET['direction'], auth_get_current_user_id()); $direction = $_GET['direction']; } return $this->sortUserStories($sort_by, $direction, $user_stories); }
} # Update password if the two match and are not empty if (!is_blank($f_password)) { if ($f_password != $f_password_confirm) { trigger_error(ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR); } else { if (!auth_does_password_match($t_user_id, $f_password)) { user_set_password($t_user_id, $f_password); $t_password_updated = true; } } } # avatar $t_username = user_get_field($t_user_id, 'username'); # store use_avatar in config config_set('use_gravatar', $f_use_gravatar, $t_user_id, ALL_PROJECTS); # upload avatar $target_path = config_get('directory_avatar') . '/'; $avatar_file_name = $_FILES['avatar_file']['name']; $ext = end(explode('.', $_FILES['avatar_file']['name'])); $target_file = $target_path . $t_username . '.' . $ext; move_uploaded_file($_FILES['avatar_file']['tmp_name'], $target_file); # delete avatar $f_delete_avatar = gpc_get_string('delete_avatar', ''); if ($f_delete_avatar != '') { $avatar_file = $target_path . '/' . $t_username . '.gif'; $fh = fopen($avatar_file, 'w') or die("can't open file"); fclose($fh); unlink($avatar_file); $avatar_file = $target_path . '/' . $t_username . '.jpg'; $fh = fopen($avatar_file, 'w') or die("can't open file");
/** * Sets up a Backdrop site to be used as a cached installation profile. */ protected function setUp() { global $conf; // Prepare the environment for running tests. $this->prepareEnvironment(); if (!$this->setupEnvironment) { return FALSE; } // Reset all statics and variables to perform tests in a clean environment. $conf = array(); backdrop_static_reset(); // Change the database prefix. // All static variables need to be reset before the database prefix is // changed, since BackdropCacheArray implementations attempt to // write back to persistent caches when they are destructed. $this->changeDatabasePrefix(); if (!$this->setupDatabasePrefix) { return FALSE; } // Preset the 'install_profile' system variable, so the first call into // system_rebuild_module_data() (in backdrop_install_system()) will register // the test's profile as a module. Without this, the installation profile of // the parent site (executing the test) is registered, and the test // profile's hook_install() and other hook implementations are never invoked. config_install_default_config('system'); config_set('system.core', 'install_profile', $this->profile); // Perform the actual Backdrop installation. include_once BACKDROP_ROOT . '/core/includes/install.inc'; backdrop_install_system(); // Set path variables. $core_config = config('system.core'); $core_config->set('file_default_scheme', 'public'); $core_config->set('file_public_path', $this->public_files_directory); $core_config->set('file_private_path', $this->private_files_directory); $core_config->set('file_temporary_path', $this->temp_files_directory); $core_config->save(); // Ensure schema versions are recalculated. backdrop_static_reset('backdrop_get_schema_versions'); // Include the testing profile. config_set('system.core', 'install_profile', $this->profile); $profile_details = install_profile_info($this->profile, 'en'); // Install the modules specified by the testing profile. module_enable($profile_details['dependencies'], FALSE); // Install the profile itself. $install_profile_module_exists = db_query("SELECT 1 FROM {system} WHERE type = 'module' AND name = :name", array(':name' => $this->profile))->fetchField(); if ($install_profile_module_exists) { module_enable(array($this->profile), FALSE); } return TRUE; }
# # agileMantis is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with agileMantis. If not, see <http://www.gnu.org/licenses/>. html_page_top(plugin_lang_get('info_title')); if (!config_is_set('plugin_agileMantis_gadiv_agilemantis_version')) { config_set('plugin_agileMantis_gadiv_agilemantis_version', 0); } ?> <?php $t_user_right = $agilemantis_au->authUser(); if ($t_user_right == 2 || $t_user_right == 3 || current_user_is_administrator()) { ?> <br> <?php include AGILEMANTIS_PLUGIN_URI . '/pages/footer_menu.php'; ?> <br> <?php echo $system; ?>
/** * Act on field_attach_delete_bundle. * * This hook is invoked after the field module has performed the operation. * * @param $entity_type * The type of entity; for example, 'node' or 'user'. * @param $bundle * The name of the bundle that was just deleted. * @param $instances * An array of all instances that existed for the bundle before it was * deleted. */ function hook_field_attach_delete_bundle($entity_type, $bundle, $instances) { // Remove the extra weights variable information for this bundle. $extra_weights = config_get('my_module.settings', 'field_extra_weights'); if (isset($extra_weights[$entity_type][$bundle])) { unset($extra_weights[$entity_type][$bundle]); config_set('my_module.settings', 'field_extra_weights', $extra_weights); } }
# get changes to access level to change these values $f_access = gpc_get('status_access'); # walk through the status labels to set the status threshold $t_enum_status = explode_enum_string(config_get('status_enum_string')); $t_set_status = array(); foreach ($t_statuses as $t_status_id => $t_status_label) { $f_level = gpc_get('access_change_' . $t_status_id); if (NEW_ == $t_status_id) { if ((int) $f_level != config_get('report_bug_threshold')) { config_set('report_bug_threshold', (int) $f_level, ALL_USERS, $t_project, $f_access); } } else { $t_set_status[$t_status_id] = (int) $f_level; } } if ($t_set_status != config_get('set_status_threshold')) { config_set('set_status_threshold', $t_set_status, ALL_USERS, $t_project, $f_access); } } ?> <br /> <div align="center"> <?php echo lang_get('operation_successful') . '<br />'; print_bracket_link($t_redirect_url, lang_get('proceed')); ?> </div> <?php html_page_bottom1(__FILE__);
/** * Set a plugin configuration option in the database. * @param string Configuration option name * @param multi Option value * @param int User ID * @param int Project ID * @param int Access threshold */ function plugin_config_set($p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL) { if ($p_access == DEFAULT_ACCESS_LEVEL) { $p_access = config_get_global('admin_site_threshold'); } $t_basename = plugin_get_current(); $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; config_set($t_full_option, $p_value, $p_user, $p_project, $p_access); }
# only MANAGERS can set global defaults.for a project if ($f_manage_page && $t_dst_project_id != ALL_PROJECTS) { access_ensure_project_level(MANAGER, $t_dst_project_id); } # user should only be able to set columns for a project that is accessible. if ($t_dst_project_id != ALL_PROJECTS) { access_ensure_project_level(VIEWER, $t_dst_project_id); } # Calculate the user id to set the configuration for. if ($f_manage_page) { $t_user_id = NO_USER; } else { $t_user_id = auth_get_current_user_id(); } $t_all_columns = columns_get_all(); $t_default = null; $t_view_issues_page_columns = config_get('view_issues_page_columns', $t_default, $t_user_id, $t_src_project_id); $t_view_issues_page_columns = columns_remove_invalid($t_view_issues_page_columns, $t_all_columns); $t_print_issues_page_columns = config_get('print_issues_page_columns', $t_default, $t_user_id, $t_src_project_id); $t_print_issues_page_columns = columns_remove_invalid($t_print_issues_page_columns, $t_all_columns); $t_csv_columns = config_get('csv_columns', $t_default, $t_user_id, $t_src_project_id); $t_csv_columns = columns_remove_invalid($t_csv_columns, $t_all_columns); $t_excel_columns = config_get('excel_columns', $t_default, $t_user_id, $t_src_project_id); $t_excel_columns = columns_remove_invalid($t_excel_columns, $t_all_columns); config_set('view_issues_page_columns', $t_view_issues_page_columns, $t_user_id, $t_dst_project_id); config_set('print_issues_page_columns', $t_print_issues_page_columns, $t_user_id, $t_dst_project_id); config_set('csv_columns', $t_csv_columns, $t_user_id, $t_dst_project_id); config_set('excel_columns', $t_excel_columns, $t_user_id, $t_dst_project_id); form_security_purge('manage_columns_copy'); $t_redirect_url = $f_manage_page ? 'manage_config_columns_page.php' : 'account_manage_columns_page.php'; print_header_redirect($t_redirect_url);
function installConfigurationParams() { if (!config_is_set('plugin_agileMantis_gadiv_workday_in_hours')) { config_set('plugin_agileMantis_gadiv_workday_in_hours', 8); } if (!config_is_set('plugin_agileMantis_gadiv_sprint_length')) { config_set('plugin_agileMantis_gadiv_sprint_length', 28); } if (!config_is_set('plugin_agileMantis_gadiv_storypoint_mode')) { config_set('plugin_agileMantis_gadiv_storypoint_mode', 0); } if (!config_is_set('plugin_agileMantis_gadiv_fibonacci_length')) { config_set('plugin_agileMantis_gadiv_fibonacci_length', 10); } if (!config_is_set('plugin_agileMantis_gadiv_show_storypoints')) { config_set('plugin_agileMantis_gadiv_show_storypoints', 0); } if (!config_is_set('plugin_agileMantis_gadiv_task_unit_mode')) { config_set('plugin_agileMantis_gadiv_task_unit_mode', 'h'); } if (!config_is_set('plugin_agileMantis_gadiv_userstory_unit_mode')) { config_set('plugin_agileMantis_gadiv_userstory_unit_mode', 'h'); } if (!config_is_set('plugin_agileMantis_gadiv_taskboard')) { config_set('plugin_agileMantis_gadiv_taskboard', 0); } if (!config_is_set('plugin_agileMantis_gadiv_daily_scrum')) { config_set('plugin_agileMantis_gadiv_daily_scrum', 0); } if (!config_is_set('plugin_agileMantis_gadiv_ranking_order')) { config_set('plugin_agileMantis_gadiv_ranking_order', 0); } if (!config_is_set('plugin_agileMantis_gadiv_show_rankingorder')) { config_set('plugin_agileMantis_gadiv_show_rankingorder', 0); } if (!config_is_set('plugin_agileMantis_gadiv_presentable')) { config_set('plugin_agileMantis_gadiv_presentable', 0); } if (!config_is_set('plugin_agileMantis_gadiv_release_documentation')) { config_set('plugin_agileMantis_gadiv_release_documentation', 0); } if (!config_is_set('plugin_agileMantis_gadiv_technical')) { config_set('plugin_agileMantis_gadiv_technical', 0); } if (!config_is_set('plugin_agileMantis_gadiv_tracker_planned_costs')) { config_set('gadiv_tracker_planned_costs', 0); } }
function setConfigValue($p_config_id, $p_user_id, $p_value) { config_set($p_config_id, $p_value, $p_user_id); }
<?php /** * Gate - Wiki engine and web-interface for WebTester Server * * Copyright (c) 2008-2009 Sergey I. Sharybin <*****@*****.**> * * This program can be distributed under the terms of the GNU GPL. * See the file COPYING. */ global $IFACE; if ($IFACE != "SPAWNING NEW IFACE" || $_GET['IFACE'] != '') { print 'HACKERS?'; die; } if ($_MARKET_config_included_ != '###MARKET_config_included###') { $_MARKET_config_included_ != '###MARKET_config_included###'; config_set('basket-timelife', 5 * 60); }
<?php require_once dirname(__FILE__) . '/../greenroom.inc.php'; require_once 'PHPUnit/Framework.php'; require_once 'linked_path.php'; require_once 'form.php'; config_set('greenroom_path', new LinkedPath('/path', '/url')); class AllTests { public static function suite() { $suite = new PHPUnit_Framework_TestSuite('blueline'); $suite->addTestSuite('LinkedPathTest'); $suite->addTestSuite('FormTest'); return $suite; } }
/** * Sets up a Backdrop site for running functional and integration tests. * * Generates a random database prefix and installs Backdrop with the specified * installation profile in BackdropWebTestCase::$profile into the * prefixed database. Afterwards, installs any additional modules specified by * the test. * * After installation all caches are flushed and several configuration values * are reset to the values of the parent site executing the test, since the * default values may be incompatible with the environment in which tests are * being executed. * * @param ... * List of modules to enable for the duration of the test. This can be * either a single array or a variable number of string arguments. * * @see BackdropWebTestCase::prepareDatabasePrefix() * @see BackdropWebTestCase::changeDatabasePrefix() * @see BackdropWebTestCase::prepareEnvironment() */ protected function setUp() { global $user, $language, $conf; // Create the database prefix for this test. $this->prepareDatabasePrefix(); // Prepare the environment for running tests. $this->prepareEnvironment(); if (!$this->setupEnvironment) { return FALSE; } // Reset all statics and variables to perform tests in a clean environment. $conf = array(); backdrop_static_reset(); // Change the database prefix. // All static variables need to be reset before the database prefix is // changed, since BackdropCacheArray implementations attempt to // write back to persistent caches when they are destructed. $this->changeDatabasePrefix(); if (!$this->setupDatabasePrefix) { return FALSE; } // Preset the 'install_profile' system variable, so the first call into // system_rebuild_module_data() (in backdrop_install_system()) will register // the test's profile as a module. Without this, the installation profile of // the parent site (executing the test) is registered, and the test // profile's hook_install() and other hook implementations are never invoked. config_install_default_config('system'); config_set('system.core', 'install_profile', $this->profile); // Perform the actual Backdrop installation. include_once BACKDROP_ROOT . '/core/includes/install.inc'; backdrop_install_system(); // Set path variables. $core_config = config('system.core'); $core_config->set('file_default_scheme', 'public'); $core_config->set('file_public_path', $this->public_files_directory); $core_config->set('file_private_path', $this->private_files_directory); $core_config->set('file_temporary_path', $this->temp_files_directory); $core_config->save(); // Set 'parent_profile' of simpletest to add the parent profile's // search path to the child site's search paths. // @see backdrop_system_listing() // @todo This may need to be primed like 'install_profile' above. config_set('simpletest.settings', 'parent_profile', $this->originalProfile); // Ensure schema versions are recalculated. backdrop_static_reset('backdrop_get_schema_versions'); // Include the testing profile. config_set('system.core', 'install_profile', $this->profile); $profile_details = install_profile_info($this->profile, 'en'); // Install the modules specified by the testing profile. module_enable($profile_details['dependencies'], FALSE); // Install modules needed for this test. This could have been passed in as // either a single array argument or a variable number of string arguments. // @todo Remove this compatibility layer and only accept a single array. $modules = func_get_args(); if (isset($modules[0]) && is_array($modules[0])) { $modules = $modules[0]; } if ($modules) { $success = module_enable($modules, TRUE); $this->assertTrue($success, t('Enabled modules: %modules', array('%modules' => implode(', ', $modules)))); } // Run the profile tasks. $install_profile_module_exists = db_query("SELECT 1 FROM {system} WHERE type = 'module' AND name = :name", array(':name' => $this->profile))->fetchField(); if ($install_profile_module_exists) { module_enable(array($this->profile), FALSE); } // Reset/rebuild all data structures after enabling the modules. $this->resetAll(); // Run cron once in that environment, as install.php does at the end of // the installation process. backdrop_cron_run(); // Ensure that the session is not written to the new environment and replace // the global $user session with uid 1 from the new test site. backdrop_save_session(FALSE); // Login as uid 1. $user = user_load(1); // Restore necessary variables. state_set('install_task', 'done'); config_set('system.core', 'clean_url', $this->originalCleanUrl); config_set('system.core', 'site_mail', '*****@*****.**'); config_set('system.date', 'date_default_timezone', date_default_timezone_get()); backdrop_static_reset('url'); // Set up English language. unset($conf['language_default']); $language = language_default(); // Use the test mail class instead of the default mail handler class. config_set('system.mail', 'default-system', 'TestingMailSystem'); backdrop_set_time_limit($this->timeLimit); $this->setup = TRUE; }
config_set('burndown_tasks_trend', 1, auth_get_current_user_id()); } if (!config_is_set('utilization_distribution_planned', auth_get_current_user_id())) { config_set('utilization_distribution_planned', 1, auth_get_current_user_id()); } if (!config_is_set('utilization_distribution_remains', auth_get_current_user_id())) { config_set('utilization_distribution_remains', 1, auth_get_current_user_id()); } if (!config_is_set('utilization_utilizationdetailed', auth_get_current_user_id())) { config_set('utilization_utilizationdetailed', 1, auth_get_current_user_id()); } if (!config_is_set('statistic_velocity_amount_of_sprints', auth_get_current_user_id())) { config_set('statistic_velocity_amount_of_sprints', 5, auth_get_current_user_id()); } if (!config_is_set('statistic_velocity_referenced_sprint', auth_get_current_user_id())) { config_set('statistic_velocity_referenced_sprint', "", auth_get_current_user_id()); } include AGILEMANTIS_PLUGIN_URI . 'pages/sprint_backlog_header.php'; ?> <br> <?php include AGILEMANTIS_PLUGIN_URI . 'pages/sprint_backlog_actions.php'; ?> <br> <center> <?php if (plugin_is_loaded('agileMantisExpert')) { event_signal('EVENT_LOAD_STATISTICS', array(auth_get_current_user_id())); } else { $images = array(); $images[] = AGILEMANTIS_PLUGIN_URL . 'images/statistics_before_sprint_starts.png';
if (!config_is_set('current_user_assume_userstories_filter_direction', auth_get_current_user_id())) { config_set('current_user_assume_userstories_filter_direction', 'ASC', auth_get_current_user_id()); } if (config_get('current_user_assume_userstories_filter_direction', null, auth_get_current_user_id()) == 'ASC') { $direction = 'DESC'; } else { $direction = 'ASC'; } # check if available if (plugin_config_get('gadiv_ranking_order') == 0 && config_get('current_user_assume_userstories_filter', null, auth_get_current_user_id()) == 'rankingOrder') { config_set('current_user_assume_userstories_filter', '', auth_get_current_user_id()); config_set('current_user_assume_userstories_filter_direction', 'ASC', auth_get_current_user_id()); } if (plugin_config_get('gadiv_tracker_planned_costs') == 0 && config_get('current_user_assume_userstories_filter', null, auth_get_current_user_id()) == 'plannedWork') { config_set('current_user_assume_userstories_filter', '', auth_get_current_user_id()); config_set('current_user_assume_userstories_filter_direction', 'ASC', auth_get_current_user_id()); } # get all unresolved user stories $undone = $agilemantis_pb->getAllUndoneUserStories($product_backlog); if (empty($undone)) { echo '<br><center><span class="message_error">' . plugin_lang_get('assume_userstories_error_120C01') . '</span></center>'; } if (plugin_is_loaded('agileMantisExpert')) { event_signal('EVENT_LOAD_USERSTORY'); } else { } ?> <br> <form action="" method="post"> <input type="hidden" name="action" value="save"> <input type="hidden"
/** * Set capability enum * @param string $p_threshold Threshold. * @param boolean $p_all_projects_only All projects only. * @return void */ function set_capability_enum($p_threshold, $p_all_projects_only = false) { global $g_access, $g_project; if ($g_access >= config_get_access($p_threshold) && (ALL_PROJECTS == $g_project || !$p_all_projects_only)) { $f_flag = gpc_get('flag_' . $p_threshold); $f_access = gpc_get_int('access_' . $p_threshold); if ($f_flag != config_get($p_threshold) || $f_access != config_get_access($p_threshold)) { config_set($p_threshold, $f_flag, NO_USER, $g_project, $f_access); } } }