/[drupal]/contributions/modules/installator/installator.module
ViewVC logotype

Diff of /contributions/modules/installator/installator.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Thu Sep 11 20:12:43 2008 UTC revision 1.2, Thu Sep 11 21:34:21 2008 UTC
# Line 63  function installator_install_theme(){ Line 63  function installator_install_theme(){
63  }  }
64    
65  function installator_install_module_form($form_state){  function installator_install_module_form($form_state){
66      $form = installator_install_form($form_state);      $form = installator_install_form($form_state,'Module');
67      $form["type"] = array('#type'=>'hidden','#value'=>'module');      $form["type"] = array('#type'=>'hidden','#value'=>'module');
68      return $form;      return $form;
69  }  }
70    
71  function installator_install_theme_form($form_state){  function installator_install_theme_form($form_state){
72      $form = installator_install_form($form_state);      $form = installator_install_form($form_state,'Theme');
73      $form["type"] = array('#type'=>'hidden','#value'=>'theme');      $form["type"] = array('#type'=>'hidden','#value'=>'theme');
74      return $form;      return $form;
75  }  }
76    
77  function installator_install_form($form_state){  function installator_install_form($form_state,$which){
78    
79      if (variable_get("installator_ftp_user","")==="")      if (variable_get("installator_ftp_user","")==="")
80          drupal_set_message(t("It looks like you haven't configured this module yet. Go ").l("here","admin/settings/installator").t(" to do so."));          drupal_set_message(t("It looks like you haven't configured this module yet. Go ").l("here","admin/settings/installator").t(" to do so."));
# Line 104  function installator_install_form($form_ Line 104  function installator_install_form($form_
104    
105      $form['furl']['submit'] = array(      $form['furl']['submit'] = array(
106          '#type' => 'submit',          '#type' => 'submit',
107          '#value' => t('Install Module'),          '#value' => t("Install $which"),
108      );      );
109    
110      $form['upload'] = array(      $form['upload'] = array(
# Line 125  function installator_install_form($form_ Line 125  function installator_install_form($form_
125    
126      $form['upload']['submit'] = array(      $form['upload']['submit'] = array(
127          '#type' => 'submit',          '#type' => 'submit',
128          '#value' => t('Upload Module'),          '#value' => t("Upload $which"),
129      );      );
130      return $form;      return $form;
131  }  }
# Line 148  function installator_install_form_submit Line 148  function installator_install_form_submit
148              drupal_set_message(t("Please Enter your FTP password"),'error');return;              drupal_set_message(t("Please Enter your FTP password"),'error');return;
149          }          }
150          $name = basename($form_state["values"]["furl"]["url"]);          $name = basename($form_state["values"]["furl"]["url"]);
151          $data = file_get_contents($form_state["values"]["furl"]["url"]);          $data = @file_get_contents($form_state["values"]["furl"]["url"]);
152          $pwd = $form_state["values"]["furl"]["pwd"];          $pwd = $form_state["values"]["furl"]["pwd"];
153          if (!$data){          if (!$data){
154              drupal_set_message(t("Error Getting File Data"),'error');return;              drupal_set_message(t("Error Getting File Data"),'error');return;
# Line 162  function installator_install_form_submit Line 162  function installator_install_form_submit
162              drupal_set_message(t("Please Enter your FTP password"),'error');return;              drupal_set_message(t("Please Enter your FTP password"),'error');return;
163          }          }
164          $name = $_FILES["files"]["name"]["upload"];          $name = $_FILES["files"]["name"]["upload"];
165          $data = file_get_contents($_FILES["files"]["tmp_name"]["upload"]);          $data = @file_get_contents($_FILES["files"]["tmp_name"]["upload"]);
166          $pwd = $form_state["values"]["upload"]["pwd"];          $pwd = $form_state["values"]["upload"]["pwd"];
167          if (!$data){          if (!$data){
168              drupal_set_message(t("Error Uploading File"),'error');return;              drupal_set_message(t("Error Uploading File"),'error');return;
# Line 179  function installator_install_form_submit Line 179  function installator_install_form_submit
179      if (!($res===FALSE)){      if (!($res===FALSE)){
180          if ($res){          if ($res){
181              foreach($res as $name){              foreach($res as $name){
182                  drupal_set_message(t('The module "').$name[0].t('" was successfully installed. You can enable it ').l("here",'admin/build/modules',array('fragment'=>$name[1]."::".$name[0])).t(' under the category "'.$name[1].'".'));                  if ($form_state["values"]["type"]=="module")
183                        drupal_set_message(t('The module "').$name[0].t('" was successfully installed. You can enable it ').l("here",'admin/build/modules',array('fragment'=>$name[1]."::".$name[0])).t(' under the category "'.$name[1].'".'));
184                    else
185                        drupal_set_message(t('The theme "').$name[0].t('" was successfully installed. You can enable it ').l("here",'admin/build/themes',array('fragment'=>$name[0])));
186              }              }
187          }else          }else
188              drupal_set_message(t("The module was successfully installed."));              drupal_set_message(t("The ".$form_state["values"]["type"]." was successfully installed."));
         $form_state['#redirect'] = 'admin/build/modules';  
         return 'admin/build/modules';  
189      }else{      }else{
190          drupal_set_message(t("Unable to install module."),"error");          drupal_set_message(t("Unable to install ".$form_state["values"]["type"]."."),"error");
191      }      }
192  }  }
193    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2