function cadmin() { global $phpc_cal; if (!$phpc_cal->can_admin()) { permission_error(__('You must be logged in as an admin.')); } $index = tag('ul', tag('li', tag('a', attrs('href="#phpc-config"'), __('Calendar Configuration'))), tag('li', tag('a', attrs('href="#phpc-users"'), __('Users'))), tag('li', tag('a', attrs('href="#phpc-categories"'), __('Categories'))), tag('li', tag('a', attrs('href="#phpc-groups"'), __('Groups'))), tag('li', tag('a', attrs('href="#phpc-fields"'), __('Fields')))); return tag('div', attrs('class="phpc-tabs"'), $index, config_form(), user_list(), category_list(), group_list(), field_list()); }
header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); if(!CategoriesCheckRightsRead()){ echo FATAL_ERROR_SHOW_128("{ERROR_NO_PRIVS}<hr>".@implode("<br>", $GLOBALS["CategoriesCheckRights"])); exit; } if(isset($_GET["move-js"])){move_js();exit;} if(isset($_GET["test-cat"])){test_category();exit;} if(isset($_GET["js-popup-master"])){js_popup_master();exit;} if(isset($_GET["subtitles-categories"])){subtitle_categories();exit;} if(isset($_GET["tabs"])){tabs();exit;} if(isset($_GET["popup"])){popup();exit;} if(isset($_GET["field-list"])){field_list();exit;} if(isset($_GET["query"])){query();exit;} if(isset($_POST["DeleteCategorizedWebsite"])){DeleteCategorizedWebsite();exit;} if(isset($_POST["ReallyDeleteCategorizedWebsite"])){DeleteCategorizedWebsiteReally();exit;} if(isset($_GET["move-category-popup"])){MoveCategory_popup();exit;} if(isset($_POST["MoveCategorizedWebsite"])){MoveCategorizedWebsite();exit;} if(isset($_POST["MoveCategorizedWebsitePattern"])){MoveCategorizedWebsiteAll();exit;} if(isset($_GET["RemoveDisabled-popup"])){removedisabled_popup();exit;} if(isset($_POST["RemoveDisabled"])){removedisabled_perform();exit;} if(isset($_POST["WEBTESTS"])){test_category_perform();exit;} if(isset($_POST["move-domain"])){move_domain();exit;} js(); function js(){ header("content-type: application/x-javascript"); $page=CurrentPageName();
function do_insert( $db_conn, $header_insert_stmt, $detail_insert_stmt ) // Perform the inserts contained in $header_insert_stmt and // $detail_insert_stmt. That will move data into temporary // tables (because the INSERTs are formatted that way by // the caller). // After the data is in the temp tables, try to insert the temp_header // table into the production header table. If successful, not the // new Seq assigned, and update the temp_detail table to reference // that value in each record's Contract field. // Then, attempt to insert the temp_detail records into the // production detail table. { GLOBAL $msg_log; if (I_DEBUG) {message_log_append( $msg_log, " begin do_insert" );} $success = TRUE; // Delete all temp_header and temp_detail records if ($success) { $qry = "DELETE FROM temp_header"; //pre_echo( $qry ); $success = mysql_query( $qry, $db_conn ); // true if success if (!$success) { message_log_append( $msg_log, "do_insert: delete from temp_header failed: " . mysql_error( $db_conn ), MSG_LOG_ERROR ); } } // if success if ($success) { $qry = "DELETE FROM temp_detail"; //pre_echo( $qry ); $success = mysql_query( $qry, $db_conn ); // true if success if (!$success) { message_log_append( $msg_log, "do_insert: delete from temp_detail failed: " . mysql_error( $db_conn ), MSG_LOG_ERROR ); } } // if success // Attempt the temp header insert if ($success) { $qry = $header_insert_stmt; //pre_echo( $qry ); $success = mysql_query( $qry, $db_conn ); // true if success if (!$success) { message_log_append( $msg_log, "do_insert: temp header insert failed: " . mysql_error( $db_conn ), MSG_LOG_ERROR ); } } // if success // Attempt the temp detail insert if ($success) { $qry = $detail_insert_stmt; //pre_echo( $qry ); $success = mysql_query( $qry, $db_conn ); // true if success if (!$success) { message_log_append( $msg_log, "temp detail insert failed: " . mysql_error( $db_conn ), MSG_LOG_ERROR ); } } // if success // Attempt to insert temp_header into contract_header if ($success) { // Set $fld_list to the list of fields in table temp_header $fld_list = field_list( "temp_header", $db_conn ); $success = (!is_null( $fld_list )); if (!$success) { message_log_append( $msg_log, "field_list of temp_header failed", MSG_LOG_ERROR ); } } // if success if ($success) { $success = !is_null( $old_seq = last_insert_id( $db_conn ) ); if (!$success) { message_log_append( $msg_log, "do_insert: last_insert_id failed(1)", MSG_LOG_ERROR ); } } // if success if ($success) { //if (I_DEBUG) message_log_append( $msg_log, "do_insert: old_seq = $old_seq" ); $qry = "INSERT INTO contract_header ( $fld_list ) " . "SELECT * FROM temp_header"; //pre_echo( $qry ); $success = mysql_query( $qry, $db_conn ); // true if success if (!$success) { message_log_append( $msg_log, "contract header insert failed: " . mysql_error( $db_conn ), MSG_LOG_ERROR ); } } // if success if ($success) { $new_seq = last_insert_id( $db_conn ); $success = (!is_null( $new_seq ) && ($new_seq <> $old_seq)); if ($success) { $seq = $new_seq; } else { message_log_append( $msg_log, "temp detail insert failed: " . mysql_error( $db_conn ), MSG_LOG_ERROR ); } } // if success // Attempt to update the temp_detail records with the new $seq number if ($success) { if (I_DEBUG) { message_log_append( $msg_log, "do_insert: new contract_header seq = $seq" ); } $qry = "UPDATE temp_detail SET Contract = $seq"; //pre_echo( $qry ); $success = mysql_query( $qry, $db_conn ); if (!$success) { message_log_append( $msg_log, mysql_error( $db_conn ), MSG_LOG_ERROR ); } } // if success if ($success) { // Set $fld_list to the list of fields in table temp_detail $fld_list = field_list( "temp_detail", $db_conn ); $success = ($fld_list != NULL); if (!$success) { message_log_append( $msg_log, "field_list of temp_detail failed", MSG_LOG_ERROR ); } } // if success if ($success) { // Set $seqn to the value of LAST_INSERT_ID() $old_seq = last_insert_id( $db_conn ); //if (I_DEBUG) message_log_append( $msg_log, "detail: old_seq = $old_seq" ); $success = (!is_null( $old_seq )); if (!$success) { message_log_append( $msg_log, "do_insert: last_insert_id failed(2)", MSG_LOG_ERROR ); } } // if success if ($success) { // insert into contract_detail from temp_detail $qry = "INSERT INTO contract_detail ( $fld_list ) " . "SELECT * FROM temp_detail"; if (I_DEBUG) { message_log_append( $msg_log, "detail: $qry" ); } //pre_echo( $qry ); $success = mysql_query( $qry, $db_conn ); if (!$success) { message_log_append( $msg_log, mysql_error( $db_conn ), MSG_LOG_ERROR ); } } // if success if ($success) { // check to see if LAST_INSERT_ID() changed $new_seq = last_insert_id( $db_conn ); $success = (($new_seq <> $old_seq) && !is_null( $new_seq )); if ($success) { if (I_DEBUG) { message_log_append( $msg_log, "do_insert: success" ); } } else { message_log_append( $msg_log, "contract_detail insert failed", MSG_LOG_ERROR ); } } // if success return( $success ); } // do_insert
exit; } if (isset($_GET["add-uris-popup"])) { add_uris_popup(); exit; } if (isset($_GET["tabs"])) { tabs(); exit; } if (isset($_GET["popup"])) { popup(); exit; } if (isset($_GET["field-list"])) { field_list(); exit; } if (isset($_GET["query"])) { query(); exit; } if (isset($_POST["items"])) { SaveItems(); exit; } if (isset($_POST["DeleteCategorizedURI"])) { DeleteCategorizedURI(); exit; } if (isset($_GET["move-category-popup"])) {
function field_edit_form_submit($data) { //$ff = new FieldTemplates(); $ff = new DbField(); $ff->byID($data['id']); foreach ($data as $key => $value) { if ($key != 'fn' && $key != 'fieldset_name') { $ff->{$key} = mysql_real_escape_string($value); $submit[$key] = mysql_real_escape_string($value); } } //Getting form name $form = new DbForm(); $form->byID($data['form_reference']); $submit['form_reference'] = $form->form_name; $submit['form_template_id'] = $data['form_reference']; $field = new DbField(); $response = $field->update($submit); if ($response['code'] == 200) { return field_list($data['id']); } }
$db_pwd = "mysql"; $db_name = "james"; $db_host = "127.0.0.1"; $db_user = "******"; $db_pwd = "EetGiOj6"; $db_name = "test_msm"; $tab = CHR( 9 ); $newline = CHR( 10 ); if ($db_conn = @mysql_connect( $db_host, $db_user, $db_pwd )) mysql_select_db( $db_name, $db_conn ); else die("mysql_connect\n"); $fld_list = field_list( "contract_header", $db_conn ); $fld_array = explode( ",", $fld_list ); // rebuild $fld_list with some modifications to re-format dates $fld_list = ""; $j = 0; while (!is_null( $fld = $fld_array[ $j++ ] )) { switch (TRUE) { case ($fld == 'StartDate'): case ($fld == 'EndDate'): $fld = "date_format( $fld, \"%Y-%m-%d\" ) as $fld"; } // switch $fld_list .= "," . $fld; } // while $fld_list = substr( $fld_list, 1 ); // remove leading comma
* Field management */ /* * Field management */ case "field_list": print field_list(); break; case 'field_list_pager': print field_list(NULL, $_GET['search'], $_GET['sort'], $_GET['page']); break; case 'field_list_sort': print field_list(NULL, $_GET['search'], $_GET['sort'], 1); break; case 'field_list_search': print field_list(NULL, $_GET['search']); break; case 'field_create_form': print field_create_form(); break; case 'field_create_form_submit': print field_create_form_submit($_GET); break; case 'field_edit_form': print field_edit_form($_GET); break; case 'field_edit_form_submit': print field_edit_form_submit($_GET); break; case 'field_delete_form': print field_delete_form($_GET);
$db_user = "******"; $db_pwd = "mysql"; $db_name = "james"; $db_host = "127.0.0.1"; $db_user = "******"; $db_pwd = "EetGiOj6"; $db_name = "test_msm"; $tab = CHR( 9 ); $newline = CHR( 10 ); if (($db_conn = @mysql_connect( $db_host, $db_user, $db_pwd )) && mysql_select_db( $db_name, $db_conn )) ; else die("mysql_connect\n"); $fld_list = field_list( "contract_detail", $db_conn ); $fld_array = explode( ",", $fld_list ); // rebuild $fld_list with some modifications to re-format dates var_dump( $fld_array ); $fld_list = ""; $j = 0; while (!is_null( $fld = $fld_array[ $j++ ] )) { switch (TRUE) { case ($fld == 'StartDate'): case ($fld == 'EndDate'): $fld = "date_format( $fld, \"%Y-%m-%d\" ) as $fld"; } // switch $fld_list .= "," . $fld;