cr41g Posted February 8, 2009 Share Posted February 8, 2009 I recently installed the above add on which does turn on and off via admin correctly. But the notify customer section does not work. When I activate it an error appears from the header.php file. This is the code that has been added to said file. // give the visitors a message that the website will be down at ... time if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'false') ) { tep_output_warning(TEXT_BEFORE_DOWN_FOR_MAINTENANCE . PERIOD_BEFORE_DOWN_FOR_MAINTENANCE); } // this will let the admin know that the website is DOWN FOR MAINTENANCE to the public if ( (DOWN_FOR_MAINTENANCE == 'true') && (EXCLUDE_ADMIN_IP_FOR_MAINTENANCE == getenv('REMOTE_ADDR')) ) { tep_output_warning(TEXT_ADMIN_DOWN_FOR_MAINTENANCE); } Is there something wrong here or could it be something else? Thanks in advance for any help. Craig Quote Link to comment Share on other sites More sharing options...
germ Posted February 8, 2009 Share Posted February 8, 2009 When I activate it an error appears from the header.php file. Until you post the error message you get, who knows? :unsure: Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
cr41g Posted February 8, 2009 Author Share Posted February 8, 2009 Until you post the error message you get, who knows?:unsure: Fatal error: Call to undefined function tep_output_warning() in E:\domains\r\rockuniverse.co.uk\user\htdocs\catalog\includes\header.php on line 39 This is the error message I receive on the index page when activating the matenance notification. Thank you. Quote Link to comment Share on other sites More sharing options...
germ Posted February 8, 2009 Share Posted February 8, 2009 If I was betting, that's what I figured. You haven't added the code for that in your catalog I would assume. Or it isn't added correctly or included. Not knowing exactly which contrib./version you installed that's as close as I can get. Go back over the install directions and verify you have done it all. Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
cr41g Posted February 8, 2009 Author Share Posted February 8, 2009 If I was betting, that's what I figured. You haven't added the code for that in your catalog I would assume. Or it isn't added correctly or included. Not knowing exactly which contrib./version you installed that's as close as I can get. Go back over the install directions and verify you have done it all. The contrib was down for maintenance the (http://addons.oscommerce.com/info/5865) I followed the instuctions and have double checked what I did. I cannot see any errors I have made comparing back to the instructions. Quote Link to comment Share on other sites More sharing options...
germ Posted February 8, 2009 Share Posted February 8, 2009 The contributor is using "non standard", outdated code. :o BACK UP THE FILE. Then change the code you added to this: // give the visitors a message that the website will be down at ... time if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'false') ) { // tep_output_warning(TEXT_BEFORE_DOWN_FOR_MAINTENANCE . PERIOD_BEFORE_DOWN_FOR_MAINTENANCE); $messageStack->add('warnings', TEXT_BEFORE_DOWN_FOR_MAINTENANCE . PERIOD_BEFORE_DOWN_FOR_MAINTENANCE,'warning'); } // this will let the admin know that the website is DOWN FOR MAINTENANCE to the public if ( (DOWN_FOR_MAINTENANCE == 'true') && (EXCLUDE_ADMIN_IP_FOR_MAINTENANCE == getenv('REMOTE_ADDR')) ) { // tep_output_warning(TEXT_ADMIN_DOWN_FOR_MAINTENANCE); $messageStack->add('warnings', TEXT_ADMIN_DOWN_FOR_MAINTENANCE,'warning'); } if ($messageStack->size('warnings') > 0) { echo $messageStack->output('warnings'); } This last bit of code may need to go in includes/header.php if you get the "headers already sent" error or it still doesn't work correctly: if ($messageStack->size('warnings') > 0) { echo $messageStack->output('warnings'); } This is my best guess at fixing it. You may want to consider a contribution that has a support thread. :blush: Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
cr41g Posted February 8, 2009 Author Share Posted February 8, 2009 The contributor is using "non standard", outdated code. :o BACK UP THE FILE. Then change the code you added to this: // give the visitors a message that the website will be down at ... time if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'false') ) { // tep_output_warning(TEXT_BEFORE_DOWN_FOR_MAINTENANCE . PERIOD_BEFORE_DOWN_FOR_MAINTENANCE); $messageStack->add('warnings', TEXT_BEFORE_DOWN_FOR_MAINTENANCE . PERIOD_BEFORE_DOWN_FOR_MAINTENANCE,'warning'); } // this will let the admin know that the website is DOWN FOR MAINTENANCE to the public if ( (DOWN_FOR_MAINTENANCE == 'true') && (EXCLUDE_ADMIN_IP_FOR_MAINTENANCE == getenv('REMOTE_ADDR')) ) { // tep_output_warning(TEXT_ADMIN_DOWN_FOR_MAINTENANCE); $messageStack->add('warnings', TEXT_ADMIN_DOWN_FOR_MAINTENANCE,'warning'); } if ($messageStack->size('warnings') > 0) { echo $messageStack->output('warnings'); } This last bit of code may need to go in includes/header.php if you get the "headers already sent" error or it still doesn't work correctly: if ($messageStack->size('warnings') > 0) { echo $messageStack->output('warnings'); } This is my best guess at fixing it. You may want to consider a contribution that has a support thread. :blush: Thank you for your help. Quote Link to comment Share on other sites More sharing options...
germ Posted February 8, 2009 Share Posted February 8, 2009 You got it working? :unsure: Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
cr41g Posted February 16, 2009 Author Share Posted February 16, 2009 You got it working?:unsure: Yes I did, thank you. Although i've noticed another issue now... When the down for Maintenance option is set to false vistitors are not meant to be able to view the D4M page, yet this does not seem to be the case. This is the code that is added to application_top.php, could this be redundant also? // BOF: Down for Maintenance except for admin ip if (EXCLUDE_ADMIN_IP_FOR_MAINTENANCE != getenv('REMOTE_ADDR')){ if (DOWN_FOR_MAINTENANCE=='true' and !strstr($PHP_SELF,DOWN_FOR_MAINTENANCE_FILENAME)) { tep_redirect(tep_href_link(DOWN_FOR_MAINTENANCE_FILENAME)); } } // do not let people get to Down for Maintenance page if not turned on if (DOWN_FOR_MAINTENANCE=='false' and strstr($PHP_SELF,DOWN_FOR_MAINTENANCE_FILENAME)) { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } // EOF: WebMakers.com Added: Down for Maintenance Craig Quote Link to comment Share on other sites More sharing options...
germ Posted February 17, 2009 Share Posted February 17, 2009 In the code you just posted replace: if (DOWN_FOR_MAINTENANCE=='false' and strstr($PHP_SELF,DOWN_FOR_MAINTENANCE_FILENAME)) { With if ( ( DOWN_FOR_MAINTENANCE == 'false' ) and ( !strstr( $PHP_SELF, DOWN_FOR_MAINTENANCE_FILENAME ) ) ) { Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
cr41g Posted February 18, 2009 Author Share Posted February 18, 2009 In the code you just posted replace: if (DOWN_FOR_MAINTENANCE=='false' and strstr($PHP_SELF,DOWN_FOR_MAINTENANCE_FILENAME)) { With if ( ( DOWN_FOR_MAINTENANCE == 'false' ) and ( !strstr( $PHP_SELF, DOWN_FOR_MAINTENANCE_FILENAME ) ) ) { Thanks yet again for you're help. I had to reload a back up version of my site for another error which overwrote all the code i'd added for this contrib previously but I have since re-added it with the two code changes you suggested, but although it was working previously when I go to my site now it brings back a FastCGI Error. FastCGI ErrorThe FastCGI Handler was unable to process the request. -------------------------------------------------------------------------------- Error Details: The FastCGI process exited unexpectedly Error Number: -2147467259 (0x80004005). Error Description: Unspecified error HTTP Error 500 - Server Error. Internet Information Services (IIS) I've looked this up and to be honest the answers aren't making much sense to me. Can you please help. I will re-install the back ups again if need be but i'd rather like to have this code/contrib working! Quote Link to comment Share on other sites More sharing options...
germ Posted February 18, 2009 Share Posted February 18, 2009 Unless it gives you a line number to look for the error I don't know. I know it's NOT the last code I posted as I tested it on my site and it worked. :huh: Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
cr41g Posted February 18, 2009 Author Share Posted February 18, 2009 Sorry it does seem to be when I add those lines, not saying its your code but probably me adding it wrong, this is what it looks like when i change it... // BOF: Down for Maintenance except for admin ip if (EXCLUDE_ADMIN_IP_FOR_MAINTENANCE != getenv('REMOTE_ADDR')){ if ( ( DOWN_FOR_MAINTENANCE == 'false' ) and ( !strstr( $PHP_SELF, DOWN_FOR_MAINTENANCE_FILENAME ) ) ) { tep_redirect(tep_href_link(DOWN_FOR_MAINTENANCE_FILENAME)); } } // do not let people get to Down for Maintenance page if not turned on if ( ( DOWN_FOR_MAINTENANCE == 'false' ) and ( !strstr( $PHP_SELF, DOWN_FOR_MAINTENANCE_FILENAME ) ) ) { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } // EOF: WebMakers.com Added: Down for Maintenance When I put it back to the oringinal instructions code I don't get a FastCGI error but obviously I can then view the D4M page when I shouldn't be able to. Quote Link to comment Share on other sites More sharing options...
germ Posted February 18, 2009 Share Posted February 18, 2009 This seems to work just as well: if ( ( DOWN_FOR_MAINTENANCE == 'false' ) && ( basename($PHP_SELF) != DOWN_FOR_MAINTENANCE_FILENAME ) ) { Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
cr41g Posted February 18, 2009 Author Share Posted February 18, 2009 This seems to work just as well: if ( ( DOWN_FOR_MAINTENANCE == 'false' ) && ( basename($PHP_SELF) != DOWN_FOR_MAINTENANCE_FILENAME ) ) { Still no, but I don't think its either of the code lines, even the original if I add the extra "!" infront of "strstr" i'm sure that should work, as the line above (almost identical) works. Could it be that when the right code IS added and the function IS working the application_top.pfp file can't handle that one extra function and times out! I do have other add ons as well that have been added to the this file, such as sid killer and Meta Tags? If this is the case is there a way around it? Quote Link to comment Share on other sites More sharing options...
germ Posted February 18, 2009 Share Posted February 18, 2009 Both pieces of code work for me so I don't know what to say except next time install something with a support thread. Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
cr41g Posted February 18, 2009 Author Share Posted February 18, 2009 Both pieces of code work for me so I don't know what to say except next time install something with a support thread. Ok thanks anyway you've been a great help. I'll keep trying with that code, and looking into the Error, if not, as you say use a supported add on, I wish i'd noticed that to start with!!! Cheers Quote Link to comment Share on other sites More sharing options...
cr41g Posted February 21, 2009 Author Share Posted February 21, 2009 Incase anyone else has issues... I was using the contrib - http://addons.oscommerce.com/info/5865 but - http://addons.oscommerce.com/info/1057 is the same thing but with a different (correct) down_for_maintenance.pfp file. This solved all the problems I was having, in other words don't use 5865! Quote Link to comment Share on other sites More sharing options...
Guest Posted February 21, 2009 Share Posted February 21, 2009 or this one: http://www.oscommerce.com/community/contributions,3902 Quote Link to comment Share on other sites More sharing options...
germ Posted February 21, 2009 Share Posted February 21, 2009 Just prior to getting invlolved in this thread I coded my own "Down for Maintenance" on my site. I added this in /includes/configure.php to turn it on/off: define('DOWN_FOR_MAINTENANCE', 'on'); // store temporarily down? I created a file called dfm.html (the page people get redirected to when the store is down) and placed it in my osC folder. Then in /includes/application_top.php find the code that starts the session: // start the session $session_started = false; if (SESSION_FORCE_COOKIE_USE == 'True') { tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain); if (isset($HTTP_COOKIE_VARS['cookie_test'])) { tep_session_start(); $session_started = true; } } elseif (SESSION_BLOCK_SPIDERS == 'True') { $user_agent = strtolower(getenv('HTTP_USER_AGENT')); $spider_flag = false; if (tep_not_null($user_agent)) { $spiders = file(DIR_WS_INCLUDES . 'spiders.txt'); for ($i=0, $n=sizeof($spiders); $i<$n; $i++) { if (tep_not_null($spiders[$i])) { if (is_integer(strpos($user_agent, trim($spiders[$i])))) { $spider_flag = true; break; } } } } if ($spider_flag == false) { tep_session_start(); $session_started = true; } } else { tep_session_start(); $session_started = true; } Just AFTER that code, ADD this code: // added to shut the store off if ($HTTP_GET_VARS['toast'] == 'wheat') { if ( ! tep_session_is_registered('toast') ) { tep_session_register('toast'); $toast = $HTTP_GET_VARS['toast']; } } if ( ! tep_session_is_registered('toast') ) { if ( DOWN_FOR_MAINTENANCE == 'on' ) { header("HTTP/1.0 307 Temporary Redirect"); header('Location: dfm.html'); } } // end of my shut the store off code I can turn the store "off" but still access it with the "secret code". If I turn it off to the public I can still access it like this: http://mystore.com/index.php?toast=wheat (This isn't the secret code I used, but you get the idea. You can use your own secret code). Now, the way this works is with a session variable, so it has a few caveats. One: You can't use the link in the admin to jump to the store. I never do that. I always have the admin open in one tab and the store in another. Two: Since it uses a session variable if the session expires so does the variable. But, it's simple and does what I need it to do. :) Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
slugg0 Posted September 8, 2011 Share Posted September 8, 2011 (edited) I just installed Down for maintenance v2.4.2 (http://addons.oscommerce.com/info/7724). But after uploading, I got Warning: require(includes/classes/navigation_history.php) [function.require]: failed to open stream: No such file or directory in /storage/content/XX/XXXXXX/eciggbutiken.se/public_html/admin/includes/application_top.php on line 127 Warning: require(includes/classes/navigation_history.php) [function.require]: failed to open stream: No such file or directory in /storage/content/XX/XXXXXX/eciggbutiken.se/public_html/admin/includes/application_top.php on line 127 Fatal error: require() [function.require]: Failed opening required 'includes/classes/navigation_history.php' (include_path='.:/usr/lib64/php') in /storage/content/XX/XXXXXX/eciggbutiken.se/public_html/admin/includes/application_top.php on line 127 -That is directly when I log on to Admin. I've checked the changed codes and nothing about navigation_history.php has been changed during the installation, that I've found. Both application_top and navigation_history are located where they should be.. Any suggestions? Edited September 8, 2011 by slugg0 Quote Link to comment Share on other sites More sharing options...
slugg0 Posted September 8, 2011 Share Posted September 8, 2011 I just installed Down for maintenance v2.4.2 (http://addons.oscommerce.com/info/7724). But after uploading, I got Warning: require(includes/classes/navigation_history.php) [function.require]: failed to open stream: No such file or directory in /storage/content/XX/XXXXXX/eciggbutiken.se/public_html/admin/includes/application_top.php on line 127 Warning: require(includes/classes/navigation_history.php) [function.require]: failed to open stream: No such file or directory in /storage/content/XX/XXXXXX/eciggbutiken.se/public_html/admin/includes/application_top.php on line 127 Fatal error: require() [function.require]: Failed opening required 'includes/classes/navigation_history.php' (include_path='.:/usr/lib64/php') in /storage/content/XX/XXXXXX/eciggbutiken.se/public_html/admin/includes/application_top.php on line 127 -That is directly when I log on to Admin. I've checked the changed codes and nothing about navigation_history.php has been changed during the installation, that I've found. Both application_top and navigation_history are located where they should be.. Any suggestions? Never mind. Must have done something wrong, started over and got it working. Quote Link to comment Share on other sites More sharing options...
germ Posted September 9, 2011 Share Posted September 9, 2011 The error was caused by accidentally uploading the /includes/application_top.php from the catalog side into the admin side. The admin doesn't use navigation_history. Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.