index beb81dfe131e31a2de3ceab40116b38cdf452e25..fbcfb4c97bfeb4d4be04e70f0d9e5d973ab05ac6 100644 (file)
var $organization = "";
var $eMail = "";
var $name = "";
- var $subscribe = TRUE;
- var $use_gosa_announce = TRUE;
+ var $subscribe = FALSE;
+ var $use_gosa_announce = FALSE;
+ var $feedback_url = "http://oss.gonicus.de/gosa-feedback/";
var $get_started = TRUE;
var $problems_encountered = "";
$this->update_strings();
}
+
function init()
{
$cv = $this->parent->captured_values;
/* Initialize values */
$this->use_since = date("Y");
$this->organization = preg_replace("/^[^=]*+=(.*),.*$/","\\1",$cv['base']);
- $this->distribution = PHP_OS."/".$_SERVER['SERVER_SOFTWARE'];
+ $this->distribution = "";
$this->web_server = $_SERVER['SERVER_SOFTWARE'];
-
$this->php_version = PHP_VERSION;
/* On first call check for rid/sid base */
$cv['connection'],
FALSE,
$cv['tls']);
-
$ldap->cd($cv['base']);
$ldap->search("(objectClass=*)",array("dn"));
$this->object_count=$ldap->count();
+ /* Preselect used features */
$oc = $ldap->get_objectclasses();
-
-
$this->features_used = array();
$this->features_used['posix'] = array("USED" => isset($oc['posixAccount']) ,
"NAME" => _("UNIX accounts/groups"));
$this->features_used['asterisk'] = array("USED" => isset($oc['goFonAccount']),
"NAME" => _("Asterisk administration"));
$this->features_used['inventory'] = array("USED" => isset($oc['glpiAccount']) ,
- "NAME" => _("System invetory"));
+ "NAME" => _("System inventory"));
$this->features_used['system'] = array("USED" => FALSE ,
"NAME" => _("System-/Configmanagement"));
$this->features_used['addressbook'] = array("USED" => FALSE ,
"NAME" => _("Addressbook"));
}
+
function update_strings()
{
$this->s_title = _("Notification and feedback");
$this->s_info = _("Get notifications or send feedback");
$this->s_title_long = _("Notification and feedback");
}
+
function execute()
{
$this->init();
}
+ $additional_info ="";
+
+ if(isset($_POST['send_feedback'])){
+
+ $msgs = $this->check_feedback();
+ if(count($msgs)){
+ foreach($msgs as $msg){
+ print_red($msg);
+ }
+ }else{
+ $str = $this->create_serialise_data_string();
+ $feedback_url = $this->feedback_url."?data=".base64_encode($str);
+
+ $ret = @fopen($feedback_url,"r");
+
+ if(!$ret){
+ print_red(sprintf(_("Could not connect to feedback server (%s). There is possibly no connection to the internet."),$this->feedback_url));
+ }else{
+ $ret_value="";
+ while($ret && !feof($ret)){
+ $ret_value.= fgets($ret,256);
+ }
+ if(!preg_match("/successful/i",$ret_value)){
+ print_red(_("Error while sending your feedback. The service is possible temporary unavailable"));
+ }else{
+ $additional_info = "<font color='green'>"._("Feedback sucessfully send")."</font>";
+ }
+ }
+ @fclose($ret);
+ }
+ }
+
$years = array();
for($i = date("Y") ; $i >= 2001; $i--){
$years[$i] = $i;
}
$smarty->assign("years",$years);
$smarty->assign("features_used",$this->features_used);
+ $smarty->assign("additional_info",$additional_info);
$smarty->assign ("must", "<font class=\"must\">*</font>");
return($smarty->fetch(get_template_path("setup_feedback.tpl",TRUE,dirname(__FILE__))));
}
+
+ function check_feedback()
+ {
+ $msgs = array();
+ if(!is_email($this->eMail) || empty($this->eMail)){
+ $msgs[] = _("Please specify a valid email address.");
+ }
+
+ if(!$this->subscribe && !$this->use_gosa_announce){
+ $msgs[] = _("You should have enabled at least one option, to subscribe or send your feedback.");
+ }
+
+ return($msgs);
+ }
+
+
function save_object()
{
if(isset($_POST['step_feedback'])){
$this->features_used[$key]['USED'] = FALSE;
}
}
- if(isset($_POST['send_feedback'])){
- $str = $this->create_serialise_data_string();
-
- $feedback_url = "http://dyn-111/hickert-test/feedback.php?data=".serialize($str);
- $ret = fopen($feedback_url,"r");
- $ret_value = fgets($ret,256);
- fclose($ret);
-
- if(!preg_match("/successfully/i",$ret_value)){
- print_red(_("Could not send feedback."));
- }
- }
}
-
}
+
function create_serialise_data_string()
{
-
$str = "#FEEDBACK ".date("H:i:s d:m:Y");
if($this->subscribe){
}else{
$str .= "\nGet started: FALSE";
}
- $str .= "\nProblems : ".base64_encode($this->problems_encountered);
+ $str .= "\nProblems : ".($this->problems_encountered);
if($this->first_use){
$str .= "\nFirst use: TRUE";
$str .="\nPHP_Version: ".$this->php_version;
$str .="\nLDAP Server: ".$this->ldap_server;
$str .="\nObject count: ".$this->object_count;
- $str .="\nMissing features: ".base64_encode($this->want_to_see_next);
+ $str .="\nMissing features: ".($this->want_to_see_next);
}
$str .= "\n\nFeatures used";