function main() { require_existence_of($_POST, array('master' => '/[A-Za-z0-9\\.]+/', 'builder_name' => '/^[A-Za-z0-9 \\(\\)\\-_]+$/', 'build_number' => '/^[0-9]+?$/', 'build_slave' => '/^[A-Za-z0-9\\-_]+$/', 'revisions' => '/^.+?$/', 'start_time' => '/^[0-9]+(\\.[0-9]+)?$/', 'end_time' => '/^[0-9]+(\\.[0-9]+)?$/')); $master = $_POST['master']; $builder_name = $_POST['builder_name']; $build_number = intval($_POST['build_number']); $start_time = float_to_time($_POST['start_time']); $end_time = float_to_time($_POST['end_time']); $revisions = json_decode(str_replace('\\', '', $_POST['revisions']), TRUE); foreach ($revisions as $repository_name => $revision_data) { require_format('repository_name', $repository_name, '/^\\w+$/'); require_existence_of($revision_data, array('revision' => '/^[a-z0-9]+$/', 'timestamp' => '/^[a-z0-9\\-\\.:TZ]+$/'), 'revision'); } if (!array_key_exists('file', $_FILES) or !array_key_exists('tmp_name', $_FILES['file']) or count($_FILES['file']['tmp_name']) <= 0) { exit_with_error('ResultsJSONNotIncluded'); } $json_path = $_FILES['file']['tmp_name']; $db = connect(); store_results($db, $master, $builder_name, $build_number, $start_time, $end_time, $revisions, $json_path); echo_success(); }
function parse_data($arr) { if (array_key_exists("fid", $arr) && array_key_exists("uid", $arr)) { //uid关键字是否存在 $user_mn = new UserManager(); if ($user_mn->ModLogin($arr["uid"], $arr["fid"])) { $fds = $user_mn->GetUsersToLogout(); //if (is_array($fds)) //{ ////foreach ($fds as $i) ////{ ////echo $i->fid."\n"; ////} //} echo_success($fds); } else { echo $name . " " . $value . "\n"; echo_error(20003); } } else { echo_error(10002); //缺少主要关键字 } }
function exit_with_success($details = array()) { echo_success($details); exit(0); }
$schema->SetPrefix($db_table_prefix); // Build the SQL array $schema->ParseSchema('schema.xml'); // maybe display this if $gacl->debug is true? if ($gacl->_debug) { print "Here's the SQL to do the build:<br />\n<code>"; print $schema->getSQL('html'); print "</code>\n"; // exit; } // Execute the SQL on the database #ADODB's xmlschema is being lame, continue on error. $schema->ContinueOnError(TRUE); $result = $schema->ExecuteSchema(); if ($result != 2) { echo_failed('Failed creating tables. Please enable DEBUG mode (set it to TRUE in $gacl_options near top of admin/gacl_admin.inc.php) to see the error and try again. You will most likely need to delete any tables already created.'); } if ($failed <= 0) { echo_success(' Installation Successful!!! <div align="center"> <font color="red"><b>*IMPORTANT*</b></font><br/> <p>Please make sure you create the <b><phpGACL root>/admin/templates_c</b> directory, and give it <b>write permissions</b> for the user your web server runs as.</p> <p>Please read the manual, and example.php to familiarize yourself with phpGACL.</p> <a href="admin/about.php?first_run=1"><b>Let\'s get started!</b></a> </div> '); } else { echo_failed('Please fix the above errors and try again.'); }
echo_normal("Sorry, <b>setup.php</b> currently does not fully support \"<b>{$db_type}</b>\" databases.\n\t\t\t\t\t<br>I'm assuming you've already created the database \"{$db_name}\", attempting to create tables.\n\t\t\t\t\t<br> Please email <b>{$author_email}</b> code to detect if a database is created or not so full support for \"<b>{$db_type}</b>\" can be added."); } /* * Attempt to create tables */ // Create the schema object and build the query array. $schema = new adoSchema($db); $schema->SetPrefix($db_table_prefix, FALSE); //set $underscore == FALSE // Build the SQL array $schema->ParseSchema(dirname(__FILE__) . '/schema.xml'); // maybe display this if $gacl->debug is true? if ($gacl->_debug) { print "Here's the SQL to do the build:<br />\n<code>"; print $schema->getSQL('html'); print "</code>\n"; // exit; } // Execute the SQL on the database #ADODB's xmlschema is being lame, continue on error. $schema->ContinueOnError(TRUE); $result = $schema->ExecuteSchema(); if ($result != 2) { echo_failed('Failed creating tables. Please enable DEBUG mode (set it to TRUE in $gacl_options near top of admin/gacl_admin.inc.php) to see the error and try again. You will most likely need to delete any tables already created.'); } if ($failed <= 0) { echo_success(' First Step of Access Control Installation Successful!!!<br>'); } else { echo_failed('Please fix the above errors and try again.<br><br>'); }
} $start_time = float_to_time($_POST['start_time']); $end_time = float_to_time($_POST['end_time']); $builder_id = add_builder($db, $master, $builder_name); if (!$builder_id) { exit_with_error('FailedToInsertBuilder', array('master' => $master, 'builderName' => $builder_name)); } $build_id = add_build($db, $builder_id, $build_number); if (!$build_id) { exit_with_error('FailedToInsertBuild', array('builderId' => $builder_id, 'buildNumber' => $build_number)); } foreach ($revisions as $repository_name => $revision_data) { $repository_id = $db->select_or_insert_row('repositories', NULL, array('name' => $repository_name)); if (!$repository_id) { exit_with_error('FailedToInsertRepository', array('name' => $repository_name)); } $revision_data = array('repository' => $repository_id, 'build' => $build_id, 'value' => $revision_data['revision'], 'time' => array_get($revision_data, 'timestamp')); $db->select_or_insert_row('build_revisions', NULL, array('repository' => $repository_id, 'build' => $build_id), $revision_data, 'value') or exit_with_error('FailedToInsertRevision', array('name' => $repository_name, 'data' => $revision_data)); } $slave_id = add_slave($db, $_POST['build_slave']); if (!store_test_results($db, $test_results, $build_id, $start_time, $end_time, $slave_id)) { exit_with_error('FailedToStoreResults', array('buildId' => $build_id)); } echo_success(); @ob_end_flush(); flush(); if (function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); } $generator = new ResultsJSONGenerator($db, $builder_id); $generator->generate();