|
Revision 21, 0.9 kB
(checked in by admin, 18 years ago)
|
|
|
| Rev | Line | |
|---|
| [21] | 1 | <? |
|---|
| 2 | |
|---|
| 3 | require( dirname(__FILE__) . '/../../../wp-config.php' ); |
|---|
| 4 | if (!(is_user_logged_in() && current_user_can(FLUTTER_CAPABILITY_PANELS))) |
|---|
| 5 | die("Athentication failed!"); |
|---|
| 6 | |
|---|
| 7 | if(isset($_GET['getFieldsByLetters']) && isset($_GET['letters'])){ |
|---|
| 8 | $letters = $_GET['letters']; |
|---|
| 9 | $letters = preg_replace("/[^a-z0-9 ]/si","",$letters); |
|---|
| 10 | |
|---|
| 11 | // Search for similar fields |
|---|
| 12 | global $wpdb; |
|---|
| 13 | require_once("RCCWP_CustomField.php"); |
|---|
| 14 | $sql = "SELECT id, group_id FROM " . RC_CWP_TABLE_GROUP_FIELDS . |
|---|
| 15 | " WHERE name like '%$letters%' "; |
|---|
| 16 | $results =$wpdb->get_results($sql); |
|---|
| 17 | |
|---|
| 18 | foreach($results as $result){ |
|---|
| 19 | $fieldGroup = RCCWP_CustomGroup::Get($result->group_id); |
|---|
| 20 | if ($_GET['panel_id'] != $fieldGroup->panel_id){ |
|---|
| 21 | $currentField = RCCWP_CustomField::Get($result->id); |
|---|
| 22 | $fieldDescription = "<b>{$currentField->description}</b> <br /> (Type: {$currentField->type}, Name: {$currentField->name})"; |
|---|
| 23 | echo $result->id."###".$fieldDescription."|"; |
|---|
| 24 | } |
|---|
| 25 | } |
|---|
| 26 | } |
|---|
| 27 | ?> |
|---|