Exemple #1
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"), " ", 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 #2
0
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object Adsense
  * @since 1.0.35
  */
 public function render($ajax_render = false)
 {
     if ($this->is_async || $this->getPage()->isThirdPartyCookiesFilterEnable()) {
         if ($this->getPage()->isThirdPartyCookiesFilterEnable()) {
             $adsense_html = "<script type=\"text/javascript\">\n";
             $adsense_html .= "(tarteaucitron.job = tarteaucitron.job || []).push('adsense');\n";
             $adsense_html .= "(adsbygoogle = window.adsbygoogle || []).push({});\n";
             $adsense_html .= "</script>\n";
         } else {
             $adsense_html = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>\n";
         }
         $adsense_html .= "<ins class=\"adsbygoogle\"\n";
         $adsense_html .= "     style=\"display:inline-block;width:" . $this->google_ad_width . "px;height:" . $this->google_ad_height . "px\"\n";
         $adsense_html .= "     data-ad-client=\"" . $this->google_ad_client . "\"\n";
         $adsense_html .= "     data-ad-slot=\"" . $this->google_ad_slot . "\"\n";
         if (GOOGLE_CODE_TRACKER != "" && !isLocalDebug() && !defined('GOOGLE_CODE_TRACKER_NOT_ACTIF')) {
             $adsense_html .= "     data-analytics-uacct=\"" . GOOGLE_CODE_TRACKER . "\"\n";
         }
         $adsense_html .= "></ins>\n";
         if (!$this->getPage()->isThirdPartyCookiesFilterEnable()) {
             $adsense_html .= "<script>\n";
             $adsense_html .= "(adsbygoogle = window.adsbygoogle || []).push({});\n";
             $adsense_html .= "</script>\n";
         }
     } else {
         $adsense_html = $this->getJavascriptTagOpen();
         $adsense_html .= "\tgoogle_ad_client=\"" . $this->google_ad_client . "\";\n";
         $adsense_html .= "\tgoogle_ad_slot=\"" . $this->google_ad_slot . "\";\n";
         $adsense_html .= "\tgoogle_ad_width=" . $this->google_ad_width . ";\n";
         $adsense_html .= "\tgoogle_ad_height=" . $this->google_ad_height . ";\n";
         if (GOOGLE_CODE_TRACKER != "" && !isLocalDebug() && !defined('GOOGLE_CODE_TRACKER_NOT_ACTIF')) {
             $adsense_html .= "\twindow.google_analytics_uacct=\"" . GOOGLE_CODE_TRACKER . "\";\n";
             if (SUBDOMAIN_URL != "") {
                 $adsense_html .= "\tgoogle_analytics_domain_name=\"";
                 if (!defined('FORCE_SERVER_NAME') || FORCE_SERVER_NAME == "") {
                     $adsense_html .= str_replace(SUBDOMAIN_URL . ".", ".", $_SERVER['SERVER_NAME']);
                 } else {
                     $adsense_html .= str_replace(SUBDOMAIN_URL . ".", ".", FORCE_SERVER_NAME);
                 }
                 $adsense_html .= "\";\n";
             } else {
                 $adsense_html .= "\tgoogle_analytics_domain_name=\"none\";\n";
             }
         }
         $adsense_html .= $this->getJavascriptTagClose();
         $adsense_html .= "<script src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>\n";
     }
     $html = $adsense_html;
     $this->object_change = false;
     return $html;
 }
Exemple #3
0
 public function Load()
 {
     header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
     parent::$PAGE_TITLE = __(ERROR_PAGE) . " - " . __(SITE_NAME);
     parent::$PAGE_META_ROBOTS = "noindex, nofollow";
     // check if URL is not bad, but could be a good URL
     if (isset($_GET['error-redirect-url']) && $_GET['error-redirect-url'] != "") {
         $url_to_check = trim($_GET['error-redirect-url']);
     } else {
         $url_to_check = trim($this->getCurrentUrl());
     }
     $base_url_tmp = BASE_URL;
     if ($base_url_tmp[strlen($base_url_tmp) - 1] == "/") {
         $base_url_tmp = substr($base_url_tmp, 0, strlen($base_url_tmp) - 1);
     }
     $url_to_check = str_replace("%22", "\"", str_replace("%5C", "\\", str_replace("%5c", "\\", str_replace("%27", "'", $url_to_check))));
     $redirect_bad_url_to = "";
     if (preg_match("@" . $base_url_tmp . "([^?]*)/'(http://|https://|http:/|https:/)(.+)/'@i", $url_to_check, $matches) == 1) {
         // url detect with /' in the end
         $redirect_bad_url_to = $matches[3];
         $redirect_bad_url_to_http = $matches[2];
     } else {
         if (preg_match("@" . $base_url_tmp . "([^?]*)/'(http://|https://|http:/|https:/)(.+)'@i", $url_to_check, $matches) == 1) {
             // url detect with '
             $redirect_bad_url_to = $matches[3];
             $redirect_bad_url_to_http = $matches[2];
         } else {
             if (preg_match("@" . $base_url_tmp . "([^?]*)/\\\\'(http://|https://|http:/|https:/)(.+)\\\\'@i", $url_to_check, $matches) == 1) {
                 // url detect with \'
                 $redirect_bad_url_to = $matches[3];
                 $redirect_bad_url_to_http = $matches[2];
             } else {
                 if (preg_match("@" . $base_url_tmp . "([^?]*)/\"(http://|https://|http:/|https:/)(.+)\"@i", $url_to_check, $matches) == 1) {
                     // url detect with "
                     $redirect_bad_url_to = $matches[3];
                     $redirect_bad_url_to_http = $matches[2];
                 } else {
                     if (preg_match("@" . $base_url_tmp . "([^?]*)/(http://|https://|http:/|https:/)(.+)@i", $url_to_check, $matches) == 1) {
                         // url detect without no '
                         $redirect_bad_url_to = $matches[3];
                         $redirect_bad_url_to_http = $matches[2];
                     } else {
                         if (preg_match("@" . BASE_URL . "combine-css/'/(.+)'@i", $url_to_check, $matches) == 1) {
                             // combine-css url with '
                             $redirect_bad_url_to = BASE_URL . $matches[1];
                             $redirect_bad_url_to_http = "";
                         }
                     }
                 }
             }
         }
     }
     // check apple icon
     if ($redirect_bad_url_to == "" && find($url_to_check, "apple-touch-icon") > 0) {
         if ($url_to_check == BASE_URL . "apple-touch-icon.png" || $url_to_check == BASE_URL . "apple-touch-icon-precomposed.png") {
             if (defined('SITE_META_IPHONE_IMAGE_114PX')) {
                 $redirect_bad_url_to = SITE_META_IPHONE_IMAGE_114PX;
             } else {
                 if (defined('SITE_META_IPHONE_IMAGE_72PX')) {
                     $redirect_bad_url_to = SITE_META_IPHONE_IMAGE_72PX;
                 } else {
                     if (defined('SITE_META_IPHONE_IMAGE_57PX')) {
                         $redirect_bad_url_to = SITE_META_IPHONE_IMAGE_57PX;
                     }
                 }
             }
         } else {
             if ($url_to_check == BASE_URL . "apple-touch-icon-57x57.png" || $url_to_check == BASE_URL . "apple-touch-icon-57x57-precomposed.png") {
                 if (defined('SITE_META_IPHONE_IMAGE_57PX')) {
                     $redirect_bad_url_to = SITE_META_IPHONE_IMAGE_57PX;
                 }
             }
         }
         if ($redirect_bad_url_to != "") {
             if (strtoupper(substr($redirect_bad_url_to, 0, 7)) != "HTTP://" && strtoupper(substr($redirect_bad_url_to, 0, 8)) != "HTTPS://") {
                 $redirect_bad_url_to = BASE_URL . $redirect_bad_url_to;
             }
         }
     }
     // End check if URL is not bad
     if ($redirect_bad_url_to != "") {
         // if URL is detect as bad but can be redirect to good URL
         if ($redirect_bad_url_to_http != "") {
             $redirect_bad_url_to = str_replace(":/", "", str_replace("://", "", $redirect_bad_url_to_http)) . "://" . $redirect_bad_url_to;
         }
         $this->redirect($redirect_bad_url_to);
         $msg_redirect = new Label(__(REDIRECT_URL_TO, $redirect_bad_url_to, $redirect_bad_url_to));
         $this->render = new ErrorTemplate($msg_redirect, parent::$PAGE_TITLE);
     } else {
         // display the error page if the URL is correct
         $error_msg_title = "";
         $array_code_error = array(401, 403, 404, 500);
         if (in_array($_GET['error-redirect'], $array_code_error)) {
             $_SESSION['calling_page'] = "";
             $error_msg = constant("ERROR_" . $_GET['error-redirect'] . "_MSG");
             parent::$PAGE_TITLE = constant("ERROR_" . $_GET['error-redirect'] . "_MSG") . " - " . __(SITE_NAME);
             $error_msg_title = constant("ERROR_" . $_GET['error-redirect'] . "_MSG");
         } else {
             if ($_SESSION['calling_page'] == "error-page") {
                 if (isset($_GET['error-redirect-url']) && $_GET['error-redirect-url'] != "") {
                     $error_msg = __(ERROR_PAGE_MSG, $_GET['error-redirect-url']);
                 } else {
                     if ($this->getRefererURL() != "") {
                         $error_msg = __(ERROR_PAGE_MSG, $this->getRefererURL());
                     } else {
                         $error_msg = __(ERROR_PAGE_MSG, "");
                     }
                 }
             } else {
                 $error_msg = __(ERROR_PAGE_MSG, $_SESSION['calling_page']);
             }
             $error_msg_title = __(ERROR_PAGE);
         }
         $error_msg = new Label($error_msg, true);
         $obj_error_msg = new Object(new Picture("wsp/img/warning.png", 48, 48, 0, "absmidlle"), "<br/>", $error_msg->setColor("red"));
         $obj_error_msg->add("<br/><br/>", __(MAIN_PAGE_GO_BACK), new Link(BASE_URL, Link::TARGET_NONE, __(SITE_NAME)));
         $this->render = new ErrorTemplate($obj_error_msg, $error_msg_title);
         // check if URL is not banned
         if (!isset($_GET['banned_url'])) {
             if (file_exists(dirname(__FILE__) . "/../../wsp/config/banned_url.cnf")) {
                 $list_banned_url = file_get_contents(dirname(__FILE__) . "/../../wsp/config/banned_url.cnf");
                 $array_banned_url = explode("\n", str_replace("\r", "", $list_banned_url));
             } else {
                 $array_banned_url = array();
             }
             if (find($this->getCurrentUrl(), $this->getBaseLanguageURL()) > 0) {
                 $url_without_base = str_replace($this->getBaseLanguageURL(), "", $this->getCurrentUrl());
             } else {
                 $url_without_base = str_replace($this->getBaseURL(), "", $this->getCurrentUrl());
             }
             if (isset($_GET['error-redirect-url']) && $_GET['error-redirect-url'] != "") {
                 if (find($_GET['error-redirect-url'], $this->getBaseLanguageURL()) > 0) {
                     $url_without_base = str_replace($this->getBaseLanguageURL(), "", $_GET['error-redirect-url']);
                 } else {
                     $url_without_base = str_replace($this->getBaseURL(), "", $_GET['error-redirect-url']);
                 }
             }
             if ($url_without_base[0] != '/') {
                 $url_without_base = "/" . $url_without_base;
             }
             $url_without_base_array = split("\\?", $url_without_base);
             $url_without_base = $url_without_base_array[0];
             if (in_array(trim($url_without_base), $array_banned_url)) {
                 $_GET['banned_url'] = "true";
             }
         }
         $nb_user_bad_url_access = 0;
         if ($_GET['banned_url'] == "true" && !$this->isCrawlerBot()) {
             WspBannedVisitors::addIP($this->getRemoteIP());
             $nb_user_bad_url_access = WspBannedVisitors::getIpNbBadAccess($this->getRemoteIP());
         }
         // send error by mail
         if (defined('SEND_ERROR_BY_MAIL') && SEND_ERROR_BY_MAIL == true && !isLocalDebug()) {
             $send_error_mail = true;
             // Check if we have enougth information to send a mail
             if (in_array($_GET['error-redirect'], $array_code_error)) {
                 if ($this->getRefererURL() == "") {
                     if (!isset($_GET['error-redirect-referer']) || $_GET['error-redirect-referer'] == "") {
                         if (!isset($_GET['error-redirect-url']) || $_GET['error-redirect-url'] == "") {
                             $send_error_mail = false;
                             // not enougth information to treat the error
                         }
                     }
                 }
             }
             // Check if file need to send a mail
             $array_files_ex = array();
             // list of files without error email
             $array_file_no_mail = array("", "crossdomain.xml", "sitemap.xml", "error-page.html", "undefined", "&", "browserconfig.xml", "favicon.gif", "favicon.png", "ui.item.id;", "url;", "javascript:void(0);");
             if (defined('SEND_BY_MAIL_FILE_EX') && SEND_BY_MAIL_FILE_EX != "") {
                 $array_files_ex = explode(',', SEND_BY_MAIL_FILE_EX);
             }
             $array_file_no_mail = array_merge($array_file_no_mail, $array_files_ex);
             if (isset($_GET['error-redirect-url']) && $_GET['error-redirect-url'] != "") {
                 $tmp_current_url = explode('?', $_GET['error-redirect-url']);
             } else {
                 $tmp_current_url = explode('?', $this->getCurrentUrl());
             }
             $current_url = $tmp_current_url[0];
             $array_current_url = explode('/', $current_url);
             $filename = $array_current_url[sizeof($array_current_url) - 1];
             if (in_array($filename, $array_file_no_mail)) {
                 $send_error_mail = false;
             } else {
                 if ($this->getBrowserName() == "Firefox" && ($this->getBrowserVersion() == "3.6" || $this->getBrowserVersion() == "3.5") && (substr($filename, strlen($filename) - 6, 6) == "%5C%27" || substr($filename, strlen($filename) - 3, 3) == "%22" || substr($filename, strlen($filename) - 3, 3) == "%5C")) {
                     // Interpretation error by firefox 3.6 and 3.5
                     $send_error_mail = false;
                 } else {
                     if ($this->getBrowserName() == "IE" && $this->getBrowserVersion() < 7) {
                         // Error with IE <= 6.0
                         $send_error_mail = false;
                     } else {
                         if ($this->getBrowserName() == "BlackBerry" && $this->getBrowserVersion() == 0) {
                             // Error with BlackBerry version 0
                             $send_error_mail = false;
                         } else {
                             // no mail for some referers (html transformed or base href not take into account)
                             $array_exluded_referer = array("translate.googleusercontent.com", "webcache.googleusercontent.com");
                             $array_referer_url = explode('/', str_replace("http://", "", str_replace("https://", "", $this->getRefererURL())));
                             $base_referer_url = $array_referer_url[0];
                             if (in_array($base_referer_url, $array_exluded_referer)) {
                                 $send_error_mail = false;
                             } else {
                                 // test if there is regexp in the administrator exclude list
                                 for ($i = 0; $i < sizeof($array_files_ex); $i++) {
                                     if (is_regexp($array_files_ex[$i], true)) {
                                         $path_or_filename = $filename;
                                         if (find($array_files_ex[$i], "\\/") > 0) {
                                             // detect is regex on a path
                                             $path_or_filename = str_replace(BASE_URL, "", $current_url);
                                         }
                                         if (preg_match($array_files_ex[$i], $path_or_filename)) {
                                             $send_error_mail = false;
                                             break;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             // send mail
             if ($send_error_mail) {
                 $debug_mail = $error_msg->render();
                 $debug_mail .= "<br/><br/><b>General information:</b><br/>";
                 if (isset($_GET['error-redirect-url']) && $_GET['error-redirect-url'] != "") {
                     $debug_mail .= "URL : " . $_GET['error-redirect-url'] . "<br/>";
                 } else {
                     $debug_mail .= "URL : " . $this->getCurrentUrl() . "<br/>";
                 }
                 if (isset($_GET['error-redirect-referer']) && $_GET['error-redirect-referer'] != "") {
                     $debug_mail .= "Referer : " . $_GET['error-redirect-referer'] . "<br/>";
                 } else {
                     $debug_mail .= "Referer : " . $this->getRefererURL() . "<br/>";
                 }
                 $debug_mail .= "IP : <a href='http://www.infosniper.net/index.php?ip_address=" . $this->getRemoteIP() . "' target='_blank'>" . $this->getRemoteIP() . "</a><br/>";
                 $debug_mail .= "Browser : ";
                 if ($this->getBrowserName() == "Default Browser") {
                     $debug_mail .= $this->getBrowserUserAgent();
                 } else {
                     $debug_mail .= $this->getBrowserName() . " (version: " . $this->getBrowserVersion() . ")";
                 }
                 $debug_mail .= "<br/>";
                 $debug_mail .= "Crawler : " . ($this->isCrawlerBot() ? "true" : "false") . "<br/>";
                 if ($_GET['banned_url'] == "true" && $nb_user_bad_url_access > 0) {
                     $debug_mail .= "<br/><font color='red'>This user already tried to access to " . $nb_user_bad_url_access . " forbidden URL.</font><br/>";
                     $debug_mail .= "(User will be blocked with captcha code after " . MAX_BAD_URL_BEFORE_BANNED . " attempts)<br/>";
                 }
                 try {
                     $mail = new SmtpMail(SEND_ERROR_BY_MAIL_TO, __(SEND_ERROR_BY_MAIL_TO), "ERROR on " . __(SITE_NAME) . " !!!", __($debug_mail), SMTP_MAIL, __(SMTP_NAME));
                     $mail->setPriority(SmtpMail::PRIORITY_HIGH);
                     $mail->send();
                 } catch (Exception $e) {
                 }
             }
         }
     }
 }
 /**
  * Method getAjaxEventFunctionRender
  * @access protected
  * @return string
  * @since 1.0.35
  */
 protected function getAjaxEventFunctionRender()
 {
     $html = "";
     $loading_obj = null;
     if (get_class($this) == "UploadFile") {
         $loading_obj = $this->getProgressBarObject();
         if ($this->isSizeLimitJsCheckActivated() && $this->getFileSizeLimit() != -1) {
             $size_alert = new DialogBox(__(ERROR), __(UPLOAD_FILESIZE_LIMIT_ERROR_MSG, $this->getFileSizeLimitStr()));
             $size_alert->activateCloseButton()->setWidth(500);
             $size_alert->setDialogBoxLevel(rand(90000, 99999));
             $html .= "var displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = function(filename) {\n";
             $html .= $size_alert->render();
             $html .= "};\n";
         } else {
             $html .= "var displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = null;\n";
         }
         if ($this->isMimeTypeJsCheckActivated() && sizeof($this->getAuthorizedMimeTypes()) > 0) {
             $mime_alert = new DialogBox(__(ERROR), __(UPLOAD_MIME_TYPES_ERROR_MSG, implode(", ", $this->getAuthorizedMimeTypes())));
             $mime_alert->activateCloseButton()->setWidth(500);
             $mime_alert->setDialogBoxLevel(rand(90000, 99999));
             $html .= "var displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = function(filename, mime_type) {\n";
             $html .= $mime_alert->render();
             $html .= "};\n";
         } else {
             $html .= "var displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = null;\n";
         }
     }
     if (gettype($this->ajax_wait_message) != "object") {
         $loading_img = new Picture("wsp/img/loading.gif", 32, 32);
         $loading_img->setId("wspAjaxEventLoadingPic" . get_class($this) . "_" . $this->getEventObjectName());
         $loading_modalbox = new DialogBox(__(LOADING), new Object($this->ajax_wait_message, "<br/>", $loading_img, $loading_obj));
         $loading_modalbox->setDialogBoxLevel(rand(90000, 99999))->modal();
     }
     $error_alert = new DialogBox(__(ERROR), __(SUBMIT_ERROR));
     $error_alert->activateCloseButton()->setWidth(500);
     $error_alert->setDialogBoxLevel(rand(90000, 99999));
     $error_unknow_alert = new DialogBox(__(ERROR), __(SUBMIT_UNKNOW_ERROR));
     $error_unknow_alert->activateCloseButton()->setWidth(400);
     $error_unknow_alert->setDialogBoxLevel(rand(90000, 99999));
     $html .= "\tvar isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
     $html .= "\tvar lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " = Array();\n";
     $html .= "\tvar nbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " = 0;\n";
     if ($this->is_ajax_event) {
         $html .= "\tvar encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . " = Array();\n";
     }
     $html .= "\tcallAjax" . get_class($this) . "_" . $this->getEventObjectName() . "_event = function(callback_value, abort_last_request) {\n";
     $html .= "\t\tif (isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " && !abort_last_request) { return; }\n";
     $html .= "\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = true;\n";
     $html .= "\t\tnbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "++;\n";
     if (!$this->disable_ajax_wait_message) {
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'block');\n";
         } else {
             $html .= "\t\t" . $loading_modalbox->render() . "\n";
         }
         $html .= "\t\tsetTimeout(\"requestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . "(\\\"\" + callback_value + \"\\\", \" + abort_last_request + \");\", " . (gettype($this->ajax_wait_message) == "object" ? "1" : "1000") . ");\n";
     } else {
         $html .= "\t\tsetTimeout(\"requestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . "(\\\"\" + callback_value + \"\\\", \" + abort_last_request + \");\", (abort_last_request?(lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length==0?1:200):1));\n";
     }
     $html .= "\t};\n";
     $html .= "\trequestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = function(callback_value, abort_last_request) {\n";
     $html .= "\t\tnbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "--;\n";
     $html .= "\t\tif (abort_last_request) { for (var i=0; i < lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length; i++) { if (lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i]!=null) { lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i].abort(); lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i]=null; } } if (nbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " > 0) { return; } }\n";
     // encrypt formular if encrypt is active
     if ($this->form_object != null) {
         $html .= "\t\t" . $this->encryptObjectData($this->form_object, "isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;" . ($loading_modalbox == null ? "" : $loading_modalbox->close()->render()));
     }
     if (get_class($this) == "UploadFile") {
         $html .= "var upload_status = \$('#" . $this->getId() . "').upload('";
     } else {
         $html .= "\t\tlastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length] = \$.ajax({ type: '";
         if ($this->form_object != null) {
             $html .= $this->form_object->getMethod();
         } else {
             $html .= "POST";
         }
         $html .= "', url: '";
     }
     $html .= BASE_URL . LANGUAGE_URL . "/ajax/";
     if ($this->form_object == null) {
         $html .= $this->getPage()->getPage() . ".html";
         if (PARAMS_URL != "") {
             $pos = find(PARAMS_URL, "?", 0, $pos);
             if ($pos > 0) {
                 $pos2 = strlen(PARAMS_URL);
                 $html .= "?" . substr(PARAMS_URL, $pos, $pos2 - $pos);
             }
         }
     } else {
         if ($this->form_object->getAction() == "") {
             $html .= $this->form_object->getPageObject()->getPage() . ".html";
             if (PARAMS_URL != "") {
                 $pos = find(PARAMS_URL, "?", 0, $pos);
                 if ($pos > 0) {
                     $pos2 = strlen(PARAMS_URL);
                     $html .= "?" . substr(PARAMS_URL, $pos, $pos2 - $pos);
                 }
             }
         } else {
             $html .= $this->form_object->getAction();
         }
     }
     $html .= "',\n";
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').serialize(),\n";
     } else {
         if ($this->form_object != null) {
             $html .= "\t\t\tdata: ";
             if ($this->form_object->isEncrypted()) {
                 $html .= "encrypt_data";
             } else {
                 $html .= "\$('#" . $this->form_object->getId() . "').serialize() + '&Callback_" . $this->getEventObjectName() . "=' + callback_value";
             }
             $html .= ",\n";
         } else {
             $html .= "\t\t\tdata: 'Callback_" . $this->getEventObjectName() . "=' + callback_value,\n";
         }
         $html .= "\t\t\tdataType: 'json',\n";
         $html .= "\t\t\tsuccess: ";
     }
     $html .= "function(ajax_event_response) {\n";
     $html .= "\t\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
     $html .= "\t\t\t\tif (ajax_event_response != \"\") {\n";
     $html .= "\t\t\t\t\tvar dialogbox_is_change = false;\n";
     if (isLocalDebug()) {
         $html .= "\t\t\t\t\tvar alert_local_eval_error = true;\n";
     }
     $html .= "\t\t\t\t\tfor (var ajax_event_ind=0; ajax_event_ind < ajax_event_response.length; ajax_event_ind++) {\n";
     if (!$this->disable_ajax_wait_message) {
         $html .= "\t\t\t\t\t\tif (ajax_event_response[ajax_event_ind] != null && ajax_event_response[ajax_event_ind].indexOf('wspDialogBox" . $modalbox_indice . "' + ' = ') != -1) {\n";
         $html .= "\t\t\t\t\t\t\tdialogbox_is_change = true;\n";
         $html .= "\t\t\t\t\t\t}\n";
     }
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t\t\t\tajax_event_response[ajax_event_ind] = myReplaceAll(myReplaceAll(ajax_event_response[ajax_event_ind], '{#wsp_lt}', '<'), '{#wsp_gt}', '>');\n";
     }
     $html .= "\t\t\t\t\t\ttry {\n";
     $html .= "\t\t\t\t\t\t\teval(ajax_event_response[ajax_event_ind]);\n";
     $html .= "\t\t\t\t\t\t} catch (e) {\n";
     $html .= "\t\t\t\t\t\t\tconsole.log('Js error: ' + e.message + '\\nCode: ' + ajax_event_response[ajax_event_ind]);\n";
     // display ajax render error message when it's local or debug execution (useful to debug)
     if (isLocalDebug()) {
         $html .= "\t\t\t\t\t\t\tif (alert_local_eval_error) {\n";
         $html .= "\t\t\t\t\t\t\t\talert('An error appeared during Ajax event, please check the console of your browser to see the error(s).');";
         $html .= "\t\t\t\t\t\t\t\talert_local_eval_error = false;\n";
         $html .= "\t\t\t\t\t\t\t}\n";
     }
     $html .= "\t\t\t\t\t\t}\n";
     $html .= "\t\t\t\t\t}\n";
     if (!$this->disable_ajax_wait_message) {
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\tif (!dialogbox_is_change) {\n";
             $html .= "\t\t\t\t\t\t" . $loading_modalbox->close()->render();
             $html .= "\t\t\t\t\t}\n";
         }
     }
     $html .= "\t\t\t\t} else {\n";
     if (gettype($this->ajax_wait_message) == "object") {
         $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
     } else {
         $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render();
     }
     $html .= "\t\t\t\t\t" . $error_unknow_alert->render() . "\n";
     $html .= "\t\t\t\t}\n";
     $html .= "\t\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').val('');\n";
     if ($this->is_ajax_event) {
         $html .= "\t\t\t\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . "();\n";
     }
     $html .= "\t\t\t},\n";
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t'json', \$('#wsp_object_wspAjaxEventLoadingObj" . get_class($this) . "_" . $this->getEventObjectName() . "'), \$('#wspAjaxEventLoadingPic" . get_class($this) . "_" . $this->getEventObjectName() . "'), displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . ", '" . $this->getFileSizeLimit() . "', displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . ", '" . implode(", ", $this->getAuthorizedMimeTypes()) . "');\n";
         $html .= "\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
         $html .= "\t\t\tif (upload_status === false) {\n";
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render() . "\n";
         }
         $html .= "\t\t\t}\n";
     } else {
         $html .= "\t\t\terror: function(transport) {\n";
         $html .= "\t\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
         $html .= "\t\t\t\tif (!abort_last_request || (abort_last_request && trim(transport.statusText) != 'abort')) {\n";
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render() . "\n";
         }
         $html .= "\t\t\t\t\tif (trim(transport.responseText) == '') {\n";
         $html .= "\t\t\t\t\t\t" . $error_unknow_alert->render();
         $html .= "\t\t\t\t\t} else {\n";
         $html .= "\t\t\t\t\t\t" . $error_alert->render();
         $html .= "\t\t\t\t\t}\n";
         $html .= "\t\t\t\t}\n";
         $html .= "\t\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').val('');\n";
         if ($this->is_ajax_event) {
             $html .= "\t\t\t\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . "();\n";
         }
         $html .= "\t\t\t}\n";
     }
     if (get_class($this) != "UploadFile") {
         $html .= "\t\t});\n";
     }
     $html .= "\t};\n";
     if ($this->is_ajax_event) {
         $html .= "\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . " = function() {\n";
         $html .= "\t\tfor (var i=0; i < encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . ".length; i++) {\n";
         $html .= "\t\t\t\$('#' + encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . "[i][0]).val(encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . "[i][1]);\n";
         $html .= "\t\t}\n";
         $html .= "\t};\n";
     }
     return $html;
 }
Exemple #5
0
		<?php 
    }
    ?>
		<script type="text/javascript">
		<?php 
    if ($__GEOLOC_ASK_USER_SHARE_POSITION__ == true && !$page_object->isCrawlerBot()) {
        ?>
			launchGeoLocalisation(true);
		<?php 
    } else {
        ?>
			launchGeoLocalisation(false);
		<?php 
    }
    if (SEND_JS_ERROR_BY_MAIL) {
        if (defined('SEND_ERROR_BY_MAIL') && SEND_ERROR_BY_MAIL == true && !isLocalDebug()) {
            ?>
			$(document).jsErrorHandler();
		<?php 
        }
    }
    ?>
		</script>
		
		<?php 
    if (is_browser_ie_6() && !isset($_SESSION['WSP_IE6_MSG_' . formalize_to_variable(SITE_NAME)]) && $_SESSION['WSP_IE6_MSG_' . formalize_to_variable(SITE_NAME)] != "ok") {
        $alternative_browser = '';
        $alternative_browser .= '<a href="http://www.mozilla.com/"><img src="' . BASE_URL . 'wsp/img/Firefox_128x128.png" height="60" width="60" border="0" title="Mozilla FireFox"/></a> ';
        $alternative_browser .= '<a href="http://www.microsoft.com/windows/internet-explorer/"><img src="' . BASE_URL . 'wsp/img/IE_128x128.png" height="60" width="60" border="0" title="Internet Explorer"/></a> ';
        $alternative_browser .= '<a href="http://www.apple.com/safari/"><img src="' . BASE_URL . 'wsp/img/Safari_128x128.png" height="60" width="60" border="0" title="Safari"/></a> ';
        $alternative_browser .= '<a href="http://www.google.com/chrome"><img src="' . BASE_URL . 'wsp/img/Chrome_128x128.png" height="60" width="60" border="0" title="Chrome"/></a> ';
 /**
  * Method sendErrorByMail
  * @access static
  * @param mixed $debug_msg 
  * @param string $attachment_file 
  * @param string $error_log_file [default value: error_send_by_mail.log]
  * @param mixed $cache_time [default value: CacheFile::CACHE_TIME_2MIN]
  * @since 1.0.100
  */
 public static function sendErrorByMail($debug_msg, $attachment_file = "", $error_log_file = "error_send_by_mail.log", $cache_time = CacheFile::CACHE_TIME_2MIN)
 {
     if (defined('SEND_ERROR_BY_MAIL') && SEND_ERROR_BY_MAIL == true && !isLocalDebug()) {
         $caching_file = new CacheFile(dirname(__FILE__) . "/../cache/" . $error_log_file, $cache_time);
         if ($caching_file->readCache() == false) {
             $debug_mail = $debug_msg;
             $page_object = Page::getInstance($_GET['p']);
             $debug_mail .= "<br/><b>General information:</b><br/>";
             $debug_mail .= "URL : " . $page_object->getCurrentUrl() . "<br/>";
             $debug_mail .= "Referer : " . $page_object->getRefererURL() . "<br/>";
             $debug_mail .= "IP : <a href='http://www.infosniper.net/index.php?ip_address=" . $page_object->getRemoteIP() . "' target='_blank'>" . $page_object->getRemoteIP() . "</a><br/>";
             $debug_mail .= "Browser : ";
             if (!isset($_SESSION['browser_info']) || $page_object->getBrowserName() == "Default Browser" || $page_object->getBrowserName() == "") {
                 $debug_mail .= $page_object->getBrowserUserAgent();
             } else {
                 $debug_mail .= $page_object->getBrowserName() . " (version: " . $page_object->getBrowserVersion() . ")";
             }
             $debug_mail .= "<br/>";
             if (isset($_SESSION['browser_info'])) {
                 $debug_mail .= "Crawler : " . ($page_object->isCrawlerBot() ? "true" : "false") . "<br/>";
             }
             $caching_file->writeCache($debug_mail);
             try {
                 $mail = new SmtpMail(SEND_ERROR_BY_MAIL_TO, __(SEND_ERROR_BY_MAIL_TO), "ERROR on " . __(SITE_NAME) . " !!!", __($debug_mail), SMTP_MAIL, __(SMTP_NAME));
                 $mail->setPriority(SmtpMail::PRIORITY_HIGH);
                 if ($attachment_file != "" && is_file($attachment_file)) {
                     $mail->addAttachment($attachment_file, basename(str_replace(".cache", ".txt", $attachment_file)));
                 }
                 if (($send_result = $mail->send()) != true) {
                     $caching_file->writeCache("Error when sent mail: " . $send_result . "\nMail: " . $debug_mail);
                     //echo $send_result;
                 }
             } catch (Exception $e) {
                 $caching_file->writeCache("\n\nMail sending error:\n" . $e);
             }
             $caching_file->close();
         }
     }
 }
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object AutoComplete
  * @since 1.0.35
  */
 public function render($ajax_render = false)
 {
     $html = "";
     $html .= $this->getJavascriptTagOpen();
     $html .= "\$(document).ready( function() {\n";
     $html .= "\$('#" . $this->link_object_id . "').autocomplete({ source: '" . $this->autocomplete_url->render() . "', minLength: " . $this->autocomplete_min_length . ", ";
     $html .= "search: function( event, ui ) { ";
     if (GOOGLE_CODE_TRACKER != "" && !isLocalDebug() && !defined('GOOGLE_CODE_TRACKER_NOT_ACTIF')) {
         if ($this->track_categ != "") {
             $html .= "if (isGoogleAnalyticsLoaded()) { ga('send', 'event', '" . addslashes($this->track_categ) . "', '" . addslashes($this->track_action) . "', '" . addslashes($this->track_label) . "'";
             if ($this->track_use_search_value) {
                 $html .= ", trim(\$('#" . $this->link_object_id . "').val())";
             }
             //$html .= ", {'hitCallback': function() {alert('analytics.js done sending data');}}";
             $html .= "); }";
         }
         if ($this->track_pageview) {
             $html .= "if (isGoogleAnalyticsLoaded()) { ga('send', 'pageview', {'page': '/" . str_replace($this->getPage()->getBaseURL(), "", $this->autocomplete_url->render()) . "?term='+urlencode(trim(\$('#" . $this->link_object_id . "').val()))}); }";
         }
     }
     if ($this->indicator_id != "") {
         $html .= "\$('#" . $this->indicator_id . "').css('display', 'block');\$('#" . $this->indicator_id . "').css('visibility', 'visible');";
     }
     $html .= " }, ";
     $html .= "open: function( event, ui ) { ";
     $html .= "\t\$('.ui-resizable').css('z-index', '0');";
     if ($this->indicator_id != "") {
         $html .= "\$('#" . $this->indicator_id . "').css('visibility', 'hidden');";
     }
     $html .= " }, ";
     $html .= "select: function( event, ui ) { ";
     if ($this->autocomplete_event != null) {
         $html .= $this->autocomplete_event->render();
     }
     $html .= " }, ";
     $html .= "close: function( event, ui ) { ";
     $html .= "\t\$('.ui-resizable').css('z-index', '2');";
     $html .= " }";
     $html .= " })\n";
     $html .= ".data(\"autocomplete\")._renderItem = function(ul, item) {\n";
     $html .= "\tif (item.icon == '') {\n\t\t\t\treturn \$(\"<li></li>\").data(\"item.autocomplete\", item).append(\"<a>\" + item.label + \"</a>\" ).appendTo(ul);\n\t\t\t} else {\n\t\t\t\treturn \$(\"<li></li>\").data(\"item.autocomplete\", item).append(\"<a><img src='\" + item.icon + \"' border='0' height='20' align='absmiddle'/> \" + item.label + \"</a>\" ).appendTo(ul);\n\t\t\t}\n\t\t}";
     $html .= ";\n";
     $html .= "});\n";
     $html .= $this->getJavascriptTagClose();
     $this->object_change = false;
     return $html;
 }
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object VideoHTML5
  * @since 1.0.87
  */
 public function render($ajax_render = false)
 {
     if ($this->video_mp4 == "" && $this->video_webm == "" && $this->video_ogg == "") {
         throw new NewException("You must specify at least one video (please call method setVideo)", 0, getDebugBacktrace(1));
     }
     if ($this->video_mp4 == "") {
         throw new NewException("MP4 video is mandatory (please call method setVideo)", 0, getDebugBacktrace(1));
     }
     if ($this->snapshot == "") {
         throw new NewException("You must specified a snapshot (please call method setSnapshot)", 0, getDebugBacktrace(1));
     }
     if (strtoupper(substr($this->snapshot, 0, 7)) != "HTTP://" && strtoupper(substr($this->snapshot, 0, 8)) != "HTTPS://") {
         $this->snapshot = BASE_URL . $this->snapshot;
     }
     if (strtoupper(substr($this->video_mp4, 0, 7)) != "HTTP://" && strtoupper(substr($this->video_mp4, 0, 8)) != "HTTPS://") {
         $this->video_mp4 = BASE_URL . $this->video_mp4;
     }
     if ($this->video_webm != "") {
         if (strtoupper(substr($this->video_webm, 0, 7)) != "HTTP://" && strtoupper(substr($this->video_webm, 0, 8)) != "HTTPS://") {
             $this->video_webm = BASE_URL . $this->video_webm;
         }
     }
     if ($this->video_ogg != "") {
         if (strtoupper(substr($this->video_ogg, 0, 7)) != "HTTP://" && strtoupper(substr($this->video_ogg, 0, 8)) != "HTTPS://") {
             $this->video_ogg = BASE_URL . $this->video_ogg;
         }
     }
     $html = "";
     $html .= "  <video id=\"video-" . md5($this->video_mp4) . "\" class=\"video-js";
     if ($this->style != "") {
         $html .= " " . $this->style . "css";
     }
     $html .= "\" width=\"" . $this->width . "\" height=\"" . $this->height . "\" controls poster=\"" . $this->snapshot . "\"" . ($this->autoplay ? " autoplay=\"true\"" : "") . ($this->autobuffering ? " preload=\"auto\"" : "") . ">\n";
     if ($this->video_mp4 != "") {
         $html .= "    <source src=\"" . $this->video_mp4 . "\" type='video/mp4' />\n";
     }
     if ($this->video_webm != "") {
         $html .= "    <source src=\"" . $this->video_webm . "\" type='video/webm' />\n";
     }
     if ($this->video_ogg != "") {
         $html .= "    <source src=\"" . $this->video_ogg . "\" type='video/ogg' />\n";
     }
     if ($this->video_mp4 != "") {
         $html .= "    <object class=\"vjs-flash-fallback\" width=\"" . $this->width . "\" height=\"" . $this->height . "\" type=\"application/x-shockwave-flash\"\n";
         $html .= "      data=\"" . BASE_URL . "wsp/flash/flowplayer.swf\">\n";
         $html .= "      <param name=\"movie\" value=\"" . BASE_URL . "wsp/flash/flowplayer.swf\" />\n";
         $html .= "      <param name=\"allowfullscreen\" value=\"true\" />\n";
         $html .= "      <param name=\"flashvars\" value='config={\"playlist\":[\"" . $this->snapshot . "\", {\"url\": \"" . $this->video_mp4 . "\",\"autoPlay\":" . ($this->autoplay ? "true" : "false") . ",\"autoBuffering\":" . ($this->autobuffering ? "true" : "false") . "}]}' />\n";
         $html .= "      <img src=\"" . $this->snapshot . "\" width=\"" . $this->width . "\" height=\"" . $this->height . "\" alt=\"" . __(MOD_VID_NO_VIDEO) . "\"\n";
         $html .= "        title=\"" . __(MOD_VID_NO_VIDEO) . "\" />\n";
         $html .= "    </object>\n";
     }
     $html .= "  </video>\n";
     if ($this->display_download_link) {
         $html .= "  <p class=\"vjs-no-video\"><strong>" . __(MOD_VID_DOWNLOAD_VIDEO) . ":</strong>\n";
         if ($this->video_mp4 != "") {
             $html .= "    <a href=\"" . $this->video_mp4 . "\">MP4</a>,\n";
         }
         if ($this->video_webm != "") {
             $html .= "    <a href=\"" . $this->video_webm . "\">WebM</a>,\n";
         }
         if ($this->video_ogg != "") {
             $html .= "    <a href=\"" . $this->video_ogg . "\">Ogg</a><br>\n";
         }
         $html .= "  </p>\n";
     }
     $html .= $this->getJavascriptTagOpen();
     $html .= "\t_V_(\"video-" . md5($this->video_mp4) . "\").ready(function() {\n";
     $html .= "\tvar video_" . md5($this->video_mp4) . " = this;\n";
     if ($this->track_categ != "" || $this->onplay != "") {
         $html .= "\tvideo_" . md5($this->video_mp4) . ".addEvent(\"play\", function(){\n";
         if (GOOGLE_CODE_TRACKER != "" && !isLocalDebug() && !defined('GOOGLE_CODE_TRACKER_NOT_ACTIF')) {
             if ($this->track_categ != "") {
                 $html .= "if (isGoogleAnalyticsLoaded()) { ga('send', 'event', '" . addslashes($this->track_categ) . "', '" . addslashes($this->track_action) . "', '" . addslashes($this->track_label) . "'); }";
             }
         }
         if ($this->onplay != "") {
             $html .= $this->onplay;
         }
         $html .= "  });\n";
     }
     if ($this->onpause != "") {
         $html .= "\tvideo_" . md5($this->video_mp4) . ".addEvent(\"pause\", function(){\n";
         $html .= $this->onpause;
         $html .= "  });\n";
     }
     if ($this->onended != "") {
         $html .= "\tvideo_" . md5($this->video_mp4) . ".addEvent(\"ended\", function(){\n";
         $html .= $this->onended;
         $html .= "  });\n";
     }
     $html .= "\t});\n";
     $html .= $this->getJavascriptTagClose();
     $this->object_change = false;
     return $html;
 }
Exemple #9
0
 /**
  * Method getCDNServerURL
  * @access public
  * @return mixed
  * @since 1.2.8
  */
 public function getCDNServerURL()
 {
     $cdn_server_url = BASE_URL;
     if (!isLocalDebug() && defined("CDN_SERVER") && (CDN_SERVER != "" && CDN_SERVER != "http://")) {
         $cdn_server_url = CDN_SERVER;
         if ($cdn_server_url[strlen($cdn_server_url) - 1] != "/") {
             $cdn_server_url .= "/";
         }
     }
     return $cdn_server_url;
 }
Exemple #10
0
 public function connect()
 {
     if (!isset($_SESSION['user_try_connect_wsp_admin']) && $_SESSION['user_try_connect_wsp_admin'] != true) {
         if (defined('SEND_ADMIN_CONNECT_BY_MAIL') && SEND_ADMIN_CONNECT_BY_MAIL == true && !isLocalDebug()) {
             $connect_mail .= "<b>User tried or is connected on administration :</b><br/>";
             $connect_mail .= "URL : " . $this->getCurrentUrl() . "<br/>";
             $connect_mail .= "Referer : " . $this->getRefererURL() . "<br/>";
             $connect_mail .= "IP : <a href='http://www.infosniper.net/index.php?ip_address=" . $this->getRemoteIP() . "' target='_blank'>" . $this->getRemoteIP() . "</a><br/>";
             $connect_mail .= "Browser : ";
             if ($this->getBrowserName() == "Default Browser") {
                 $connect_mail .= $this->getBrowserUserAgent();
             } else {
                 $connect_mail .= $this->getBrowserName() . " (version: " . $this->getBrowserVersion() . ")";
             }
             $connect_mail .= "<br/>";
             $connect_mail .= "Crawler : " . ($this->isCrawlerBot() ? "true" : "false") . "<br/><br/>";
             $connect_mail .= "If it's not you or another member of your organisation, we recommand to ban this IP.<br/>";
             try {
                 $mail = new SmtpMail(SEND_ADMIN_CONNECT_BY_MAIL_TO, __(SEND_ADMIN_CONNECT_BY_MAIL_TO), "Admin connection on " . __(SITE_NAME) . " !!!", __($connect_mail), SMTP_MAIL, __(SMTP_NAME));
                 $mail->setPriority(SmtpMail::PRIORITY_HIGH);
                 $mail->send();
             } catch (Exception $e) {
             }
             $_SESSION['user_try_connect_wsp_admin'] = true;
         }
     }
     $this->auth_obj->connect();
 }
Exemple #11
0
             header("Content-Type: text/" . $type);
             header("Content-Length: " . filesize($cachedir . '/' . $_GET['type'] . '/' . $cachefile));
             fpassthru($fp);
             fclose($fp);
             exit;
         }
     }
 }
 $my_site_base_url_merge_css = "";
 if (strrpos($_SERVER['REQUEST_URI'], "wsp/includes/css-merge.php") > 0) {
     $my_site_base_url_merge_css = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "wsp/includes/css-merge.php"));
 }
 if (strrpos($_SERVER['REQUEST_URI'], "combine-css/") > 0) {
     $my_site_base_url_merge_css = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "combine-css/"));
 }
 if (!isLocalDebug() && defined("CDN_SERVER") && (CDN_SERVER != "" && CDN_SERVER != "http://")) {
     $cdn_server_url = CDN_SERVER;
     if ($cdn_server_url[strlen($cdn_server_url) - 1] != "/") {
         $cdn_server_url .= "/";
     }
     $my_site_base_url_merge_css = $cdn_server_url;
 }
 // Get contents of the files
 $contents = '';
 reset($elements);
 while (list(, $element) = each($elements)) {
     $element = str_replace("|", "/", $element);
     $tmp_path_array = explode('/', $element);
     $path = realpath($base . '/' . str_replace(".php.css", ".css.php", $element));
     if (!file_exists($path)) {
         $path = realpath($base . '/../../' . str_replace(".php.css", ".css.php", $element));
Exemple #12
0
function create_label_translation($constantValue)
{
    $translate_file = $_GET['p'] . ".inc.php";
    // Check if translation needs to be writed in all.inc.php
    $trace_array = explode("\n", getDebugBacktrace(2));
    if (isset($trace_array[1])) {
        $trace_array[1] = str_replace("\\", "/", $trace_array[1]);
        if (find($trace_array[1], "wsp/includes/utils_label.inc.php") > 0) {
            // call function __()
            $trace = isset($trace_array[4]) ? $trace_array[4] : "";
        } else {
            // call function translate()
            $trace = isset($trace_array[1]) ? $trace_array[1] : "";
        }
        $trace = str_replace("\\", "/", $trace);
        if (($pos = find($trace, SITE_DIRECTORY)) > 0) {
            $trace_file = substr($trace, $pos, strlen($trace));
            $page_label = str_replace("/pages/", "", substr($trace_file, 0, strlen($trace_file) - 4));
            if ($page_label != $_GET['p']) {
                $translate_file = "all.inc.php";
            }
        }
    }
    // Create new label in each languages
    $creation_message = "";
    $base_dir = dirname(__FILE__) . "/../..";
    $array_lang_dir = scandir($base_dir . "/lang");
    for ($i = 0; $i < sizeof($array_lang_dir); $i++) {
        if (is_dir($base_dir . "/lang/" . $array_lang_dir[$i]) && $array_lang_dir[$i] != "" && $array_lang_dir[$i] != "." && $array_lang_dir[$i] != ".." && $array_lang_dir[$i] != ".svn" && strlen($array_lang_dir[$i]) == 2) {
            $lang_file_path = str_replace("\\", "/", realpath($base_dir . "/lang/" . $array_lang_dir[$i])) . "/" . $translate_file;
            // Read File
            $lang_file_content = "";
            if (file_exists($lang_file_path)) {
                $lang_file = new File($lang_file_path);
                $lang_file_content = $lang_file->read();
                $lang_file->close();
            }
            // Check if the label doesn't already exists for this language
            if (!label_exists($lang_file_content, $constantValue)) {
                // Create new label
                if ($lang_file_content == "") {
                    $lang_file_content = "<?php\n";
                }
                $lang_file_content = str_replace("\r", "", $lang_file_content);
                $lang_file_content = str_replace_last("?>", "", $lang_file_content);
                $lang_file_content .= "\tdefine('" . addslashes($constantValue) . "', '" . addslashes($constantValue) . "'); // TODO: Label needs to be translated\n";
                $lang_file_content .= "?>";
                // Write File
                if ($GLOBALS['WSP_AUTO_CREATE_CONSTANT']) {
                    $lang_file = new File($lang_file_path, false, true);
                    if ($lang_file->write($lang_file_content) !== false) {
                        $creation_message .= "Information: Constant <font color='blue'>" . $constantValue . "</font> automatically <font color='green'>CREATED</font> in the file " . $lang_file_path . ".<br/>";
                    }
                    $lang_file->close();
                }
                // Check if this label doesn't exists in other language for the current page
                if ($translate_file == "all.inc.php") {
                    $page_lang_file_path = str_replace("\\", "/", realpath($base_dir . "/lang/" . $array_lang_dir[$i])) . "/" . $_GET['p'] . ".inc.php";
                    if (file_exists($page_lang_file_path)) {
                        $lang_file = new File($page_lang_file_path);
                        $lang_file_content = $lang_file->read();
                        $lang_file->close();
                        if (!label_exists($lang_file_content, $constantValue)) {
                            $label_found = false;
                            if (find($lang_file_content, "define(\"" . $constantValue . "\"") > 0) {
                                $lang_file_content = str_replace_first("define(\"" . $constantValue . "\"", "// TODO: Remove label (now in all.inc.php) -> define(\"" . $constantValue . "\"", $lang_file_content);
                                $label_found = true;
                            } else {
                                if (find($lang_file_content, "define('" . $constantValue . "'") > 0) {
                                    $lang_file_content = str_replace_first("define('" . $constantValue . "'", "// TODO: Remove label (now in all.inc.php) -> define('" . $constantValue . "'", $lang_file_content);
                                    $label_found = true;
                                }
                            }
                            // Write File
                            if ($label_found && $GLOBALS['WSP_AUTO_CREATE_CONSTANT']) {
                                $lang_file = new File($page_lang_file_path, false, true);
                                if ($lang_file->write($lang_file_content) !== false) {
                                    $creation_message .= "Information: Constant <font color='blue'>" . $constantValue . "</font> automatically <font color='red'>COMMENT</font> in the file " . $page_lang_file_path . ".<br/>";
                                }
                                $lang_file->close();
                            }
                        }
                    }
                }
            }
        }
    }
    if ($creation_message != "") {
        // Simulate the new label is loaded
        define($constantValue, $constantValue);
        // Inform the developer by DialogBox
        if ($GLOBALS['__AJAX_LOAD_PAGE__'] == false || $GLOBALS['__AJAX_LOAD_PAGE__'] == true && find($_GET['mime'], "html") > 0) {
            $dialog = new DialogBox("Alert translation", $creation_message);
            $dialog->activateCloseButton()->setWidth(600);
            Page::getInstance($_GET['p'])->addObject($dialog);
        }
        // Inform the developer by mail
        if (defined('SEND_ERROR_BY_MAIL') && SEND_ERROR_BY_MAIL == true && !isLocalDebug()) {
            try {
                $mail = new SmtpMail(SEND_ERROR_BY_MAIL_TO, __(SEND_ERROR_BY_MAIL_TO), "New label on " . __(SITE_NAME) . " !!!", $creation_message, SMTP_MAIL, __(SMTP_NAME));
                $mail->setPriority(SmtpMail::PRIORITY_HIGH);
                $mail->send();
            } catch (Exception $e) {
            }
        }
    }
}
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object GoogleSearchBar
  * @since 1.0.35
  */
 public function render($ajax_render = false)
 {
     $html = "<div id=\"cse-search-form\" style=\"width: 100%;\">Loading</div>\n\t\t\t\t<script type=\"text/javascript\">\n";
     if (GOOGLE_CODE_TRACKER != "" && !isLocalDebug() && !defined('GOOGLE_CODE_TRACKER_NOT_ACTIF')) {
         $html .= "\tvar _gaq = _gaq || []; _gaq.push(['_setAccount', '" . GOOGLE_CODE_TRACKER . "']);\n\t\t\t\t\t\t\t_trackCseQuery = function(control, searcher, query) {\n\t\t\t\t\t\t    var loc = document.location;\n\t\t\t\t\t\t    var url = [\n\t\t\t\t\t\t      loc.pathname,\n\t\t\t\t\t\t      loc.search,\n\t\t\t\t\t\t      loc.search ? '&' : '?',\n\t\t\t\t\t\t      encodeURIComponent('search'),\n\t\t\t\t\t\t      '=',\n\t\t\t\t\t\t      encodeURIComponent(query)\n\t\t\t\t\t\t    ];\n\t\t\t\t\t\t    _gaq.push(['_trackPageview', url.join('')]);\n\t\t\t\t\t\t  }\n";
     }
     $html .= "\tcse_search = function() {\n\t\t\t\t\tthis.customSearchControl = new google.search.CustomSearchControl('" . $this->search_control_code . "');\n";
     if ($this->adsense_code != "") {
         $html .= "\t\tthis.customSearchControl.enableAds('" . $this->adsense_code . "');\n";
     }
     if ($this->link_target != "") {
         $html .= "\t\tthis.customSearchControl.setLinkTarget(" . $this->link_target . ");\n";
     }
     $html .= "\t\tthis.customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);\n";
     if (GOOGLE_CODE_TRACKER != "" && !isLocalDebug() && !defined('GOOGLE_CODE_TRACKER_NOT_ACTIF')) {
         $html .= "            this.customSearchControl.setSearchStartingCallback(null, _trackCseQuery);\n";
     }
     if ($this->web_tab) {
         $html .= "\t\tvar searcher_opt = new google.search.SearcherOptions();\n\t\t\t\t\t    searcher_opt.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);\n\t\t\t\t\t    this.customSearchControl.addSearcher(new google.search.WebSearch(), searcher_opt);\n";
     }
     for ($i = 0; $i < sizeof($this->array_site_restriction); $i++) {
         $html .= "\t\tvar searcher = new google.search.WebSearch();\n\t\t\t\t    \tsearcher.setSiteRestriction(\"" . $this->array_site_restriction[$i] . "\");\n\t\t\t        \tsearcher.setUserDefinedLabel('" . addslashes($this->array_label[$i]) . "');\n\t\t\t        \tthis.customSearchControl.addSearcher(searcher);\n";
     }
     $html .= "\t\tvar options = new google.search.DrawOptions();\n";
     if ($this->autocomplete) {
         $html .= "            options.setAutoComplete(true);\n";
     }
     $html .= "\t\toptions.setSearchFormRoot('cse-search-form');\n\t\t\t\t    this.customSearchControl.setSearchStartingCallback(this, cseSearchSubmit);\n\t\t\t\t    this.customSearchControl.draw('cse-result', options);\n\t\t\t\t  }\n\t\t\t\t  \n\t\t\t\t  var last_query = '';\n\t\t\t\t  cseSearchSubmit = function(form) {\n\t\t\t\t  \tvar q = form.input.value;\n\t\t\t        if (q && q!= '' && q != last_query) {\n\t\t\t        \tlast_query = q;\n\t\t\t        \t\$('#cse-normal-content').css('display', 'none');\n\t\t\t\t  \t \t\$('#cse-result-div').css('display', 'block');\n                                                document.getElementById('cse-result').firstChild.style.padding = 0;\n\t\t\t\t  \t \tdocument.getElementById('cse-result').firstChild.style.width = '98%';\n\t\t\t        }\n\t\t\t        return false;\n\t\t\t      }\n\t\t\t\t  \n\t\t\t\t  \tvar cse_search_page_loaded = false;\n\t\t\t\t  \tCseSearchPageLoaded = function() {\n\t\t\t\t  \t\tcse_search_page_loaded = true;\n\t\t\t\t  \t}\n\t\t\t\t  \tCseSearchOnLoad = function() {\n\t\t\t\t  \t\tif (cse_search_page_loaded) {\n\t\t\t\t        \tCseSearchLoad();\n\t\t\t\t        } else {\n\t\t\t\t        \tStkFunc(CseSearchLoad);\n\t\t\t\t        }\n\t\t\t     \t}\n\t\t\t     \tfunction CseSearchLoad() {\n\t\t\t        google.load('search', '1', {language : '" . $_SESSION['lang'] . "', callback: function () { new cse_search(); } });\n\t\t\t     \t}\n";
     $html .= "   \$(document).ready(function() { \$(window).load(function() {\n";
     $html .= "      if (typeof google != 'undefined') {\n";
     if ($this->getPage()->isThirdPartyCookiesFilterEnable()) {
         $html .= "      if (tarteaucitron.state['jsapi'] == true) {\n";
     }
     $html .= "      CseSearchPageLoaded();\n\t\t\t\tCseSearchOnLoad();\n";
     if ($this->getPage()->isThirdPartyCookiesFilterEnable()) {
         $html .= "      } else { \$('#cse-search-form').html(''); }\n";
     }
     $html .= "      } else { \$('#cse-search-form').html(''); }\n";
     $html .= "   }); });\n";
     $html .= "</script>";
     $this->object_change = false;
     return $html;
 }