Changeset 11499


Ignore:
Timestamp:
Jun 23, 2011, 3:33:26 PM (13 years ago)
Author:
cljosse
Message:

[extensions] set_plugins fix bugs with free

Location:
extensions/set_plugins
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/set_plugins/include/affiche.php

    r11497 r11499  
    2020
    2121  $liste = set_plugins::set_var('liste',array());
    22   $liste= array_unique($liste);
     22   $liste= array_unique($liste);
     23
    2324  $state=set_plugins::set_var('state',"active");
    2425  $list_visible=set_plugins::set_var('list_visible',"on,on,on,on");
     
    5051              //    $infos_message .= set_plugins::memo_var("STORE");
    5152              break;
     53 
     54 }
    5255
    53             }
    54          
    5556}
    56 if($add_plugins!=""  ){ 
     57
     58
     59if($add_plugins!=""  ){
    5760$infos_message .=$add_plugins;
    5861 if(!array_search($add_plugins, $liste)){
     
    7275}
    7376if(count($liste)>0) {
    74   $liste= array_unique($liste);
     77  $liste= array_unique($liste);
     78 
    7579}
     80
    7681//$infos_message .= "liste_des_plugins_activés".set_plugins::memo_var($liste_des_plugins_activés);
    77 //$infos_message .= "liste".set_plugins::memo_var($liste_mem);
     82//$infos_message .= "liste".set_plugins::memo_var($liste_mem);
     83
    7884
    7985if ( $set=="true"){   
     86$infos_message .= l10n("save");
    8087    set_plugins::save_config();
    8188
    8289 } 
     90
     91
     92
    8393 //=======================================================
    8494 if(isset($liste) && count($liste)>0)  $liste_plugins =$liste;
     
    8898  array_keys($liste_plugins) 
    8999  );
    90 
    91100$liste_tpl=array();
    92101foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) {   
     
    112121        'STATE' =>$State_id,
    113122        'COLOR' => $couleur
    114         );
     123      );
    115124      $liste_tpl[$plugin_id]=  $tpl_plugin ;   
    116       }      
    117   } 
     125      }
     126  }
    118127}           
    119128$edited_file=set_plugins::get_file_name();
  • extensions/set_plugins/js/field_set.js

    r11497 r11499  
    7474        jQuery("input[name=list_visible]").val(liste_visible);
    7575      }
    76       if (typeof (liste_visible)=="string")
    7776      liste_visible = liste_visible.split(reg);
    7877      reg = new RegExp("['off']", "g");
     
    8079      h_min = 0;
    8180      jQuery("fieldset").each(function (i) {
    82         id0 = jQuery(this).attr("id");
    83         if (id0 == "") jQuery(this).attr("id", "fieldset_" + i);
    84         jQuery(this).attr("rel", i);
    85         if (!jQuery(this).hasClass("field_set"))
    86           jQuery(this).addClass("field_set");
     81          id0 = jQuery(this).attr("id");
     82          if (id0 == "") jQuery(this).attr("id", "fieldset_" + i);
     83          jQuery(this).attr("rel", i);
     84
     85          if (!jQuery(this).hasClass("field_set"))
     86            jQuery(this).addClass("field_set");
    8787        if (liste_visible[i] == "off") {
    8888          liste_visible[i] = "off";
    89           jQuery(this).height(h_min + 0);
    90           jQuery("#" + this.id + ' legend').prepend(
     89            jQuery(this).height(h_min + 0);
     90
     91            jQuery("#" + this.id + ' legend').prepend(
    9192            '<img alt = "" title = ""' + 'src = "' + plus_path + '"' + '>&nbsp;'
    92             );
    93         } else {
     93        );
     94          } else {
    9495          liste_visible[i] = "on";
    95           jQuery(this).addClass("visible");
    96           jQuery("#" + this.id + ' legend').prepend(
    97               '<img alt = "" title = ""' +
    98               'src = "' + minus_path + '"' + '>&nbsp;'
    99             );
    100         }
    101         jQuery("#" + this.id + ' legend').css('cursor', 'pointer');
     96            jQuery(this).addClass("visible");
     97            jQuery("#" + this.id + ' legend').prepend(
     98          '<img alt = "" title = ""' +
     99          'src = "' + minus_path + '"' + '>&nbsp;'
     100        );
     101          }
     102
     103          jQuery("#" + this.id + ' legend').css('cursor', 'pointer');
    102104        id0 = jQuery(this).attr("id");
    103105
    104         jQuery("#" + id0 + ' legend').click(function (event) {
    105           n = jQuery(this).parent().hasClass("visible");
     106
     107          jQuery("#" + id0 + ' legend').click(function (event) {
     108
     109            n = jQuery(this).parent().hasClass("visible");
    106110          i = jQuery(jQuery(this).parent()).attr("rel");
    107111
    108           if (typeof liste_visible == "undefined") {
    109             liste_visible = "on,on,on,on";
    110             jQuery("input[name=list_visible]").val(liste_visible);
    111           }
     112            if (typeof liste_visible == "undefined") {
     113              liste_visible = "on,on,on,on";
     114              jQuery("input[name=list_visible]").val(liste_visible);
     115            }
    112116          liste_visible = jQuery("input[name=list_visible]").val().split(",");
    113           // src = jQuery(this).find("img").attr("src");
    114           if (n) {
    115             jQuery(this).parent().height(h_min + 0);
    116             jQuery(this).parent().removeClass("visible");
     117            // src = jQuery(this).find("img").attr("src");
     118            if (n) {
     119              jQuery(this).parent().height(h_min + 0);
     120              jQuery(this).parent().removeClass("visible");
    117121            liste_visible[i] = "off";
    118             jQuery(this).find("img").attr({
    119               src: plus_path
    120             });
     122              jQuery(this).find("img").attr({
     123                src: plus_path
     124
     125              });
    121126          } else {
    122             jQuery(this).parent().css("height", "auto");
    123             jQuery(this).parent().addClass("visible");
     127              jQuery(this).parent().css("height", "auto");
     128              jQuery(this).parent().addClass("visible");
    124129            liste_visible[i] = "on";
    125             jQuery(this).find("img").attr({
    126               src: minus_path
    127             });
    128           }
     130              jQuery(this).find("img").attr({
     131                src: minus_path
     132
     133              });
     134            }
    129135          val = liste_visible.join(",");
    130           jQuery("input[name=list_visible]").val(val);
    131          
     136            jQuery("input[name=list_visible]").val(val);
     137            jQuery('#set').val("true");
    132138          jQuery("#set").click();
    133139
    134140
    135141        }); // click
    136       }); //each fieldset
     142        }); //each fieldset
    137143      //==========================================================
    138144
     
    145151      liste_des_plugins_activés.push(jQuery(this).attr('id'));
    146152    });
    147    
     153
    148154    //==============================================================
    149     jQuery("input.button").each(
     155    jQuery("input").each(
    150156        function (i) {
    151157          jQuery(this).click(function (event) {
     
    178184        send_val({
    179185          liste_des_plugins_activés: liste_des_plugins_activés,
    180           add_plugins: query.plugin,
    181           set: "true",
    182           action: query.action
     186            add_plugins: query.plugin,
     187            set: "true",
     188            action: query.action
    183189        });
     190
     191
    184192        /* */
     193
    185194      }
    186195
    187196    });
    188197  }); // load
    189 });                                                                                         //ready           
     198});                                                                                  //ready           
    190199           
  • extensions/set_plugins/main.inc.php

    r11484 r11499  
    1414define('SET_PLUGINS_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    1515
    16 //$SET_PLUGINS_PATH_ABS = str_replace('\\','/',dirname(__FILE__) );
     16$SET_PLUGINS_PATH_ABS = str_replace('\\','/', realpath(SET_PLUGINS_PATH)."\\" );
    1717if (!defined('SET_PLUGINS_PATH_ABS'))
    1818define(
    19   'SET_PLUGINS_PATH_ABS',   realpath(SET_PLUGINS_PATH)."\\"
     19  'SET_PLUGINS_PATH_ABS',   $SET_PLUGINS_PATH_ABS
    2020);
    2121
  • extensions/set_plugins/set_plugins_class.php

    r11497 r11499  
    1616  function begin_admin() {
    1717    global $erreur_message,$liste_des_plugins_activés,$liste_active_plugins,$page; 
    18     //========= Liste des plugins actifs =================   
    19     if (!isset($page['body_id'])) return;
    20     if($page['body_id']!='theAdminPage' ) return ;
    21     if($page['page']=='plugins_list' || $page['page']=='plugins'){
     18      //========= Liste des plugins actifs =================
     19if (!isset($page['body_id'])) return;
     20if($page['body_id']!='theAdminPage' ) return ;
     21if($page['page']=='plugins_list' || $page['page']=='plugins'){
    2222      $plugins = new plugins();
    2323      $plugins->sort_fs_plugins('name');
    2424      $liste_des_plugins_activés = array();
    25       foreach ($plugins->fs_plugins as $plugin_id => $fs_plugin){
    26         if(isset( $plugins->db_plugins_by_id[$plugin_id])){
    27           $State_id=$plugins->db_plugins_by_id[$plugin_id]['state'] ;
    28           if($State_id=="active" && $plugin_id!="set_plugins")
     25  foreach ($plugins->fs_plugins as $plugin_id => $fs_plugin){
     26      if(isset( $plugins->db_plugins_by_id[$plugin_id])){
     27        $State_id=$plugins->db_plugins_by_id[$plugin_id]['state'] ;
     28        if($State_id=="active" && $plugin_id!="set_plugins")
    2929            array_push($liste_des_plugins_activés,$plugin_id);
    30         }     
     30  }
    3131      }   //foreach
    32       if (isset($_GET['set'])){       
    33   //pwg_set_session_var('plugins_new_order', $_GET['plugins_new_order']);
    34   //exit;
     32      if (isset($_GET['set'])){ 
    3533        $ret['config']=$_GET;
    3634        $ret['liste_plugins']=$liste_des_plugins_activés;
     
    3937             set_plugins::save_config();
    4038        echo json_encode($ret);   
    41  
    42         exit;
    43       }
     39
     40   exit;
     41}
    4442      $liste_active_plugins=$liste_des_plugins_activés;
    45     }
     43   }
    4644  }
    4745  //============================================================================
     
    217215  $template->set_filenames(
    218216    array(    'cl_plugin' => SET_PLUGINS_PATH_ABS.'template/admin.tpl'  )
    219     );
     217  );
    220218
    221219  //===========================================================
     
    253251function get_file_name(){
    254252global  $edited_file,$infos_message;
    255  
    256   $dir = realpath("./local/plugins");   
    257   if (!is_dir($dir)){ 
    258   $dir = realpath("./local")."\\plugins";   
    259    $umask = umask(0);
    260     $mkd = @mkdir($dir, 0755, true );
    261     umask($umask);
    262     }
    263    $dir = realpath("./local/plugins/set_plugins");   
     253  $dir=realpath('./local/plugins/set_plugins');
    264254  if (!is_dir($dir)){   
    265     $dir= realpath('./local/plugins'). "\\set_plugins";
    266     $umask = umask(0);
    267     $mkd = @mkdir($dir, 0755, true );
    268     umask($umask);
    269     if ($mkd==false){
    270       fatal_error( "$dir ".l10n('no write access'));       
    271     }
    272   //  $file = $dir.'\\.htaccess';
    273    // @file_put_contents( $file, 'allow from all' );
    274   }   
    275   $dir=realpath('./local/plugins/set_plugins');
     255       $dir=realpath('./local/plugins');
     256      if (!is_dir($dir)){   
     257         $dir=str_replace("\\","/",realpath('./local').'/plugins');   
     258         $umask = umask(0);
     259         $mkd = @mkdir($dir, 0755, true );
     260         umask($umask);
     261         if ($mkd==false){
     262           fatal_error( "1°) $dir ".l10n('no write access'));       
     263          }
     264        }
     265      //=====================================================
     266      $dir=realpath('./local/plugins/set_plugins');   
     267      if (!is_dir($dir)){   
     268       
     269       $dir=str_replace("\\","/",realpath('./local/plugins').'/set_plugins');   
     270        $umask = umask(0);
     271        $mkd = @mkdir($dir, 0755, true );
     272        umask($umask);
     273        if ($mkd==false){
     274          fatal_error( "2°) $dir ".l10n('no write access'));
     275        }
     276         //$file = $dir.'\\.htaccess';
     277         //@file_put_contents( $file, 'allow from all' );
     278      }   
     279      $dir=realpath('./local/plugins/set_plugins');
     280  }
     281
    276282  if(!isset($edited_file) || $edited_file=="")
    277283  $edited_file=$dir."/config.txt";
    278284  $edited_file=str_replace("\\","/", $edited_file);
     285
     286
    279287  return $edited_file ;
    280288}
  • extensions/set_plugins/template/admin.tpl

    r11497 r11499  
    3434    </span>
    3535       
    36     {/if}
     36{/if}
    3737</td>       
    3838
  • extensions/set_plugins/template/menu.tpl

    r11497 r11499  
    11</legend>
    22<form action="{$action}" method="POST" name="form_set_plugins" id="form_set_plugins">
    3 <input name="add_plugins" type="hidden" id="add_plugins" value="{$add_plugins}" />
    4 <input type="submit" class="button" style="display:none" id="set" name="set" value="{$set}" />
    5 <input name="list_visible" style="display:none" id="list_visible" type="text" class="button"
    6   value="{$list_visible}" />
    7 <input name="submit" type="submit" value="{'Deactivate'|@translate}" class="button cluetip"
     3<input type="submit" style="display: none" id="set" name="set" value="{$set}" />
     4 
     5<input name="submit" type="submit" value="{'Deactivate'|@translate}" class="cluetip button"
    86  title="{'s_pl_action4'|@translate}" />
    9 <input name="submit" type="submit" value="{'Activate'|@translate}" class="button cluetip"
     7<input name="submit" type="submit" value="{'Activate'|@translate}" class="cluetip"
    108  title="{'s_pl_action5'|@translate}" />
    11 
    129<label class="cluetip" title="{'s_pl_action6'|@translate}">
    1310  {'nb'|@translate}:</label>
    1411<input name="nb" type="text" value="{$nb}" size="5" />
    15 
    16 
    17 <input type="submit" name="submit" class="cluetip button" title="{'s_pl_action7'|@translate}"
     12<input name="list_visible" id="list_visible" type="text" value="{$list_visible}" />
     13<input name="add_plugins" type="hidden" id="add_plugins" value="{$add_plugins}" />
     14<input type="submit" name="submit" class="cluetip" title="{'s_pl_action7'|@translate}"
    1815  value="{'store'|@translate}" />
    19 <input class="cluetip button" title="{'s_pl_action8'|@translate}  {$edited_file}"
    20   type="submit" value="{'save_file'|@translate}" name="submit" />
     16<input class="cluetip" title="{'s_pl_action8'|@translate}  {$edited_file}" type="submit"
     17  value="{'save_file'|@translate}" name="submit" />
    2118{if $restore}
    22 <input class="cluetip button " title="{'s_pl_action9'|@translate}  {$edited_file}"
    23   type="submit" value="{'restore'|@translate}" name="submit" onclick="return confirm('{'restore_confirm'|@translate|escape:'javascript'}');" />
     19<input class="cluetip" title="{'s_pl_action9'|@translate}  {$edited_file}" type="submit"
     20  value="{'restore'|@translate}" name="submit" onclick="return confirm('{'restore_confirm'|@translate|escape:'javascript'}');" />
    2421{/if}
Note: See TracChangeset for help on using the changeset viewer.