Commit 5ab387a5 authored by Mario's avatar Mario

Merge branch '3.4RC'

parents 6db8413d 0369ab26
MIT License
Copyright (c) 2017 Matthew Dent
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
url: $baseurl/cart
requires: local_channel
name: Cart
photo: $baseurl/addon/cart/view/img/cart.png
This diff is collapsed.
$itemtypehook='cart_order_before_additem_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
call_hooks('cart_order_before_additem',$calldata);
--
$itemtypehook='cart_order_additem_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
call_hooks('cart_order_additem',$calldata);
--
$itemtypehook='cart_order_after_additem_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
}
call_hooks('cart_order_after_additem',$calldata);
--
$itemtypehook='cart_order_before_updateitem_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
call_hooks('cart_order_before_updateitem',$calldata);
--
$itemtypehook='cart_order_updateitem_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
call_hooks('cart_order_updateitem',$calldata);
--
$itemtypehook='cart_order_after_updateitem_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
}
call_hooks('cart_order_after_updateitem',$calldata);
--
$calldata = Array("order"=>$order,"content"=null);
call_hooks('cart_display_before',$calldata);
--
$itemtypehook='cart_display_before_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
call_hooks("cart_display_item",$calldata);
--
unset($calldata["content"]);
call_hooks("cart_display_item_after",$calldata);
--
$calldata["content"]=null;
call_hooks($itemtypehook,$calldata);
--
$calldata = Array("orderhash"=>$orderhash,"content"=null);
call_hooks('cart_display_after',$calldata)
--
$itemtypehook='cart_before_checkout_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
$calldata=Array('order'=>$order,"error"=>null,"content"=>null)
call_hooks('cart_before_checkout',$calldata);
--
$calldata=Array('order'=>$order,"error"=>null,"content"=>null)
call_hooks('cart_checkout',$calldata);
--
$itemtypehook='cart_after_checkout_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
$calldata=Array('order'=>$order,"content"=>null)
call_hooks('cart_after_checkout',$calldata);
--
$itemtypehook='cart_orderpaid_'.$itemtype;
call_hooks($itemtypehook,$calldata);
--
$calldata=Array('order'=>$order,"error"=>null,"content"=>null)
call_hooks('cart_orderpaid',$calldata);
<?php
function cart_post_manual_checkout_confirm () {
$orderhash = cart_getorderhash(false);
if ($_POST["orderhash"] != $orderhash) {
notice (t('Error: order mismatch. Please try again.') . EOL );
goaway(z_root() . '/cart/' . argv(1) . '/checkout/start');
}
$order = cart_loadorder($orderhash);
cart_do_checkout ($order);
cart_do_checkout_after ($order);
//cart_do_fulfill ($order); //No auto fulfillment on manual payments.
//goaway(z_root() . '/cart/' . argv(1) . '/checkout/complete');
}
function cart_checkout_complete (&$hookdata) {
}
function cart_checkout_manual (&$hookdata) {
$page_uid = ((App::$profile_uid) ? App::$profile_uid : local_channel());
$manualpayments = get_pconfig($page_uid,'cart','enable_manual_payments');
$manualpayments = isset($manualpayments) ? $manualpayments : false;
if (!$manualpayments) {
notice (t('Manual payments are not enabled.') . EOL );
goaway(z_root() . '/cart/' . argv(1) . '/checkout/start');
}
$orderhash = cart_getorderhash(false);
if (!$orderhash) {
notice (t('Order not found.') . EOL );
goaway(z_root() . '/cart/' . argv(1) . '/order');
}
$order = cart_loadorder($orderhash);
$manualpayopts = get_pconfig($page_uid,'cart','manual_payopts');
$manualpayopts["order_hash"]=$orderhash;
$order["payopts"]=$manualpayopts;
$order["finishedtext"]=t("Finished");
$order["finishedurl"]= z_root() . '/cart/' . $nick;
$template = get_markup_template('basic_checkout_manual_confirm.tpl','addon/cart/');
$display = replace_macros($template, $order);
$hookdata["checkoutdisplay"] = $display;
}
function cart_paymentopts_register_manual (&$hookdata) {
global $id;
$nick = argv(1);
$owner = channelx_by_nick($nick);
if(! $owner) {
notice( t('Invalid channel') . EOL);
goaway('/' . argv(0));
}
$manualpayments = get_pconfig(App::$profile['uid'],'cart','enable_manual_payments');
$manualpayments = isset($manualpayments) ? $manualpayments : false;
logger ("[cart] MANUAL PAYMENTS ($nick , ".$id.") ? ".print_r($manual_payments,true));
if ($manualpayments) {
$hookdata["manual"]=Array('title'=>'Manual Payment','html'=>"<b>Pay by Check, Money Order, or other manual payment method</b>");
}
return;
}
function cart_manualpayments_unload () {
Zotlabs\Extend\Hook::unregister('cart_paymentopts','addon/cart/manual_payments.php','cart_paymentopts_register_manual');
Zotlabs\Extend\Hook::unregister('cart_checkout_manual','addon/cart/manual_payments.php','cart_checkout_manual');
Zotlabs\Extend\Hook::unregister('cart_post_manual_checkout_confirm','addon/cart/manual_payments.php','cart_post_manual_checkout_confirm');
}
function cart_manualpayments_load () {
Zotlabs\Extend\Hook::register('cart_paymentopts','addon/cart/manual_payments.php','cart_paymentopts_register_manual');
Zotlabs\Extend\Hook::register('cart_checkout_manual','addon/cart/manual_payments.php','cart_checkout_manual');
Zotlabs\Extend\Hook::register('cart_post_manual_checkout_confirm','addon/cart/manual_payments.php','cart_post_manual_checkout_confirm');
}
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by IcoMoon.io -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20">
<path fill="#000000" d="M8 20c-1.103 0-2-0.897-2-2s0.897-2 2-2 2 0.897 2 2-0.897 2-2 2zM8 17c-0.551 0-1 0.449-1 1s0.449 1 1 1 1-0.449 1-1-0.449-1-1-1z"></path>
<path fill="#000000" d="M15 20c-1.103 0-2-0.897-2-2s0.897-2 2-2 2 0.897 2 2-0.897 2-2 2zM15 17c-0.551 0-1 0.449-1 1s0.449 1 1 1 1-0.449 1-1-0.449-1-1-1z"></path>
<path fill="#000000" d="M17.539 4.467c-0.251-0.297-0.63-0.467-1.039-0.467h-12.243l-0.099-0.596c-0.131-0.787-0.859-1.404-1.658-1.404h-1c-0.276 0-0.5 0.224-0.5 0.5s0.224 0.5 0.5 0.5h1c0.307 0 0.621 0.266 0.671 0.569l1.671 10.027c0.131 0.787 0.859 1.404 1.658 1.404h10c0.276 0 0.5-0.224 0.5-0.5s-0.224-0.5-0.5-0.5h-10c-0.307 0-0.621-0.266-0.671-0.569l-0.247-1.48 9.965-0.867c0.775-0.067 1.483-0.721 1.611-1.489l0.671-4.027c0.067-0.404-0.038-0.806-0.289-1.102zM16.842 5.404l-0.671 4.027c-0.053 0.316-0.391 0.629-0.711 0.657l-10.043 0.873-0.994-5.962h12.076c0.117 0 0.215 0.040 0.276 0.113s0.085 0.176 0.066 0.291z"></path>
</svg>
<h1>CART CONTENTS</h1>
<div class="dm42cart catalog" style="width:100%;">
<div class='section-title-wrapper'>
<div class="title">{{if $title}}{{$title}}{{else}}Order{{/if}}</div>
</div>
<div class='section-content-wrapper' style="width:100%;">
<table style="width:100%;">
<tr>
<th width=60%>Description</th>
<th width=20% style="text-align:right;">Price each {{if $currencysymbol}}({{$currencysymbol}}){{/if}}</th>
<th width=20% style="text-align:right;">Extended</th>
</tr>
{{foreach $items as $item}}
<tr>
<td>{{$item.item_desc}}</td>
<td style="text-align:right;">{{$item.item_price}}</td>
<td style="text-align:right;">{{$item.extended}}</td>
</tr>
{{/foreach}}
<tr>
<td></td>
<th style="text-align:right;">Subtotal</th>
<td style="text-align:right;">{{$totals.Subtotal}}</td>
</tr>
<tr>
<td></td>
<th style="text-align:right;">Tax Total</th>
<td style="text-align:right;">{{$totals.Tax}}</td>
</tr>
<tr>
<td></td>
<th style="text-align:right;">Order Total</th>
<td style="text-align:right;">{{$totals.OrderTotal}}</td>
</tr>
{{if $totals.Payment}}
<tr>
<td></td>
<th>Payment</th>
<td style="text-align:right;">{{$totals.Payment}}</td>
</tr>
{{/if}}
</table>
</div>
</div>
<div class="dm42cart catalog">
<div class='section-title-wrapper'>
<div class="title">{{if $title}}{{$title}}{{else}}Catalog{{/if}}</div>
</div>
<div class='section-content-wrapper'>
<form method="post">
<input type="hidden" name="cart_posthook" value="add_item">
<table>
<tr>
<th></th>
<th>Description</th>
<th>Price each {{if $currencysymbol}}({{$currencysymbol}}){{/if}}</th>
</tr>
{{foreach $items as $item}}
<tr>
<td><button class="btn btn-primary" type="submit" name="add" id="newchannel-submit-button" value="{{$item.item_sku}}">Add</button></td>
<td>{{$item.item_desc}}</td>
<td>{{$item.item_price}}</td>
</tr>
{{/foreach}}
</table>
</form>
</div>
</div>
<center><h1>INVOICE</h1>
<h4>ORDER: {{$order_hash}}</h4>
</center>
{{include file="./basic_cart.tpl"}}
<div class="center">
<p>Print and send a copy of this invoice along with your check
or money order to:</p>
<p>{{$payopts.mailing_address}}</p>
</div>
{{if !$order.checkedout}}
<form method="post">
<input type=hidden name="cart_posthook" value="manual_checkout_confirm">
<input type=hidden name="orderhash" value="{{$order_hash}}">
<button class="btn btn-primary" type="submit" name="Confirm" id="cart-submit-button" value="Confirm">Confirm Order</button>
</form>
{{else}}
<h3>This order has been confirmed and is awaiting payment.</h3>
<h4><a href="{{$finishedurl}}">{{$finishedtext}}</a></h4>
{{/if}}
{{include "./basic_cart.tpl"}}
<h1>Payment Options</h1>
<form method="post">
<input type="hidden" name="cart_posthook" value="checkout_choosepayment">
{{foreach from=$paymentopts key=payslug item=payopt}}
<input type="radio" name="paymenttypeslug" value="{{$payslug}}">{{$payopt.html}} <BR>
{{/foreach}}
<button class="btn btn-primary" type="submit" name="add" id="pay" value="pay">Continue with Payment</button>
</form>
<div id="cart-aside-main" class="widget">
<h3>Cart</h3>
<div id="cart-aside-main-content">
{{$content}}
</div>
</div>
<div class="clear"></div>
<div class='item'>
<div class='sku'>{{$item.item_sku}}</div>
<div class='description'>{{$item.item_description}}</div>
<div class='qty'>{{$item.item_qty}}</div>
<div class='priceea'>{{$item.item_price}}</div>
<div class='priceext'>{{$item.$extended}}</div>
</div>
<h1>HubCart Main Menu</h1>
<div class="dm42cart myshop" style="width:100%;">
<div class='section-title-wrapper'>
<div class="title">{{if $title}}{{$title}}{{else}}<h1>My Shop</h1>{{/if}}</div>
</div>
<div class='section-content-wrapper' style="width:100%;">
{{$content}}
</div>
</div>
<div id="cart-myshop-aside-main" class="widget">
<h3>My Shop</h3>
<div id="cart-myshop-aside-main-content">
{{$content}}
</div>
</div>
<div class="clear"></div>
<h1>CART CONTENTS</h1>
<div class="dm42cart catalog" style="width:100%;">
<div class='section-title-wrapper'>
<div class="title">{{if $title}}{{$title}}{{else}}Order{{/if}}</div>
</div>
<div class='section-content-wrapper' style="width:100%;">
<table style="width:100%;">
<tr>
<th width=60%>Description</th>
<th width=20% style="text-align:right;">Price each {{if $currencysymbol}}({{$currencysymbol}}){{/if}}</th>
<th width=20% style="text-align:right;">Extended</th>
</tr>
{{foreach $items as $item}}
<tr {{if $item.item_exeption}} class="cart-item-exception"{{/if}}>
<td {{if $item.item_exeption}} class="cart-item-exception"{{/if}}>{{$item.item_desc}}
</td>
<td style="text-align:right;" {{if $item.item_exeption}} class="cart-item-exception"{{/if}}>{{$item.item_price}}</td>
<td style="text-align:right;" {{if $item.item_exeption}} class="cart-item-exception"{{/if}}>{{$item.extended}}</td>
</tr>
<tr><td colspan=3>
{{include "./myshop_order_item_xtrahtml.tpl"}}
</td>
</tr>
{{/foreach}}
<tr>
<td></td>
<th style="text-align:right;">Subtotal</th>
<td style="text-align:right;">{{$totals.Subtotal}}</td>
</tr>
<tr>
<td></td>
<th style="text-align:right;">Tax Total</th>
<td style="text-align:right;">{{$totals.Tax}}</td>
</tr>
<tr>
<td></td>
<th style="text-align:right;">Order Total</th>
<td style="text-align:right;">{{$totals.OrderTotal}}</td>
</tr>
{{if $totals.Payment}}
<tr>
<td></td>
<th>Payment</th>
<td style="text-align:right;">{{$totals.Payment}}</td>
</tr>
{{/if}}
</table>
<div>
{{if !$order_paid}}
<form method="post">
<input type=hidden name="form_security_token" value="{{$security_token}}">
<input type=hidden name="cart_posthook" value="myshop_order_markpaid">
<input type=hidden name="orderhash" value="{{$order_hash}}">
<input type=hidden name="action" value="markpaid">
<button class="btn btn-primary" type="submit" name="Confirm" id="cart-payment-button" class="cart-payment-button" value="Confirm">Mark Paid</button>
</form>
{{/if}}
<hr>
<h3>Order Notes</h3>
<ul>
{{foreach $order_meta.notes as $note}}
<li>{{$note}}</li>
{{/foreach}}
</ul>
<hr>
<h3>Add Order Note</h3>
<div class="cart-myshop-ordernotes-form">
<form method="post">
<input type=hidden name="form_security_token" value="{{$security_token}}">
<input type="hidden" name="cart_posthook" value="myshop_add_ordernote">
<textarea name="notetext" rows=3 cols=80></textarea>
<button class="btn btn-primary" type="submit" name="add" id="cart-myshop-add-item-note" value="add">Add Note</button>
</form>
</div>
</div>
</div>
</div>
<div style="margin-left:5em;">{{if !$item.item_fulfilled}}
<div><span style="font-weight:bold;">Item Not Fulfilled</span></div>
{{else}}
<div><span style="font-weight:bold;">Item Fulfilled</span></div>
{{/if}}
<div class="cart-myshop-itemfulfill-form">
<form method="post">
<input type=hidden name="form_security_token" value="{{$security_token}}">
<input type="hidden" name="cart_posthook" value="myshop_item_fulfill">
<input type="hidden" name="itemid" value="{{$item.id}}">
<button class="btn btn-primary" type="submit" name="cart-myshop-fullfill-item" id="newchannel-submit-button" value="{{$item.item_sku}}">Fulfill</button>
</form>
</div>
{{if $item.item_fulfilled}}<div class="warning">Warning: May result in duplicate product being sent.</div>{{/if}}
{{if $item.item_exception}}<div class="warning">Item Exception: Please review notes.</div>
<div class="cart-myshop-itemexception-form">
<form method="post">
<input type=hidden name="form_security_token" value="{{$security_token}}">
<input type="hidden" name="cart_posthook" value="myshop_clear_item_exception">
<input type="hidden" name="itemid" value="{{$item.id}}">
<input type="hidden" name="exception" value="false">
<button class="btn btn-primary" type="submit" name="cart-myshop-clear-item-exception" value="{{$item.id}}">Clear Exception</button>
</form>
</div>
{{/if}}
<div class="cart-myshop-itemnotes">
{{foreach $item.item_meta.notes as $note}}
<li>{{$note}}</li>
{{/foreach}}
</div>
<div class="cart-myshop-itemnotes-form">
<form method="post">
<input type=hidden name="form_security_token" value="{{$security_token}}">
<input type="hidden" name="cart_posthook" value="myshop_add_itemnote">
<input type="hidden" name="itemid" value="{{$item.id}}">
<textarea name="notetext" rows=3 cols=80></textarea>
<br><input type="checkbox" name="exception">EXCEPTION<br>
<button class="btn btn-primary" type="submit" name="add" id="cart-myshop-add-item-note" value="add">Add Note</button>
</form>
</div>
{{if $item.meta.notes}}
<ul>
{{foreach $item.meta.notes as $note}}
<li>{{$note}}
{{/foreach}}
</ul>
{{/if}}
</div>
<div class="dm42cart orderlist" style="width:100%;">
<div class='section-title-wrapper'>
<div class="title">{{if $title}}{{$title}}{{else}}Orders{{/if}}</div>
</div>
<div class='section-content-wrapper' style="width:100%;">
<table style="width:100%;">
{{foreach $orders as $order}}
<tr>
<td rowspan=2>
<form method="get" action="{{$urlprefix}}/{{$order.order_hash}}"><button class="btn btn-primary" type="submit" name="Confirm" id="cart-submit-button">View Order</button></form>
</td>
<th>{{$order.buyer_channelname}} / {{$order.buyer_altid}} <span class="order-flags">
{{if $order.flags.exception}} <span class="order-flags-exception">**EXCEPTION**</span> {{/if}}
{{if $order.flags.fulfilled}} Fulfilled {{else}}
{{if $order.flags.confirmed}} Confirmed {{/if}}
{{/if}}</span>
</th>
<th style="text-align:right;">
Order Total: {{$order.totals.OrderTotal}}</td>
</th>
<th style="text-align:right;">
Paid: {{$order.totals.Payment}}</td>
</th>
</tr>
<tr>
<td colspan=3>
{{if $order.order_paid}}Paid: {{$order.order_paid}}{{else}}UNPAID{{/if}}
{{if $order.order_checkedout}}Checkout Date: {{$order.order_checkedout}}{{else}}Checkout Not Complete{{/if}}
</td>
</tr>
{{/foreach}}
</table>
</div>
</div>
Cat-Avatar-Generator
====================
![cover picture](http://www.peppercarrot.com/data/images/lab/2016-11-30_cdn/2016-11-29_the-quest-to-free-peppercarrot-website_02a-avatar.jpg)
A generator of cats pictures optimised to generate or random avatars, or defined avatar from a "seed". A derivation by [David Revoy](http://www.peppercarrot.com) from the original [MonsterID by Andreas Gohr's](https://www.splitbrain.org/blog/2007-01/20_monsterid_as_gravatar_fallback).
## License:
**Artworks:**
PNG and ORA files licensed under: [CC-By 4.0](https://creativecommons.org/licenses/by/4.0/) attribution: David Revoy with the following exception: Generated cats used as Avatar (for blog,forum,social-network) don't need direct attribution and so, can be used as regular avatars without pasting David Revoy's name all over the place.
**Code**
This PHP is licensed under the short and simple permissive:
[MIT License](https://en.wikipedia.org/wiki/MIT_License)
## Usage:
Call the script this way:
```
echo '<img height="70px" width="70px" src="your/path/to/cat-avatar-generator?seed='.$var.'"/>';
```
_(Note: for the seed, I advice to use author's name to not expose email or sensitive datas, even hashed on a public code.)_
## How to edit artworks
1. Open img/00_SRC.ora with Krita ( or Gimp,Mypaint,Pinta) Do your edit/draw/paint, respect layer naming, save.
2. Open it again in Gimp 2.8, with the [export layer plugin](https://github.com/khalim19/gimp-plugin-export-layers/releases/download/2.4/export-layers-2.4.zip)
3. Scale the image down to the result you want (eg. 256px x 256px as on the demo ) LancZos filter
3. File > Export layer (Allow invisible layer to be exported, check 'image size', PNG file format )
4. Done.
All PNG files of 'parts' are extracted this way and keep their layer name.