index of source file [apache] - apache

Currently I have a website setup with apache on ubuntu.
I'd like to customize the "Index of" file (the one that comes up when there is no index.html/php/etc as defined under DirectoryIndex) to remove the line of text that says "Apache/x.x.x (Ubuntu) Server at domain Port #".
I'm not sure where this file is located (in order to locate it and edit it). Additionally, I'd like to know how to have Apache point towards a different file (e.g. comment out the indexof.file and have it point towards a customized indexof2.file).
Image of the "Index of" file that I'm talking about:
Summary of my questions:
1) Where is the "Index of" file located
2) How can I direct Apache to use a different "Index of" file (when there are no index.html/php/etc in that directory).

The automatic index Apache generates is handled by this module (available by default): https://httpd.apache.org/docs/2.4/mod/mod_autoindex.html
The customisation options would be way to long to explain here but they definitely exist, and are detailed in the link above.
More specifically, you want to have a look at the styling options from this chapter: https://httpd.apache.org/docs/2.4/mod/mod_autoindex.html#indexoptions
You can also find "premade" option packages like this one: http://adamwhitcroft.com/apaxy/
It's probably worth looking at this to understand how it works and get a good example of what's possible.
In this specific example, there's a lot of IndexOptions involved, as you can see in https://github.com/AdamWhitcroft/apaxy/blob/master/apaxy/htaccess.txt
Definitely not something easy to implement as this not just a file to edit, like you would edit a template, but there's room for customisation.

Thanks to Capsule's response, I was able to research in a more meaningful manner and I stumbled upon a nice guide. For anybody who may visit this stackoverflow question of mine in future and is looking for a guide on editting the "Index of" directory page, the guide may help you too: https://perishablepress.com/better-default-directory-views-with-htaccess/

Related

TYPO3 CMS 9.5.5 most simple extension

I have to create a simple TYPO3 extension for version 9.5.5.
i installed TYPO3 CMS 9.5.5 from https://bitnami.com/stack/typo3
in docu for latest (9-dev)
https://docs.typo3.org/typo3cms/CoreApiReference/ExtensionArchitecture/FilesAndLocations/Index.html
they say "usually located in typo3conf/ext for local extensions, or typo3/sysext for system extensions."
i dont have a "typo3conf/ext", no "typo3conf" and "typo3/ext" . and yes there is a "typo3/sysext".
I have not found a guide online that takes this fact into account.
Then i read "... there is a tool which makes it easier to start. It is called Extension builder" ( https://docs.typo3.org/typo3cms/CoreApiReference/ExtensionArchitecture/CreateNewExtension/Index.html )
Ttherefore I have installed this "Extension Builder"
via Zip from https://extensions.typo3.org/extension/extension_builder/
Download ZIP file
Log into your TYPO3 backend
Go to Extension Manager module
Press the upload button on the top bar
Select the ZIP file and upload it.
and with me it looks very different as in the documentation:
then i read "Docs » Creating a first extension » Create Folder Structure And Configuration Files" (https://docs.typo3.org/typo3cms/ExtbaseFluidBook/4-FirstExtension/2-create-folder-structure-and-configuration-files.html)
There they talk about "unique identifier of our extension". whats this?
"as store_inventory". whats this?
anyway.
and "These are in the folder typo3conf/ext/"
but this folder does not exist in my installation.
I then looked into an installation of another computer days later and there was this folder also not.
anyway.
i created then "typo3conf/ext/store_inventory" (as described there).
then I wondered about the following formulation:
"The name of this folder must be written like the extension key"
So this folder probably had to be different named?
then i found this folder structure at the same page:
https://docs.typo3.org/typo3cms/ExtbaseFluidBook/_images/figure-4-1.png
and I wondered a lot about the amount of folders and files.
I just wanted to make a simple extension that just lists files.
I thought that's a few lines of source code.
is not that any easier?
I do not need all these things like eg. ext_icon.gif. i hope i do not need to create all that files and folder manually.
Here are some answers:
The extension key is the name of your folder inside of "typo3conf/ext". I recommend not using an underscore because it might be confusing for you later on as a beginner with TYPO3. Choose a simple and short name. To make sure the name is not available already, please check "extensions.typo3.org" to see if the key (extension name) is already taken. If you want to be 100% sure, you have to register an account there and register the extension key officially. This is all free of course.
The file ext_icon.gif is indeed not necessary, but looks nice when your extension is shown in the list of extensions in the Extension Manager of TYPO3.
You say you want to "list files". I guess you are talking about static files like images etc. that you have in your fileadmin folder already?
So in this case you need a minimum folder structure like this:
store_inventory
Classes
Controller
StoreController.php (Contains PHP function "filesList")
Configuration
TypoScript
Resources
Private
Templates
Files.html (Contains HTML/Fluid-Code for Frontend)
ext_emconf.php (Contains necessary information about your Ext.)
ext_localconf.php (Contains registration of Frontend-Plugin/Controller)
A more detailed answer requires more information about your extension's exact requirements. Here are some more links that I think you might need for this project:
ext_emconf.php
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitecture/DeclarationFile/Index.html#
ext_localconf.php
https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/4-FirstExtension/7-configuring-the-plugin.html
Controllers and Actions:
https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/7-Controllers/1-Creating-Controllers-and-Actions.html
Your Controller needs to have a function called for instance "fileAction" and the template file for this "Action" must be named "File.html" in order to work. If you name the action "fileListAction", your template file must be named "FileList.html" and so on...
There are some other small things to think about, but I don't know enough about your exact requirements. If you have any trouble, don't hesitate to ask more questions!
I know, TYPO3 can be frustrating. I do it for decades already ;)
Good luck

Joomla: Allowing a user to upload an image

Alright so I learned that to have an upload button on a page, what you do is basically call a php file (call is upload.php) that would upload a file to the server. I have no idea where I am supposed to put the php file inside the server so I can call it.
I feel stupid because I can't find any answers online. I am getting very frustrated and confused because I am told I need to create a database but I have no idea how to edit a database in Joomla. I took a class in SQL so I don't have to learn about that. I just don't know where it is. I was also told I need to make a component. But this is confusing because all I want to do is have an upload button that will upload an image to the server.
I understand your frustration. I've got the basic idea on what you are trying to do. Here are a couple of options:
You might wanna take a look at Joomla! Extensions Directory ™. You might just find there a component or a module that already does this for you.
If you want to do it on your own, than you need to create a small module or a component inside Joomla! Please refer to the Joomla! Documentation or tutorials on this topic. Please note that you won't get this working instantly, because you first need to understand how Joomla! works. So your upload.php file will go in your module / component files. I don't think you need to do any SQL.
Now the part with "allowing a user" is a bit confusing... you want to "allow" any user to upload things to your server or just let's say, registered users? Generally uploading scripts need to be very strong from the security point of view. If this is the case, that you need to do a search for Joomla! ACL
You can simply create a form and add the "media" field type.
http://docs.joomla.org/Standard_form_field_types
You can also opt for the "file" field types to allow different types of fields.
Both fields can be added using the Joomla Component Creator: http://www.notwebdesign.com/joomla-component-creator/
And you might also want to take a look at K2 which has an excellent image upload functionality that allows scaling of images into three different sizes.

"Index of ..." directory listing protection

all!
On our server we have got a directory 'files' with materials for students and teachers:
http://sample.ru/files/4students/
http://sample.ru/files/4teacherszzz/
http://sample.ru/files/markszzz/
...
Each directory, when you type it into your web-browser shows you 'Index of /files/4students/' page with list of files/subdirs.
But, we've got problem: when the student types 'http://sample.ru/files/' he can see all other folders! But students must not see teachers files (in folders 4teacherzzz and markszzz).
So, we've put blank index.html into /files/ . And by typing this url, student can't see other folders.
Now, this is question: can anyone student (he only knows 'http://sample.ru /files/4students/' url) get list of urls in 'http://sample.ru /files/' (may be by special typing '/files/4students/../' or so on)? and how? and how to deny this?
The problem is that we must leave that folders system --- it is more convenient for teachers (they only copy files to a folder on server and files automatically appears in "Index of ..." page)
Thanks for your replies!
Depending on your brand of web server - no. Most brands of normal origin servers (like Apache, IIS) will be particularly careful about collapsing any attempts at ../.. and similar naughtiness. (Note that some servers optimized for proxy/caching and similar non-origin use may well NOT do that).
But regardless you want to read the documentation very carefully. And note that most servers, like Apache and IIS, have specific directives for just this particular problem.
Have a look at "Indexes" - .i.e.
<Directory /something/>
option -Indexes
...
note the minus - will very explicitly disable indexes (Be careful with symbolic links though - or also use -FollowSymLinks ). http://httpd.apache.org/docs/2.0/mod/core.html has the full story.
Check specifically the section 'Directory Directive' and note the text:
Be careful with the directory-path arguments: They have to literally
match the filesystem path which Apache uses to access the files.
Directives applied to a particular will not apply to files
accessed from that same directory via a different path, such as via
different symbolic links.
and the example just below it. So you typically will want to lock down (-Indexes) on the lower level and then do a directory(match) one down for the students where you do allow Indexes.
Your trick of adding an index.html usually works - but note that this is just because mod_autoindex snarfs it in a timely fashion. This is not as guaranteed as above - in particular when you have MultiViews or other localisation/internationalization and similar (language/charset) variants in your server. See http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html.
Hope this helps,
Dw.

Rebol SOAP Server

Where can I find the source of the soap server in rebol mentioned here:
http://www.rebolplanet.com/zine/rzine-1-02/#sect6.
the link http://www.compkarori.co.nz/reb/discordian.txt doesn't work any more.
It's also now in my GitHub repo
https://github.com/gchiu/Rebol2/blob/master/Scripts/discordian.r
Whenever you have this sort of question, try pasting the URL into the search box of archive.org (The Internet Archive).
In this case, a copy of the file was snapshotted in 2004:
http://web.archive.org/web/20040205210622/http://www.compkarori.co.nz/reb/discordian.txt
(You might let the operators of the site know the %reb/ directory is missing, since the others in the set are still there.)

Automate adding entries to a wiki

Once I have my renamed files I need to add them to my project's wiki page. This is a fairly repetitive manual task, so I guess I could script it but I don't know where to start.
The process is:
Got to appropriate page on the wiki
for each team member (DeveloperA, DeveloperB, DeveloperC)
{
for each of two files ('*_current.jpg', '*_lastweek.jpg')
{
Select 'Attach' link on page
Select the 'manage' link next to the file to be updated
Click 'Browse' button
Browse to the relevant file (which has the same name as the previous version)
Click 'Upload file' button
}
}
Not necessarily looking for the full solution as I'd like to give it a go myself.
Where to begin? What language could I use to do this and how difficult would it be?
Check if the wiki you mean to talk to supports XMLRPC, because if it does it should be a snap. I wrote a tool called WikiUp to solve a similar problem (updating a delineated section on a wiki page).
If you're writing in C#, the WebClient classes might be a good place to start. I bet people could give more specific advice if you mentioned which wiki platform you are using, and whether it requires authentication, though.
I'd probably start by downloading fiddler and watching the http requests from doing it manually. Then you could use some simple scripts and regexes to build your http requests for automating the process.
Of course, if your wildly lucky, your wiki would have a backend simple enough that you could just plug them into its db directly. :)
You might find CoScripter useful -- it's a Firefox extension that allows you to automate tasks you perform on websites. I'm not certain how you'd integrate this with the list of files you're changing on your local system, but it can certainly handle the file uploading through a web form.
Better bet is probably using cURL or a similar HTTP library with your programming language of choice. If you're on *nix, you can use the cURL commandline program inside your shell script to get this done fairly easily. (Like #jsight said you will need to analyze the actual forms you're using on the webpage, using Fiddler or just looking at the form elements and re-creating the POST through cURL.)