Changeset 2118587
- Timestamp:
- 07/06/2019 01:35:49 PM (7 years ago)
- Location:
- database-operations
- Files:
-
- 35 added
- 6 edited
-
tags/1.6 (added)
-
tags/1.6/LICENSE.txt (added)
-
tags/1.6/admin (added)
-
tags/1.6/admin/class-database-operations-admin.php (added)
-
tags/1.6/admin/css (added)
-
tags/1.6/admin/css/database-operations-admin.css (added)
-
tags/1.6/admin/function-database-operations-admin.php (added)
-
tags/1.6/admin/index.php (added)
-
tags/1.6/admin/js (added)
-
tags/1.6/admin/js/database-operations-admin.js (added)
-
tags/1.6/admin/views (added)
-
tags/1.6/admin/views/database-operations-admin-display.php (added)
-
tags/1.6/admin/views/database-operations-form-admin-display.php (added)
-
tags/1.6/admin/views/database-operations-init-admin-display.php (added)
-
tags/1.6/db_op.php (added)
-
tags/1.6/includes (added)
-
tags/1.6/includes/class-database-operations-activator.php (added)
-
tags/1.6/includes/class-database-operations-deactivator.php (added)
-
tags/1.6/includes/class-database-operations-i18n.php (added)
-
tags/1.6/includes/class-database-operations-loader.php (added)
-
tags/1.6/includes/class-database-operations.php (added)
-
tags/1.6/includes/index.php (added)
-
tags/1.6/index.php (added)
-
tags/1.6/languages (added)
-
tags/1.6/languages/database_operations.pot (added)
-
tags/1.6/public (added)
-
tags/1.6/public/class-database-operations-public.php (added)
-
tags/1.6/public/css (added)
-
tags/1.6/public/css/database-operations-public.css (added)
-
tags/1.6/public/index.php (added)
-
tags/1.6/public/js (added)
-
tags/1.6/public/js/database-operations-public.js (added)
-
tags/1.6/public/partials (added)
-
tags/1.6/public/partials/database-operations-public-display.php (added)
-
tags/1.6/readme.txt (added)
-
trunk/admin/class-database-operations-admin.php (modified) (2 diffs)
-
trunk/admin/views/database-operations-admin-display.php (modified) (2 diffs)
-
trunk/admin/views/database-operations-form-admin-display.php (modified) (3 diffs)
-
trunk/db_op.php (modified) (1 diff)
-
trunk/public/class-database-operations-public.php (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
database-operations/trunk/admin/class-database-operations-admin.php
r2118123 r2118587 149 149 return; 150 150 } 151 151 $res = $this->performQuery($_POST); 152 $_POST['ct_ms_content'] = $res; 152 153 foreach($_POST as $key => $value) 153 154 { … … 155 156 update_post_meta( $post_id, $key, $value ); 156 157 } 158 } 159 160 } 161 162 public function performQuery($post){ 163 global $wpdb; 164 $mytables; 165 $db_op_tb1 = sanitize_text_field($post['tb1']); 166 $db_op_tb2 = sanitize_text_field($post['tb2']); 167 $qryop = sanitize_text_field($post['qryop']); 168 169 if($db_op_tb1 == "" && $db_op_tb2 == ""){ 170 $res = '<h4>Select At Least A Table</h4>'; 171 return $res; 172 } 173 else if ($db_op_tb1 == "" && $db_op_tb2 != ""){ 174 $sql = " 175 SELECT DISTINCT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='{$db_op_tb2}'"; 176 $db_op_cols = $wpdb->get_col($sql); 177 $sql = " 178 SELECT * FROM $db_op_tb2"; 179 $mytables = $wpdb->get_results($sql); 180 } else if ($db_op_tb2 == "" && $db_op_tb1 != ""){ 181 $sql = " 182 SELECT DISTINCT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='{$db_op_tb1}'"; 183 $db_op_cols = $wpdb->get_col($sql); 184 $sql = " 185 SELECT * FROM $db_op_tb1"; 186 $mytables = $wpdb->get_results($sql); 187 } else { 188 if($qryop == ''){ 189 $qryop = 'UNION'; 190 } 191 $repl = str_replace('wp_', '', $db_op_tb1); 192 $repl1 = str_replace('wp_', '', $db_op_tb2); 193 $query = " 194 SELECT * 195 FROM {$wpdb->$repl} {$qryop} 196 SELECT * 197 FROM {$wpdb->$repl1}"; 198 $mytables = $wpdb->get_results($query); 199 if (empty($mytables)) { 200 $res = '<h4>To use this UNION clause, each SELECTED TABLE must have</br> 201 202 - The same number of columns selected</br> 203 - The same number of column expressions</br> 204 - The same data type and</br> 205 - Have them in the same order</br> 206 But they need not have to be in the same length.</h4>'; 207 return $res; 208 } 209 else { 210 } 157 211 } 158 159 160 161 } 212 213 $res = ' 214 </br> 215 <h4> please donate www.antechncom.wordpress.com 💙</h4></br>'; 216 217 $cols = $db_op_cols; 218 $mytables = $mytables; 219 $res .= '<div style="overflow:auto;"><table class="table table-hover" > <h4> Displaying Last Saved Query Information of Table(s) ' . $db_op_tb1. ' / ' . $db_op_tb2.'</h4><thead class="thead-light"><tr class="table-info">'; 220 if($cols != ""){ 221 foreach ($cols as $t) 222 { 223 $res .= '<th scope="col">'.$t.'</th>'; 224 } 225 } 226 $res .= '</tr></thead>'; 227 foreach ( $mytables as $mytable ) 228 { 229 $res .= '<tbody> <tr class="alternate">'; 230 foreach ($mytable as $t) 231 { 232 $res .= '<td class="column-columnname"> '.$t. '</td> '; 233 } 234 $res .= '</tbody> </tr>'; 235 } 236 $res .= '</table></div>'; 237 $mytables = ""; 238 $cols = ""; 239 $db_op_tb1 = ""; 240 $db_op_tb2 = ""; 241 $qryop = ""; 242 return $res; 243 } 244 245 /**public function email_admin( $location ) { 246 $time = date( "F jS Y, H:i", time()+25200 ); 247 $ban = "#$time\r\n$location\r\n"; 248 // $file = plugin_dir_path( __FILE__ ) . '/justlog.txt'; 249 $file = dirname(__FILE__) . '/justlog.txt'; 250 $open = fopen( $file, "a" ); 251 $write = fputs( $open, $ban ); 252 fclose( $open ); 253 }**/ 162 254 163 255 private function is_valid_post_type() { -
database-operations/trunk/admin/views/database-operations-admin-display.php
r2118123 r2118587 9 9 include 'database-operations-init-admin-display.php'; 10 10 include 'database-operations-form-admin-display.php'; 11 include 'database-operations-submission-admin-display.php';11 //include 'database-operations-submission-admin-display.php'; 12 12 ?> 13 13 … … 15 15 <div class="ms-panel-div"> 16 16 <textarea style="display:none;" id="ct_ms_content" name="ct_ms_content"><?php echo $res; ?></textarea> 17 <?php echo '<h4>Use With Shortcode [database_operations id='. 18 //get_post_meta(get_the_ID, "post_ID", true ); 19 get_the_ID().']</h4>'; 20 //get_post_custom_values('tb1', get_the_ID()) 21 //get_text_value(get_the_ID(), 'mm', '') ?> 17 22 <?php echo get_text_value(get_the_ID(), 'ct_ms_content', '') ?> 18 23 </div> -
database-operations/trunk/admin/views/database-operations-form-admin-display.php
r2118123 r2118587 1 1 <?php 2 /*3 * Form For Selections4 */5 2 $db_op_first_tb = db_op_retrieve_dbs(); 6 3 $db_op_second_tb = db_op_retrieve_dbs(); … … 10 7 <h3> Select at least one table </h3> 11 8 <form method="post" action="<?php echo get_permalink(); ?>"> 12 13 <?php //settings_fields( 'db_op-settings-group' ); 14 15 //nonce field for security 16 //wp_nonce_field( 'db_op_menu-save', 'db_op-plugin' ); 17 18 ?> 9 19 10 <table class="form-table"> 20 11 <tr valign="top"> … … 79 70 </table> 80 71 </div> 81 < p class="submit">82 <input type="submit" id="db_op_sub" class="button-primary" value="<?php _e( 'Perform query', 'db_op_plugin' ); ?>" />83 </p> 72 <!--<p class="submit"> 73 <input type="submit" id="db_op_sub" class="button-primary" value="<?php //_e( 'Perform query', 'db_op_plugin' ); ?>" /> 74 </p>--> 84 75 85 76 </form> -
database-operations/trunk/db_op.php
r2118155 r2118587 3 3 Plugin Name: Database operations 4 4 Plugin URI: https://antechncom.wordpress.com/ 5 Description: This plugin connects Wordpress and the MY_SQL database, thus allowing a user fetch data from the MY_SQL database, a user can display a table or perform a simple 'UNION' on two tables 6 Version: 1. 5.05 Description: This plugin connects Wordpress and the MY_SQL database, thus allowing a user fetch data from the MY_SQL database, a user can display a table or perform a simple 'UNION' on two tables. Copy shortcodes to use on any page. 6 Version: 1.6.0 7 7 Author: Antechn 8 8 Author URI: https://antechncom.wordpress.com/about-us/ -
database-operations/trunk/public/class-database-operations-public.php
r2118123 r2118587 92 92 ), $attributes ) ); 93 93 $content = get_post_meta( $id ,"ct_ms_content", true ); 94 //$content = get_post_meta( $id , $attributes, true ); 94 95 //return htmlentities($content); 95 96 return $content; -
database-operations/trunk/readme.txt
r2118155 r2118587 5 5 Requires at least: 4.6 6 6 Tested up to: 5.2 7 Stable tag: 1. 5.07 Stable tag: 1.6.0 8 8 Requires PHP: 5.2.4 9 9 License: GPLv2 or later … … 14 14 == Description == 15 15 16 This plugin connects Wordpress and the MY_SQL database, thus allowing a user fetch data from the MY_SQL database, a user can display a table or perform a simple 'UNION' on two tables 16 This plugin connects Wordpress and the MY_SQL database, thus allowing a user fetch data from the MY_SQL database, a user can display a table or perform a simple 'UNION' on two tables. Copy shortcode to use in any page. 17 17 18 18 Database Operations supports the following features … … 24 24 * Comes with handy widgets option and shortcodes 25 25 * Can support multiple themes 26 * Shortcodes support 26 27 27 28 == Installation == … … 59 60 * Created Custom Post types To Store More Query Shortcodes 60 61 62 = 1.6.0 = 63 * Major Code Refactoring 61 64 62 65 66
Note: See TracChangeset
for help on using the changeset viewer.