rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: raybob on March 09, 2011, 10:44:38 PM

Title: command lines
Post by: raybob on March 09, 2011, 10:44:38 PM
Is it somehow possible to create a new user account using a command line?

Thanks for any input,
Raybob
Title: Re: command lines
Post by: rejetto on March 14, 2011, 02:17:41 PM
yes, there is, but you need to make it possible with a simple script.
the first method that comes to my mind is to have an event that runs every 1 or 5 seconds, and executes a specific file/script.
That's ALT+F6, and put this code
Code: [Select]
[every 2 seconds]
{.load|automatic.txt.}
{.delete|automatic.txt.}

Now, every time you want HFS to do something, you can make a script and save (or copy) it to automatic.txt (same folder as hfs.exe)

to create an account named "test", the script is
{.new account|my test.}

more details at http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands#Account_manipulation
Title: Re: command lines
Post by: raybob on March 15, 2011, 08:59:02 PM
My end goal here is to make it so that it is somehow possible for a user to create their own account by submitting a form on one of the webpages.

This is what I'm thinking:

I could use Apache with PHP on another port, then have the form data submitted get put into a file like "automatic.txt" in the proper format and then have HFS automatically load the script every few seconds by putting that code you posted into HFS.events . . .

Is that a viable idea?

EDIT:  I wrote this script and it works perfectly.  Now I need to write some PHP to get it to submit the form data to this file in the proper syntax:

Code: [Select]
{.mkdir|D:\PERSON.}
{.add folder|real|D:\PERSON|.person.}
{.new account|person|password=password|enabled=true|member of=can change password|redirect=/.person/.}
{.set item|.person|hide=1|access=person|delete=person|upload=person.}

Only one problem I couldn't figure out: I need to make it so that the template of the folder is changed also.  Is this possible?  



EDIT 2:  Would it be possible to use an HFS functionality rather than PHP to get form data saved as a .txt ?
Title: Re: command lines
Post by: rejetto on March 17, 2011, 05:19:22 PM
consider you don't need to pass via Apache to have a form for account creation. Indeed you can find by searching on this forum some scripts doing it.
HFS is able to handle the form's data.

just use the {.postvar|name.} command to read "name" if you are using method=post
or even easier {.?name.} if the form is not using method=post
Title: Re: command lines
Post by: raybob on March 17, 2011, 06:08:42 PM
I've already written the PHP and gotten everything to work perfectly, so I'm going to use it for now.

However, there is one problem I have whether or not I use HFS or PHP for the form scripting.  That is, I need to be able to change a folder's default template in the VFS using command line manipulation, but I see nothing about it in the wiki.

Is that possible?  If not then could you include it in build 276?

Thanks,
Ray
Title: Re: command lines
Post by: rejetto on March 17, 2011, 09:46:50 PM
i don't know if i understood you.
you want to have different templates, based on the folder?
Title: Re: command lines
Post by: raybob on March 17, 2011, 11:46:27 PM
Yes.

You know how in HFS itself it lets you specify a different template for each folder?

I would like a way to specify the template with the command.

Ray
Title: Re: command lines
Post by: rejetto on March 18, 2011, 10:01:45 AM
yes, it's possible with the {.load tpl.} command (http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands).
it works for sure if you use it in event (http://www.rejetto.com/wiki/index.php/HFS:_Event_scripts) [request].
the template shall depend on the %url%.

please describe the rule that decides the template to be used
Title: Re: command lines
Post by: raybob on March 18, 2011, 10:54:33 PM
In HFS, if you go on the left, and right click a folder then hit properties, the properties box comes up.  One of the available tabs is 'Diff Template' which allows you to change the template for each specific folder, a feature that I rely on heavily.  I need a way to do this with the macro command line.

If you could go more in-depth on how to do this I would appreciate it greatly.

Thanks,
Ray
Title: Re: command lines
Post by: Mars on March 19, 2011, 03:26:53 PM
Quote
In HFS, if you go on the left, and right click a folder then hit properties, the properties box comes up.  One of the available tabs is 'Diff Template' which allows you to change the template for each specific folder, a feature that I rely on heavily.

if you add a directiory into the vfs as real folder, you can edit the diff template by putting the {.load tpl|"full_path_tpl".} command. or you can use a file named hfs.diff.tpl inside the folder, then it's possible to create modify or delete this last file with another application, see wiki about.

by security there is no way to modify a diff template.  ;)

Title: Re: command lines
Post by: raybob on March 20, 2011, 02:42:04 AM
Yes!  Creating an hfs.diff.tpl is exactly the type of thing I was looking for.  I didn't know you could do that.    :)

Title: Re: command lines
Post by: rejetto on March 20, 2011, 01:47:43 PM
diff tpl is mainly designed for making changes to the current template.
but in case you need to use whole different templates, you don't need to make a copy of the template in each folder (named hfs.diff.tpl).
you can use {.load tpl.} and then {.section.} to reload the main section of the template.
another way is to load the template in events, event [request]
Title: Re: command lines
Post by: raybob on March 20, 2011, 05:17:03 PM
Alright!  I got the whole thing coded out exactly as I need it.  Maybe one day when I feel up to it I'll write an HFS Script rather than PHP.  Or I could just wait until HFS can use PHP  ;D

But here's what I got in HFS.events:

Code: [Select]
[every 1 seconds]
{.load|automatic.txt.}
{.delete|automatic.txt.}

In Submitted.php in XAMPP:

Code: [Select]
<?php



// Get posted variables for Name, password, and email

$name $_POST["name"];
$password $_POST["password"];
$email $_POST["email"];



// Specify the new HFS Script and the Email Log File

$myFile "M:\automatic.txt";
$myFile2 "M:\User emails\\$name.txt";
$fh fopen($myFile'w');
$fh2 fopen($myFile2'w');



// Specify the contents of the two new files, one with the HFS Macros and the other with the user's email address

$string1 "{.mkdir|D:\\$name.}
{.add folder|real|D:\\
$name|.$name.}
{.new account|
$name|password=$password|enabled=true|member of=can change password|redirect=/.$name/.}
{.set item|.
$name|hide=1|access=$name|delete=$name|upload=$name.}";

$string2 "$email";



// Create the two files and write the new contents

fwrite($fh"$string1");
fclose($fh);

fwrite($fh2"$string2");
fclose($fh2);



// Wait 1 second for HFS to create the new directory

sleep(2);



// Copy over the HFS template to the new directory

$old "D:/hfs.diff.tpl";
$new "D:/$name/hfs.diff.tpl";

copy($old$new);



?>


I hope I'm not asking too much, but if anybody gets the time, could someone please "convert" this PHP script to HFS macros?  That would be hugely appreciated.

Thanks,
Ray

Title: Re: command lines
Post by: rejetto on March 21, 2011, 11:26:18 AM
i'm just noticing that you can't use "set item" to set the diff tpl of the folder.
if you could, you would be able to get rid of those hfs.diff.tpl in every folder.
you would just need to set the diff tpl field of the folder to D:\hfs.diff.tpl
and the content would be automatically be loaded from that.
I will add this in next release (277)

as a side note, you can have a much shorter form with php, like this

file_put_contents("M:\automatic.txt",
    "{.mkdir|D:\\$name.}
    {.add folder|real|D:\\$name|.$name.}
    {.new account|$name|password=$password|enabled=true|member of=can change password|redirect=/.$name/.}
    {.set item|.$name|hide=1|access=$name|delete=$name|upload=$name.}");
Title: Re: command lines
Post by: rejetto on March 21, 2011, 11:41:53 AM
I hope I'm not asking too much, but if anybody gets the time, could someone please "convert" this PHP script to HFS macros?  That would be hugely appreciated.

not tested.
put this in the root/home diff template

Code: [Select]
[process-form]
{.mkdir|D:\{.$name.}.}
{.add folder|real|D:\{.$name.}|.{.$name.}.}
{.new account|{.$name.}|password={.$password.}|enabled=true|member of=can change password|redirect=/{.$name.}/.}
{.set item|{.$name.}|hide=1|access={.$name.}|delete={.$name.}|upload={.$name.}.}
{.save|M:\User emails\{.$name.}.txt|{.$email.}.}
{.copy| D:\hfs.diff.tpl | D:\{.$name.}\hfs.diff.tpl .}
Done!

then point the action of your form to /~process-form
Title: Re: command lines
Post by: raybob on March 21, 2011, 01:38:31 PM
But is {.name} actually a variable in HFS?  Don't I have to use {.postvar| } to get the posted variables?
Title: Re: command lines
Post by: Mars on March 21, 2011, 01:59:23 PM
But is {.name} actually a variable in HFS?  Don't I have to use {.postvar| } to get the posted variables?

to access posted variables the only way is using {.postvar| .}

Macro Shortcuts

$A
is a shortcut for section | A

?A
is a shortcut for urlvar | A

^A
is a shortcut for call | A

A = B
is a shortcut for =|A|B

?name = X
is a shortcut for {.?name.} = X .

It works also for <> != < <= > >= .
Retrieved from "http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands"

Title: Re: command lines
Post by: rejetto on March 21, 2011, 04:28:31 PM
yes, you are right, postvar is for post.
the syntax i reported works if you don't put the "method=post" in your form.
Title: Re: command lines
Post by: raybob on March 21, 2011, 08:47:18 PM
Well, I put this script in:

Code: [Select]

[submission]
{.mkdir|D:\{.postvar|name.}.}
{.add folder|real|D:\{.postvar|name.}|.{.postvar|name.}.}
{.new account|{.postvar|name.}|password={.postvar|password.}|enabled=true|member of=can change password|redirect=/{.postvar|name.}/.}
{.set item|{.postvar|name.}|hide=1|access={.postvar|name.}|delete={.postvar|name.}|upload={.postvar|name.}.}
{.save|M:\User emails\{.postvar|name.}.txt|{.postvar|email.}.}
{.copy|D:\hfs.diff.tpl|D:\{.postvar|name.}\hfs.diff.tpl.}


And HFS simply crashes every time I try to load the page.  There isn't even a Windows warning that the program crashed.  (I'm using Beta 274)

EDIT:  I tried build 276 and the crash still happens.  I'm gonna try one line of code at a time to see where the problem is.

EDIT #2:  I figured out (duh) that the problem was that I couldn't use M:\ drive since the script was now on the same server as HFS, not over my local network.  Changing it to C:\ solved the problem and now it all works great!!!!!

I'm beginning to see that I can do a lot more than I previously though with macros.  And also, the admins on this forum are probably the most helpful I've ever seen on any forum.  Thank you very much!!!!
Title: Re: command lines
Post by: rejetto on March 22, 2011, 12:52:41 PM
ok, i got to reproduce that bug, and fixed it, for next release (277)
Title: Re: command lines
Post by: raybob on March 25, 2011, 05:56:56 PM
Rejetto, why does this script not work?  It still lets users through successfully (thus erasing my VFS with later code creating their account) even when the fields are left blank . . .

Originally I had %user% in place of the postvar user but that wouldn't work either.
Code: [Select]
{.

{.if|{.postvar|user.}|{.redirect|/~newaccount?alreadysignedup=yes.}{.break.}.}
{.not|{.postvar|name.}|{.redirect|/~newaccount?username=none.}{.break.}.}
{.not|{.postvar|password1.}|{.redirect|/~newaccount?password=none.}{.break.}.}

.}
Title: Re: command lines
Post by: raybob on March 25, 2011, 08:38:12 PM
Nevermind, fixed it myself by doing a little reading in this section . . .

http://www.rejetto.com/wiki/index.php/HFS:_Template_macros#Workaround_to_the_problem
Title: Re: command lines
Post by: rejetto on March 25, 2011, 10:58:15 PM
the outer pair {. .} must be removed.
this pair marks a command, not a block like in most languages.
And the "body" of the {.if.} must be enclosed in this pair {: :} because otherwise it will always be executed.

{.if|{.postvar|user.}|{:{.redirect|/~newaccount?alreadysignedup=yes.}{.break.}:}.}

and i guess with {.not.} you meant {.if not.}

%user% is the username of the http authentication. Nothing to do with a field in a form that you named "user".
Title: Re: command lines
Post by: raybob on March 26, 2011, 12:15:09 AM
OK, I think I might finally be done with this topic . . .

This is what I got on the ~submission page.

Code: [Select]
{.if     | {.postvar|user.}                                                                   |   {: {.redirect | /~newaccount?alreadysignedup=yes.}{.break.}  :}        |.}
{.if not | {.postvar|name.}                                                                   |   {: {.redirect | /~newaccount?username=none.}{.break.}        :}        |.}
{.if     | {.>= | {.count substring|{|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|.|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring| |{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|?|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|}|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|]|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|[|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|;|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|:|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|"|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|'|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|>|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|<|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|,|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|!|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|@|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|#|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|$|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|%|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|^|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|&|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|*|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|(|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|)|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|-|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|_|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|=|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|+|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|~|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|`|{.postvar|name.}.}|1.}                                  |   {: {.redirect | /~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if not | {.postvar|email.}                                                                  |   {: {.redirect | /~newaccount?emailgiven=no.}{.break.}        :}        |.}
{.if not | {.=  | {.count substring|@|{.postvar|email.}.}|1.}                                 |   {: {.redirect | /~newaccount?emailgiven=no.}{.break.}        :}        |.}
{.if not | {.>= | {.count substring|.|{.postvar|email.}.}|1.}                                 |   {: {.redirect | /~newaccount?emailgiven=no.}{.break.}        :}        |.}
{.if not | {.postvar|password1.}                                                              |   {: {.redirect | /~newaccount?passwordA=none.}{.break.}       :}        |.}
{.if not | {.postvar|password2.}                                                              |   {: {.redirect | /~newaccount?passwordB=none.}{.break.}       :}        |.}
{.if not | {.>= | {.length|{.postvar|password1.} .} | 8 .}                                    |   {: {.redirect | /~newaccount?password=short.}{.break.}       :}        |.}
{.if not | {.=  | {.postvar|password1.}             | {.postvar|password2.} .}                |   {: {.redirect | /~newaccount?passwordmatch=no.}{.break.}     :}        |.}
{.if not | {.=  | {.postvar|agree.}                 | yes.}                                   |   {: {.redirect | /~newaccount?agreement=no.}{.break.}         :}        |.}
{.if not | {.=  | {.postvar|spamcheck.}|{.add |{.postvar|x.}|{.postvar|y.}.}.}                |   {: {.redirect | /~newaccount?wrongmath=yes.}{.break.}        :}        |.}

{.mkdir|D:\{.upper|{.postvar|name.}.}.}
{.add folder|real|D:\{.upper|{.postvar|name.}.}|.{.postvar|name.}.}
{.new account|{.postvar|name.}|password={.postvar|password1.}|enabled=true|member of=can change password|redirect=/.{.postvar|name.}/.}
{.set item|.{.postvar|name.}|hide=1|access={.postvar|name.}|delete={.postvar|name.}|upload={.postvar|name.}.}
{.save|C:\Documents and Settings\Beck\Desktop\User emails\{.postvar|name.}.txt|{.postvar|email.}.}
{.copy|C:\Documents and Settings\Beck\Desktop\User Template.tpl|D:\{.upper|{.postvar|name.}.}\hfs.diff.tpl.}

Everything is spaced out to make it a bit easier to read, but it still functions the same.  By the way, I do know how %user% works.  In the original newaccount form, there is a hidden field which has a value of %user% and then it posts the variable to here, which is how I retrieve it on this page.  It works just fine.
Title: Re: command lines
Post by: raybob on March 27, 2011, 07:27:30 PM
Is there a scripting command to remove an item from the VFS?  Or was this intentionally left out because of possible security vulnerabilities?
Title: Re: command lines
Post by: rejetto on March 29, 2011, 05:52:38 PM
if you want to check validity of username and email there's a much better method, {.regexp.} i will tell you more asap.

first i will just say something general about the scripting.
you are using the >= to don't act when the value is zero,
but you don't need it because 0 is considered false.

so,
{.if     | {.>= | {.count substring|,|{.postvar|name.}.}|1.}
and
{.if     | {.count substring|,|{.postvar|name.}.}
will do the same

MORE

the "count substring" will give you a number.
if you just put every counting in line, you will always get a number, just longer, like   00001000.
Since you are ok only when all is zero, then again the {.if.} will treat it right.
You can shorten it as

{.if | {.count substring|,|{.postvar|name.}.}{.count substring|;|{.postvar|name.}.}{.count substring|:|{.postvar|name.}.}
etc etc

but the truly cool solution is using {.regexp.} but i'm in a rush. I'll continue later.
Title: Re: command lines
Post by: rejetto on March 30, 2011, 10:16:21 AM
here it is

{.if not| {.regexp|[-A-Z0-9_.]+|{.postvar|name.}.} | {: ...redirect... :} .}

{.if not| {.regexp|[-A-Z0-9_.]+@[-A-Z0-9_.]+\.[A-Z]{2,4}|{.postvar|email.}.} | {: ...redirect... :} .}

regexp stands for regular expressions, that is a standard way to define rules for text (google if interested).

the first one accept characters, numbers, underscores, dots and dashes.
and it cannot be empty.

the second one is the same, but then a @ must follow, and the rest.
Title: Re: command lines
Post by: raybob on March 31, 2011, 09:15:46 PM
Thanks for that!  Simplifies things a bit.

2 more questions (as of now  :P ) about scripting commands.

1)  Is there a command to delete a folder from the VFS?
2)  Is there a command to set a folder in the VFS as archivable?
Title: Re: command lines
Post by: rejetto on April 01, 2011, 07:20:49 AM
1) nope
2) no, i see its useful,  i will add it in next release (278)
Title: Re: command lines
Post by: raybob on April 05, 2011, 11:12:22 PM
Is there a parameter to set a File/Folder mask on a folder using {.add folder.} or {.set item.} ?
If not then would it be possible to add it in the next build?

Thanks
Title: Re: command lines
Post by: rejetto on April 06, 2011, 03:58:32 PM
ok.
let me know if you need a preview
Title: Re: command lines
Post by: raybob on April 06, 2011, 09:10:51 PM
Hey Rejetto, why does this hfs.events script not work?  I'm trying to make a script that generates thumbnails when a user uploads them. On uploading a picture, HFS launches the program, but something wrong happens with the parameters, because the program doesn't do what it's supposed to.  I know that the parameters are right for the program because they work just fine when using them in a shortcut to the program without having HFS launch it.  So obviously, something is wrong that's making HFS not give it the right parameters, but I don't know why.

Code: [Select]
[upload completed]

{.if|    {.or| {.=|%item-ext%|jpg.} | {.=|%item-ext%|png.} .}   |

{.set|parameter1|"{.vfs to disk|%item-url%.}".}
{.set|parameter2|{.chr|47.}D="D:\%user%\thumbnails\".}
{.exec|C:\Program Files\Easy Thumbnails\EzThumbs.exe| {.call|parameter1.} {.call|parameter2.} .}

.}

Parameter 1 could look like  
Code: [Select]
"D:\user\test.jpg"
and Parameter 2 would then look like
Code: [Select]
/D="D:\user\thumbnails\"
Parameter 1 is supposed to tell the program the source file and parameter 2 tells it the output.
I know that the scripting that creates the correct parameters themselves works because I had it input the result into the log with {.add to log.} and it was correct.

http://www.fookes.com/ezthumbs/

Thanks for your endless help  ;D ,
Ray


BTW, not that it's relevant because this part works but to show the thumbnails, I put this in the template.

Code: [Select]
[file=folder=link|private]


<tr class='{.if|{.mod|{.count|row.}|2.}|even|odd.}' >

<td>
<input type='checkbox' class='selector' name='box' value='%item-url%' {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
{.if not|{.get|can access.}|<img src='/~img_lock'>.}
<a class="the-item" href="%item-url%" >

<img src="%item-icon%" alt="" />
&nbsp;%item-name%</a>


[color=blue]{.if|    {.or| {.=|%item-ext%|jpg.} | {.=|%item-ext%|png.} .}   |

<div style="float:right;">
<a href="%item-url%" class="thumblink" >
<img src="/.%user%/thumbnails/thumbnail.%item-name%" alt="" />
</a>
</div>

.}[/color]

Title: Re: command lines
Post by: Mars on April 07, 2011, 11:43:30 AM


the syntax of "if" macro will be

{.if | boolean expression |
       {:  text or Set of macro-commands  when booelan TRUE :}
     |
       {:  text or Set of macro-commands  when boolean FALSE :}
/if.}

Quote
[upload completed]

{.if|{.=|%item-ext%|jpg.}{.=|%item-ext%|png.}|
{:
{.set|parameter1|"{.vfs to disk|%item-url%.}".}
{.set|parameter2|{.chr|47.}D="D:\%user%\thumbnails\".}
{.exec|C:\Program Files\Easy Thumbnails\EzThumbs.exe| {.call|parameter1.} {.call|parameter2.} .}
:}
.}

Quote
[file=folder=link|private]


<tr class='{.if|{.mod|{.count|row.}|2.}|even|odd.}' >

<td>
   <input type='checkbox' class='selector' name='box' value='%item-url%'
{.if not|{.get|can delete.}{.get|can access.}{.get|can archive item.}|disabled='disabled'.} />
   {.if not|{.get|can access.}|<img src='/~img_lock'>.}
   <a class="the-item" href="%item-url%" >

<img src="%item-icon%" alt="" />
&nbsp;%item-name%</a>

{.if|{.=|%item-ext%|jpg.}{.=|%item-ext%|png.}|
<div style="float:right;">
<a href="%item-url%" class="thumblink" >
<img src="/.%user%/thumbnails/thumbnail.%item-name%" alt="" />
</a>
</div>
.}

if your script has no error, it must work now ;)
Title: Re: command lines
Post by: rejetto on April 07, 2011, 12:14:10 PM
i can easily see two problems
1. you are using {.exec.} the wrong way.
all the command line must be supplied as a single parameter, you are dividing it in multiple parameters.

2. you didn't surround with {:these markers:} the instructions inside the IF, so they will be executed in any case.
Title: Re: command lines
Post by: raybob on April 07, 2011, 10:23:13 PM
You're right it should have quotes but that shouldn't stop it from working (and it doesn't because I just tried it)

And what do you mean I'm using it wrong?  I am using {.exec|program|parameters.}
There are 2 parameters I want to run on the program and that's what the two variables are.
Title: Re: command lines
Post by: SilentPliz on April 07, 2011, 11:25:10 PM
tested with:

Quote
[+upload completed]
{.switch|%item-ext%|,|jpg,jpe,jpeg,png,gif|
{:
{.exec|"C:\Program Files\Easy Thumbnails\EzThumbs.exe" "{.vfs to disk|%item-name%.}" /D="D:\%user%\thumbnails\".}
:}.}

Works fine  ;)
Title: Re: command lines
Post by: raybob on April 08, 2011, 02:01:07 AM
Hmmmm yeah that works!

Thanks!

Title: Re: command lines
Post by: raybob on April 17, 2011, 02:15:18 PM
Just thought I'd share this.  You can have a simple email validation system by using this program:   http://caspian.dotconf.net/menu/Software/SendEmail/ (http://caspian.dotconf.net/menu/Software/SendEmail/)

And here's my new account code.  When a user submits the new account form, they are taken to ~submission then immediately to ~Validation.  If they get the Validation code correct from the email then they are sent to ~validation-output and then immediately to ~success-creation.  Here's an example of that part that I put into my template.

Code: [Select]
[submission]

{.if     | {.postvar|user.}                                                                   |   {: {.redirect |/~newaccount?alreadysignedup=yes.}{.break.}  :}        |.}
{:{.if     | {.and| {.=|{.cookie|signedup.}|yes.} | {.!=|{.cookie|deleted.}|yes.}.}             |   {: {.redirect |/~newaccount?alreadysignedup=yes.}{.break.}  :}        |.}:}
{.if     | {.>= | {.count substring|{.postvar|name.}|{.load|User Emails.txt.}.}|1.}           |   {: {.redirect |/~newaccount?credentials=used.}{.break.}     :}        |.}
{.if     | {.>= | {.count substring|{.postvar|email.}|{.load|User Emails.txt.}.}|1.}          |   {: {.redirect |/~newaccount?credentials=used.}{.break.}     :}        |.}
{.if not | {.postvar|name.}                                                                   |   {: {.redirect |/~newaccount?username=none.}{.break.}        :}        |.}
{.if     | {.>= | {.count substring|{|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|.|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring| |{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|?|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|}|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|]|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|[|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|;|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|:|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|"|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|'|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|>|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|<|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|,|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|!|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|@|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|#|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|$|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|%|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|^|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|&|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|*|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|(|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|)|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|-|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|_|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|=|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|+|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|~|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if     | {.>= | {.count substring|`|{.postvar|name.}.}|1.}                                  |   {: {.redirect |/~newaccount?usernamee=invalid.}{.break.}    :}        |.}
{.if not | {.postvar|email.}                                                                  |   {: {.redirect |/~newaccount?emailgiven=no.}{.break.}        :}        |.}
{.if not | {.=  | {.count substring|@|{.postvar|email.}.}|1.}                                 |   {: {.redirect |/~newaccount?emailgiven=no.}{.break.}        :}        |.}
{.if not | {.>= | {.count substring|.|{.postvar|email.}.}|1.}                                 |   {: {.redirect |/~newaccount?emailgiven=no.}{.break.}        :}        |.}
{.if not | {.postvar|password1.}                                                              |   {: {.redirect |/~newaccount?passwordA=none.}{.break.}       :}        |.}
{.if not | {.postvar|password2.}                                                              |   {: {.redirect |/~newaccount?passwordB=none.}{.break.}       :}        |.}
{.if not | {.>= | {.length|{.postvar|password1.} .} | 8 .}                                    |   {: {.redirect |/~newaccount?password=short.}{.break.}       :}        |.}
{.if not | {.=  | {.postvar|password1.}             | {.postvar|password2.} .}                |   {: {.redirect |/~newaccount?passwordmatch=no.}{.break.}     :}        |.}
{.if not | {.=  | {.postvar|agree.}                 | yes.}                                   |   {: {.redirect |/~newaccount?agreement=no.}{.break.}         :}        |.}
{.if not | {.=  | {.postvar|spamcheck.}|{.add |{.postvar|x.}|{.postvar|y.}.}.}                |   {: {.redirect |/~newaccount?wrongmath=yes.}{.break.}        :}        |.}

{.mkdir|D:\{.upper|{.postvar|name.}.}.}
{.mkdir|D:\{.upper|{.postvar|name.}.}\thumbnails.}
{.add folder|real|D:\{.upper|{.postvar|name.}.}|.{.lower|{.postvar|name.}.}.}
{.new account|{.postvar|name.}|password={.postvar|password1.}|enabled=0|member of=can change password|redirect=/.{.lower|{.postvar|name.}.}/.}
{.set item|.{.postvar|name.}|hide=1|access={.postvar|name.}|delete={.postvar|name.}|upload={.postvar|name.}.}
{.copy|C:\Documents and Settings\Admin\Desktop\User Template.tpl|D:\{.upper|{.postvar|name.}.}\hfs.diff.tpl.}
{.copy|D:\user1\thumbnails\hfs.diff.tpl|D:\{.upper|{.postvar|name.}.}\thumbnails\hfs.diff.tpl.}

{.set| Validation-Code  |{.random|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9.}{.random|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9.}{.random|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9.}{.random|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9.}{.random|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9.}{.random|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9.}{.random|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9.}{.random|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9.}.}

{.set| Email-From       | -f "Internet-Drive.tk Administrator <internetdrivetk@aol.com>"  .}
{.set| Email-To         | -t "{.postvar|name.} <{.postvar|email.}>"                       .}
{.set| Email-Server     | -s smtp.aol.com                                                 .}
{.set| Email-Logon      | -xu username                                             .}
{.set| Email-Password   | -xp password                                                      .}
{.set| Email-Subject    | -u "Validate your account on Internet-Drive.tk"                 .}
{.set| Email-Content    | -m "Your Validation Code is: {.call|Validation-Code.}"          .}

{.exec|Email-{.random|A|B|C|D|E|F.}.exe {.call|Email-From.} {.call|Email-To.} {.call|Email-Server.} {.call|Email-Logon.} {.call|Email-Password.} {.call|Email-Subject.} {.call|Email-Content.} .}

{.save|C:\Documents and Settings\Admin\Desktop\Validation Codes\{.postvar|name.}.txt|{.call|Validation-Code.}.}

{.append |C:\Documents and Settings\Admin\Desktop\User Emails.txt|
{.postvar|name.}
{.postvar|email.}
{.time.}
.}






<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>

<title>internet-drive.tk BETA - Submitted New Account Request</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<style type="text/css">
body, th { font-family:tahoma, verdana, arial, helvetica, sans; font-weight:normal; font-size:9pt; }
body { margin:0; background-color:#FFFFF; padding:10px; }
p { margin:0 }
h1 {font-size:38px}
</style>

</head>

<body>

<script type="text/javascript">
var t = setTimeout("alertMsg()",3000);
function alertMsg()
{
window.location = "/~validation?name={.postvar|name.}"
}
</script>

<center>
<div style="padding-top:10%;">

<h1>If your browser does not automatically<br />
redirect you in 3 seconds, please click <a href="~validation?name={.postvar|name.}">here.</a></h1>



</div>
</center>
</body>
</html>


Code: [Select]
[validation]

{.if not|{.urlvar|name.}|{:{.redirect|/.}:}.}
{.if not|{.is file|C:\Documents and Settings\Admin\Desktop\Validation Codes\{.urlvar|name.}.txt.}|{:{.redirect|/.}:}.}  

<html><body>

<center>
<br /><br />

To activate your account, please enter the validation code that was sent to your registered email.

<br /><br />

<div style="border:1px solid; width:320px; ">
<form name="validation" action="/~validation-output" method="post" style="padding-top:16px;" >
<input type="text" size="36" name="code" /><br />
<input type="hidden" size="36" name="name" value="{.urlvar|name.}" /><br />
<input type="submit" name="send" value="Submit" />
</form>
</div>

<br />

{.if|{.=|{.urlvar|code.}|incorrect.}|

<div style="color:red;">
<b>ERROR:</b> That validation code is incorrect!
</div>

.}

</center>

</body></html>


Code: [Select]
[validation-output]

{.if |{.=|{.postvar|name.}|.}|{:{.redirect|/.}{.break.}:}.}

{.if
|
{.=|{.postvar|code.}|{.load|C:\Documents and Settings\Admin\Desktop\Validation Codes\{.postvar|name.}.txt.}.}
|{:
{.redirect|/~success-creation?user={.postvar|name.}.}
:}
.}


{.if
|
{.!=|{.postvar|code.}|{.load|C:\Documents and Settings\Admin\Desktop\Validation Codes\{.postvar|name.}.txt.}.}
|{:
{.redirect|/~validation?code=incorrect&name={.postvar|name.}.}:}
.}


Code: [Select]
[success-creation]

{.if not|{.is file|C:\Documents and Settings\Admin\Desktop\Validation Codes\{.urlvar|user.}.txt.}|{:{.redirect|/.}{.break.}:}.}
{.set account|{.urlvar|user.}|enabled=1.}
{.delete|C:\Documents and Settings\Admin\Desktop\Validation Codes\{.urlvar|user.}.txt.}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <title>Internet-Drive.tk - Made a new account!</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  
<!-- CSS INFORMATION BELOW -->

 <style type="text/css">
  
body, th { font-family:tahoma, verdana, arial, helvetica, sans; font-weight:normal; font-size:9pt; }
body { margin:8; background-color:#F8F8F8;
 padding:10px;
background-image:url("/background.png");
background-repeat:repeat-x;}
p { margin:0 }
.button7 { padding:5px; padding-top:7px; margin:15px; border:2px solid black; background:white; font-size:8pt; font-weight:bold; }
a { text-decoration:none;  background-color:Transparent; color:#000000 }
a:visited { color:#000000; }
a:hover { background-color:#BBF; }
img { border-style:none }
td { font-size:10pt; background:#C4F4C3; border:1px solid #BBF }
td img { vertical-align:top }
th, th a, th a:visited { color:#000000; font-size:14pt; font-weight:bold; padding-bottom:0; }
.button { float:right; padding:5px; padding-top:7px; margin:15px; border:2px solid black; background:white; font-size:8pt; font-weight:bold; }
.button img { vertical-align:text-bottom; }
.flag { font-weight:bold; font-size:8pt; background:white; color:red; text-align:center; border:1px solid red; }
h1 {color:black;font-family:"Comic Sans MS";font-size:38px;}
p {color:black;font-family:"Comic Sans MS";font-size:16px;}
w3css {vertical-align:bottom;text-align:right;}
hr {width:600px; }

</style>
  

</head>
<body>

<center>



<h1>Your account was successfully validated!</h1><br />
<h2>You may now log in.</h1><br /><br />

<a href="~login" class="button7" style="margin-bottom:200px;" > <img src="/~img27" alt="" /> USER LOGON</a>
<br /><br /><br /><br />



{.section|footer.}
Title: Re: command lines
Post by: rejetto on May 24, 2011, 03:51:20 PM
you didn't use my {.regexp.} suggestion in the end