Plugin Directory

Changeset 1165150


Ignore:
Timestamp:
05/21/2015 06:04:41 PM (11 years ago)
Author:
hunk
Message:

update for 2.3.1

Location:
magic-fields-2/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • magic-fields-2/trunk/admin/mf_ajax_call.php

    r761841 r1165150  
    120120        $cats = preg_split('/\|\|\|/', $data['cats']);
    121121        $cats = maybe_serialize($cats);
     122
     123    $table = $wpdb->postmeta;
    122124       
    123         $check_parent ="SELECT meta_id FROM ".$wpdb->postmeta." WHERE meta_key='".$post_type_key."' ";
     125    $check_parent = $wpdb->prepare(
     126      "SELECT meta_id FROM $wpdb->postmeta ".
     127      "  WHERE meta_key='%s'",
     128      $post_type_key
     129    );
    124130        $query_parent = $wpdb->query($check_parent);
    125131
    126132    if($query_parent){
    127             $sql = "UPDATE ". $wpdb->postmeta .
    128               " SET meta_value = '".$cats."' ".
    129               " WHERE meta_key = '".$post_type_key."' AND post_id = '0' ";
     133      $sql = $wpdb->prepare(
     134        "UPDATE $wpdb->postmeta".
     135        " SET meta_value = '%s' ".
     136        " WHERE meta_key = '%s' AND post_id = '0' ",
     137        $cats,
     138        $post_type_key
     139      );
     140
    130141        }else{
    131             $sql = "INSERT INTO ". $wpdb->postmeta .
    132              " (meta_key, meta_value) ".
    133              " VALUES ('".$post_type_key."', '".$cats."')";
     142      $sql = $wpdb->prepare(
     143        "INSERT INTO $wpdb->postmeta".
     144        " (meta_key, meta_value) ".
     145        " VALUES ('%s', '%s')",
     146        $post_type_key,
     147        $cats
     148      );
    134149        }
    135150        $wpdb->query($sql);
  • magic-fields-2/trunk/admin/mf_custom_fields.php

    r864350 r1165150  
    286286    // change the name of field?
    287287    if( $mf['core']['name'] != $field['name'] ){
    288       $query = sprintf(
    289       "UPDATE %s pm, %s p ".
    290       "SET pm.field_name = '%s' ".
    291       "WHERE pm.field_name = '%s' AND p.post_type = '%s' AND pm.post_id = p.id",
     288      $query = $wpdb->prepare(
     289      "UPDATE %s pm, $wpdb->posts p ".
     290      " SET pm.field_name = '%s' ".
     291      " WHERE pm.field_name = '%s' AND p.post_type = '%s' AND pm.post_id = p.id",
    292292      MF_TABLE_POST_META,
    293       $wpdb->posts,
    294293      $mf['core']['name'],
    295294      $field['name'],
    296295      $mf['core']['post_type']
    297       );
     296    );
     297
    298298      $wpdb->query($query);
    299299    }
     
    602602
    603603      if( is_int($id) ){
    604         $sql = "DELETE FROM ".MF_TABLE_CUSTOM_FIELDS." WHERE id = ".$id;
     604        $sql = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_FIELDS." WHERE id = %d",$id );
    605605        $wpdb->query($sql);
    606606      }
  • magic-fields-2/trunk/admin/mf_custom_group.php

    r864350 r1165150  
    4949      if( is_int($id) ){
    5050        $group = $this->get_group($id);
    51         $sql = sprintf("DELETE FROM %s WHERE id = %s",MF_TABLE_CUSTOM_GROUPS,$id);
     51        $sql = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_GROUPS." WHERE id = %d",$id );
    5252        $wpdb->query($sql);
    5353       
    54         $sql_fields = sprintf("DELETE FROM %s WHERE custom_group_id = %s",MF_TABLE_CUSTOM_FIELDS,$id);
     54        $sql_fields = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_FIELDS." WHERE custom_group_id = %d",$id );
    5555        $wpdb->query($sql_fields);
    5656
  • magic-fields-2/trunk/admin/mf_custom_taxonomy.php

    r640332 r1165150  
    108108
    109109      if( is_int($id) ){
    110         $sql = sprintf(
    111           "DELETE FROM " . MF_TABLE_CUSTOM_TAXONOMY .
    112           " WHERE id = %d",
    113           $id
    114         );
     110        $sql = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_TAXONOMY." WHERE id = %d",$id );
    115111        $wpdb->query($sql);
    116112        $this->mf_redirect(null,null,array('message' => 'success'));
     
    547543  }
    548544 
    549   public function check_custom_taxonomy($type,$id = NULL){
     545  public static function check_custom_taxonomy($type,$id = NULL){
    550546    global $wpdb;
    551547 
  • magic-fields-2/trunk/admin/mf_post.php

    r958257 r1165150  
    263263
    264264      /** Deleting the old values **/
    265             $wpdb->query( "DELETE FROM ". MF_TABLE_POST_META ." WHERE post_id= {$post_id}" );
     265      $sql_delete = $wpdb->prepare( "DELETE FROM ".MF_TABLE_POST_META." WHERE post_id = %s",$post_id );
     266      $wpdb->query($sql_delete);
     267
    266268      foreach ( $customfields as $field_name => $field ) {
    267269        delete_post_meta($post_id, $field_name);
     
    285287            $meta_id = $wpdb->insert_id;
    286288
    287             $wpdb->query("INSERT INTO ". MF_TABLE_POST_META." ( meta_id, field_name, field_count, group_count, post_id ) ".
    288               " VALUES ( {$meta_id}, '{$field_name}' , {$field_count},{$group_count} ,{$post_id} )"
     289            $sql_insert = $wpdb->prepare(
     290              "INSERT INTO " . MF_TABLE_POST_META .
     291              " ( meta_id, field_name, field_count, group_count, post_id ) " .
     292              " VALUES " .
     293              " (%s,'%s',%s,%s,%s) ",
     294              $meta_id,
     295              $field_name,
     296              $field_count,
     297              $group_count,
     298              $post_id
    289299            );
     300
     301            $wpdb->query($sql_insert);
     302
    290303            $field_count++;
    291304          }
  • magic-fields-2/trunk/admin/mf_posttype.php

    r979682 r1165150  
    740740
    741741      if( $post_type ){
    742         $sql = sprintf(
    743           "DELETE FROM " . MF_TABLE_POSTTYPES .
    744           " WHERE type = '%s'",
    745           $post_type
    746         );
     742
     743        $sql = $wpdb->prepare( "DELETE FROM ".MF_TABLE_POSTTYPES." WHERE type = '%s'",$post_type );
    747744        $wpdb->query($sql);
    748745       
    749746        //delete all groups of post_type
    750         $sql_fields = sprintf("DELETE FROM %s WHERE post_type = '%s'",MF_TABLE_CUSTOM_GROUPS,$post_type);
     747        $sql_fields = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_GROUPS." WHERE post_type = '%s'",$post_type );
    751748        $wpdb->query($sql_fields);
    752749       
    753750        //delete field of post_type
    754         $sql_fields = sprintf("DELETE FROM %s WHERE post_type = '%s'",MF_TABLE_CUSTOM_FIELDS,$post_type);
     751        $sql_fields = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_FIELDS." WHERE post_type = '%s'",$post_type );
    755752        $wpdb->query($sql_fields);
    756753       
  • magic-fields-2/trunk/css/mf_field_base.css

    r906980 r1165150  
    191191 padding-bottom:2px;
    192192 display: block;
    193  margin-right:10px;
    194193}
    195194.multiline_custom_field{ margin-left: 10px; }
     
    225224    padding:4px 5px 2px;
    226225}
     226.mf_media_button_div{
     227  margin-left: 10px;
     228}
    227229
    228230/**
  • magic-fields-2/trunk/main.php

    r979682 r1165150  
    44Plugin URI: http://magicfields.org
    55Description: Create custom fields for your post types
    6 Version: 2.3
     6Version: 2.3.1
    77Author:  Hunk and Gnuget
    88Author URI: http://magicfields.org
     
    154154   */
    155155  function mf_dispatcher() {
     156
     157    //is user loged?
     158    if ( !is_user_logged_in() ) {
     159      die;
     160    }
     161
     162    //same capabilities for the menu
     163    if (!current_user_can('activate_plugins') ) {
     164      die;
     165    }
     166
    156167    $section = "mf_dashboard";
    157168    $action = "main";
     
    165176    if( !empty( $_GET['mf_action'] ) ) {
    166177      $action = urlencode( $_GET['mf_action'] );
     178    }
     179
     180    //check only mf_section has prefix mf   
     181    if ( !(strpos($section, "mf_") === 0) ) {
     182      die;
     183    }
     184
     185    //exist class
     186    if (!class_exists($section)) {
     187      die;
     188    }
     189
     190    if (!method_exists($section,$action)) {
     191      die;
    167192    }
    168193
  • magic-fields-2/trunk/readme.txt

    r979682 r1165150  
    22Contributors: hunk, Gnuget
    33Tags: cms, post types, fields, taxonomies, custom fields, admin, advanced, edit, magic fields,  more fields, Post, repeater, simple fields, text, textarea, type, advanced custom fields, cck,
    4 Tested up to: Wordpress 4.0
     4Tested up to: Wordpress 4.2.2
    55Requires at least: 3.1
    66Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=edgar%40programador%2ecom&lc=GB&item_name=Donation%20Magic%20Fields&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
    7 Stable tag: 2.3
     7Stable tag: 2.3.1
    88Description:  Magic Fields 2 is a feature rich Wordpress CMS plugin
    99
     
    2626
    2727== Changelog ==
     28
     29= 2.3.1 =
     30* add verification in dispacher, add wpdb->prepare
     31* add improvements and testing for WP 4.2.2
    2832
    2933= 2.3 =
Note: See TracChangeset for help on using the changeset viewer.