. // web interface for managing apps require_once('../inc/util_ops.inc'); function do_updates() { $id = post_int("id"); $app = BoincApp::lookup_id($id); if (!$app) admin_error_page("no such app"); $n = post_str("deprecated", true)?1:0; $app->update("deprecated=$n"); $n = post_num("weight"); $app->update("weight=$n"); $n = post_int("homogeneous_redundancy"); $app->update("homogeneous_redundancy=$n"); $n = post_str("homogeneous_app_version", true)?1:0; $app->update("homogeneous_app_version=$n"); $n = post_str("non_cpu_intensive", true)?1:0; $app->update("non_cpu_intensive=$n"); $n = post_str("beta", true)?1:0; $app->update("beta=$n"); $n = post_str("fraction_done_exact", true)?1:0; $app->update("fraction_done_exact=$n"); echo "Application $id updated.
You must restart the project for this to take effect. "; } function add_app() { $name = BoincDb::escape_string(post_str('add_name')); $user_friendly_name = BoincDb::escape_string(post_str('add_user_friendly_name')); if (empty($name) || empty($user_friendly_name) ) { admin_error_page( "To add a new application please supply both a brief name and a longer 'user-friendly' name.
" ); } $now = time(); $id = BoincApp::insert( "(name,user_friendly_name,create_time) VALUES ('$name', '$user_friendly_name', $now)" ); if (!$id) { admin_error_page("insert failed"); } echo "Application added.You must restart the project for this to take effect. "; } function show_form() { echo "
Click for details
", "Created", "weightdetails
", "shmem items", "HR typedetails
", "homogeneous app version?details
", "deprecated?", "Non-CPU-intensive?", "Beta?", "Exact fraction done?", "" ); $total_weight = BoincApp::sum("weight"); $swi = parse_config(get_config(), "
\n"; } admin_page_head("Manage applications"); if (post_str('add_app', true)) { add_app(); } else if (post_str('submit', true)) { do_updates(); } show_form(false); admin_page_tail(); ?>