Merge pull request #430 from n3bir0s/fix_427

Fix for issue 427
This commit is contained in:
Andrius Putna committed 2016-02-04 11:33:46 +02:00
commit 8a310425c1
17 files changed
+75 -24

No files matched your search

+1 -1
View File
@@ -53,4 +53,4 @@ deploy:
on:
tags: true
all_branches: true
php: 5.3
php: 5.3
+1 -1
View File
@@ -90,7 +90,7 @@
<target name="test-unit">
<exec executable="src/bb-vendor/bin/phpunit" failonerror="true">
<arg line="tests/bb-library/" />
<arg line="tests/bb-library/" />
</exec>
<exec executable="src/bb-vendor/bin/phpunit" failonerror="true">
<arg line="tests/bb-modules/" />
+1 -1
View File
@@ -251,7 +251,7 @@ function twig_size_filter($value)
function twig_markdown_filter(Twig_Environment $env, $value)
{
$markdownParser = new \Michelf\MarkdownExtra;
return $markdownParser->transform($value);
return $markdownParser->transform(htmlspecialchars($value, ENT_NOQUOTES));
}
function twig_truncate_filter(Twig_Environment $env, $value, $length = 30, $preserve = false, $separator = '...')
+3 -1
View File
@@ -64,7 +64,9 @@ class Model_ProductDomainTable extends Model_ProductTable
private function isFreeDomainSet($item)
{
return isset($item['config']['free_domain']) && $item['config']['free_domain'];
if(isset($item['config']['free_domain']) && $item['config']['free_domain'] && isset($item['config']['free_domain_periods']) && in_array($item['config']['period'],$item['config']['free_domain_periods']) && isset($item['config']['free_tlds']) && in_array($item['config']['tld'],$item['config']['free_tlds']))
{ return true;}
else{ return false;}
}
private function registerDomainMatch($item, $config)
+3 -3
View File
@@ -281,9 +281,9 @@ class Service implements InjectionAwareInterface
$where = array();
$params = array();
if($search) {
$where[] = 'c.first_name LIKE %:first_name% OR c.last_name LIKE %:last_name% OR c.id LIKE :id';
$params[':first_name'] = $search;
$params[':last_name'] = $search;
$where[] = 'c.first_name LIKE :first_name OR c.last_name LIKE :last_name OR c.id LIKE :id';
$params[':first_name'] = "%".$search."%";
$params[':last_name'] = "%".$search."%";
$params[':id'] = $search;
}
+1 -1
View File
@@ -46,7 +46,7 @@ class Service
}
if ($search) {
$sql .= " title LIKE :q OR content LIKE :q";
$sql .= " AND title LIKE :q OR content LIKE :q";
$filter[':q'] = "%$search%";
}
@@ -4,6 +4,9 @@
<a class="accordion-toggle" href="#checkout" data-parent="#accordion1" data-toggle="collapse"><span class="awe-shopping-cart"></span> {% trans 'Cart' %} <span class="label label-warning pull-right">{{ cart.items | length }}</span></a>
</div>
{% if cart.items %}
{% set cart = cart|merge({'total':0})%}
{% set temp_total_discount =0 %}
{% set temp_cart_total =0 %}
<div id="checkout" class="accordion-body collapse {% if request.checkout and client %}in{%endif%}">
<div class="accordion-inner" id="checkout-inner">
@@ -17,6 +20,7 @@
</thead>
<tbody>
{% for i, item in cart.items %}
{% set temp_cart_total = temp_cart_total + (item.price*item.quantity) %}
<tr>
<td>
{{ item.title }}
@@ -30,8 +34,14 @@
</td>
<td>
{% if item.discount_price %}
{% set temp_discount = (item.price * item.quantity ) %}
{% set temp_total_discount = temp_total_discount + temp_discount %}
{% set item = item|merge({'discount_price': temp_discount}) %}
{% set cart =cart|merge({'discount':temp_discount}) %}
<del>{{ (item.price * item.quantity) | money_convert }}</del>
<strong class="text-success">{{ (item.price * item.quantity - item.discount_price) | money_convert }}</strong>
{% else %}
{{ (item.price * item.quantity) | money_convert }}
{% endif %}
@@ -97,6 +107,10 @@
{% endif %}
</tr>
{% endif %}
{% set cart= cart|merge({'total':temp_cart_total})%}
{% set cart= cart|merge({'discount':temp_total_discount})%}
{% endfor %}
</tbody>
</table>
@@ -137,7 +151,7 @@
{% if cart.discount >0 %}
<tr>
<td><strong>{% trans 'Subtotal:' %}</strong></td>
<td><strong>{{ (cart.total + cart.discount)| money_convert }}</strong></td>
<td><strong>{{ (cart.total)| money_convert }}</strong></td>
</tr>
<tr>
<td><strong>{% trans 'Discount:' %}</strong></td>
@@ -156,6 +170,7 @@
{% endif %}
<tr>
<td><strong>{% trans 'Total:' %}</strong></td>
{% set cart= cart|merge({'total':temp_cart_total - temp_total_discount})%}
<td><strong>{{ (cart.total + tax_amount) | money_convert }}</strong></td>
</tr>
@@ -171,8 +171,8 @@ class Service implements \Box\InjectionAwareInterface
'timezone' => 'auto',
'allowproxy' => '0',
'charset' => 'ISO-8859-1',
'servertype' => 'ShoutCast2',
'sourcetype' => 'sctrans2',
'servertype' => $pc['servertype'],
'sourcetype' => $pc['sourcetype'],
'template' => $pc['template'],
);
@@ -413,4 +413,4 @@ class Service implements \Box\InjectionAwareInterface
{
return $this->di['crypt']->encrypt($password, $this->_salt);
}
}
}
@@ -21,6 +21,14 @@
<div class="fix"></div>
</div>
<div class="rowElem">
<label>{% trans 'Server Type' %}</label>
<div class="formRight">
<input type="text" name="config[servertype]" value="{{ product.config.servertype }}" placeholder="Enter the Server type ShoutCast2/IceCast"/>
</div>
<div class="fix"></div>
</div>
<div class="rowElem">
<label>{% trans 'Max clients' %}</label>
<div class="formRight">
@@ -56,7 +64,7 @@
<div class="rowElem">
<label>{% trans 'Autostart' %}</label>
<div class="formRight">
<input type="text" name="config[autostart]" value="{{ product.config.autostart }}" placeholder="Set this to '1' to automatically start the server after provisioning"/>
<input type="text" name="config[autostart]" value="{{ product.config.autostart }}" placeholder="Set this to '1' to automatically start the server after provisioning, Set it to 2 for icecast"/>
</div>
<div class="fix"></div>
</div>
@@ -64,4 +72,4 @@
<input type="submit" value="{% trans 'Update' %}" class="greyishBtn submitForm" />
<input type="hidden" name="id" value="{{ product.id }}" />
</fieldset>
</form>
</form>
+1 -1
View File
@@ -260,7 +260,7 @@ class Service implements InjectionAwareInterface
throw new \Box_Exception('Account password is missing or is not valid');
}
$u = $data['username'];
$u = strtolower($data['username']);
if($this->_performOnService($order)){
list($adapter, $account) = $this->_getAM($model);
+2 -2
View File
@@ -1156,12 +1156,12 @@ class Service implements \Box\InjectionAwareInterface
{
$data = $this->di['db']->toArray($model);
$messages = array();
$messagesArr = $this->di['db']->find('SupportPTicketMessage', 'support_p_ticket_id = :support_p_ticket_id', array(':support_p_ticket_id' => $model->id));
$messagesArr = $this->di['db']->find('SupportPTicketMessage', 'support_p_ticket_id = :support_p_ticket_id ORDER BY id', array(':support_p_ticket_id' => $model->id));
foreach ($messagesArr as $msg) {
$messages[] = $this->publicMessageToApiArray($msg);
}
$first = $this->di['db']->findOne('SupportPTicketMessage', 'support_p_ticket_id = :support_p_ticket_id LIMIT 1', array(':support_p_ticket_id' => $model->id));
$first = reset($messagesArr);
if ($first instanceof \Model_SupportPTicketMessage) {
$data['author'] = $this->publicMessageGetAuthorDetails($first);
} else {
@@ -160,7 +160,7 @@
</div>
</div>
<div id="suspend_popup_panel">
<input type="button" class="blueBtn" value="&nbsp;{% trans 'Suspend' %}&nbsp;" id="popup_ok" onclick="return susp.suspendOrder('admin/order/suspend?id={{order.id}}', 'reason');"/>
<input type="button" class="blueBtn" value="&nbsp;{% trans 'Suspend' %}&nbsp;" id="popup_ok" onclick="return susp.suspendOrder('/api/admin/order/suspend?id={{order.id}}', 'reason');"/>
<input type="button" class="basicBtn" value="&nbsp;Cancel&nbsp;" id="popup_cancel" onclick="return susp.suspenderHide();"/>
</div>
</div>
@@ -46,6 +46,23 @@
</div>
<div class="fix"></div>
</div>
<!-- Select periods to offer free domains -->
<div class="rowElem free-periods-row">
<label>{% trans 'Select free periods' %}</label>
<div class="formRight">
<select name="config[free_domain_periods][]" multiple="multiple" class="multiple" size="8">
<option value="1M" {% if "1M" in product.config.free_domain_periods %}selected="selected"{% endif %}>1M</option>
<option value="3M" {% if "3M" in product.config.free_domain_periods %}selected="selected"{% endif %}>3M</option>
<option value="6M" {% if "6M" in product.config.free_domain_periods %}selected="selected"{% endif %}>6M</option>
<option value="1Y" {% if "1Y" in product.config.free_domain_periods %}selected="selected"{% endif %}>1Y</option>
<option value="2Y" {% if "2Y" in product.config.free_domain_periods %}selected="selected"{% endif %}>2Y</option>
<option value="3Y" {% if "3Y" in product.config.free_domain_periods %}selected="selected"{% endif %}>3Y</option>
</select>
</div>
<div class="fix"></div>
</div>
<div class="rowElem">
<label>{% trans 'Free domain transfer' %}:</label>
<div class="formRight">
@@ -128,18 +145,23 @@
<script>
var free_domain_radios = $('input:radio[name="config[free_domain]"]');
var freeTldsRow = $('.free-tlds-row');
var freePerdsRow = $('.free-periods-row');
free_domain_radios.on('click', function(){
if ($(this).val() == 1){
freeTldsRow.fadeIn('slow');
freePerdsRow.fadeIn('slow');
}
if ($(this).val() == 0){
freeTldsRow.fadeOut('slow');
freePerdsRow.fadeOut('slow');
}
});
if (free_domain_radios.filter('[value=0]:checked').length > 0){
freeTldsRow.hide();
freePerdsRow.hide();
}
</script>
@@ -42,8 +42,8 @@
<td>{{ item.period | period_title }}</td>
<td class="currency">
{% if item.discount_price %}
<del>{{ item.price | money_convert }}</del>
{{ (item.price - item.discount_price) | money_convert }}
<del>{{ (item.price*item.quantity) | money_convert }}</del>
{{ (item.price*item.quantity - item.discount_price*item.quantity) | money_convert }}
{% else %}
{{ item.price | money_convert }}
{% endif %}
@@ -96,7 +96,11 @@
<div class="currency">{{ tax_amount | money_convert }}</div>
{% endif %}
<p>{% trans 'Total:' %}</p>
<div class="currency">{{ (cart.total + tax_amount) | money_convert }}</div>
<div class="currency">{% if cart.items[1].quantity > 1 and cart.items[1].discount_price%}
{{ (cart.total - (cart.items[1].price*(cart.items[1].quantity-1))) | money_convert }}
{%else%}
{{(cart.total + tax_amount) | money_convert }}
{%endif%}</div>
<form method="post" action="{{ 'api/client/cart/checkout'|link }}" class="api-form" data-api-jsonp="onAfterCartCheckout">
{% set enough_in_balance = client.client_balance_get_total >= cart.total %}
{% if cart.total and not enough_in_balance %}
+1 -1
View File
@@ -419,7 +419,7 @@ VALUES
(7,3,7,NULL,'BoxBilling license','boxbilling-license','BoxBilling license','product',1,'enabled',0,0,'after_payment','[4,5,6]',NULL,0,0,0,NULL,NULL,NULL,70,'{\"prefix\":\"BOX-PRO-\", \"length\":25, \"plugin\":\"Default\"}','2012-01-01 12:00:00','2012-01-01 12:00:00','license'),
(8,3,8,NULL,'Free BoxBilling license','free-license','Free BoxBilling license','product',1,'enabled',0,0,'after_order','[4,5,6]',NULL,0,0,0,NULL,NULL,NULL,70,'{\"prefix\":\"BOX-FREE-\", \"length\":25, \"plugin\":\"Default\"}','2012-01-01 12:00:00','2012-01-01 12:00:00','license'),
(9,1,9,NULL,'My Demo software','boxbilling-software','My Demo software description','product',1,'enabled',0,0,'after_payment','[4,5,6]',NULL,0,0,0,NULL,NULL,NULL,60,'{\"filename\":\"test.txt\"}','2012-01-01 12:00:00','2012-01-01 12:00:00','downloadable'),
(10,2,10,NULL,'Shared Hosting','shared-hosting','Shared hosting description','product',1,'enabled',0,0,'after_payment','[4,5,6]',NULL,0,0,0,NULL,NULL,NULL,2,'{\"server_id\":\"1\", \"hosting_plan_id\":\"1\", \"reseller\":0}','2012-01-01 12:00:00','2012-01-01 12:00:00','hosting'),
(10,2,10,NULL,'Shared Hosting','shared-hosting','Shared hosting description','product',1,'enabled',0,0,'after_payment','[4,5,6]',NULL,0,0,0,NULL,NULL,NULL,2,'{\"server_id\":\"1\", \"hosting_plan_id\":\"1\", \"reseller\":0,\"free_domain_periods\":[\"3M\"],\"free_domain\":\"1\",\"free_tlds\":[\".com\"]}','2012-01-01 12:00:00','2012-01-01 12:00:00','hosting'),
(11,2,11,NULL,'Gold Hosting','reseller-hosting','Reseller hosting description','product',1,'enabled',0,0,'after_payment','[4,5,6]',NULL,0,0,0,NULL,NULL,NULL,3,'{\"server_id\":\"1\", \"hosting_plan_id\":\"1\", \"reseller\":1}','2012-01-01 12:00:00','2012-01-01 12:00:00','hosting'),
(12,5,NULL,NULL,'All domains','domain-checker','Choose domains','product',1,'enabled',0,0,'after_payment','[4,5,6]',NULL,0,0,0,NULL,NULL,NULL,1,'{\"all_tlds\":1}','2012-01-01 12:00:00','2012-01-01 12:00:00','domain'),
(13,4,12,NULL,'Forum membership','forum-membership','Register for our forum membership','product',1,'enabled',0,0,'after_payment',NULL,NULL,0,0,0,NULL,NULL,NULL,10,NULL,'2012-01-01 12:00:00','2012-01-01 12:00:00','membership');
+1 -1
View File
@@ -45,7 +45,7 @@
<product id="8" product_category_id="1" product_payment_id="8" type="hosting" title="Shared hosting" description="" unit="month" active="1" is_addon="0" addons="[3,4,5]" config='{"server_id":"1", "hosting_plan_id":"1"}' setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="9" product_category_id="1" product_payment_id="9" type="hosting" title="Reseller hosting" description="" unit="month" active="1" is_addon="0" addons="[3,4,5]" config='{"server_id":"1", "hosting_plan_id":"1"}' setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="10" product_category_id="1" type="domain" title="All domains" description="" unit="month" active="1" is_addon="0" addons="[3,4,5]" config='{"all_tlds":1}' setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="11" product_category_id="1" product_payment_id="8" type="hosting" title="Shared hosting with free domain" description="" unit="month" active="1" is_addon="0" addons="" config='{"server_id":"1", "hosting_plan_id":"1", "free_domain":"1", "free_transfer":"1"}' setup="after_payment" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="11" product_category_id="1" product_payment_id="8" type="hosting" title="Shared hosting with free domain" description="" unit="month" active="1" is_addon="0" addons="" config='{"server_id":"1", "hosting_plan_id":"1", "free_domain":"1", "free_transfer":"1","free_tlds":[".com"],"free_domain_periods":["1M","3M","6M","1Y","2Y"]}' setup="after_payment" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="12" product_category_id="1" product_payment_id="10" type="membership" title="PVA Membership" description="" unit="month" active="1" is_addon="0" addons="" config='' setup="after_payment" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="13" product_category_id="1" product_payment_id="11" type="custom" title="Product with setup price" description="Product with setup price" unit="product" active="1" is_addon="0" addons="" setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="15" product_category_id="1" product_payment_id="12" type="solusvm" title="SolusVM product" description="VPS Product" unit="product" active="1" is_addon="0" addons="" config='{"node":"1", "plan":"Small", "vtype":"openvz", "ips":"1"}' setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
+1 -1
View File
@@ -41,7 +41,7 @@
<product id="8" product_category_id="1" product_payment_id="8" type="hosting" title="Shared hosting" description="" unit="month" active="1" is_addon="0" addons="[3,4,5]" config='{"server_id":"1", "hosting_plan_id":"1"}' setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="9" product_category_id="1" product_payment_id="9" type="hosting" title="Reseller hosting" description="" unit="month" active="1" is_addon="0" addons="[3,4,5]" config='{"server_id":"1", "hosting_plan_id":"1"}' setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="10" product_category_id="1" type="domain" title="All domains" description="" unit="month" active="1" is_addon="0" addons="[3,4,5]" config='{"all_tlds":1}' setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="11" product_category_id="1" product_payment_id="8" type="hosting" title="Shared hosting with free domain" description="" unit="month" active="1" is_addon="0" addons="" config='{"server_id":"1", "hosting_plan_id":"1", "free_domain":"1", "free_transfer":"1"}' setup="after_payment" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="11" product_category_id="1" product_payment_id="8" type="hosting" title="Shared hosting with free domain" description="" unit="month" active="1" is_addon="0" addons="" config='{"server_id":"1", "hosting_plan_id":"1", "free_domain":"1", "free_transfer":"1","free_tlds":[".com"],"free_domain_periods":["1M","3M","6M","1Y","2Y"] }' setup="after_payment" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="12" product_category_id="1" product_payment_id="10" type="membership" title="PVA Membership" description="" unit="month" active="1" is_addon="0" addons="" config='' setup="after_payment" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="13" product_category_id="1" product_payment_id="11" type="custom" title="Product with setup price" description="Product with setup price" unit="product" active="1" is_addon="0" addons="" setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>
<product id="15" product_category_id="1" product_payment_id="12" type="solusvm" title="SolusVM product" description="VPS Product" unit="product" active="1" is_addon="0" addons="" config='{"node":"1", "plan":"mazas", "vtype":"openvz", "ips":"1"}' setup="after_payment" plugin="" created_at="2011-01-01 12:00:00" updated_at="2011-01-01 12:00:00"/>