GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — column_edit/config.inc.php at master · jdlx/column_edit Expand file tree/ Copy pathconfig.inc.phpMore file actions executable file ·119 lines (98 loc) · 3.96 KB / Copy pathconfig.inc.phpFile metadata and controlsexecutable file ·119 lines (98 loc) · 3.96 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 <?php /** * column_edit - XFORM Plugin * * @version 1.1.0 * @author http://rexdev.de * @package redaxo 4.5.x/4.6.x * @package xform 2.9.x - 4.8.0 */ if(!$REX['REDAXO']) { return; } $myself = 'column_edit'; $myroot = $REX['INCLUDE_PATH'].'/addons/xform/plugins/'.$myself; $page = rex_request('page' , 'string' ); $subpage = rex_request('subpage' , 'string' ); $tripage = rex_request('tripage' , 'string' ); $table_name = rex_request('table_name' , 'string' ); $start = rex_request('start' , 'int' , 0 ); $sort = rex_request('sort' , 'string' , 'false'); $rex_xform_search = rex_request('rex_xform_search', 'int' , 0 ); $list = rex_request('list' , 'string' , 'false'); $send = rex_request('send' , 'string' , 'false'); $func = rex_request('func' , 'string' , 'false'); // ADDON REX COMMONS //////////////////////////////////////////////////////////////////////////////// $REX['ADDON']['rxid'][$myself] = '990'; $REX['ADDON']['version'][$myself] = '1.1.0'; $REX['ADDON']['author'][$myself] = 'rexdev.de'; $REX['ADDON']['supportpage'][$myself] = 'rexdev.de'; $REX['ADDON']['perm'][$myself] = $myself.'[]'; $REX['PERM'][] = $myself.'[]'; // XFORM SUBPAGE //////////////////////////////////////////////////////////////////////////////// if ($REX['USER'] && ($REX['USER']->isAdmin() || $REX['USER']->hasPerm("xform[column_edit]"))){ $REX['ADDON']['xform']['SUBPAGES'][] = array($myself , 'Column Edit'); } // GENERIC REPLY FUNC //////////////////////////////////////////////////////////////////////////////// function column_edit_reply($data=false) { if(!$data) return false; if(is_array($data) && count($data)>0) { while(ob_get_level()){ ob_end_clean(); } ob_start(); header('Content-Type: application/json'); echo json_encode($data); die(); } } // RECEIVER/API //////////////////////////////////////////////////////////////////////////////// rex_register_extension('ADDONS_INCLUDED', function() { $data = rex_request('column_edit','string',false); if($data!==false) { $data = json_decode(stripslashes($data),true); if(!is_array($data)) { return column_edit_reply(array('error'=>'no valid POST data')); } switch ($data['action']) { case 'column-select-options': if($data['table_name']=='') { column_edit_reply(array('html'=>'')); } $db = new rex_sql; // GET COLUMN DEFINITIONS $db->setQuery('SHOW CREATE TABLE `'.$data['table_name'].'`;'); $column_options = array(); $create_parts = explode(PHP_EOL,$db->getValue('Create Table')); foreach ($create_parts as $part) { preg_match('#^\s*`(\w+)`([^,`]+),$#',trim($part),$matches); if(count($matches)===3) { $column_options[$matches[1]] = trim($matches[2]); } } // NAME FIELD DEPENDING ON XFORM VERSION .. $name_field = version_compare(rex_addon::getVersion('xform'),'4.8','>=') ? 'name' : 'f1'; // BUILD SELECT OPTIONS $select_options = '<option id="opt_"data-mysql-create-opts="" value="">Select Column:</option>'; foreach($db->getArray('SELECT `'.$name_field.'` FROM `rex_xform_field` WHERE `table_name`=\''.$data['table_name'].'\';') as $k => $v) { $selected = (isset($data['selected_column']) && $data['selected_column']==$v[$name_field]) ? ' selected="selected"' : '' ; $select_options .= '<option id="opt_'.$v[$name_field].'" data-mysql-create-opts="'.$column_options[$v[$name_field]].'" value="'.$v[$name_field].'" '.$selected.'>'.$v[$name_field].'</option>'; } column_edit_reply(array('html'=>$select_options)); break; default: // } } }); // rex_register_extension |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |