function translate($txt)
{
    if (is_array($txt)) {
        $args = $txt;
    } else {
        $args = func_get_args();
    }
    $txt = array_shift($args);
    // Test if constant exists (constant without space)
    if (!defined($txt) && find($txt, " ") == 0) {
        if (!($key = getConstantName($txt))) {
            // auto create constant in translation files
            create_label_translation($txt);
        }
    }
    // Encode data
    $array_lang_convert_html = array('ru');
    if ($GLOBALS['__AJAX_LOAD_PAGE__'] == true && !in_array($_GET['l'], $array_lang_convert_html) && (find($_GET['mime'], "xml") > 0 || find($_GET['mime'], "rss") > 0)) {
        $txt = utf8decode($txt);
    } else {
        $txt = utf8encode($txt);
    }
    // convert %s by args
    for ($i = 0; $i < sizeof($args); $i++) {
        if ($GLOBALS['__AJAX_LOAD_PAGE__'] == true && !in_array($_GET['l'], $array_lang_convert_html) && (find($_GET['mime'], "xml") > 0 || find($_GET['mime'], "rss") > 0)) {
            $txt = preg_replace('/%s/', utf8decode($args[$i]), $txt, 1);
        } else {
            $txt = preg_replace('/%s/', utf8encode($args[$i]), $txt, 1);
        }
    }
    if ($GLOBALS['__AJAX_LOAD_PAGE__'] == true && in_array($_GET['l'], $array_lang_convert_html) && (find($_GET['mime'], "xml") > 0 || find($_GET['mime'], "rss") > 0)) {
        $txt = convert_utf8_to_html($txt);
    }
    return $txt;
}
Exemple #2
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_SMTP);
     // Admin
     $form = new Form($this);
     $table_form = new Table();
     $table_form->addRow();
     $this->edtHost = new TextBox($form);
     $this->edtHost->setValue(SMTP_HOST);
     $edtHostValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_HOST) . ":&nbsp;", $this->edtHost->setLiveValidation($edtHostValidation->addValidatePresence()->setFieldName(__(EDT_HOST))), "&nbsp;(ssl://smtp.gmail.com)");
     $this->edtPort = new TextBox($form);
     $this->edtPort->setValue(SMTP_PORT);
     $edtPortValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_PORT) . ":&nbsp;", $this->edtPort->setLiveValidation($edtPortValidation->addValidateNumericality(true)->setFieldName(__(EDT_PORT))), "&nbsp;(465)");
     $this->edtName = new TextBox($form);
     $this->edtName->setValue(utf8encode(SMTP_NAME));
     $edtNameValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_NAME) . ":&nbsp;", $this->edtName->setLiveValidation($edtNameValidation->addValidatePresence()->setFieldName(__(EDT_NAME))), "&nbsp;(Robert Francis)");
     $this->edtMail = new TextBox($form);
     $this->edtMail->setValue(SMTP_MAIL);
     $edtMailValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_MAIL) . ":&nbsp;", $this->edtMail->setLiveValidation($edtMailValidation->addValidatePresence()->addValidateEmail()->setFieldName(__(EDT_MAIL))), "&nbsp;(robert.francis@gmail.com)");
     $this->cmbAuth = new ComboBox($form);
     $this->cmbAuth->addItem("false", __(DESACTIVATE), SMTP_AUTH == false ? true : false)->addItem("true", __(ACTIVATE), SMTP_AUTH == true ? true : false)->setWidth(143)->onChange("changeCmbAuth")->setAjaxEvent()->disableAjaxWaitMessage();
     $table_form->addRowColumns(__(CMB_AUTH) . ":&nbsp;", $this->cmbAuth, "&nbsp;(" . __(ACTIVATE) . ")");
     $this->edtUser = new TextBox($form);
     $this->edtUser->setValue(SMTP_USER);
     if (SMTP_AUTH == false) {
         $this->edtUser->disable();
     }
     $table_form->addRowColumns(__(EDT_USER) . ":&nbsp;", $this->edtUser, "&nbsp;(robert.francis@gmail.com)");
     $this->edtPassword = new Password($form);
     $this->edtPassword->setValue(SMTP_PASS);
     if (SMTP_AUTH == false) {
         $this->edtPassword->disable();
     }
     $table_form->addRowColumns(__(EDT_PASS) . ":&nbsp;", $this->edtPassword, "&nbsp;(*********)");
     $table_form->addRow();
     $btnValidate = new Button($form);
     $btnValidate->setValue(__(BTN_VALIDATE))->onClick("configureSmtp")->setAjaxEvent();
     $table_form->addRowColumns($btnValidate)->setColumnColspan(1, 3)->setColumnAlign(1, RowTable::ALIGN_CENTER);
     $table_form->addRow();
     $form->setContent($table_form);
     $this->render = new AdminTemplateForm($this, $form);
 }
Exemple #3
0
 public function Load()
 {
     if (defined('SEND_ERROR_BY_MAIL') && SEND_ERROR_BY_MAIL == true && !isLocalDebug()) {
         if ($this->is_trace) {
             // standard msg "administrator is notified"
             parent::$PAGE_TITLE = __(ERROR) . " - " . __(SITE_NAME);
             $box_title = __(ERROR);
             $debug_msg = __(ERROR_DEBUG_MAIL_SENT);
         } else {
             // no trace in the debug information
             parent::$PAGE_TITLE = "Debug error - " . __(SITE_NAME);
             $box_title = "Debug error";
             $debug_msg = $_POST['debug'];
         }
     } else {
         parent::$PAGE_TITLE = "Debug error - " . __(SITE_NAME);
         $box_title = "Debug error";
         $debug_msg = $_POST['debug'];
     }
     $error_title_table = new Table();
     $error_title_table->addRowColumns(new Picture("wsp/img/warning.png", 48, 48, 0, "absmidlle"), "&nbsp;", new Label(__(ERROR), true));
     $obj_error_msg = new Object($error_title_table, "<br/>");
     $debug_obj = new Object(utf8encode($debug_msg));
     $debug_obj->setAlign(Object::ALIGN_LEFT);
     $debug_obj->setWidth("80%");
     $obj_error_msg->add($debug_obj, "<br/><br/>");
     if ($GLOBALS['__AJAX_LOAD_PAGE__'] == false) {
         $obj_error_msg->add("<a href=\"" . $_GET['from_url'] . "\">Refresh this page</a>", "<br/><br/>");
     }
     $obj_error_msg->add("<b>Consult <a href=\"http://www.php.net\" target=\"_blank\">PHP</a> or <a href=\"http://www.website-php.com\" target=\"_blank\">WebSite-PHP</a> documentations.</b>", "<br/>");
     $obj_error_msg->add("<br/><br/>", "Go back to the main page", new Link(BASE_URL, Link::TARGET_NONE, __(SITE_NAME)));
     $this->render = new ErrorTemplate($obj_error_msg, $box_title);
     if (trim($_POST['debug']) != "") {
         $cache_filename = "";
         if (isset($_POST['cache_filename']) && trim($_POST['cache_filename']) != "") {
             $cache_filename = $this->getRealCacheFileName($_POST['cache_filename']);
             if (!file_exists($cache_filename)) {
                 $cache_filename = "";
             }
         }
         NewException::sendErrorByMail($_POST['debug'], $cache_filename);
     }
 }
Exemple #4
0
 /**
  * Method getValue
  * @access public
  * @param string $attribute 
  * @return mixed
  * @since 1.0.35
  */
 public function getValue($attribute)
 {
     if (!array_key_exists($attribute, $this->row)) {
         throw new NewException("Error DataRow->getValue(): attribute " . $attribute . " unknow in table " . $this->db_table_object->getDbTableName(), 0, getDebugBacktrace(1));
     }
     if (gettype($this->row[$attribute]) == "string") {
         $value = $this->row[$attribute];
         if ($this->activate_htmlentities) {
             $value = htmlentities(html_entity_decode($value));
             $value = str_replace("&lt;", "<", $value);
             $value = str_replace("&gt;", ">", $value);
             $value = str_replace("&quot;", "\"", $value);
             $value = str_replace("&#34;", "\"", $value);
             $value = str_replace("&#39;", "'", $value);
             $value = str_replace("&lsquo;", "'", $value);
             $value = str_replace("&rsquo;", "'", $value);
             $value = str_replace("&acute;", "'", $value);
         }
         return utf8encode($value);
     } else {
         return $this->row[$attribute];
     }
 }
 /**
  * Method prepareFieldsArray
  * @access public
  * @param mixed $properties [default value: array(]
  * @return mixed
  * @since 1.2.1
  */
 public function prepareFieldsArray($properties = array())
 {
     $this->fields_array = array();
     $list_attribute = $this->database_object->getDbTableAttributes();
     $list_attribute_type = $this->database_object->getDbTableAttributesType();
     $auto_increment_id = $this->database_object->getDbTableAutoIncrement();
     // Add properties to apply on all fields
     if (isset($properties[ModelViewMapper::PROPERTIES_ALL]) && is_array($properties[ModelViewMapper::PROPERTIES_ALL])) {
         $apply_all_array = $properties[ModelViewMapper::PROPERTIES_ALL];
         foreach ($apply_all_array as $property_name => $property_value) {
             for ($i = 0; $i < sizeof($list_attribute); $i++) {
                 $property[$property_name] = $property_value;
                 if (isset($properties[$list_attribute[$i]])) {
                     // Handle child override of global property
                     if (!isset($properties[$list_attribute[$i]][$property_name])) {
                         $properties[$list_attribute[$i]] = array_merge($properties[$list_attribute[$i]], $property);
                     }
                 } else {
                     $properties[$list_attribute[$i]] = $property;
                 }
             }
         }
     }
     // check foreign keys
     $db_table_foreign_keys = $this->database_object->getDbTableForeignKeys();
     foreach ($db_table_foreign_keys as $fk_attribute => $value) {
         if (isset($properties[$fk_attribute])) {
             $fk_property = $properties[$fk_attribute];
             if (isset($fk_property["fk_attribute"])) {
                 // create combobox
                 $cmb = new ComboBox($this->form_or_page);
                 // get foreign key data
                 $query = "select distinct " . $value["column"] . " as id, " . $fk_property["fk_attribute"] . " as value from " . $value["table"];
                 if (isset($fk_property["fk_where"])) {
                     $query .= " where " . $fk_property["fk_where"];
                 }
                 if (isset($fk_property["fk_orderby"])) {
                     $query .= " order by " . $fk_property["fk_orderby"];
                 }
                 $stmt = DataBase::getInstance()->prepareStatement($query);
                 $row = DataBase::getInstance()->stmtBindAssoc($stmt, $row);
                 while ($stmt->fetch()) {
                     $cmb->addItem(utf8encode($row['id']), utf8encode($row['value']));
                 }
                 // add combo box in properties
                 $value['cmb_obj'] = $cmb;
                 $properties[$fk_attribute] = array_merge($properties[$fk_attribute], $value);
             }
         }
     }
     foreach ($list_attribute as $i => $attribute) {
         $wspobject = "TextBox";
         $attribute_properties = array();
         if (is_array($properties[$attribute])) {
             $attribute_properties = $properties[$attribute];
         }
         if (isset($attribute_properties["display"]) && $attribute_properties["display"] == false) {
             continue;
         }
         $is_update_ok = true;
         if (isset($attribute_properties["update"]) && $attribute_properties["update"] == false) {
             $is_update_ok = false;
         }
         $method = "get" . $this->getFormatValue($attribute);
         $value = call_user_func_array(array($this->database_model_object, $method), array());
         if ($attribute != $auto_increment_id && $is_update_ok) {
             // get property cmb_obj
             if (isset($attribute_properties['cmb_obj'])) {
                 $field = $attribute_properties['cmb_obj'];
             } else {
                 if (isset($attribute_properties["wspobject"]) && $attribute_properties["wspobject"] != "") {
                     $wspobject = $attribute_properties["wspobject"];
                 } else {
                     if ($list_attribute_type[$i] == "datetime") {
                         $wspobject = "Calendar";
                     } else {
                         if ($list_attribute_type[$i] == "boolean") {
                             $wspobject = "CheckBox";
                         }
                     }
                 }
                 if ($wspobject == "Calendar") {
                     $field = new Calendar($this->form_or_page);
                 } else {
                     if ($wspobject == "CheckBox") {
                         $field = new CheckBox($this->form_or_page);
                     } else {
                         if ($wspobject == "TextArea") {
                             $field = new TextArea($this->form_or_page);
                         } else {
                             if ($wspobject == "Editor") {
                                 $field = new Editor($this->form_or_page);
                                 if (isset($attribute_properties["editor_param"]) && $attribute_properties["editor_param"] != "") {
                                     $field->setToolbar($attribute_properties["editor_param"]);
                                 }
                             } else {
                                 if ($wspobject == "ComboBox") {
                                     $field = new ComboBox($this->form_or_page);
                                     if (isset($attribute_properties["combobox_values"])) {
                                         if (is_array($attribute_properties["combobox_values"])) {
                                             for ($j = 0; $j < sizeof($attribute_properties["combobox_values"]); $j++) {
                                                 $field->addItem($attribute_properties["combobox_values"][$j]['value'], $attribute_properties["combobox_values"][$j]['text']);
                                             }
                                         } else {
                                             throw new NewException(get_class($this) . "->prepareFieldsArray() error: the property combobox_values need to be an array.", 0, getDebugBacktrace(1));
                                         }
                                     }
                                 } else {
                                     $field = new TextBox($this->form_or_page);
                                     if ($list_attribute_type[$i] == "integer" || $list_attribute_type[$i] == "double") {
                                         $field->setWidth(70);
                                     }
                                     if (in_array($attribute, $key_attributes)) {
                                         $lv = new LiveValidation();
                                         $field->setLiveValidation($lv->addValidatePresence());
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             // Handle Checkbox case that only support value as "on" or "off"
             if (get_class($field) == "CheckBox") {
                 if ($value == "1") {
                     $field->setValue("on");
                 } else {
                     $field->setValue("off");
                 }
             } else {
                 if (get_class($field) == "Calendar") {
                     $field->setValue($value);
                 } else {
                     $field->setValue(utf8encode($value));
                 }
             }
             if (isset($attribute_properties["width"]) && method_exists($field, "setWidth")) {
                 $field->setWidth($attribute_properties["width"]);
             }
             if (isset($attribute_properties["height"]) && method_exists($field, "setHeight")) {
                 $field->setHeight($attribute_properties["height"]);
             }
             if (isset($attribute_properties["class"]) && method_exists($field, "setClass")) {
                 $field->setClass($attribute_properties["class"]);
             }
             if (isset($attribute_properties["style"]) && method_exists($field, "setStyle")) {
                 $field->setStyle($attribute_properties["style"]);
             }
             if (isset($attribute_properties["disable"])) {
                 if ($attribute_properties["disable"] == true && method_exists($field, "disable")) {
                     $field->disable();
                 } else {
                     if ($attribute_properties["disable"] == false && method_exists($field, "enable")) {
                         $field->enable();
                     }
                 }
             }
             if (get_class($field) != "Calendar") {
                 if (isset($attribute_properties["strip_tags"]) && $attribute_properties["strip_tags"] == true && method_exists($field, "setStripTags")) {
                     if (isset($attribute_properties["allowable_tags"])) {
                         $field->setStripTags($attribute_properties["allowable_tags"]);
                     } else {
                         $field->setStripTags("");
                         // no tag allowed
                     }
                 }
             }
         } else {
             if (isset($attribute_properties['cmb_obj'])) {
                 $field_tmp = $attribute_properties['cmb_obj'];
                 $field_tmp->setValue($value);
                 $value = $field_tmp->getText();
             }
             if (get_class($value) == "DateTime") {
                 $value = $value->format("Y-m-d");
             }
             $field = new Object(utf8encode($value));
         }
         $this->fields_array[$attribute] = $field;
     }
     return $this->fields_array;
 }
Exemple #6
0
 /**
  * Method createDbAttributeObject
  * @access private
  * @param mixed $row 
  * @param mixed $list_attribute 
  * @param mixed $list_attribute_type 
  * @param mixed $i 
  * @param mixed $ind 
  * @param mixed $key_attributes 
  * @return mixed
  * @since 1.1.6
  */
 private function createDbAttributeObject($row, $list_attribute, $list_attribute_type, $i, $ind, $key_attributes)
 {
     // get property cmb_obj (created by method loadFromSqlDataView)
     if (isset($this->from_sql_data_view_properties[$list_attribute[$i]]['cmb_obj'])) {
         $input_obj_tmp = $this->from_sql_data_view_properties[$list_attribute[$i]]['cmb_obj'];
         $input_obj = clone $input_obj_tmp;
         $input_obj->setName($this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
         $register_objects = WebSitePhpObject::getRegisterObjects();
         $register_objects[] = $input_obj;
         $_SESSION['websitephp_register_object'] = $register_objects;
     } else {
         $wspobject = "TextBox";
         $attribute_properties = array();
         if (is_array($this->from_sql_data_view_properties[$list_attribute[$i]])) {
             $attribute_properties = $this->from_sql_data_view_properties[$list_attribute[$i]];
         }
         if (isset($attribute_properties["wspobject"]) && $attribute_properties["wspobject"] != "") {
             $wspobject = $attribute_properties["wspobject"];
         } else {
             if ($list_attribute_type[$i] == "datetime") {
                 $wspobject = "Calendar";
             } else {
                 if ($list_attribute_type[$i] == "boolean") {
                     $wspobject = "CheckBox";
                 }
             }
         }
         if ($wspobject == "Calendar") {
             $input_obj = new Calendar($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
         } else {
             if ($wspobject == "CheckBox") {
                 $input_obj = new CheckBox($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
             } else {
                 if ($wspobject == "TextArea") {
                     $input_obj = new TextArea($this->table_form_object, $object_id);
                 } else {
                     if ($wspobject == "Editor") {
                         $input_obj = new Editor($this->table_form_object, $object_id);
                         if (isset($attribute_properties["editor_param"]) && $attribute_properties["editor_param"] != "") {
                             $input_obj->setToolbar($attribute_properties["editor_param"]);
                         }
                     } else {
                         if ($wspobject == "ComboBox") {
                             $input_obj = new ComboBox($this->table_form_object, $object_id);
                             if (isset($attribute_properties["combobox_values"])) {
                                 if (is_array($attribute_properties["combobox_values"])) {
                                     for ($j = 0; $j < sizeof($attribute_properties["combobox_values"]); $j++) {
                                         $input_obj->addItem($attribute_properties["combobox_values"][$j]['value'], $attribute_properties["combobox_values"][$j]['text']);
                                     }
                                 } else {
                                     throw new NewException(get_class($this) . "->loadFromSqlDataView() error: the property combobox_values need to be an array.", 0, getDebugBacktrace(1));
                                 }
                             }
                         } else {
                             $input_obj = new TextBox($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
                             if ($list_attribute_type[$i] == "integer" || $list_attribute_type[$i] == "double") {
                                 $input_obj->setWidth(70);
                             }
                             if (in_array($list_attribute[$i], $key_attributes)) {
                                 $lv = new LiveValidation();
                                 $input_obj->setLiveValidation($lv->addValidatePresence());
                             }
                         }
                     }
                 }
             }
         }
     }
     // get properties width and strip_tags
     if (is_array($this->from_sql_data_view_properties[$list_attribute[$i]])) {
         $attribute_properties = $this->from_sql_data_view_properties[$list_attribute[$i]];
         if (isset($attribute_properties["width"]) && method_exists($input_obj, "setWidth")) {
             $input_obj->setWidth($attribute_properties["width"]);
         }
         if (isset($attribute_properties["height"]) && method_exists($input_obj, "setHeight")) {
             $input_obj->setHeight($attribute_properties["height"]);
         }
         if (isset($attribute_properties["class"]) && method_exists($input_obj, "setClass")) {
             $input_obj->setClass($attribute_properties["class"]);
         }
         if (isset($attribute_properties["style"]) && method_exists($input_obj, "setStyle")) {
             $input_obj->setStyle($attribute_properties["style"]);
         }
         if (isset($attribute_properties["disable"])) {
             if ($attribute_properties["disable"] == true && method_exists($input_obj, "disable")) {
                 $input_obj->disable();
             } else {
                 if ($attribute_properties["disable"] == false && method_exists($input_obj, "enable")) {
                     $input_obj->enable();
                 }
             }
         }
         if (get_class($input_obj) != "Calendar") {
             if (isset($attribute_properties["strip_tags"]) && $attribute_properties["strip_tags"] == true && method_exists($input_obj, "setStripTags")) {
                 if (isset($attribute_properties["allowable_tags"])) {
                     $input_obj->setStripTags($attribute_properties["allowable_tags"]);
                 } else {
                     $input_obj->setStripTags("");
                     // no tag allowed
                 }
             }
         }
     }
     if ($row != null) {
         // get property db_attribute
         $field_value = $row->getValue($list_attribute[$i]);
         if (isset($this->from_sql_data_view_properties[$list_attribute[$i]]["db_attribute"])) {
             $db_attribute = $this->from_sql_data_view_properties[$list_attribute[$i]]["db_attribute"];
             $field_value = $row->getValue($db_attribute);
         }
         $input_obj->onChange("onChangeTableFromSqlDataView")->setAjaxEvent()->disableAjaxWaitMessage();
         if (get_class($input_obj) == "TextBox") {
             $input_obj->onKeyUpJs("if (\$(this)[0].defaultValue != \$(this).val()) { \$('#" . $this->id . "_img_" . $ind . "_cancel_" . $list_attribute[$i] . "').hide(); } else { \$('#" . $this->id . "_img_" . $ind . "_cancel_" . $list_attribute[$i] . "').show(); }");
         }
         if ($list_attribute_type[$i] == "boolean") {
             if (!$input_obj->isChanged()) {
                 $input_obj->setValue($field_value == true ? "on" : "off");
             }
         } else {
             if (gettype($field_value) == "object") {
                 $input_obj->setValue($field_value);
             } else {
                 $input_obj->setValue(utf8encode($field_value));
             }
         }
     }
     return $input_obj;
 }
Exemple #7
0
/**
 * Codifica os valores de um array ou um objeto em UTF-8
 * @param	mixed	$data		dados a serem convertidos
 * @return	mixed				retorna o array ou objeto convertido
 */
function utf8encode($data)
{
    if (is_string($data)) {
        return utf8_encode($data);
    }
    if (is_array($data)) {
        $encoded = array();
        foreach ($data as $k => $d) {
            $encoded[$k] = utf8encode($d);
        }
        return $encoded;
    }
    if (is_object($data)) {
        $encoded = new stdClass();
        foreach ($data as $k => $d) {
            $encoded->{$k} = utf8encode($d);
        }
        return $encoded;
    }
    return $data;
}
function getMonth($month_number)
{
    return utf8encode($GLOBALS['months'][$month_number]);
}
 /**
  * Method printStaticDebugMessage
  * @access static
  * @param string|object $debug_msg 
  * @since 1.0.59
  */
 public static function printStaticDebugMessage($debug_msg)
 {
     // print the debug
     $GLOBALS['__ERROR_DEBUG_PAGE__'] = true;
     if ($GLOBALS['__DEBUG_PAGE_IS_PRINTING__'] == false) {
         $GLOBALS['__DEBUG_PAGE_IS_PRINTING__'] = true;
         if (gettype($debug_msg) == "object") {
             if (get_class($debug_msg) == "NewException") {
                 $debug_msg = NewException::generateErrorMessage($debug_msg->code, $debug_msg->message, $debug_msg->file, $debug_msg->line);
             } else {
                 $debug_msg = echo_r($debug_msg);
             }
         }
         if ($GLOBALS['__AJAX_PAGE__'] == false || $GLOBALS['__AJAX_LOAD_PAGE__'] == true && $_GET['mime'] == "text/html") {
             $_POST['debug'] = $debug_msg;
             $_GET['p'] = "error-debug";
             try {
                 if (!defined('FORCE_SERVER_NAME') || FORCE_SERVER_NAME == "") {
                     if ($_SERVER['SERVER_PORT'] == 443) {
                         $from_url = "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
                     } else {
                         $port = "";
                         if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != "") {
                             $port = ":" . $_SERVER['SERVER_PORT'];
                         }
                         $from_url = "http://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
                     }
                 } else {
                     $from_url = "http://" . FORCE_SERVER_NAME . $_SERVER['REQUEST_URI'];
                 }
                 $_GET['from_url'] = $from_url;
                 require_once dirname(__FILE__) . "/../../pages/error/error-debug.php";
                 $debug_page = new ErrorDebug(self::$trace !== false ? true : false);
                 if (method_exists($debug_page, "InitializeComponent")) {
                     $debug_page->InitializeComponent();
                 }
                 if (method_exists($debug_page, "Load")) {
                     $debug_page->Load();
                 }
                 $debug_page->loadAllVariables();
                 $__PAGE_IS_INIT__ = true;
                 $debug_page->executeCallback();
                 if (method_exists($debug_page, "Loaded")) {
                     $debug_page->Loaded();
                 }
                 $http_type = "";
                 $split_request_uri = explode("\\?", $_SERVER['REQUEST_URI']);
                 if (!defined('FORCE_SERVER_NAME') || FORCE_SERVER_NAME == "") {
                     if ($_SERVER['SERVER_PORT'] == 443) {
                         $http_type = "https://";
                         $current_url = str_replace("//", "/", $_SERVER['SERVER_NAME'] . substr($split_request_uri[0], 0, strrpos($split_request_uri[0], "/")) . "/");
                     } else {
                         $port = "";
                         if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != "") {
                             $port = ":" . $_SERVER['SERVER_PORT'];
                         }
                         $http_type = "http://";
                         $current_url = str_replace("//", "/", $_SERVER['SERVER_NAME'] . $port . substr($split_request_uri[0], 0, strrpos($split_request_uri[0], "/")) . "/");
                     }
                 } else {
                     $http_type = "http://";
                     $current_url = str_replace("//", "/", FORCE_SERVER_NAME . substr($split_request_uri[0], 0, strrpos($split_request_uri[0], "/")) . "/");
                 }
                 // define the base URL of the website
                 $my_base_url = "";
                 $array_cwd = explode('/', str_replace('\\', '/', getcwd()));
                 $wsp_folder_name = $array_cwd[sizeof($array_cwd) - 1];
                 // Detect base URL with the root folder of wsp
                 $array_current_url = explode('/', $current_url);
                 for ($i = sizeof($array_current_url) - 2; $i >= 0; $i--) {
                     if ($array_current_url[$i] == $wsp_folder_name) {
                         $my_base_url = $http_type;
                         for ($j = 0; $j <= $i; $j++) {
                             $my_base_url .= $array_current_url[$j] . "/";
                         }
                         break;
                     }
                 }
                 if ($my_base_url == "") {
                     if (!defined('FORCE_SERVER_NAME') || FORCE_SERVER_NAME == "") {
                         // If not find root folder then test if there is an alias
                         $array_script_name = explode('/', $_SERVER['SCRIPT_NAME']);
                         unset($array_script_name[sizeof($array_script_name) - 1]);
                         $alias_path = implode('/', $array_script_name);
                         if ($alias_path != "") {
                             // Alias detected
                             $my_base_url = $http_type . $array_current_url[0] . $alias_path . "/";
                         } else {
                             // No Alias detected
                             $my_base_url = $http_type . $array_current_url[0] . "/";
                         }
                     } else {
                         if (strtoupper(substr(FORCE_SERVER_NAME, 0, 7)) == "HTTP://" || strtoupper(substr(FORCE_SERVER_NAME, 0, 8)) == "HTTPS://") {
                             $my_base_url = FORCE_SERVER_NAME . "/";
                         } else {
                             $my_base_url = $http_type . FORCE_SERVER_NAME . "/";
                         }
                     }
                 }
                 $my_site_base_url = $my_base_url;
                 header("Content-Type: text/html");
                 echo "<html><head><title>Debug Error - " . utf8encode(SITE_NAME) . "</title>\n";
                 $jquery_style = "";
                 if (DEFINE_STYLE_JQUERY != "") {
                     $jquery_style = DEFINE_STYLE_JQUERY;
                 }
                 echo "<link type=\"text/css\" rel=\"StyleSheet\" href=\"" . $my_site_base_url . "combine-css/styles.php.css,angle.php.css,jquery" . JQUERY_UI_VERSION . "|" . $jquery_style . "|jquery-ui-" . JQUERY_UI_VERSION . ".custom.css";
                 if (trim(CssInclude::getInstance()->getCssConfigFile()) != "") {
                     echo "?conf_file=" . CssInclude::getInstance()->getCssConfigFile();
                 }
                 echo "\" media=\"screen\" />\n";
                 echo "<script type=\"text/javascript\" src=\"" . $my_site_base_url . "combine-js/jquery|jquery-" . JQUERY_VERSION . ".min.js,jquery|jquery-ui-" . JQUERY_UI_VERSION . ".custom.min.js,jquery.cookie.js,pngfix.js,utils.js\"></script>\n";
                 echo "<script type=\"text/javascript\" src=\"" . $my_site_base_url . "combine-js/jquery.backstretch.min.js,jquery.cookie.js\"></script>\n";
                 echo "<meta name=\"Robots\" content=\"noindex, nofollow\" />\n";
                 echo "<base href=\"" . $my_site_base_url . "\" />\n";
                 echo "</head><body>\n";
                 echo $debug_page->render();
                 if ($GLOBALS['__AJAX_LOAD_PAGE__'] == true && $GLOBALS['__AJAX_LOAD_PAGE_ID__'] != "") {
                     echo "<script type=\"text/javascript\">\n";
                     echo "lauchJavascriptPage_" . $GLOBALS['__AJAX_LOAD_PAGE_ID__'] . " = function() {\n";
                     echo "\t\$('#idLoadPageLoadingPicture" . $GLOBALS['__AJAX_LOAD_PAGE_ID__'] . "').attr('style', 'display:none;');\n";
                     echo "\t\$('#idLoadPageContent" . $GLOBALS['__AJAX_LOAD_PAGE_ID__'] . "').attr('style', 'display:block;');\n";
                     echo "};\n";
                     echo "\twaitForJsScripts(" . $GLOBALS['__AJAX_LOAD_PAGE_ID__'] . ");\n";
                     echo "\tLoadPngPicture();\n";
                     echo "</script>\n";
                 }
                 echo "</body></html>\n";
             } catch (Exception $e) {
                 echo $e->getMessage();
                 NewException::sendErrorByMail($debug_msg);
             }
         } else {
             header('HTTP/1.1 500 Internal Server Error');
             if (defined('SEND_ERROR_BY_MAIL') && SEND_ERROR_BY_MAIL == true && !isLocalDebug()) {
                 if (self::$trace !== false) {
                     // standard msg "administrator is notified"
                     echo __(ERROR_DEBUG_MAIL_SENT);
                 } else {
                     // no trace in the debug information
                     echo utf8encode($debug_msg);
                 }
             } else {
                 echo utf8encode($debug_msg);
             }
             NewException::sendErrorByMail($debug_msg);
             exit;
         }
     }
 }
Exemple #10
0
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object Calendar
  * @since 1.0.93
  */
 public function render($ajax_render = false)
 {
     if ($this->live_validation != null) {
         parent::onChangeJs(parent::getOnChangeJs() . "LV_" . $this->getId() . ".validate();");
     }
     $html = parent::render($ajax_render);
     $html .= $this->getJavascriptTagOpen();
     $html .= "\$.datepicker.setDefaults(\$.datepicker.regional[\"" . $_SESSION['lang'] . "\"]);\n";
     $html .= "\$(\"#" . $this->getId() . "\").datepicker({ ";
     if ($this->maxDate != "") {
         $html .= "maxDate: '" . $this->maxDate . "', ";
     }
     if ($this->dateFormat != "") {
         $html .= "dateFormat: '" . $this->dateFormat . "', ";
     }
     if ($this->showButtonPanel) {
         $html .= "showButtonPanel: true, ";
     }
     if ($this->changeMonth) {
         $html .= "changeMonth: true, ";
     }
     if ($this->changeYear) {
         $html .= "changeYear: true, ";
     }
     if ($this->showOtherMonths) {
         $html .= "showOtherMonths: true, ";
     }
     if ($this->selectOtherMonths) {
         $html .= "selectOtherMonths: true, ";
     }
     if ($this->showWeek) {
         $html .= "showWeek: true, ";
     }
     if ($this->firstDay != "") {
         $html .= "firstDay: " . $this->firstDay . ", ";
     } else {
         $html .= "firstDay: 1, ";
     }
     if ($this->numberOfMonths != "") {
         $html .= "numberOfMonths: " . $this->numberOfMonths . ", ";
     }
     if ($this->minDate != -999999999) {
         $html .= "minDate: '";
         if (get_class($this->minDate) == "DateTime") {
             if ($this->dateFormat == "") {
                 $html .= $this->minDate->format("m-d-Y");
             } else {
                 if (array_key_exists($this->dateFormat, $this->dateFormatConvertPhpFormat)) {
                     $html .= $this->minDate->format($this->dateFormatConvertPhpFormat[$this->dateFormat]);
                 } else {
                     $html .= $this->minDate->format($this->dateFormat);
                 }
             }
         } else {
             $html .= $this->minDate;
         }
         $html .= "', ";
     }
     $html .= "showAnim: '" . $this->showAnim . "'";
     if ($this->getPage()->getLanguage() != "en") {
         $html .= ",monthNames: [";
         if (sizeof($this->monthNames) > 0) {
             for ($i = 0; $i < sizeof($this->monthNames); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->monthNames[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(__(__JANUARY__))) . "', '" . addslashes(utf8encode(__(__FEBRUARY__))) . "', '" . addslashes(utf8encode(__(__MARCH__))) . "', '" . addslashes(utf8encode(__(__APRIL__))) . "', '" . addslashes(utf8encode(__(__MAY__))) . "', '" . addslashes(utf8encode(__(__JUNE__))) . "', '" . addslashes(utf8encode(__(__JULY__))) . "', '" . addslashes(utf8encode(__(__AUGUST__))) . "', '" . addslashes(utf8encode(__(__SEPTEMBER__))) . "', '" . addslashes(utf8encode(__(__OCTOBER__))) . "', '" . addslashes(utf8encode(__(__NOVEMBER__))) . "', '" . addslashes(utf8encode(__(__DECEMBER__))) . "']";
         }
         $html .= ",dayNames: [";
         if (sizeof($this->dayNames) > 0) {
             for ($i = 0; $i < sizeof($this->dayNames); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->dayNames[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(__(__SUNDAY__))) . "', '" . addslashes(utf8encode(__(__MONDAY__))) . "', '" . addslashes(utf8encode(__(__TUESDAY__))) . "', '" . addslashes(utf8encode(__(__WEDNESDAY__))) . "', '" . addslashes(utf8encode(__(__THURSDAY__))) . "', '" . addslashes(utf8encode(__(__FRIDAY__))) . "', '" . addslashes(utf8encode(__(__SATURDAY__))) . "']";
         }
         $html .= ",monthNamesShort: [";
         if (sizeof($this->monthNamesShort) > 0) {
             for ($i = 0; $i < sizeof($this->monthNamesShort); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->monthNamesShort[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(substr(__(__JANUARY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__FEBRUARY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__MARCH__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__APRIL__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__MAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__JUNE__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__JULY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__AUGUST__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__SEPTEMBER__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__OCTOBER__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__NOVEMBER__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__DECEMBER__), 0, 3))) . "']";
         }
         $html .= ",dayNamesShort: [";
         if (sizeof($this->dayNamesShort) > 0) {
             for ($i = 0; $i < sizeof($this->dayNamesShort); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->dayNamesShort[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(substr(__(__SUNDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__MONDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__TUESDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__WEDNESDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__THURSDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__FRIDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__SATURDAY__), 0, 3))) . "']";
         }
         $html .= ",dayNamesMin: [";
         if (sizeof($this->dayNamesMin) > 0) {
             for ($i = 0; $i < sizeof($this->dayNamesMin); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->dayNamesMin[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(substr(__(__SUNDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__MONDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__TUESDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__WEDNESDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__THURSDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__FRIDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__SATURDAY__), 0, 2))) . "']";
         }
     }
     $html .= "});\n";
     $html .= $this->getJavascriptTagClose();
     return $html;
 }
Exemple #11
0
        } else {
            ?>
          (tarteaucitron.job = tarteaucitron.job || []).push('analytics');
          tarteaucitron.user.analyticsUa = '<?php 
            echo GOOGLE_CODE_TRACKER;
            ?>
';
          tarteaucitron.user.analyticsMore = function () {
              ga('require', 'displayfeatures');
              ga('send', 'pageview', {
                  'page': '<?php 
            echo "/" . str_replace($page_object->getBaseURL(), "", $page_object->getCurrentURL());
            ?>
',
                  'title': '<?php 
            echo addslashes(str_replace("\n", "", str_replace("\r", "", str_replace("\t", "", utf8encode(html_entity_decode($current_page_title))))));
            ?>
'
              });
          }
          <?php 
        }
        ?>
		</script>
		<?php 
    }
    if ($jquery_load_local == true) {
        ?>
            <?php 
        if ($page_object->isThirdPartyCookiesFilterEnable()) {
            ?>
Exemple #12
0
 /**
  * Renderiza um conteúdo JSON e mata a execução
  * @param	object	$ob		objeto com informações do JSON
  * @return	void
  */
 private function renderJson($ob)
 {
     header('Content-type: application/json; charset=' . Config::get('charset'));
     $this->response .= json_encode(utf8encode(d($ob->Data)));
 }
 /**
  * Method sendMail
  * @access public
  * @since 1.0.59
  */
 public function sendMail()
 {
     if (!$this->captcha->check()) {
         $this->captcha->forceObjectChange();
         $dialog = new DialogBox(__(ERROR), __(ERROR_CAPTCHA));
         $this->page_object->addObject($dialog->activateCloseButton());
     } else {
         try {
             $message = __(CONTACTFORM_NAME) . ": " . utf8encode($this->getContactName()) . "<br/>" . __(CONTACTFORM_EMAIL) . ": " . $this->getContactEmail() . "<br/>" . __(CONTACTFORM_SUBJECT) . ": " . utf8encode($this->getContactSubject()) . "<br/><br/>" . __(CONTACTFORM_MESSAGE) . ": <br/>" . utf8encode($this->getContactMessage());
             $mail = new SmtpMail($this->mail_to, __($this->mail_to_name), __(SITE_NAME) . " : " . utf8encode($this->getContactSubject()), $message, $this->getContactEmail(), utf8encode($this->getContactName()));
             if (!$mail->Send()) {
                 $dialog = new DialogBox(__(CONTACTFORM_MAIL) . " " . __(ERROR), $mail->getErrorInfo());
                 $this->page_object->addObject($dialog->activateCloseButton());
             } else {
                 if ($this->send_wait_mail) {
                     if ($this->send_wait_mail_message == "") {
                         $this->send_wait_mail_message = __(CONTACTFORM_SEND_WAIT_MAIL_MESSAGE, $this->getContactName(), __(SITE_NAME), $this->mail_to_name);
                     }
                     $wait_mail = new SmtpMail($this->getContactEmail(), utf8encode($this->getContactName()), __(SITE_NAME), utf8encode($this->send_wait_mail_message), $this->mail_to, utf8encode($this->mail_to_name));
                     $wait_mail->Send();
                 }
                 $dialog = new DialogBox(__(CONTACTFORM_MAIL), __(CONTACTFORM_MAIL_SENT));
                 $this->page_object->addObject($dialog->activateCloseButton());
                 $this->page_object->forceObjectsDefaultValues();
             }
         } catch (Exception $ex) {
             $dialog = new DialogBox(__(ERROR), __(ERROR) . ": " . $ex->getMessage());
             $this->page_object->addObject($dialog->activateCloseButton());
         }
     }
 }
Exemple #14
0
 /**
  * Método de criptografia
  * @param	mixed	$value		valor a ser criptografado
  * @param	string	$key		chave utilizada para criptografar
  * @return	string				retorna um string da base 64 com o valor criptografado
  */
 public static function encrypt($value, $key)
 {
     return base64_encode(self::crypt(json_encode(utf8encode($value)), $key));
 }
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object ImageRotator
  * @since 1.0.35
  */
 public function render($ajax_render = false)
 {
     // remove old cache files
     $dirname = "wsp/cache/xml/image-rotator/";
     $dir = opendir($dirname);
     while ($file = readdir($dir)) {
         if ($file != '.' && $file != '..' && !is_dir($dirname . $file)) {
             $filemtime = @filemtime($dirname . $file);
             if ($filemtime != false && time() - $filemtime >= 1800) {
                 // > 30 minutes
                 $filedir = $dirname . $file;
                 unlink($filedir);
             }
         }
     }
     closedir($dir);
     $file = $dirname . $this->id . "-" . session_id() . ".xml";
     $f = new File($file, false, true);
     $f->debug_mode(true);
     $data = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
     $data .= "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">\n";
     $data .= "\t<trackList>\n";
     for ($i = 0; $i < sizeof($this->array_img_src); $i++) {
         $link = new Link($this->array_img_link[$i]);
         if ($link->getUserHaveRights()) {
             $data .= "\t\t<track>\n";
             $data .= "\t\t\t<title>" . utf8encode($this->array_img_title[$i]) . "</title>\n";
             $data .= "\t\t\t<creator>" . utf8encode(SITE_NAME) . "</creator>\n";
             $data .= "\t\t\t<location>" . $this->array_img_src[$i] . "</location>\n";
             $data .= "\t\t\t<info>" . $this->array_img_link[$i] . "</info>\n";
             $data .= "\t\t</track>\n";
         }
     }
     $data .= "\t</trackList>\n";
     $data .= "</playlist>\n";
     $f->write($data);
     $f->close();
     $video_object = new SwfObject($this->id, BASE_URL . "wsp/flash/imagerotator.swf", $this->width, $this->height);
     $video_object->addParam("allowfullscreen", "true");
     $video_object->addVariable("file", $file);
     if ($this->navigation_bar == false) {
         $video_object->addVariable("shownavigation", "false");
     }
     if ($this->rotate_time != '') {
         $video_object->addVariable("rotatetime", $this->rotate_time);
     }
     if ($this->transition != '') {
         $video_object->addVariable("transition", $this->transition);
     }
     if ($this->is_link) {
         $video_object->addVariable("linkfromdisplay", 'true');
     }
     $this->object_change = false;
     return $video_object->render();
 }