예제 #1
0
 /**
  * Get the message translated into the specified language
  * old function keeped for compatibility with old modules
  *
  * @param integer $messageId The ID of the message to get
  * @param array(string) $parameters An array of parameters which will replace %s in the returned string
  * @param string $module The codename of the module owner of the message
  * @return string
  * @access private
  */
 protected function _getOldMessage($messageId, $parameters = false, $module = '')
 {
     if (SensitiveIO::isPositiveInteger($messageId)) {
         if (!($string = $this->_getPrefetchedMessage($messageId, $module))) {
             $sql = "\n\t\t\t\t\tselect\n\t\t\t\t\t\t*\n\t\t\t\t\tfrom\n\t\t\t\t\t\tI18NM_messages\n\t\t\t\t\twhere\n\t\t\t\t\t\tid='" . io::sanitizeSQLString($messageId) . "' \n\t\t\t\t\t\tand module='" . io::sanitizeSQLString($module) . "'\n\t\t\t\t";
             $q = new CMS_query($sql);
             if ($q->getNumRows()) {
                 $data = $q->getArray();
                 $string = isset($data[$this->_code]) ? $data[$this->_code] : $data[APPLICATION_DEFAULT_LANGUAGE];
                 $this->_storeMessage($messageId, $module, $string);
                 if ($parameters) {
                     $replacement = SensitiveIO::arraySprintf($string, $parameters);
                     if (!$replacement) {
                         return $string;
                     } else {
                         return $replacement;
                     }
                 } else {
                     return $string;
                 }
             } else {
                 return '';
             }
         } else {
             if ($parameters) {
                 $replacement = SensitiveIO::arraySprintf($string, $parameters);
                 if (!$replacement) {
                     return $string;
                 } else {
                     return $replacement;
                 }
             } else {
                 return $string;
             }
         }
     } else {
         $this->raiseError("messageId is not a positive integer : " . $messageId);
         return $messageId;
     }
 }
예제 #2
0
 function getContent($type = 'menu')
 {
     //create a random name (useful for onSubmit purposes among other)
     $form_name = md5(mt_rand());
     $onSubmit = '0';
     $method = isset($this->_formAttributes["method"]) ? $this->_formAttributes["method"] : "post";
     if ($method != 'post') {
         $onSubmit = '1';
     }
     if ($type == 'DHTML' || $type == 'popup') {
         $content = '<tr><td width="100%" height="34" valign="top" nowrap="nowrap">';
     } else {
         $content = '<td width="34" height="35" onMouseOver="changeColor(this,\'A69C9A\');" onMouseOut="changeColor(this,\'\');" valign="center" align="center">';
     }
     $content .= '<form name="' . $form_name . '" method="' . $method . '" action="' . $this->_formAction . '" ';
     foreach ($this->_formAttributes as $name => $value) {
         if ($name != "method" && $name != "onSubmit" && $name != "onsubmit" && $name != "target") {
             $content .= $name . '="' . io::htmlspecialchars($value) . '" ';
         }
         if ($name == "onSubmit" || $name == "onsubmit") {
             $content .= $name . '="' . io::htmlspecialchars($value) . '" ';
             $onSubmit = '1';
         }
         if ($name == "target") {
             if ($value == "_blank") {
                 $onSubmit = '1';
             }
             $content .= $name . '="' . io::htmlspecialchars($value) . '" ';
         }
     }
     if (!$onSubmit && $type != 'popup') {
         $content .= ' onSubmit="check();" ';
     }
     $content .= '>';
     foreach ($this->_formHiddens as $name => $value) {
         $value = str_replace("\n", "", $value);
         $value = str_replace("\r", "", $value);
         $value = io::htmlspecialchars($value);
         $content .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
     }
     foreach ($this->_formTexts as $name => $textArray) {
         $value = $textArray["value"];
         $size = $textArray["size"];
         $code = $textArray["code"];
         $replace = array("\n" => '', "\r" => '');
         $value = str_replace(array_keys($replace), $replace, $value);
         $value = htmlspecialchars($value);
         $content .= SensitiveIO::arraySprintf($code, array('<input type="text" class="admin_input_text" name="' . $name . '" value="' . $value . '" size="' . $size . '" />'));
     }
     if ($type == 'DHTML' || $type == 'popup') {
         if ($this->_picto) {
             $content .= '<input align="absmiddle" type="image" src="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/' . $this->_picto . '" alt="' . $this->_label . '" title="' . $this->_label . '" value="' . $this->_label . '" /><input type="submit" onMouseOver="this.style.backgroundColor=\'#D0CBCA\';" onMouseOut="this.style.backgroundColor=\'#FFFFFF\';" class="CMS_dhtml_input_submit" value="' . $this->_label . '" />';
         } else {
             $content .= '<input type="submit" class="admin_input_submit" value="' . $this->_label . '" style="width:130px" />';
         }
     } else {
         if ($this->_picto) {
             $content .= '<input type="image" src="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/' . $this->_picto . '" alt="' . $this->_label . '" title="' . $this->_label . '" value="' . $this->_label . '" />';
         } else {
             $content .= '<input type="submit" class="admin_input_submit" value="' . $this->_label . '" style="width:130px" />';
         }
     }
     if ($type == 'DHTML' || $type == 'popup') {
         $content .= '</form></td></tr>';
     } else {
         $content .= '</form></td>';
     }
     return $content;
 }
예제 #3
0
    function getContent($class = "admin")
    {
        //create a random name (useful for onSubmit purposes among other)
        $form_name = md5(mt_rand());
        $onSubmit = '0';
        $method = isset($this->_formAttributes["method"]) ? $this->_formAttributes["method"] : "post";
        if ($method != 'post') {
            $onSubmit = '1';
        }
        $content = '<form name="' . $form_name . '" method="' . $method . '" action="' . $this->_formAction . '" ';
        foreach ($this->_formAttributes as $name => $value) {
            if ($name != "method" && $name != "onSubmit" && $name != "onsubmit" && $name != "target") {
                $content .= $name . '="' . io::htmlspecialchars($value) . '" ';
            }
            if ($name == "onSubmit" || $name == "onsubmit") {
                $content .= $name . '="' . io::htmlspecialchars($value) . '" ';
                $onSubmit = '1';
            }
            if ($name == "target") {
                if ($value == "_blank") {
                    $onSubmit = '1';
                }
                $content .= $name . '="' . io::htmlspecialchars($value) . '" ';
            }
        }
        if (!$onSubmit) {
            $content .= ' onSubmit="check();" ';
        }
        $content .= '><tr>';
        foreach ($this->_formHiddens as $name => $value) {
            $value = str_replace("\n", "", $value);
            $value = str_replace("\r", "", $value);
            $value = io::htmlspecialchars($value);
            $content .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
        }
        $content .= '<td class="' . $class . '" align="center">';
        foreach ($this->_formTexts as $name => $textArray) {
            $value = $textArray["value"];
            $size = $textArray["size"];
            $code = $textArray["code"];
            $value = str_replace("\n", "", $value);
            $value = str_replace("\r", "", $value);
            $value = io::htmlspecialchars($value);
            $content .= SensitiveIO::arraySprintf($code, array('<input type="text" class="admin_input_text" name="' . $name . '" value="' . $value . '" size="' . $size . '" />'));
        }
        $content .= '<input type="submit" class="admin_input_' . $class . '" value="' . $this->_label . '" style="width:130px" /></td>
			</tr>
			</form>
		';
        return $content;
    }