merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit f6e3ab0b3f96cd811d747c3b593c98bbcca13312
parent f91fa734c739671c3094a488def366febc2a208a
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Thu, 25 Feb 2016 14:16:10 +0100

fixing article shown in page's source

Diffstat:
Mexamples/blog/essay_cc-form.html | 8++++----
Mexamples/blog/essay_fulfillment.php | 23+++++++++++++++++------
Mexamples/blog/index.html | 2+-
3 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/examples/blog/essay_cc-form.html b/examples/blog/essay_cc-form.html @@ -20,7 +20,6 @@ Nationality<br> <input type="text"></input><br> Gender<br> <input type="radio" name"gender">Male</input> <input type="radio" name="gender">Female</input><br> - <input id='article-name' type="hidden" value="{article}"></input> </form> <form method="post" action="essay_cc-fulfillment.php?article={article}"> <input type="submit"></input> @@ -59,8 +58,9 @@ } function has_taler_wallet_cb(aEvent){ - var article = document.getElementById('article-name'); - get_contract(article.value); + //var article = document.getElementById('article-name'); + //get_contract(article.value); + get_contract("{article}"); }; function signal_taler_wallet_onload(){ @@ -89,7 +89,7 @@ } </script> <script type="application/javascript" src="taler-presence.js"></script> - <script type="text/javascript"> + <script type="application/javascript"> {jscode} </script> </body> diff --git a/examples/blog/essay_fulfillment.php b/examples/blog/essay_fulfillment.php @@ -26,22 +26,31 @@ return; } session_start(); + $payments = &pull($_SESSION, 'payments', array()); - $my_payment = &pull($payments, $article, array()); + $my_payment = &pull($payments, $article, false); + + // BUGGY + //$payments = &pull($_SESSION, 'payments', array()); + //$my_payment = &pull($payments, $article, array()); + $pay_url = url_rel("essay_pay.php"); $offering_url = url_rel("essay_fulfillment.php", true); $offering_url .= "?article=$article"; - //FIXME ispayed not always defined; wrap around some check - if (null === get($payments[$article]['ispayed']) || null === $my_payment){ + + //if (null === get($payments[$article]['ispayed']) || null === $my_payment){ # BUGGY + // In PHP false == null + if (null == get($payments[$article]['ispayed']) || false == $my_payment){ $tid = get($_GET['tid']); $timestamp = get($_GET['timestamp']); // 1st time if (null == $tid || null == $timestamp){ - $js_code = "get_contract(\"$article\")"; - $cc_page = template("./essay_cc-form.html", array('article' => $article, 'jscode' => $js_code)); + $cc_page = template("./essay_cc-form.html", array('article' => $article, 'jscode' => null)); echo $cc_page; - die(); + log_string("cnt blog"); + return; } + log_string("restoring blog"); // restore contract $now = new DateTime(); $now->setTimestamp(intval($timestamp)); @@ -85,9 +94,11 @@ $js_code = "executePayment('$hc', '$pay_url', '$offering_url')"; $cc_page = template("./essay_cc-form.html", array('article' => $article, 'jscode' => $js_code)); echo $cc_page; + log_string("pay blog"); return; } // control here == article payed + log_string("arti blog"); $article = get_article($article); echo $article; ?> diff --git a/examples/blog/index.html b/examples/blog/index.html @@ -114,7 +114,7 @@ Gakuin University <li><a name="stoc-What_0027s-in-a-Name_003f" href="/essay_fulfillment.php?article=scrap1_12"><h3>12. What&rsquo;s in a Name?</h3></a><div class="teasers_item"><p>Names convey meanings; our choice of names determines the meaning of what we say. An inappropriate name gives people the wrong idea. A rose by any other name would smell as sweet—but if you call it a pen, people will be rather disappointed when they try to write with it. And if you call pens “roses,” people may not realize what they are good for. If you call our operating system Linux, that conveys a mistaken idea of the system’s origin, history, and purpose. If you call it GNU/Linux, that conveys (though not in detail) an accurate idea. </p></div></li> <li><a name="stoc-Categories-of-Free-and-Nonfree-Software" href="/essay_fulfillment.php?article=scrap1_13"><h3>13. Categories of Free and Nonfree Software</h3></a><div class="teasers_item"><p>Free software is software that comes with permission for anyone to use, copy, and/or distribute, either verbatim or with modifications, either gratis or for a fee. In particular, this means that source code must be available. “If it’s not source, it’s not software.”</p></div></li> <li><a name="stoc-Why-Open-Source-Misses-the-Point-of-Free-Software" href="/essay_fulfillment.php?article=scrap1_14"><h3>14. Why Open Source Misses the Point of Free&nbsp;Software</h3></a><div class="teasers_item"><p>When we call software “free,” we mean that it respects the users’ essential freedoms: the freedom to run it, to study and change it, and to redistribute copies with or without changes. This is a matter of freedom, not price, so think of “free speech,” not “free beer.” </p></div></li> - <li><a name="stoc-Did-You-Say-_0060_0060Intellectual-Property_0027_0027_003f_0040entrybreak_007b_007dIt_0027s-a-Seductive-Mirage" href="/essay_fulfillment.php?article=scrap1_15"><h3>15. Did You Say &ldquo;Intellectual Property&rdquo;?@entrybreak{}It&rsquo;s a Seductive Mirage</h3></a><div class="teasers_item"><p></p></div></li> + <li><a name="stoc-Did-You-Say-_0060_0060Intellectual-Property_0027_0027_003f_0040entrybreak_007b_007dIt_0027s-a-Seductive-Mirage" href="/essay_fulfillment.php?article=scrap1_15"><h3>15. Did You Say &ldquo;Intellectual Property&rdquo;? It&rsquo;s a Seductive Mirage</h3></a><div class="teasers_item"><p></p></div></li> <li><a name="stoc-Words-to-Avoid-_0028or-Use-with-Care_0029--Because-They-Are-Loaded-or-Confusing" href="/essay_fulfillment.php?article=scrap1_16"><h3>16. Words to Avoid (or Use with Care) <br>Because&nbsp;They&nbsp;Are&nbsp;Loaded&nbsp;or&nbsp;Confusing</h3></a><div class="teasers_item"><p>There are a number of words and phrases that we recommend avoiding, or avoiding in certain contexts and usages. Some are ambiguous or misleading; others presuppose a viewpoint that we hope you disagree with. </p></div></li> <li><a name="stoc-The-Right-to-Read_003a-A-Dystopian-Short-Story" href="/essay_fulfillment.php?article=scrap1_17"><h3>17. The Right to Read: A Dystopian Short&nbsp;Story</h3></a><div class="teasers_item"><p>For Dan Halbert, the road to Tycho began in college—when Lissa Lenz asked to borrow his computer. Hers had broken down, and unless she could borrow another, she would fail her midterm project. There was no one she dared ask, except Dan. </p></div></li> <li><a name="stoc-Misinterpreting-Copyright_002d_002d_002dA-Series-of-Errors" href="/essay_fulfillment.php?article=scrap1_18"><h3>18. Misinterpreting Copyright&mdash;A Series of&nbsp;Errors</h3></a><div class="teasers_item"><p>Something strange and dangerous is happening in copyright law. Under the US Constitution, copyright exists to benefit users—those who read books, listen to music, watch movies, or run software—not for the sake of publishers or authors. Yet even as people tend increasingly to reject and disobey the copyright restrictions imposed on them “for their own benefit,” the US government is adding more restrictions, and trying to frighten the public into obedience with harsh new penalties.</p></div></li>