Zen cart using html links, but no html files - nginx

I am working with a pre-existing zen-cart site has been worked on over the years by multiple teams. Backtracking through all of the teams is not a viable option. Some of the development teams implemented some hacks, one of them being replacing how zen-cart normally creates links, and I am stuck as to how they did it. For example, zen-cart normally links to a product through a link such as the one below:
http://yoursite.com/index.php?main_page=product_info&cPath=67&products_id=823
Instead, this zen-cart installation is doing the following:
http://yoursite.com/item-name-here-p-45-.html?cPath=1_26
I have figured out that the number after p-, in this case 45, is the product ID. However, I am stuck as to what that .html file is actually referencing. I am guessing that it is somehow feeding that data back into the index.php file, and it was done for search engine optimization purposes. The server is using nginx if that makes a difference. I would rather use apache for this site, but I am fine with nginx.
Additionally, there are also links such as:
http://yoursite.com/sitemap.html
but there is no file called sitemap.html on the entire system. However, there is a file called sitemap.xml
For a myriad of reasons, I can't link to the actual site and I hope you fellow developers can understand that. However, if anyone has any idea as to whats going on here, I would be very interested to know. I will provide what other details I can.

I just figured this out, and I want to share my answer for anyone that stumbles upon this. This was caused by something called Ultimate SEO which masks urls with html links to make them more search engine friendly. The reason there are no actual html files involved is because Ultimate SEO creates a .htaccess file that reads the filename from the URL, and converts it to parameters to be passed to a php file. I just simply disabled Ultimate SEO from the zen-cart admin page. Furthermore, Ultimate SEO is something that is used outside of Zen-Cart, so if you are having the same issue I did, this might be it, or something similar.

Related

Corporate Intranet on IIS 7: Looking to Enhance Directory Listing

I am looking for the ability to enhance the appearance of the directory listing pages of a very basic corporate intranet I developed for use by our employees. I am using Windows Server 2012 R2, and the site is deployed in Internet Information Services.
I did not use anything like Visual Studio to create this, and I have already handwritten all of the CSS and HTML for the index page that serves as a jump-off point for the rest of the site so that users can get to the content they need; however, the directory listings pages where the users land leave quite a bit to be desired to say the least.
I just want to be able to add some quick styles to these directories, such as modifying the font family and perhaps the link styles. Nothing major, really. The site already functions perfectly for what it was designed to do, and has been for years. This is just something that's always kind of bugged me but I never devoted any time to it. I'd like to do that now. Ideally I'd be able to just add something in the web.config file like inline CSS, or perhaps link it to a .css file that will house the styles. The latter is probably preferred, actually, but any way is fine.
Any help is greatly appreciated. To get this out of the way early: yes, I have done lots and lots and lots of searching on this topic — I'm talking hours. I have not been able to find a solution that seems to meet my needs. I consider posting here as somewhat of a last resort because I understand that it's a free resource and users here are usually quick to let other users know when they didn't find a particular article that seems to offer the solution they're seeking — which is usually a result of not knowing exactly what keywords to use — and I don't want to waste anyone's time. Just know that I have tried everything I know to find the solution, and that I'm genuinely stumped and looking for help from some pros.
Thank you!
Since the directory page is not HTML, you can't directly style it with CSS. However, there are a few options for changing the way it looks.
Write a script to point to your own, custom-styled, directory page. See this forum thread for tips on how to do that and a sample script.
Create a custom page using this module that you can further customize yourself.
Use the DirectoryListing open source app, which allows for customization of the directory page.
Either one of those solutions should give you more control over how the directory page looks.

From static blogging to manual html editing?

I have my site done with WordPress. It's been like that for a few years.
Now, I have started to look for other options. WordPress has all these things I don't really need. One option would be static blogging. Generate the content locally and deploy the generated content to web with rsync, for example. There is tools like Jekyll, Hyde and Octopress for this.
But even Octopress seems like an overkill for me. It really feels like that. I don't need all those plugins it comes with. I'm building an image heavy site for myself, just a place where I can put my drawings that I create with my tablet.
So what if I would just manually edit HTML-files, where every file would become "a post" and make an index for them at root of my site? Come to think of it, I could work faster with this type of solution, even compared to Octopress. I could have a blank "post template" as raw html and set it as fill in snippet in TextExpander. In there, I could fill all the details for that html file like the title tag and so on.
I'm not really a coder. I draw things and write stories. In spite of this, I somehow have managed to work my way around with WordPress and recently, with Octopress.
I'm just thinking why Jekyll or Octopress or Hyde or Cactus would be a better fit for me instead of manually editing html files, and calling them "articles" or "posts"?
Thanks for any views or answers.
Why do you want to go to static html?
If you have problems with using too many resources, you should add a caching plugin to your WordPress install and that will help greatly.
Most of the time you still want some "dynamic" functionality that happens every time you add a page. For example you probably want to have a RSS/Atom feed so that people can subscribe to your site. And you want that automatically updated when you add a new page. You probably also want something to generate a sitemap file for the search engines to index it better.
These static site generators are able to do that well, so I would recommend using one.

Integrate OsTicket into Drupal 7

Our main web page is Drupal and we would like to use Osticket as our issue tracking system, but there is a problem with Osticket: anybody can create new tickets.
We can protect this by .htaccess, but we don't want do that; we would like to make this protect by Drupal: only authenticated users should access the Osticket page.
Is there a way to achieve this?
Found a solution here:
http://osticket.com/forum/discussion/9910/integrate-with-drupal-7
Here is the relevant part:
Preamble
It just so happens I was doing some off-again on-again work with integrating this into Drupal.
If you're just interested in ensuring a user is logged you're right, you need bootstrap.inc and you're right you end up with useless blank pages.
Solution
I've yet to get to properly documenting, so try this and let me know if I missed something and I'll have another look, however the following should sort the issue:
Duplicate Function Names
osTicket uses db_query() and (I think) db_close() rename the functions to something like db_ost_query() and you'll be fine. (Note I put the 'ost' in the middle to help future find/replace) I can't remember whether all occurrences of the function needed renaming for it to work, but its probably a good idea to do it.
Location of the bootstrap
The bootstrap has all manner of issues if called from outside the root Drupal directory, I gave up finding an answer to this and just kept an file in the root that osticket would include.
Headers, Headers everywhere
Bootstrap seems to like sending additional headers out so you'd want to include your file in an appropriate location (i.e. one of the .inc files). I think this solved everything.
Disclaimer
Of course, remember this will break on any updates and any mods you add you'd have to take this into account. If I've remembered rightly this will get bootstrap up and running and you can run is_user_logged_in() and show or redirect the page.
Further Concerns
I actually had a greater goal in mind in my meddling and so I don't remember whether everything was perfectly cosy after this addition.
I do remember having further issues with headers being sent and when fully bootstrapping the system session usage interfering with ostickets sessions - I think this occurred later though and shouldn't be an issue for you.
An Alternative Solution
When googling, many people suggested simply creating a module and having it iframe the contents inside it, this might be a good enough solution for what you want and would require a whole lot less messing around with ostickets code.

Why do index.php files for CMS's like wordpress & drupal contain little other than an include/require statement?

Several popular CMS's such as Drupal, Wordpress, etc. have an index.php file that is pretty much empty except for a include/require statement that includes some other PHP file (as in one file) containing all of the bootstrap code for the CMS. What is the rationale for this? Why not just move all of the bootstrapping code into index.php if it is doing nothing other than including the bootstrapping code anyway?
I'm trying to build a CMS as an example project to improve my PHP skills, and I'd like to understand what design considerations led them to do it this way. I understand the benefit of breaking up applications into multiple files, but I've never heard of making a file that does nothing but include another one. Obviously there is some benefit, since several major CMS projects designed it this way, but I just can't figure out what it is.
Can someone explain to me the reasoning for this?
In Drupal's case, there are other files that do a similar bootstrap. These typically aren't normal pages, but do serve important purposes. Off the top of my head cron.php, update.php, and install.php do this. I use the bootstrap process at the beginning of custom import scripts, as well as scripts that get called by cron that I don't want to use a hook_cron for.
I can think of two reasons:
When using a product like Wordpress, you sometimes end up adding user hacks to the front controller - say, setting custom constants, specific redirects, or an additional layer of access control, or whatever. An empty index file allows you to add that kind of stuff without disturbing the product's original code.
Having everything in a separate bootstrap creates the possibility of moving all code (including the bootstrap) to a location outside the web root, and include it from there.
Aesthetics mostly. You can have a clean and neat directory structure (outside of webroot), in which bootstrapping files are separated from index.php file. There are probably several of them (vs. one index.php file) and they are doing different things (db init, authorisation).
I also found one or two CMS which start in debug declaration (in order to switch display errors and warnings before including any files, so you can have your errors printed before php includes a file with syntax error, but that's not really a good practice).
I would say this is good design because you can easily change the path to the bootstrap, which makes it very easy to change location of the CMS, if ever necessary.
Another good reason is you could also be running a dev CMS while developing, and roll out new versions with one path change in the index.php.

How to obscure Wordpress?

I am running a site using Wordpress as CMS System.
Now I don't want anyone to know that this site is powered by Wordpress in the background.
Is there any easy way to completely obscure Wordpress?
The first thing I want to do is:
- Rename wp-content & wp-admin directory, respectively rename their URLs.
Maybe there is a Plugin for this?
Thanks!
Apart from the footer references WordPress implements some HTML standards compliant code in the top of every page.
http://bloke.org/wordpress/cleaning-up-wordpress-header/ gives some insight about it, and plugins make comments too.
Renaming wp-admin is a tricky process, which is, mostly, by design. There are ways around it as highlighted in this thread:
https://wordpress.stackexchange.com/questions/4789/changing-the-wp-admin-url-to-whatever-i-want
(you'll need to follow a few links, one of which is to an example plugin as you requested - but please do read the thread and the links in it)
You are also able to easily remove all of the wp-related bits and bobs which WordPress adds to the head of your theme. Follow these links for further info:
http://digwp.com/2009/07/remove-wordpress-version-number/
and
http://bloke.org/wordpress/cleaning-up-wordpress-header/
As for moving the wp-content folder, follow the information in this link:
http://www.johngirvin.com/archives/moving-the-wordpress-wp-content-folder.html
By far and away the hardest part (and least recommended) is moving the wp-admin folder and all of the references to it.
If you are doing this simply for security through obscurity, then, well, it has limited value (see: http://codex.wordpress.org/Hardening_WordPress#Security_through_obscurity ). Otherwise, good luck.

Resources