public function results() { if (!$this->isAdmin) { $this->login(); } $this->check(); $this->title("Manage " . $this->application); $this->CSS("results", "cpanel"); $this->CSS("pagination"); $this->js("checkbox"); $trash = segment(3, isLang()) === "trash" ? TRUE : FALSE; $total = $this->CPanel_Model->total($trash); $thead = $this->CPanel_Model->thead("checkbox, " . getFields($this->application) . ", Action", FALSE); $pagination = $this->CPanel_Model->getPagination($trash); $tFoot = getTFoot($trash); $this->vars["message"] = !$tFoot ? "Error" : NULL; $this->vars["pagination"] = $pagination; $this->vars["trash"] = $trash; $this->vars["search"] = getSearch(); $this->vars["table"] = getTable(__(_("Manage " . ucfirst($this->application))), $thead, $tFoot, $total); $this->vars["view"] = $this->view("results", TRUE, "cpanel"); $this->render("content", $this->vars); }
function thumbnailForm_submit($form, $form_state) { $params = drupal_get_query_parameters(); // getting the inputted info from the fields $fields = array("FID"); $picData = getFields($fields, $form_state['values']); $picData = stripTags($picData, ''); $oldFID = isset($form_state['oldFID']) ? $form_state['oldFID'] : 0; if (isset($params["UID"])) { // if updating user's profile picture $UID = $params["UID"]; replacePicture($picData['FID'], $oldFID, 'Users'); dbUpdate("profiles", $picData, "UID", $UID); drupal_goto("viewUser", array('query' => array('UID' => $UID))); } else { if (isset($params["OID"])) { // if editing outreach thumbnail $OID = $params["OID"]; replacePicture($picData['FID'], $oldFID, 'Outreach'); dbUpdateOutreach($OID, $picData); drupal_goto("viewOutreach", array('query' => array('OID' => $OID))); } else { if (isset($params["TID"])) { // if editing team thumbnail $TID = $params["TID"]; replacePicture($picData['FID'], $oldFID, 'Teams'); dbUpdateTeam($TID, $picData); drupal_goto("viewTeam", array('query' => array('TID' => $TID))); } else { drupal_goto("myDashboard"); } } } }
function notificationForm_submit($form, $form_state) { global $user; $params = drupal_get_query_parameters(); $OID = $params['OID']; // generate the notification $notification = getFields(array('dateTargeted', 'message'), $form_state['values']); $notification = stripTags($notification); // allow some tags $notification['dateTargeted'] = dbDatePHP2SQL(strtotime($notification['dateTargeted'])); $notification['bttnTitle'] = 'View Outreach'; $notification['bttnLink'] = '?q=viewOutreach&OID=' . $OID; $notification['OID'] = $OID; $notification['TID'] = dbGetTeamForOutreach($OID); $notification['dateCreated'] = dbDatePHP2SQL(time()); foreach ($form_state['values']['UID'] as $UID) { if ($UID != null) { $notification['UID'] = $UID; $result = dbAddNotification($notification); } } if ($result) { drupal_set_message('Notification added!'); drupal_goto('manageNotifications', array('query' => array('OID' => $OID))); } else { drupal_set_message('There was an error.', 'error'); } }
function usersSearch_submit($form, $form_state) { $names = array('nameContains'); $row = getFields($names, $form_state['values']); $row = stripTags($row, ''); drupal_goto('showUsersForTeam', array('query' => array('query' => $row['nameContains']))); return; }
function outreachPageHeader_submit($form, &$form_state) { $fields = array('team'); $newTID = getFields($fields, $form_state['values'])['team']; setCurrentTeam($newTID); $teamNumber = dbGetTeamNumber($newTID); drupal_set_message("Now operating under Team {$teamNumber}!"); drupal_goto('outreach'); }
function createData() { $sections = array(); A::$DB->query("SELECT * FROM " . DOMAIN . "_sections WHERE module='shoplite' OR module='catalog' ORDER BY sort"); while ($row = A::$DB->fetchRow()) { $_section = DOMAIN . "_" . $row['lang'] . "_" . $row['name']; if (getFields($_section)) { $sections[$_section] = $row['caption']; } } A::$DB->free(); $this->Assign("sections", $sections); if (!empty($_GET['section'])) { $_section = preg_replace("/[^a-zA-Z0-9_-]/i", "", $_GET['section']); if (isset($sections[$_section])) { $section = $_section; setcookie(STRUCTURE, $_GET['section'], time() + 31104000); } } if (empty($section)) { $section = preg_replace("/[^a-zA-Z0-9_-]/i", "", A_Session::get(STRUCTURE, isset($_COOKIE[STRUCTURE]) ? $_COOKIE[STRUCTURE] : key($sections))); } A_Session::set(STRUCTURE, $section); $this->Assign("section", $section); if (empty($section)) { return; } $categories = A::$DB->getAll("SELECT id,idker,name FROM {$section}_categories ORDER BY level,sort"); $this->Assign("categories", $categories); $idcat = !empty($_GET['idcat']) ? (int) $_GET['idcat'] : 0; $_cfields = getTextOption(STRUCTURE, 'cfields'); $_cfields = !empty($_cfields) ? unserialize($_cfields) : array(); if (!isset($_cfields[$section])) { $_cfields[$section] = $_cfields; } $_cfields = !empty($_cfields[$section][$idcat]) ? $_cfields[$section][$idcat] : array(); $cfields = cfields_getfields($idcat, $section); foreach ($cfields as $field => $value) { if (in_array($field, $_cfields)) { unset($cfields[$field]); } } $fields = array(); A::$DB->query("SELECT * FROM " . DOMAIN . "_fields WHERE item='{$section}' ORDER BY sort"); while ($row = A::$DB->fetchRow()) { $row['disabled'] = isset($cfields[$row['field']]); $row['checked'] = in_array($row['field'], $_cfields) || $row['disabled']; $row['caption'] = $row['name_' . LANG]; $fields[] = $row; } A::$DB->free(); $this->Assign("fields", $fields); }
/** * Enter description here... * * @param unknown_type $ret * @return */ function generateDomainObjects($ret){ for($i=0;$i<count($ret);$i++){ if(!doesTableContainPK($ret[$i])){ continue; } $tableName = $ret[$i][0]; $clazzName = getClazzName($tableName); if($clazzName[strlen($clazzName)-1]=='s'){ $clazzName = substr($clazzName, 0, strlen($clazzName)-1); } $template = new Template('templates/Domain.tpl'); $template->set('domain_class_name', $clazzName); $template->set('table_name', $tableName); $tab = getFields($tableName); $fields = ""; $initFields = ""; $getsetMethods = "\n"; $toStrFields = "return ''"; for($j=0;$j<count($tab);$j++) { $fieldName = getVarNameWithS($tab[$j][0]); $fields .= "\tprivate $".$fieldName.";\n"; $initFields .= "\t\tif (isset(\$fields['".$fieldName."'])) \$this->".$fieldName." = \$fields['".$fieldName."'];\n"; $camelFieldName = $fieldName; $camelFieldName[0] = strtoupper($fieldName[0]); $getsetMethods .= "\tpublic function get$camelFieldName() {\n\t\treturn \$this->$fieldName;\n\t}\n"; $getsetMethods .= "\tpublic function set$camelFieldName($".$fieldName.") {\n\t\t\$this->fields['$fieldName'] = $".$fieldName.";\n\t\t\$this->$fieldName = $".$fieldName.";\n\t}\n\n"; $toStrFields .= ".':'.\$this->".$fieldName; } $toStrFields .= ";"; $template->set('variables', $fields); $template->set('init_variables', $initFields); $template->set('getset_methods', $getsetMethods); $template->set('tostr_variables', $toStrFields); $template->set('date', date("Y-m-d H:i")); $template->write('generated/'.$clazzName.'.php'); } }
<?php // Author : Wisnu // Email : - // Start : 25 Maret 2009 session_start(); include_once "../dwo.lib.php"; include_once "../db.mysql.php"; include_once "../connectdb.php"; include_once "../parameter.php"; include_once "../cekparam.php"; include_once "../fpdf.php"; $pmbid = $_REQUEST['pmbid']; $pmb = getFields('pmb', "PMBID", $pmbid, '*'); $ProdiNama = getFields('prodi', "ProdiID", $pmb['ProdiID'], 'Nama'); $pdf = new FPDF('P', 'mm', 'A4'); $pdf->AddPage(); $identitas = GetFields('identitas', 'Kode', KodeID, '*'); $pdf->Image('../img/logo.jpg', 10, 10, 20); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(10, 6, '', 0, 0); $pdf->Cell(75, 6, 'KARTU TANDA MAHASISWA SEMENTARA', 0, 1, 'C'); $pdf->SetFont('Helvetica', 'B', 15); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(10, 15, '', 0, 0); $pdf->Cell(75, 6, $identitas['Nama'], 0, 1, 'C'); $pdf->Ln(5); $pdf->SetFont('Courier', 'B', 18); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(5, 10, '', 0, 0); $pdf->Cell(50, 10, $pmb['MhswID'], 0, 1);
function experimentHasTime($eid) { $fields = getFields($eid); if ($fields != NULL) { foreach ($fields as $f) { // If the type if 7 if ($f['type_id'] == 7) { return $f['type_name']; } } } return false; }
function teamSummary_submit($form, &$form_state) { $fields = array('team'); $newTID = getFields($fields, $form_state['values'])['team']; setCurrentTeam($newTID); $teamNumber = dbGetTeamNumber($newTID); drupal_set_message("Now operating under Team {$teamNumber}!"); drupal_goto('teamDashboard'); }
<?php // Author : Wisnu // Email : - // Start : 25 Maret 2009 session_start(); include_once "../dwo.lib.php"; include_once "../db.mysql.php"; include_once "../connectdb.php"; include_once "../parameter.php"; include_once "../cekparam.php"; include_once "../fpdf.php"; $pmbid = $_REQUEST['pmbid']; $pmb = getFields('pmb', "PMBID", $pmbid, '*'); $pdf = new FPDF('P', 'mm', 'A4'); $pdf->AddPage(); $identitas = GetFields('identitas', 'Kode', KodeID, '*'); $pdf->Image('../img/logo.jpg', 10, 10, 20); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(20, 6, '', 0, 0); $pdf->Cell(75, 6, 'KARTU TANDA MAHASISWA SEMENTARA', 0, 1, 'C'); $pdf->SetFont('Helvetica', 'B', 15); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(20, 15, '', 0, 0); $pdf->Cell(75, 15, $identitas['Nama'], 0, 1, 'C'); $pdf->SetFont('Courier', 'B', 18); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(5, 10, '', 0, 0); $pdf->Cell(50, 10, $pmb['MhswID'], 0, 1); $pdf->SetFont('Arial', '', 6); $pdf->Cell(55, 4, 'NOMOR POKOK MAHASISWA', 0, 1);
function outreachForm_submit($form, $form_state) { global $user; $UID = $user->uid; $TID = $form_state['TID']; $outreachFields = array("name", "peopleImpacted", "address", "city", "state", "country", "status", "co_organization", "co_firstName", "co_lastName", "co_email", "co_phoneNumber", "isPublic"); $outreachData = getFields($outreachFields, $form_state['values']); $outreachData = stripTags($outreachData, ''); // remove all tags $outreachData['description'] = stripTags(array($form_state['values']['description'])); // allow some tags $outreachData["TID"] = $TID; if ($form_state['new']) { $outreachData["UID"] = $UID; } if (isset($form_state['OID'])) { $OID = $form_state['OID']; $oldOutreachData = dbGetOutreach($OID); if ($outreachData["status"] == "doingWriteUp" && $oldOutreachData["isWriteUpApproved"] == true) { $outreachData["writeUpUID"] = null; $outreachData["isWriteUpSubmitted"] = 0; $outreachData["isWriteUpApproved"] = 0; } } if (!$form_state['new']) { // updating existing event $OID = $form_state['OID']; $result = dbUpdateOutreach($OID, $outreachData); if ($result) { // if db call was successful for ($i = 0; $i < $form_state['numRows']; $i++) { // loop through date rows $TOID = isset($form_state['fields']['dates']["TOID-{$i}"]) ? $form_state['fields']['dates']["TOID-{$i}"] : 0; $timeData['startTime'] = dbDatePHP2SQL(strtotime($form_state['values']["startTime-{$i}"])); dpm($timeData['startTime']); $timeData['endTime'] = dbDatePHP2SQL(strtotime($form_state['values']["endTime-{$i}"])); if ($timeData['startTime'] != null && $timeData['endTime'] != null) { // if row isn't empty if ($TOID != 0) { // update existing record dbUpdateTimesForOutreach($TOID, $timeData); } else { // add a new time record if there wasn't one previously $timeData['OID'] = $OID; dbAddTimesToOutreach($timeData); } } else { // remove time record if empty dbRemoveTimeFromOutreach($TOID); } } for ($i = $form_state['numRows']; $i < $form_state['initialNumTimes']; $i++) { // executes if times were deleted dbRemoveTimeFromOutreach($form_state['fields']['dates']["TOID-{$i}"]); } $notification = array(); $userName = dbGetUserName($user->uid); $outName = dbGetOutreachName($OID); $notification['dateCreated'] = dbDatePHP2SQL(time()); $notification['dateTargeted'] = dbDatePHP2SQL(time()); $notification['message'] = "{$userName} has updated outreach {$outName}."; $notification['bttnTitle'] = 'View'; $notification['bttnLink'] = '?q=viewOutreach&OID=' . $OID; $notification['TID'] = $TID; notifyUsersByRole($notification, 'moderator'); // handle tags if (!empty($form_state['values']['tags'])) { $newTags = $form_state['values']['tags']; $previous = dbGetTagsForOutreach($OID, true); // the "true" means this will return only OTID's if ($previous == false) { // if there aren't any tags $previous = array(); } $deleted = array_diff($previous, $newTags); $added = array_diff($newTags, $previous); foreach ($deleted as $delete) { // $delete is the OTID to be removed from the outreach if (!empty($delete)) { dbRemoveTagFromOutreach($delete, $OID); } } foreach ($added as $add) { // $add is the OTID to be added to the outreach if (!empty($add)) { dbAddTagToOutreach($add, $OID); } } } drupal_set_message("Outreach updated!"); } else { drupal_set_message("Outreach not updated."); } } else { // adding new event $outreachData['logDate'] = dbDatePHP2SQL(time()); $OID = dbCreateOutreach($outreachData); if ($OID != false) { dbAddUserAsOwnerOfOutreach($UID, $OID); dbAssignUserToOutreach($UID, $OID, 'owner'); // handle times if ($outreachData['status'] != 'isIdea') { for ($i = 0; $i < $form_state['numRows']; $i++) { $time = array("startTime-{$i}", "endTime-{$i}"); $timeData = getFields($time, $form_state['values']); if ($timeData["startTime-{$i}"] != null && $timeData["endTime-{$i}"] != null) { // rename array keys to match columns $timeData['startTime'] = dbDatePHP2SQL(strtotime($timeData["startTime-{$i}"])); $timeData['endTime'] = dbDatePHP2SQL(strtotime($timeData["endTime-{$i}"])); unset($timeData["endTime-{$i}"], $timeData["startTime-{$i}"]); $timeData['OID'] = $OID; dbAddTimesToOutreach($timeData); } } } // handle tags if (!empty($form_state['values']['tags'])) { foreach ($form_state['values']['tags'] as $OTID) { dbAddTagToOutreach($OTID, $OID); } } // create notification $notification = array(); $userName = dbGetUserName($user->uid); $outName = dbGetOutreachName($OID); $notification['dateCreated'] = dbDatePHP2SQL(time()); $notification['dateTargeted'] = dbDatePHP2SQL(time()); $notification['message'] = "{$userName} has created outreach {$outName}."; $notification['bttnTitle'] = 'View'; $notification['bttnLink'] = '?q=viewOutreach&OID=' . $OID; $notification['TID'] = $TID; notifyUsersByRole($notification, 'moderator'); drupal_set_message("Outreach created!"); } else { // if the $OID IS false form_set_error("Outreach not created successfully"); } } if (dbIsOutreachOver($OID)) { drupal_set_message("It appears you are logging an old event. Don't forget to <a href=\"?q=logHours&OID={$OID}\"><b>log old hours</b></a>!"); } drupal_goto('viewOutreach', array('query' => array('OID' => $OID))); }
// Get experiment Id for each session foreach ($sessionIds as $sid) { $eid = getSessionExperimentId($sid); $data[] = array('experimentId' => $aid != -1 ? $aid : $eid, 'sessionId' => $sid, 'fields' => getFields($eid), 'meta' => array(getSession($sid)), 'data' => getData($eid, $sid)); } } else { $eid = getSessionExperimentId($sessionIds[0]); $data['id'] = $eid; $data['meta'] = getExperiment($eid); $data['sessions'] = array(); foreach ($sessionIds as $sid) { $x = array(); $x['id'] = $sid; $x['meta'] = array(getSession($sid)); $x['data'] = getData($eid, $sid); $x['fields'] = getFields($eid); $x['visibility'] = true; $data['sessions'][] = $x; } } } else { if (isset($_GET['vsessions'])) { } } for ($i = 0; $i < count($data[0]['fields']); $i++) { if ($data[0]['fields'][$i]['type_id'] == 7) { $tf = $i; } } if (isset($tf)) { if (is_numeric($data[0]['data'][0][$tf])) {
$state = (int) safeString($_REQUEST['state']); } else { $state = IDENTIFY; } if (isset($_POST['timefix'])) { $timefix = $_POST['timefix']; } if (isset($_POST['columnfix'])) { $columnfix = $_POST['columnfix']; } if (isset($_REQUEST['id'])) { $eid = isset($_POST['id']) ? $_POST['id'] : $_GET['id']; if ($meta = getExperiment($eid)) { $ownerid = $meta['owner_id']; $title = ucwords($meta['name']) . " - Add New Session"; $fields = getFields($eid); } //$fields = array_slice($fields, 1); $smarty->assign('meta', $meta); $smarty->assign('title', $title); $smarty->assign('fields', $fields); $smarty->assign('field_count', count($fields)); } else { array_push($errors, 'Could not find your experiment.'); } // Check to see if we have started the form process yet if (isset($_POST['session_create']) && count($errors) == 0) { $type = isset($_POST['session_type']) ? safeString($_POST['session_type']) : "file"; $smarty->assign('session_type', $type); // Check to ensure we get all the experiment meta $post_data = array('session_name' => "", 'session_description' => "", 'session_street' => "", 'session_citystate' => "", 'session_type' => "");
function hoursForm_submit($form, $form_state) { global $user; // getting value of new from form state $new = isset($form_state['new']) ? $form_state['new'] : true; $OID = $form_state['OID']; // looping through the rows of hours for ($i = 0; $i < $form_state['numRows']; $i++) { $fields = array("numberOfHours-{$i}", "description-{$i}", "type-{$i}"); $row = getFields($fields, $form_state['values']); // dont allow any html tags $row = stripTags($row, ''); // setting the values which were read in into the row which will go into the database $row['numberOfHours'] = $row["numberOfHours-{$i}"]; $row['description'] = $row["description-{$i}"]; $row['isApproved'] = 0; $row['type'] = $row["type-{$i}"]; unset($row["type-{$i}"], $row["numberOfHours-{$i}"], $row["description-{$i}"]); if (isset($form_state['values']['fields']['UID'])) { $UID = $form_state['values']['fields']['UID']; } else { $UID = $user->uid; } if ($UID != 0) { $row['UID'] = $UID; } $row['OID'] = $OID; // if adding new hours if ($new) { if (dbLogHours($row) == false) { drupal_set_message("Error", 'error'); break; } } else { // editing old hours $row['isApproved'] = 0; if (dbUpdateHours($row, $form_state['HID']) == false) { drupal_set_message("Error", 'error'); break; } } } // end of for loop drupal_set_message("Your hours have been logged!"); // assigning user to outreach if not new if (!$new) { dbAssignUserToOutreach($UID, $OID, $row['type']); drupal_goto("viewOutreach", array('query' => array("OID" => $OID))); } else { // notifying appropriate users of changes/addition of hours $outreachName = dbGetOutreachName($OID); $personName = dbGetUserName($user->uid); $notification['message'] = "{$personName} has logged hours for {$outreachName}!"; $notification['TID'] = dbGetTeamForOutreach($OID); $notification['dateTargeted'] = dbDatePHP2SQL(time()); $notification['dateCreated'] = dbDatePHP2SQL(time()); notifyUsersByRole($notification, 'moderator'); notifyOwnerOfOutreach($OID, $notification); if ($OID != 0) { drupal_goto("viewHours", array('query' => array("OID" => $OID))); } else { drupal_goto("viewHours", array('query' => array("UID" => $UID))); } } }
function cfields_ShowBlock($block, $data) { if ($block == 'shoplite_filters') { $section = MODULE == 'shoplite' ? SECTION : getSectionByModule('shoplite'); $idcat = MODULE == 'shoplite' ? A::$MAINFRAME->idcat : 0; $fields = getFields($section); $_fields = cfields_getfields($idcat, $section); $filters = $data['object']->get_template_vars('filters'); foreach ($filters as $i => $filter) { if (isset($fields[$filter['field']]) && !isset($_fields[$filter['field']])) { unset($filters[$i]); } } $data['object']->Assign("filters", array_values($filters)); } }
function profileForm_submit($form, $form_state) { global $user; $params = drupal_get_query_parameters(); if (!isset($params['UID'])) { $UID = $user->uid; } else { $UID = $params['UID']; } // getting the inputted info from the fields $fields = array("firstName", "lastName", "position", "phone", "grade", "gender", "FID", "type"); $profileData = getFields($fields, $form_state['values']); $profileData = stripTags($profileData, ''); $profileData['UID'] = $UID; $profileData['bio'] = stripTags(array($form_state['values']['bio'])); // allow some tags in the bio only if (dbUserHasProfile($profileData['UID']) == false) { // if the user doesn't have a profile $result = dbCreateProfile($profileData); // creating new profile if ($result != false) { drupal_set_message("Your profile has been created!"); // if it went through successfully } else { drupal_set_message("There was an error."); // if something "bad" occured during submission } } else { // if the user is simply editing existing profile dbUpdate("profiles", $profileData, "UID", $profileData['UID']); drupal_set_message("Profile has been updated!"); } if (!empty($form_state['values']['secondaryEmail'])) { // user entered value if (dbGetSecondaryEmailForUser($profileData['UID']) == false) { // the user is adding a new secondary email dbAddEmailsToUser($profileData['UID'], array(trim($form_state['values']['secondaryEmail']))); } else { // user is updating an old email dbUpdate('emailsVsUsers', array('email' => $form_state['values']['secondaryEmail']), "UID", $profileData['UID']); } } else { // user didn't enter value dbRemoveEntry('emailsVsUsers', 'UID', $profileData['UID']); } drupal_goto("viewUser", array('query' => array('UID' => $UID))); }
/** * Parses csv file * * @param string $filename FIle name including path. * @return array */ function parseFile($filename) { $fields = getFields(); $field_names = array_keys($fields); $result = []; $handle = @fopen($filename, "r"); if ($handle) { while (($row = fgetcsv($handle, 20000, ",")) !== false) { if (count($row) != 75) { continue; } $result[$row[59]] = processRow($row, $fields, $field_names); } if (!feof($handle)) { echo "Error: unexpected fgets() exception\n"; exit(1); } fclose($handle); } else { echo "Error: file '{$filename}' can not be opened.\n"; exit(1); } return $result; }
function xydac_tax() { if (isset($_GET['manage_fields_submit']) || isset($_POST['add_field_submit']) || isset($_GET['field']) || isset($_POST['doaction_submit'])) { $not_inserted = false; $t_name = $_GET['manage_fields_select']; $p_tname = ""; $p_fname = ""; $p_flabel = ""; $p_ftype = ""; $p_fdesc = ""; if (isset($_POST['doaction_submit']) && isset($_POST['taxonomy'])) { if (isset($_POST['action']) && $_POST['action'] == 'delete') { if (isset($_POST['delete_content_type'])) { foreach ($_POST['delete_content_type'] as $k => $v) { deleteField($v); $message = __('Item Deleted.'); } } } $t_name = $_POST['taxonomy']; } if (isset($_GET['field']) || isset($_POST['field_id'])) { $frow = isset($_GET['field']) ? getFieldrow(intval($_GET['field'])) : getFieldrow(intval($_POST['field_id'])); $t_name = $frow->tax_name; $p_tname = $frow->tax_name; $p_fname = $frow->field_name; $p_flabel = $frow->field_label; $p_ftype = $frow->field_type; $p_fdesc = $frow->field_desc; $p_fval = $frow->field_val; $not_inserted = true; } if (isset($_POST['edit_field_submit'])) { if (isset($_POST["field_name"]) && empty($_POST["field_name"])) { $xydac_error = new WP_Error('err', __("You need to give field name")); } elseif (isset($_POST['field_name']) && $_POST['field_name'] != $p_fname) { $xydac_error = new WP_Error('err', __("Changing Field Name is not allowed !!!")); } else { $p_fid = $_POST['field_id']; $p_tname = $_POST['tax_name']; $p_fname = sanitize_title_with_dashes($_POST['field_name']); $p_flabel = !empty($_POST['field_label']) ? $_POST['field_label'] : $_POST['field_name']; $p_ftype = $_POST['field_type']; $p_fdesc = $_POST['field_desc']; $p_fval = $_POST['field_val']; if ($p_tname != '' && $p_fname != '' && $p_flabel != '' && $p_ftype != '') { //if(updateField($p_fid,$p_tname,$p_fname,$p_flabel,$p_ftype,$p_fdesc,$p_fval)!=1) $not_inserted=true;else {$message = __('Item Updated.');$not_inserted = false;} updateField($p_fid, $p_tname, $p_fname, $p_flabel, $p_ftype, $p_fdesc, $p_fval); $message = __('Item Updated.'); $not_inserted = false; } else { $not_inserted = true; } } } if (isset($_POST['add_field_submit'])) { if (isset($_POST["field_name"]) && empty($_POST["field_name"])) { $xydac_error = new WP_Error('err', __("You need to give field name")); } elseif (!xydac_field_avail(sanitize_title_with_dashes($_POST['field_name']))) { $xydac_error = new WP_Error('err', __("Field name not available")); } else { $t_name = $_POST['tax_name']; //@TODO: check empty post $p_tname = $_POST['tax_name']; $p_fname = sanitize_title_with_dashes($_POST['field_name']); $p_flabel = !empty($_POST['field_label']) ? $_POST['field_label'] : $_POST['field_name']; $p_ftype = $_POST['field_type']; $p_fdesc = $_POST['field_desc']; $p_fval = $_POST['field_val']; if ($p_tname != '' && $p_fname != '' && $p_flabel != '' && $p_ftype != '') { $check = insertField($p_tname, $p_fname, $p_flabel, $p_ftype, $p_fdesc, $p_fval); if ($check == '') { $not_inserted = true; } else { $message = __('Item Added.'); $not_inserted = false; } } else { $not_inserted = true; } } } $rows = getFields($t_name); ?> <div class="wrap" id="page_content"> <?php xydac_heading("fields"); ?> <?php if (isset($xydac_error) && is_wp_error($xydac_error)) { ?> <div id="message" class="error below-h2"><p><?php echo $xydac_error->get_error_message(); ?> </p></div> <?php } ?> <?php if (isset($message)) { ?> <div id="message" class="updated below-h2"><p><?php echo $message; ?> </p></div> <?php } ?> <br class="clear" /> <div id="col-container"> <div id="col-right"> <p>Taxonomy Name <span style="color:red;"><strong><?php _e($t_name, 'xydac'); ?> </strong></span> <a href="<?php echo XYDAC_FIELDS_PATH; ?> ">[Select Another Taxonomy]</a></p> <div class="form-wrap"> <form id="form_field_edit" action="<?php _e(XYDAC_FIELDS_PATH, 'xydac'); ?> " method="post" > <input type="hidden" name="page" value="ultimate-taxonomy-manager"/> <input type="hidden" name="sub" value="custom-taxonomy-fields"/> <input type="hidden" name="taxonomy" value="<?php _e($t_name, 'xydac'); ?> "/> <div class="tablenav"> <select name="action"> <option value=""><?php _e('Bulk Actions', 'xydac'); ?> </option> <option value="delete"><?php _e('Delete', 'xydac'); ?> </option> </select> <input type="submit" class="button-secondary action" id="doaction_submit" name="doaction_submit" value="Apply"/> </div><br class="clear"> <table class="widefat tag fixed" cellspacing="0"> <thead class="content-types-list"> <tr> <th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th> <th style="" class="manage-column column-name" id="name" scope="col"><?php _e('Name', 'xydac'); ?> </th> <th style="" class="manage-column column-fields" id="fields" scope="col"><?php _e('Label', 'xydac'); ?> </th> <th style="" class="manage-column column-categories" id="categories" scope="col"><?php _e('Type', 'xydac'); ?> </th> </tr> </thead> <tbody id="the-list"> <?php //field_id,field_name,field_label,field_type foreach ($rows as $row) { ?> <tr id="content-type-<?php _e($row->field_id, 'xydac'); ?> " class=""> <th class="check-column" scope="row"> <input type="checkbox" value="<?php _e($row->field_id, 'xydac'); ?> " name="delete_content_type[]"/> </th> <td class="name column-name"> <strong> <a class="row-title" title="Edit “<?php _e($row->field_name, 'xydac'); ?> ”" href="<?php echo XYDAC_FIELDS_PATH; ?> &manage_fields_select=<?php echo $t_name; ?> &field=<?php _e($row->field_id, 'xydac'); ?> "><?php _e($row->field_name, 'xydac'); ?> </a></strong><br /> </td> <td class="fields column-fields"> <?php _e($row->field_label, 'xydac'); ?> </td> <td class="categories column-categories"> <?php _e($row->field_type, 'xydac'); ?> </td> </tr> <?php //echo $row->field_name; } ?> </tbody> <tfoot> <tr> <th style="" class="manage-column column-cb check-column" scope="col"><input type="checkbox"></th> <th style="" class="manage-column column-name" scope="col"><?php _e('Name', 'xydac'); ?> </th> <th style="" class="manage-column column-fields" scope="col"><?php _e('Label', 'xydac'); ?> </th> <th style="" class="manage-column column-categories" scope="col"><?php _e('Type', 'xydac'); ?> </th> </tr> </tfoot> </table> </form> <br class="clear"> <br class="clear"> <div class="form-wrap"> <p><strong>Note:</strong><br>Deleting a field does not deletes the value in database</p> </div> </div> </div> <div id="col-left"><div class="col-wrap"> <div class="form-wrap"> <h3><?php if ($not_inserted) { _e('Edit Taxynomy Field', 'xydac'); } else { _e('Add a New Taxynomy Field', 'xydac'); } ?> </h3> <form id="form_create_field" action="<?php _e(XYDAC_FIELDS_PATH . "&manage_fields_submit=true&manage_fields_select=" . $t_name, 'xydac'); ?> " method="post"> <div class="form-field form-required"> <label for="field_name"><?php _e('Field Name', 'xydac'); ?> </label> <input type="text" name="field_name" class="name" <?php if ($not_inserted) { echo "readonly"; } ?> id="field_name" value="<?php if ($not_inserted) { if (isset($_POST['field_name'])) { _e($p_fname, 'xydac'); } else { if (isset($_GET['field'])) { _e($p_fname, 'xydac'); } } } ?> "> <p><?php _e('The name of the Field.', 'xydac'); ?> </p> </div> <div class="form-field form-required"> <label for="field_label"><?php _e('Field Label', 'xydac'); ?> </label> <input type="text" name="field_label" class="name" id="field_label" value="<?php if ($not_inserted) { if (isset($_POST['field_label'])) { _e($p_flabel, 'xydac'); } else { if (isset($_GET['field'])) { _e($p_flabel, 'xydac'); } } } ?> "> <p><?php _e('The Label of the Field.', 'xydac'); ?> </p> </div> <div class="form-field"> <label for="field_type"><?php _e('Field Type', 'xydac'); ?> </label> <select id="field_type" name="field_type" class="postform"> <option value="text" <?php if ($p_ftype == 'text') { _e('Selected'); } ?> >Text</option> <option value="combobox" <?php if ($p_ftype == 'combobox') { _e('Selected'); } ?> >ComboBox</option> <option value="image" <?php if ($p_ftype == 'image') { _e('Selected'); } ?> >Image</option> <option value="textarea" <?php if ($p_ftype == 'textarea') { _e('Selected'); } ?> >Textarea</option> </select> <p><?php _e('Input type of the field.', 'xydac'); ?> </p> </div> <div class="form-field"> <label for="field_desc"><?php _e('Field Description', 'xydac'); ?> </label> <input type="text" name="field_desc" id="field_desc" class="name" value="<?php if ($not_inserted) { if (isset($_POST['field_desc'])) { _e($p_fdesc, 'xydac'); } else { if (isset($_GET['field'])) { _e($p_fdesc, 'xydac'); } } } ?> "> <p><?php _e('Description for The Field', 'xydac'); ?> </p> </div> <div class="form-field"><?php //@TODO:make values disabled when text is selected ?> <label for="field_val"><?php _e('Field Value', 'xydac'); ?> </label> <input type="text" name="field_val" id="field_val" class="name" value="<?php if ($not_inserted) { if (isset($_POST['field_val'])) { _e($p_fval, 'xydac'); } else { if (isset($_GET['field'])) { _e($p_fval, 'xydac'); } } } ?> "> <p><?php _e('Enter a comma seperated values to be used for Combo-box.Provide it only for Combobox', 'xydac'); ?> </p> </div> <input type="hidden" name="tax_name" value="<?php _e($t_name, 'xydac'); ?> "/> <?php if (isset($_GET['field'])) { ?> <input type="hidden" name="field_id" value="<?php _e($_GET['field'], 'xydac'); ?> "/><?php } ?> <p class="submit"> <input type="submit" name="<?php if (isset($_GET['field'])) { _e('edit_field_submit', 'xydac'); } else { _e('add_field_submit', 'xydac'); } ?> " id="<?php if (isset($_GET['field'])) { _e('edit_field_submit', 'xydac'); } else { _e('add_field_submit', 'xydac'); } ?> " class="button-primary" value="<?php if (isset($_GET['field'])) { _e('Update Custom Field', 'xydac'); } else { _e('Add Custom Field', 'xydac'); } ?> "> </p> </form> </div> </div></div> </div> </div> <?php } else { xydac_heading("fields"); $output = 'objects'; // or objects $taxonomies = get_taxonomies('', $output); ?> <div class="wrap"> <form name='manage_fields' action='<?php _e(XYDAC_FIELDS_PATH, 'xydac'); ?> ' method='get' > <h3>Select the Taxonomy to manage </h3> <select name='manage_fields_select' id='manage_fields_select' style="margin:20px;"> <?php foreach ($taxonomies as $taxonomy => $e) { if ($e->name != 'link_category' && $e->name != 'nav_menu') { ?> <option value="<?php _e($e->name, 'xydac'); ?> "><?php !empty($e->label) ? _e($e->label, 'xydac') : _e($e->name, 'xydac'); ?> </option> <?php } } ?> </select> <input type="hidden" name="page" value="ultimate-taxonomy-manager"/> <input type="hidden" name="sub" value="custom-taxonomy-fields"/> <input type="submit" name="manage_fields_submit" id="manage_fields_submit" class="button" value="Manage"> </form> <br class="clear" /> <p>The fields that you create here will be visible on the Taxonomy Page.</p><br class="clear" /><br class="clear" /> <div id="poststuff" class="ui-sortable"> <?php xydac_home_aboutus(); ?> </div> </div> <?php } }
public function __construct($name, $resp = null) { global $db; global $loggedTables; $this->name = $name; $this->response = $resp ? $resp : new response($this->name); if (!count($this->response->header)) { $this->response->header = getFields($this->name); } $this->header = $this->response->header; if (array_key_exists($this->name, $loggedTables)) { $this->logging = true; } $this->db = $db; $this->fields = getFieldsAssoc($this->name); }
} ?> </select> </div> <div> Data Lookup: <label for="lookup1"><input type="radio" name="lookup" id="lookup1" value="5" checked = "checked" />add missing</label> <label for="lookup2"><input type="radio" name="lookup" id="lookup2" value="6" />overwrite</label> </div> <div> <table><tr> <?php $fields_in_a_row = 6; $fields = getFields(); $keys = array_keys($fields); $field_amount = count($keys); for ($i = 0; $i < $field_amount; $i++) { $checked = $fields[$keys[$i]] == 1 ? "checked" : ""; if ($i % $fields_in_a_row == 0 && $i != 0) { print "</TR><TR>"; } print '<TD nowrap="nowrap"><input type="checkbox" name="update_' . $keys[$i] . '" value="1" ' . $checked . ' />' . $keys[$i] . '</TD>'; } for ($i = 0; $i < $fields_in_a_row - $field_amount % $fields_in_a_row; $i++) { print '<TD> </TD>'; } ?> </tr></table> </div>
<?php require_once "../class/config.php"; $fields = array("mode" => array("get", "integer", 0), "sd" => array("get", "integer", 0), "usr" => array("get", "integer", 0)); getFields($fields); if (!$admin->enabled) { __("This page is restricted to authorized staff"); exit; } include_once "head.php"; ?> <h3><?php __("Quotas status"); ?> </h3> <hr id="topbar"/> <br /> <?php if (isset($error) && $error) { echo "<p class=\"alert alert-warning\">{$error}</p>"; } ?> <p> <?php __("This page shows the space and service count of your AlternC server and each AlternC accounts."); echo "<br /><br />"; printf(_("If you want to manage them, go to") . " <a href=\"adm_list.php\">" . _("Administration -> Manage the Alternc accounts") . "</a>"); ?> </p> <p> <?php
<?php //ini_set('display_errors',1); error_reporting(E_ALL); require_once '../Core/init.php'; $user = new user(null, $_log); $_db = db::getInstance(); //var_dump($logger); if (!$user->isLoggedIn()) { redirect::to('index.php'); } $coordinates = $_POST['coordinates']; $radius = $_POST['radius']; $type = $_POST['type']; $RTU_ID = $_POST['rtuID']; $fields = getFields($RTU_ID, $type, $radius, $coordinates); if ($db_data = $_db->get('Unit_Geo_Fences', array('Unit_Id', '=', $RTU_ID))) { if ($db_data->counts() > 0) { if (!$_db->updateUnit('Unit_Geo_Fences', $RTU_ID, $fields)) { $_log->info('Could not update fence into DB', $fields); // Will be logged throw new Exception('There was a problem updating! '); echo false; } $_log->info('fence saved for RTU_ID: ' . $RTU_ID); // Will be logged echo true; } else { if (!$_db->insert('Unit_Geo_Fences', $fields)) { $_log->error('Could not insert fence into DB', $fields); // Will be logged throw new Exception('There was a problem inserting! ');
/** * Формирование данных доступных в шаблоне страницы сравнения. */ function ComparePage() { $compare = A_Session::get(SECTION . "_compare", array()); foreach ($compare as $id => $row) { $compare[$id]['deletelink'] = getSectionLink(SECTION) . "?action=delcompare&id={$id}"; } $this->Assign('items', array_values($compare)); $this->Assign('fields', getFields(SECTION)); $this->prevc = false; $this->AddNavigation(SECTION_NAME, getSectionLink(SECTION)); }
if (isset($_REQUEST['experiment'])) { $id = safeString($_REQUEST['experiment']); $dataset = getImagesForExperiment($id); if ($dataset) { $data = $dataset; $status = 200; } } break; case "sessiondata": if (isset($_REQUEST['sessions'])) { $sessionIds = split(" ", $_REQUEST['sessions']); $dataset = array(); foreach ($sessionIds as $sid) { $eid = getSessionExperimentId($sid); $dataset[] = array('experimentId' => $eid, 'sessionId' => $sid, 'fields' => getFields($eid), 'meta' => array(getSession($sid)), 'data' => getData($eid, $sid)); } $data = $dataset; $status = 200; } break; case "getExperiment": if (isset($_REQUEST['experiment'])) { $id = safeString($_REQUEST['experiment']); $dataset = getExperiment($id); if ($dataset) { $data = $dataset; $status = 200; } } break;
function CetakSuratRekomendasi($pmb, $gelombang, $NomerSurat, $pdf) { $NomerSurat = GetaField('pmb', "PMBID='{$pmb['PMBID']}' and KodeID", KodeID, 'NomerSurat'); if (empty($NomerSurat)) { $NomerSurat = GetNextNomerNomerSurat($gelombang['PMBPeriodID'], $pmb['PMBID']); } $tahun = $gelombang['Tahun']; $tahunnext = $tahun + 1; $identitas = getFields('identitas', "Kode", KodeID, '*'); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => "<b>No : {$NomerSurat}</b>"); $db_data[] = array('Isi' => '<b>Perihal : Pengumuman Hasil Seleksi</b>'); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => 'Kepada Yth.'); $db_data[] = array('Isi' => '<b>Sdr/i ' . $pmb[Nama] . '</b>'); $db_data[] = array('Isi' => 'Di Tempat'); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => 'Dengan Hormat,'); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => "Dengan ini kami sampaikan bahwa berdasarkan Hasil Seleksi Ujian masuk Tahun Ajaran / Akademik {$tahun}/{$tahunnext} " . $identitas[Nama] . " pada tanggal " . GetDateInWords($gelombang['UjianMulai']) . ", maka saudara yang namanya tersebut di atas dinyatakan :"); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ' <b>LULUS</b>'); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => 'Selanjutnya saudara/i diberikan kesempatan belajar di ' . $identitas[Nama] . ' dan diwajibkan untuk:'); $db_data[] = array('Isi' => " a. Melakukan Pendaftaran Ulang di Kampus " . $identitas[Nama] . " paling lambat s/d tanggal " . GetDateInWords($gelombang['BayarSelesai']) . ""); $db_data[] = array('Isi' => ' b. Menyelesaikan Administrasi dan mengambil Slip Pembayaran di ' . $identitas[Nama] . ''); $db_data[] = array('Isi' => " c. Segera mengisi / mengambil KRS (Kartu Rencana Studi) Semester I {$tahun}/{$tahunnext} di Administrasi / Akademik " . $identitas[Nama] . ""); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => 'Bila memerlukan informasi dan pelayanan akademik dapat menghubungi :'); $db_data[] = array('Isi' => '<b>Telp ' . $identitas[Telepon] . '</b>'); $db_data[] = array('Isi' => ''); $KotaIdentitas = GetaField('identitas', "Kode", KodeID, 'Kota'); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => "{$KotaIdentitas}, " . GetDateInWords(date('Y-m-d'))); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $db_data[] = array('Isi' => ''); $PejabatAkademik = GetAField('pejabat', "KodeJabatan='KABAA' and KodeID", KodeID, "Nama"); $db_data[] = array('Isi' => "<b>{$PejabatAkademik}</b>"); $db_data[] = array('Isi' => 'Bagian Akademik'); $col_names = array('Isi' => ''); $title = ''; $rowoptions = array('width' => 500, 'lineCol' => array(1, 1, 1), 'innerLineThickness' => 0, 'outerLineThickness' => 0, 'shaded' => 0, 'rowGap' => 0, 'fontSize' => 12); $pdf->ezTable($db_data, $col_names, $title, $rowoptions); }
// Establece la Conexion con la Base de Datos //********************************************** $_SESSION['domain'] = 'update'; require "../../../cgi_bin/phpFun.php"; $dbDomains = dirList('../db/domains/*.db3'); foreach ($dbDomains as $db) { echo $db . '<br>' . realpath('../db/bak/') . '/' . $db . '<hr>'; rename(realpath('../db/domains/') . '/' . $db, realpath('../../db/bak/') . '/' . $db); copy(realpath('master.db3'), realpath('../db/domains/') . '/' . $db); $path = 'sqlite:' . realpath('../db/bak/' . $db); $origen = new PDO($path); $origen->exec("ATTACH '../db/domains/{$db}' as destino"); $strsql = "select name from main.sqlite_master where type='table'"; $tables = $origen->query($strsql); while ($table = $tables->fetch()) { $fields = getFields($origen, $table['name']); if ($fields > '0') { $strsql = 'INSERT INTO destino.' . $table['name'] . ' (' . $fields . ') SELECT ' . $fields . ' FROM main.' . $table['name']; $result = $origen->exec($strsql); echo $table['name'] . '<br>' . $strsql . '<br>'; var_dump($result); echo '<br>'; } } } function getFields($db, $table) { $fieldsOrigen = getColumnNames($db, $table, 'main'); $fieldsDestino = getColumnNames($db, $table, 'destino'); if (isset($fieldsOrigen) && isset($fieldsDestino)) { $valRet = array_intersect($fieldsOrigen, $fieldsDestino);
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 General Public License for more details. To read the license please visit http://www.gnu.org/copyleft/gpl.html ---------------------------------------------------------------------- Purpose of file: listing of mail accounts for one domain. ---------------------------------------------------------------------- */ require_once "../class/config.php"; include_once "head.php"; $fields = array("mail_arg" => array("request", "integer", ""), "domain_id" => array("request", "integer", ""), "show_systemmails" => array("request", "integer", ""), "search" => array("request", "string", ""), "offset" => array("request", "integer", 0), "count" => array("request", "integer", 50)); $champs = getFields($fields); $counts = array("10" => "10", "20" => "20", "30" => "30", "50" => "50", "100" => "100", "200" => "200", "500" => "500", "1000" => "1000"); if (!$domain_id) { include "main.php"; exit; } $fatal = false; if ($domain = $dom->get_domain_byid($domain_id)) { if (!($mails_list = $mail->enum_domain_mails($domain_id, $search, $offset, $count, $show_systemmails)) && $search) { $error = $err->errstr(); } $allmails_list = $mail->enum_domain_mails($domain_id, $search, $offset, $count, 'true'); } else { $error = $err->errstr(); $fatal = true; }
function readCSV($dir, $csvFile, $tableName) { // connect $m = new MongoClient(); // select a database $db = $m->trend; $collection = $db->{$tableName}; // Get yeat and month from csvFile list($year, $month, $rest) = explode("_", $csvFile, 3); $year = intval($year); $month = intval($month); assert($year != null && $month != null); $row = 0; if (($handle = fopen("{$dir}/{$csvFile}", "r")) == FALSE) { echo "{$dir} . {$csvFile} not found!"; return; } while (($data = fgetcsv($handle, 10000000, ",")) !== FALSE) { // table head field if ($row++ == 0) { $thdata = array_values($data); $fields = getFields($data); $types = getTypes($fields); // Num of Fields $numFields = count($fields); // Add meta fields $fields[] = "year"; $fields[] = "month"; $fields[] = "state"; $fields[] = "city"; $fields[] = "county"; $fields[] = "region"; //$fields[] = "xlsrow"; // types $types[] = "i"; $types[] = "i"; $types[] = "s"; $types[] = "s"; $types[] = "s"; $types[] = "s"; //$types[] = "i"; print_r($fields); //make a unique/index index //makeDBIndex($db, $collection, $fields); continue; } // Another table head? $diff = array_diff($thdata, $data); // all same? if (count($diff) == 0) { echo "Skip another table head"; continue; } $num = count($data); if ($num != $numFields) { echo "<!> {$num} fields in line {$row}!\n"; print_r($data); continue; } assert($fields); // add year and month $data[] = $year; $data[] = $month; list($state, $city, $county, $region) = explode(" ", trim($data[0]), 4); // data 0 should be the full loc $data[] = $state; $data[] = $city; $data[] = $county; $data[] = $region; $data[] = $row; // echo "$data[0] $data[1]"; // Let's insert insertDB($db, $collection, $types, $fields, $data); } fclose($handle); // mk grpo echo "<!> Inserted {$row} rows!\n"; echo "<!> making agg for {$year}/{$month}...\n"; mkgrp($db, $tableName, $year, $month); }
<?php require_once "conn.php"; require_once "func.php"; $match_way = $_POST['match_way']; $query_way = $_POST['query_way']; $search_text = $_POST['search_text']; $Fields = getFields($query_way); //CheckStringType($Fields,$search_text); if ($search_text == '') { echo "请输入字符"; } else { $sql = QuerySql($match_way, $query_way, $search_text, $Fields); //echo $sql."<br/>"; $res = mysql_unbuffered_query($sql); echo "<table border='1'><tr>"; foreach ($Fields as $value) { echo "<th>" . $value . "</th>"; } echo "</tr>"; while ($row = mysql_fetch_array($res)) { echo "<tr onmouseover=\"this.style.backgroundColor='#ffff66';\" onmouseout=\"this.style.backgroundColor='#d4e3e5';\">"; for ($m = 0; $m < count($Fields); $m++) { echo "<td>" . $row[$m] . "</td>"; } echo "</tr>"; } echo "</table>"; mysql_close($conn); }