FileZilla Server.xml is not reloading and showiing changes - filezilla

I created something basic that will soon allow automatic user uploads for fileZilla, I have not yet made it general, Though what i am curious about is, Why is it that when I look back in the user table of the fileZilla GUI the new user is not being added? All i did was put the xml structure in a write function in php and changed the user from the one I made in the fileZilla GUI.
///write to xml file
$xml ='FileZilla Server/FileZilla Server.xml';
$handler = fopen($xml,'w');
fwrite($handler,'<FileZillaServer>
<Settings>
<Item name="Admin port" type="numeric">14147</Item>
</Settings>
<Groups />
<Users>
<User Name="ddf">
<Option Name="Pass">B7B5349BC807B2C385478AA02C2ADDCEA37F3330994D15457C8CB5ED378EF9C7D0E64D5366048AEFEF8F2424662B25A1025D863ACB5F39093BA04091BE510412</Option>
<Option Name="Salt">)W5#&apos;jgXQ5^&p2F$Wa2V2F4~RG^Ox9.J24H(:LB)i;M[BbQ8<m,J52#Jt$!8Ms/.</Option>
<Option Name="Group"></Option>
<Option Name="Bypass server userlimit">0</Option>
<Option Name="User Limit">0</Option>
<Option Name="IP Limit">0</Option>
<Option Name="Enabled">1</Option>
<Option Name="Comments"></Option>
<Option Name="ForceSsl">0</Option>
<IpFilter>
<Disallowed />
<Allowed />
</IpFilter>
<Permissions>
<Permission Dir="C:\Users\greatness\Desktop\New folder">
<Option Name="FileRead">1</Option>
<Option Name="FileWrite">0</Option>
<Option Name="FileDelete">0</Option>
<Option Name="FileAppend">0</Option>
<Option Name="DirCreate">0</Option>
<Option Name="DirDelete">0</Option>
<Option Name="DirList">1</Option>
<Option Name="DirSubdirs">1</Option>
<Option Name="IsHome">1</Option>
<Option Name="AutoCreate">0</Option>
</Permission>
</Permissions>
<SpeedLimits DlType="0" DlLimit="10" ServerDlLimitBypass="0" UlType="0" UlLimit="10" ServerUlLimitBypass="0">
<Download />
<Upload />
</SpeedLimits>
</User>
</Users>
</FileZillaServer>
');
}
////////////////////////////////////////

Afaik, FileZilla Server does not reload the configuration when you change the file.
The FileZilla Server interface uses Admin interface port of FileZilla Server to notify it about a change to make it reload the configuration.
You might be able to implement the same. See AdminSocket class in FileZilla Server repository.

Related

Use one List for multiple web pages

I have a webpage with the following code:
<td width="178>NAME:</td>
<td><select NAME="NAME" size="1" tabindex="1">
<option selected = true VALUE"">Please Specify</option>
<option VALUE=" Brown Dog">Brown Dog</option>
<option VALUE=" Blue Dog">Blue Dog</option>
<option VALUE=" Big Dog">Big Dog</option>
<option VALUE=" Bad Dog">Bad Dog</option>
...
</select>
</td>
</tr>
</tr>
This same exact code also resides in a number of other pages. When i update one page I have to update all of the other pages as well.
How can i code this information so it shows up in all of my webpages but only have to update it in one place?
Can I store this information in a file and call it in when the webpage is loaded?

Scrolling and selecting a checkbox in a drop down using python webdriver

I have to select a checkbox from within a drop down. The problem is the value is not visible. I need to scroll down to reach the value.
html
<select class="select_box" tabindex="25" id="cbo_CC_CType"
name="cbo_CC_CType" multiple="multiple" multi-select="true"
autofillkey="CMDTYPE" title="COMMAND TYPE">
<option value="Authorization">Authorization</option>
<option value="Cancel">Cancel</option>
<option value="Change">Change</option>
<option value="Clear">Clear</option>
<option value="Final">Final</option>
<option value="Final1">Final</option>
<option value="Fina2">Final</option>
<option value="Fina3">Final</option>
.
.
.
.
.
.
<option value="MyCar">MyCar</option>
</select>
I tried:
chromedriver.find_element_by_xpath("//select[#id='cbo_CC_CType']/option[#value='MyCar']").click()
Can someone please help

Transfer Value from drop down to a

I need some help ...
I need the location drop down box to determine the appropriate inbox the form should be sent to.
ex if I choose Houston from the drop down box it will send it to the PayrollUSA email.
Im currently using a radio button to make the selection but i would like to automate with the drop down.
Im pretty new to this but im sure theres a if statement that can tie them together...
im using .asp for this.
<input type="radio" name="payroll" value="PayrollUSA#mail.com" checked="checked">US Payroll
<input type="radio" name="payroll" value="PayrollCAN#mail.com">CAN Payroll
<input type="radio" name="payroll" value="PayrollUK#mail.com">UK Payroll
<input type="radio" name="payroll" value="PayrollHK#mail.com">HK Payroll
Drop down selection
<SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
<option selected >Select</option>
<OPTION>Calgary</OPTION>
<OPTION>Chicago</OPTION>
<OPTION>Hong Kong</OPTION>
<OPTION>Houston</OPTION>
<OPTION>London</OPTION>
<OPTION>Los Angeles</OPTION>
<OPTION>Montreal</OPTION>
<OPTION>New York</OPTION>
<OPTION>New York Corporate</OPTION>
<OPTION>Philadelphia</OPTION>
<OPTION>San Francisco</OPTION>
<OPTION>Toronto</OPTION>
<OPTION>Toronto Corporate</OPTION>
<OPTION>Vancouver</OPTION>
</SELECT>
If you need the option value to be held then try this:
<SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
<option value="">Select an Option</option>
<option <% if Business_Unit= "PayrollCAN#mail.com" then %> selected <% End if %> value="PayrollCAN#mail.com">Calgary</option>
<option <% if Business_Unit= "PayrollUSA#mail.com" then %> selected <% End if %> value="PayrollUSA#mail.com">Chicago</option>
</select>
etc. for each option and same value may be used for different option displays
I imaging this should just be html based. So your option menu should look like:
<SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
<option value="-1">Select an Option</option>
<OPTION value="PayrollCAN#mail.com">Calgary</OPTION>
<OPTION value="PayrollUSA#mail.com">Chicago</OPTION>
<OPTION value="PayrollHK#mail.com">Hong Kong</OPTION>
<OPTION value="PayrollUSA#mail.com">Houston</OPTION>
<OPTION value="PayrollUK#mail.com">London</OPTION>
<OPTION value="PayrollUSA#mail.com">Los Angeles</OPTION>
<OPTION value="PayrollCAN#mail.com">Montreal</OPTION>
<OPTION value="PayrollUSA#mail.com">New York</OPTION>
<OPTION value="PayrollUSA#mail.com">New York Corporate</OPTION>
<OPTION value="PayrollUSA#mail.com">Philadelphia</OPTION>
<OPTION value="PayrollUSA#mail.com">San Francisco</OPTION>
<OPTION value="PayrollCAN#mail.com">Toronto</OPTION>
<OPTION value="PayrollCAN#mail.com">Toronto Corporate</OPTION>
<OPTION value="PayrollCAN#mail.com">Vancouver</OPTION>
</SELECT>
You can use the same value multiple times if needed

cfselect - how to dynamically set the selected option value w/ manual values?

If I have a select setup with with hard manual values and I want to set one of the options below as the default value based on that, how would you go about it? Like when this form is reached theres a variable that will contain 1 through 12. So if it's "6" I'd like to make "6 months" the selected value. I know you can put "selected = "selected"" directly in the option values but I don't see how to get an if statement in there. I tried doing it a few was in the cfselect and couldn't figure out anything that worked.
Thanks!
<cfselect name="months_select" id="months_select" multiple="no">
<option value="1">1 Month</option>
<option value="2">2 Months</option>
<option value="3">3 Months</option>
<option value="4">4 Months</option>
<option value="5">5 Months</option>
<option value="6">6 Months</option>
<option value="7">7 Months</option>
<option value="8">8 Months</option>
<option value="9">9 Months</option>
<option value="10">10 Months</option>
<option value="11">11 Months</option>
<option value="12">12 Months</option>
</cfselect>
You can embed the CF directly into the HTML, I've done the first one as an example.
<select name="months_select" id="months_select" multiple="no">
<option value="1" <cfif YourVariable EQ 1>selected="selected"</cfif>>1 Month</option>
<option value="2">2 Months</option>
<option value="3">3 Months</option>
<option value="4">4 Months</option>
<option value="5">5 Months</option>
<option value="6">6 Months</option>
<option value="7">7 Months</option>
<option value="8">8 Months</option>
<option value="9">9 Months</option>
<option value="10">10 Months</option>
<option value="11">11 Months</option>
<option value="12">12 Months</option>
</select>
You're better off making a loop though.
<select name="months_select" id="months_select" multiple="no">
<cfloop from="1" to="12" index="Month">
<option value="#Month#" <cfif YourVariable EQ Month>selected="selected"</cfif>>#Month# Month<cfif Month GT 1>s</cfif></option>
</cfloop>
</select>
Hope that helps.
If you're using cfselect and generating your options with a query, you can define the default value there.
<cfselect
name="months_select"
id="months_select"
multiple="no"
query="numMonths"
selected="#monthSelected#"
value="monthValue"></cfselect>

Looking to replace option value="" with the text between <option value="">this text</option>

I have this html, and I want to replace the numeric value within value="##" with the value between <option>value</option>
For example: <option value="16">Accounting</option>, I want to know the regex it'd take to automatically change it to <option value="Accounting">Accounting</option>
I plan on doing it to this entire list.
<option value="16">Accounting A.A.S.</option>
<option value="15">Accounting A.S.</option>
<option value="33">Art Studies</option>
<option value="18">Business Administration A.A.S.</option>
<option value="17">Business Administration A.S.</option>
<option value="20">Computer Network Technician</option>
<option value="21">Computer Support Specialist</option>
<option value="40">Criminal Justice A.A.S.</option>
<option value="39">Criminal Justice A.S.</option>
<option value="37">Criminal Justice: Corrections Certificate</option>
<option value="41">Criminal Justice: Cybersecurity</option>
<option value="42">Criminal Justice: Economic Crime</option>
<option value="43">Criminal Justice: Forensic Investigation</option>
<option value="34">Early Childhood</option>
<option value="22">Fashion Buying & Merchandising</option>
<option value="35">Fine Arts</option>
<option value="23">Health Services Management A.S.</option>
<option value="24">Health Services Management Technology A.A.S.</option>
<option value="92">Human Resource Management A.A.S.</option>
<option value="44">Human Services</option>
<option value="25">International Business</option>
<option value="36">Liberal Arts & Sciences: Childhood Education</option>
<option value="49">Liberal Arts & Sciences: Communication Arts</option>
<option value="50">Liberal Arts & Sciences: General Studies</option>
<option value="52">Liberal Arts & Sciences: Social Science</option>
<option value="51">Liberal Arts and Sciences: Humanities</option>
<option value="26">Marketing A.A.S.</option>
<option value="27">Medical Coder/Transcriptionist Certificate</option>
<option value="45">Music Industry</option>
<option value="28">Paralegal</option>
<option value="46">Photographic Technology</option>
<option value="47">Radio/Television Broadcasting</option>
<option value="91">Science A.S.</option>
<option value="29">Small Business Management</option>
<option value="30">Small Business Management: Certificate</option>
<option value="48">Teaching Assistant: Certificate</option>
<option value="31">Travel & Tourism: Hospitality & Events Management</option>
<option value="32">Website and E-Business Development</option>
EDIT: I want to use GREP, within textwrangler
Just remove the value attributes. <option> by default takes a value of it's content.
<option value="Accounting">Accounting</option>
is equivalent to:
<option>Accounting</option>
Edit: using sed you can do
sed -r s/' value="[0-9]+"'//g
I assume this means you want:
<option value="14">Foobar</option>
To become:
<option value="Foobar">Foobar</option>
If so, here's the Javascript. I assume the select variable contains the surrounding <select> tag DOM element, e.g. by form.nameOfselect.
for ( var option : select.options ) {
option.value = option.text;
}
Under Linux:
sed 's|<option value="[^"]*">\([^<>]*\)</option>|<option value="\1">\1</option>|g'
If your HTML is well-formed, this will do the trick:
Regex:
(?<=<option) value="\d+"
Replace with the empty string.
In HTML, option values fall back automatically to the displayed text, if no value attribute is present.
You've added that you want to perform the operation in a text editor. I wrote something assuming you'd want to use php, and I'll let it stand here because I think it's important.
Anyway, using TextWrangler (or any other text editor), replace
<option value="[^"]*">([^<]*)</option>
with
<option value="\1">\1</option>
As you're mostly active in the php tag, I assume you're asking for a solution in php. However, let me begin this answer with an advice: If you are looking for a way, state your goal, not a technology you think is suitable. regexps work, but this is far easier in simplexml:
$xml = str_replace("&", "&", $xml); // Fix errors in your XML
$doc = simplexml_load_string($xml);
foreach ($doc->xpath("//option") as $o) {
$o["value"] = "" . $o;
}
$xml = $doc->asXML();
If you insist on using a regexps, you can do so:
$xml = preg_replace(
'#<option value="[^"]*">([^<]*)</option>#',
'<option value="$1">$1</option>', $xml);
It can be made a bit more general, but it works when there are no other attributes in the option tag:
/(.*")([^"]+)(">)([^<]+)(.*)/
Then replace the captured string with this:
$1$4$3$4$5
If you're using backslash as the subgroup reference character, replace the dollar signs with backslash.
Tip: There is a great regexp tester online at http://gskinner.com/RegExr/, check it out!
I haven't tested this, but I believe this will work, using jQuery.
$('option').each(function(elm) { $(this).val($(this).text()); });