From 601799a087251358190fb8e8be0caf5556844428 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 26 Jul 2010 15:46:50 +0000 Subject: [PATCH] Updated several service dialogs, fixed typos, string, html, post handling and more. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19126 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/kerberos/class_krb5_policy.inc | 250 +++++++++--------- 1 file changed, 125 insertions(+), 125 deletions(-) diff --git a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_krb5_policy.inc b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_krb5_policy.inc index b3e5b6d92..3379df4cc 100644 --- a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_krb5_policy.inc +++ b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_krb5_policy.inc @@ -20,151 +20,151 @@ class krb5_policy extends plugin { - var $name = ""; - var $data = array(); - var $is_new = TRUE; - var $init_name =""; - var $parent ; - var $config ; - var $attributes = array("MASK","POLICY_REFCNT","PW_HISTORY_NUM","PW_MAX_LIFE", - "PW_MIN_CLASSES","PW_MIN_LENGTH","PW_MIN_LIFE"); - - - /*! \brief Initializes the policy class. + var $name = ""; + var $data = array(); + var $is_new = TRUE; + var $init_name =""; + var $parent ; + var $config ; + var $attributes = array("MASK","POLICY_REFCNT","PW_HISTORY_NUM","PW_MAX_LIFE", + "PW_MIN_CLASSES","PW_MIN_LENGTH","PW_MIN_LIFE"); + + + /*! \brief Initializes the policy class. @param Object The GOsa configuration object. @param Array The policy data array to edit or an empty array() @param Object The parent object. - */ - public function __construct($config,$entry,$parent) - { - $this->config = $config; - $this->parent = $parent; - if(count($entry)){ - $this->is_new =FALSE; - $this->name = $entry['NAME']; - $this->data = $entry['DATA']; - }else{ - $this->data['MASK'] = 0; - $this->data['POLICY_REFCNT'] = 0; - $this->data['PW_HISTORY_NUM'] = 5; - $this->data['PW_MAX_LIFE'] = 604800; - $this->data['PW_MIN_CLASSES'] = 3; - $this->data['PW_MIN_LENGTH'] = 6; - $this->data['PW_MIN_LIFE'] = 36000; + */ + public function __construct($config,$entry,$parent) + { + $this->config = $config; + $this->parent = $parent; + if(count($entry)){ + $this->is_new =FALSE; + $this->name = $entry['NAME']; + $this->data = $entry['DATA']; + }else{ + $this->data['MASK'] = 0; + $this->data['POLICY_REFCNT'] = 0; + $this->data['PW_HISTORY_NUM'] = 5; + $this->data['PW_MAX_LIFE'] = 604800; + $this->data['PW_MIN_CLASSES'] = 3; + $this->data['PW_MIN_LENGTH'] = 6; + $this->data['PW_MIN_LIFE'] = 36000; + } + $this->init_name = $this->name; } - $this->init_name = $this->name; - } - - /*! \brief Returns a HTML ui which allows - configuring this policy + + /*! \brief Returns a HTML ui which allows + configuring this policy @return String a HTML interface. - */ - public function execute() - { - $display = plugin::execute(); - $smarty = get_smarty(); - - $smarty->assign("name",$this->name); - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->data[$attr]); + */ + public function execute() + { + $display = plugin::execute(); + $smarty = get_smarty(); + + $smarty->assign("name", set_post($this->name)); + foreach($this->attributes as $attr){ + $smarty->assign($attr, set_post($this->data[$attr])); + } + + $smarty->assign("POLICY_REFCNT", sprintf(""._("This policy is referenced %d times.")."", $this->data["POLICY_REFCNT"])); + return($smarty->fetch(get_template_path("krb5_policy.tpl",TRUE,dirname(__FILE__)))); } - $smarty->assign("POLICY_REFCNT", sprintf(""._("This policy is referenced %d times.")."", $this->data["POLICY_REFCNT"])); - return($smarty->fetch(get_template_path("krb5_policy.tpl",TRUE,dirname(__FILE__)))); - } - - - /*! \brief Saves the HTML posted variables - */ - public function save_object() - { - if(isset($_POST['Policy_Posted'])){ - if(isset($_POST['name'])){ - $this->name = get_post("name"); - } - foreach($this->attributes as $attr){ - if(isset($_POST[$attr])){ - $this->data[$attr] = get_post($attr); + + /*! \brief Saves the HTML posted variables + */ + public function save_object() + { + if(isset($_POST['Policy_Posted'])){ + if(isset($_POST['name'])){ + $this->name = get_post("name"); + } + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->data[$attr] = get_post($attr); + } + } } - } } - } - - - /*! \brief Checks the given input + + + /*! \brief Checks the given input @return Array Containing errors about incorrect values. - */ - public function check() - { - $message = array(); - $names = $this->parent->getPolicyNames(); - if($this->name != $this->init_name && in_array($this->name,$names)){ - $message[] = msgPool::duplicated(_("Policy name")); - } - if(empty($this->name)){ - $message[] = msgPool::required(_("Policy name")); - } - - if(!preg_match("/^[a-z0-9\@\.\-_]*$/i",$this->name)){ - $message[] = msgPool::invalid(_("Policy name"),$this->name,"/[a-z0-9]/i"); - } + */ + public function check() + { + $message = array(); + $names = $this->parent->getPolicyNames(); + if($this->name != $this->init_name && in_array($this->name,$names)){ + $message[] = msgPool::duplicated(_("Policy name")); + } + if(empty($this->name)){ + $message[] = msgPool::required(_("Policy name")); + } - /* Check password history */ - if(!is_numeric($this->data['PW_HISTORY_NUM'])){ - $message[] = msgPool::invalid(_("Password history size")); - }elseif($this->data['PW_HISTORY_NUM'] <= 0){ - $message[] = msgPool::toosmall(_("Password history size")); - } + if(!preg_match("/^[a-z0-9\@\.\-_]*$/i",$this->name)){ + $message[] = msgPool::invalid(_("Policy name"),$this->name,"/[a-z0-9]/i"); + } - /* Check password minimum length */ - if(!is_numeric($this->data['PW_MIN_LENGTH'])){ - $message[] = msgPool::invalid(_("Minimum password length")); - }elseif($this->data['PW_MIN_LENGTH'] <= 0){ - $message[] = msgPool::toosmall(_("Minimum password length")); - } + /* Check password history */ + if(!is_numeric($this->data['PW_HISTORY_NUM'])){ + $message[] = msgPool::invalid(_("Password history size")); + }elseif($this->data['PW_HISTORY_NUM'] <= 0){ + $message[] = msgPool::toosmall(_("Password history size")); + } - /* Check password different character classes */ - if(!is_numeric($this->data['PW_MIN_CLASSES'])){ - $message[] = msgPool::invalid(_("Required different characters")); - }elseif($this->data['PW_MIN_CLASSES'] <= 0){ - $message[] = msgPool::toosmall(_("Required different characters")); - }elseif($this->data['PW_MIN_CLASSES'] > $this->data['PW_MIN_LENGTH']){ - $message[] = sprintf(_("The value specified for '%s' must be smaller than the value specified for '%s'!"), - _("Required different characters"),_("Minimum password length")); - } + /* Check password minimum length */ + if(!is_numeric($this->data['PW_MIN_LENGTH'])){ + $message[] = msgPool::invalid(_("Minimum password length")); + }elseif($this->data['PW_MIN_LENGTH'] <= 0){ + $message[] = msgPool::toosmall(_("Minimum password length")); + } - /* Check password min lifetime */ - if(!is_numeric($this->data['PW_MIN_LIFE'])){ - $message[] = msgPool::invalid(_("Minimum password lifetime")); - }elseif($this->data['PW_MIN_LIFE'] <= 0){ - $message[] = msgPool::toosmall(_("Minimum password lifetime")); - } + /* Check password different character classes */ + if(!is_numeric($this->data['PW_MIN_CLASSES'])){ + $message[] = msgPool::invalid(_("Required different characters")); + }elseif($this->data['PW_MIN_CLASSES'] <= 0){ + $message[] = msgPool::toosmall(_("Required different characters")); + }elseif($this->data['PW_MIN_CLASSES'] > $this->data['PW_MIN_LENGTH']){ + $message[] = sprintf(_("The value specified for '%s' must be smaller than the value specified for '%s'!"), + _("Required different characters"),_("Minimum password length")); + } + + /* Check password min lifetime */ + if(!is_numeric($this->data['PW_MIN_LIFE'])){ + $message[] = msgPool::invalid(_("Minimum password lifetime")); + }elseif($this->data['PW_MIN_LIFE'] <= 0){ + $message[] = msgPool::toosmall(_("Minimum password lifetime")); + } - /* Check password lifetime */ - if(!is_numeric($this->data['PW_MAX_LIFE'])){ - $message[] = msgPool::invalid(_("Password lifetime")); - }elseif($this->data['PW_MAX_LIFE'] <= 0){ - $message[] = msgPool::toosmall(_("Password lifetime")); - }elseif($this->data['PW_MAX_LIFE'] < $this->data['PW_MIN_LIFE']){ - $message[] = sprintf(_("The value specified for '%s' must be smaller than the value specified for '%s'!"), - _("Minimum password lifetime"),_("Password lifetime")); + /* Check password lifetime */ + if(!is_numeric($this->data['PW_MAX_LIFE'])){ + $message[] = msgPool::invalid(_("Password lifetime")); + }elseif($this->data['PW_MAX_LIFE'] <= 0){ + $message[] = msgPool::toosmall(_("Password lifetime")); + }elseif($this->data['PW_MAX_LIFE'] < $this->data['PW_MIN_LIFE']){ + $message[] = sprintf(_("The value specified for '%s' must be smaller than the value specified for '%s'!"), + _("Minimum password lifetime"),_("Password lifetime")); + } + + return($message); } - return($message); - } - - /*! \brief Returns object data of the currently edited policy + /*! \brief Returns object data of the currently edited policy @return Array A multidimensional array containing policy informations. - */ - public function save() - { - $ret = array(); - $ret['NAME'] = $this->name; - $ret['DATA'] = $this->data; - return($ret); - } + */ + public function save() + { + $ret = array(); + $ret['NAME'] = $this->name; + $ret['DATA'] = $this->data; + return($ret); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -- 2.30.2