Plugin Directory

Changeset 3016412


Ignore:
Timestamp:
01/02/2024 12:08:25 PM (2 years ago)
Author:
iteras
Message:

Paywall signing key is now handled separately

Location:
iteras/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • iteras/trunk/README.txt

    r3012163 r3016412  
    33Requires at least: 3.5.1
    44Tested up to: 6.4.2
    5 Stable tag: 1.6.0
     5Stable tag: 1.7.0
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    111111
    112112== Changelog ==
     113= 1.7.0 =
     114* Paywall signing key is now handled separately
     115
    113116= 1.6.0 =
    114117* Added bulk action for updating paywall state on posts
  • iteras/trunk/admin/iteras-admin.php

    r3012163 r3016412  
    2121
    2222  protected $plugin = null;
    23 
    24   public $access_levels = null;
    25 
     23  protected $plugin_slug = null;
     24
     25  protected $access_levels = null;
     26  protected $paywall_display_types = null;
     27  protected $paywall_integration_methods = null;
    2628
    2729  private function __construct() {
     
    334336    $settings = array(
    335337      'api_key' => sanitize_text_field($_POST['api_key']),
     338      'signing_key' => sanitize_text_field($_POST['signing_key']),
    336339      'paywalls' => $prev_settings['paywalls'],
    337340      'profile_name' => sanitize_text_field($_POST['profile']),
  • iteras/trunk/admin/views/admin.php

    r2417359 r3016412  
    2020
    2121      <tr>
     22        <th scope="row"><label for="signingkey"><?php _e('ITERAS signing key', $domain); ?></label></th>
     23        <td>
     24          <input class="regular-text" id="signingkey" name="signing_key" placeholder="<?php _e('e.g.', $domain); ?> j8kau2v3lzp0n12ilw1d0hurr6059gyo" type="text" value="<?=$settings['signing_key']; ?>">
     25          <p class="description"><?php _e('You can find your signing key in the general settings section in the top right menu in ITERAS.', $domain); ?></p>
     26        </td>
     27      </tr>
     28
     29      <tr>
    2230        <th scope="row"><label for="apikey"><?php _e('ITERAS API key', $domain); ?></label></th>
    2331        <td>
    24           <input class="regular-text" id="apikey" name="api_key" placeholder="<?php _e('e.g. drurhphapaikr5fcywk158n93ghat0vz', $domain); ?>" type="text" value="<?=$settings['api_key']; ?>">
    25           <p class="description"><?php _e('You can find your API key in the general settings section in the top right menu in ITERAS.', $domain); ?></p>
     32          <input class="regular-text" id="apikey" name="api_key" placeholder="<?php _e('e.g.', $domain); ?> drurhphapaikr5fcywk158n93ghat0vz" type="text" value="<?=$settings['api_key']; ?>">
     33          <p class="description"><?php _e('You can create an API key under integrations in the top right menu in ITERAS.', $domain); ?></p>
    2634        </td>
    2735      </tr>
  • iteras/trunk/admin/views/post-meta-box.php

    r1880666 r3016412  
    33wp_nonce_field( "post".$post->ID, 'iteras_paywall_post_nonce' );
    44
    5 if (!$settings['api_key']) {
     5if (!$settings['api_key'] || !$settings['signing_key']) {
    66?>
    77  <div class="attention-box">
  • iteras/trunk/iteras.php

    r3012163 r3016412  
    1313 * Plugin URI:        https://app.iteras.dk
    1414 * Description:       Integration with ITERAS, a cloud-based state-of-the-art system for managing subscriptions/memberships and payments.
    15  * Version:           1.6.0
     15 * Version:           1.7.0
    1616 * Author:            ITERAS
    1717 * Author URI:        https://www.iteras.dk
  • iteras/trunk/languages/iteras-da_DK.po

    r3012163 r3016412  
    66"Project-Id-Version: iteras\n"
    77"Report-Msgid-Bugs-To: [email protected]\n"
    8 "POT-Creation-Date: 2023-12-19 19:48+0100\n"
    9 "PO-Revision-Date: 2023-12-19 19:48+0100\n"
     8"POT-Creation-Date: 2024-01-02 13:05+0100\n"
     9"PO-Revision-Date: 2024-01-02 13:05+0100\n"
    1010"Last-Translator: Ole Laursen <[email protected]>\n"
    1111"Language-Team: da\n"
     
    1515"Content-Transfer-Encoding: 8bit\n"
    1616
    17 #: admin/iteras-admin.php:59
     17#: admin/iteras-admin.php:61
    1818msgid "Everybody"
    1919msgstr "Alle"
    2020
    21 #: admin/iteras-admin.php:65
     21#: admin/iteras-admin.php:67
    2222msgid "Redirect to subscribe landing page"
    2323msgstr "Omdiriger til abonnér-landingsside"
    2424
    25 #: admin/iteras-admin.php:66
     25#: admin/iteras-admin.php:68
    2626msgid "Cut text and add call-to-action box"
    2727msgstr "Beskær tekst og tilføj call to action-boks"
    2828
    29 #: admin/iteras-admin.php:70
     29#: admin/iteras-admin.php:72
    3030msgid "Automatic"
    3131msgstr "Automatisk"
    3232
    33 #: admin/iteras-admin.php:71
     33#: admin/iteras-admin.php:73
    3434msgid "Custom"
    3535msgstr "Specialudviklet"
    3636
    37 #: admin/iteras-admin.php:88
     37#: admin/iteras-admin.php:90
    3838msgid "ITERAS Paywall"
    3939msgstr "ITERAS-paywall"
    4040
    41 #: admin/iteras-admin.php:93
     41#: admin/iteras-admin.php:95
    4242msgid "Paywall"
    4343msgstr "Betalingsmur"
    4444
    45 #: admin/iteras-admin.php:138
     45#: admin/iteras-admin.php:140
    4646msgid "Does not restrict visitors, everyone can see the content"
    4747msgstr "Begrænser ingen besøgende, alle kan se indholdet"
    4848
    49 #: admin/iteras-admin.php:139
     49#: admin/iteras-admin.php:141
    5050msgid ""
    5151"Content restricted to visitors who are in the subscriber database (but they "
     
    5555"have et aktivt abonnement)"
    5656
    57 #: admin/iteras-admin.php:140
     57#: admin/iteras-admin.php:142
    5858msgid "Content restricted to visitors with an active subscription"
    5959msgstr "Indhold begrænset til besøgende i abonnentdatabasen"
    6060
    61 #: admin/iteras-admin.php:185
     61#: admin/iteras-admin.php:184
    6262msgid "Add paywall"
    6363msgstr "Tilføj betalingsmur"
    6464
    65 #: admin/iteras-admin.php:188
     65#: admin/iteras-admin.php:187
    6666msgid "Remove paywalls"
    6767msgstr "Fjern betalingsmure"
    6868
    69 #: admin/iteras-admin.php:247
     69#: admin/iteras-admin.php:246
    7070msgid "ITERAS configuration"
    7171msgstr "ITERAS-konfiguration"
    7272
    73 #: admin/iteras-admin.php:248
     73#: admin/iteras-admin.php:247
    7474msgid "ITERAS"
    7575msgstr "ITERAS"
    7676
    77 #: admin/iteras-admin.php:287
     77#: admin/iteras-admin.php:286
    7878msgid "Synchronization of paywalls from ITERAS complete"
    7979msgstr "Synkronisering af betalingsmure fra ITERAS gennemført"
    8080
    81 #: admin/iteras-admin.php:293
     81#: admin/iteras-admin.php:292
    8282msgid "Couldn't synchronize paywalls from ITERAS"
    8383msgstr "Kunne ikke synkronisere betalingsmure fra ITERAS"
    8484
    85 #: admin/iteras-admin.php:325
     85#: admin/iteras-admin.php:324
    8686msgid "Settings"
    8787msgstr "Indstillinger"
     
    104104
    105105#: admin/views/admin.php:22
     106msgid "ITERAS signing key"
     107msgstr "ITERAS signeringsnøgle"
     108
     109#: admin/views/admin.php:24 admin/views/admin.php:32
     110msgid "e.g."
     111msgstr "f.eks."
     112
     113#: admin/views/admin.php:25
     114msgid ""
     115"You can find your signing key in the general settings section in the top "
     116"right menu in ITERAS."
     117msgstr ""
     118"Du kan finde din signeringsnøgle under grundindstillingerne i menuen øverst "
     119"til højre i ITERAS."
     120
     121#: admin/views/admin.php:30
    106122msgid "ITERAS API key"
    107123msgstr "ITERAS API-nøgle"
    108124
    109 #: admin/views/admin.php:24
    110 msgid "e.g. drurhphapaikr5fcywk158n93ghat0vz"
    111 msgstr "f.eks. drurhphapaikr5fcywk158n93ghat0vz"
    112 
    113 #: admin/views/admin.php:25
    114 msgid ""
    115 "You can find your API key in the general settings section in the top right "
    116 "menu in ITERAS."
    117 msgstr ""
    118 "Du kan finde din API-nøgle under grundindstillingerne i menuen øverst til "
    119 "højre i ITERAS."
    120 
    121 #: admin/views/admin.php:30
     125#: admin/views/admin.php:33
     126msgid ""
     127"You can create an API key under integrations in the top right menu in ITERAS."
     128msgstr ""
     129"Du kan oprette en API-nøgle under integrationer i menuen øverst til højre i "
     130"ITERAS."
     131
     132#: admin/views/admin.php:38
    122133msgid "Available paywalls"
    123134msgstr "Tilgængelige betalingsmure"
    124135
    125 #: admin/views/admin.php:34
     136#: admin/views/admin.php:42
    126137msgid "No paywalls available"
    127138msgstr "Ingen betalingsmure tilgængelig"
    128139
    129 #: admin/views/admin.php:44
     140#: admin/views/admin.php:52
    130141msgid "Synchronize"
    131142msgstr "Synkronisér"
    132143
    133 #: admin/views/admin.php:45
     144#: admin/views/admin.php:53
    134145msgid ""
    135146"You can configure paywalls in ITERAS in the paywalls section under "
     
    141152"knappen her bagefter."
    142153
    143 #: admin/views/admin.php:50
     154#: admin/views/admin.php:58
    144155msgid "Default paywall access"
    145156msgstr "Forvalgt paywall-adgang"
    146157
    147 #: admin/views/admin.php:58
     158#: admin/views/admin.php:66
    148159msgid "Default paywall access for new posts."
    149160msgstr "Betalingsmur-indstilling som nye indlæg og sider får som forvalg."
    150161
    151 #: admin/views/admin.php:63
     162#: admin/views/admin.php:71
    152163msgid "Access restriction"
    153164msgstr "Adgangsbegrænsning"
    154165
    155 #: admin/views/admin.php:71
     166#: admin/views/admin.php:79
    156167msgid "How users will be greeted on an article they don't have access to."
    157168msgstr ""
    158169"Hvordan besøgende bliver modtaget på en artikel som de ikke har adgang til."
    159170
    160 #: admin/views/admin.php:76
     171#: admin/views/admin.php:84
    161172msgid "Subscribe landing page"
    162173msgstr "Abonnér-landingsside"
    163174
    164 #: admin/views/admin.php:78
     175#: admin/views/admin.php:86
    165176msgid "e.g. /?page_id=1"
    166177msgstr "f.eks. /?page_id=1"
    167178
    168 #: admin/views/admin.php:79
     179#: admin/views/admin.php:87
    169180msgid ""
    170181"URL to the landing page for logging in or becoming a <b>paying subscriber</"
     
    174185"b>."
    175186
    176 #: admin/views/admin.php:84
     187#: admin/views/admin.php:92
    177188msgid "User landing page"
    178189msgstr "Bruger-landingsside"
    179190
    180 #: admin/views/admin.php:86
     191#: admin/views/admin.php:94
    181192msgid "e.g. /?page_id=2"
    182193msgstr "f.eks. /?page_id=2"
    183194
    184 #: admin/views/admin.php:87
     195#: admin/views/admin.php:95
    185196msgid ""
    186197"URL to the landing page for logging in or registering as a <b>user</b>. The "
     
    190201"b>. Abonnér- og bruger-landingssiderne kan pege på den samme Wordpress-side."
    191202
    192 #: admin/views/admin.php:92
     203#: admin/views/admin.php:100
    193204msgid "Cut text at"
    194205msgstr "Beskær tekst ved"
    195206
    196 #: admin/views/admin.php:94
     207#: admin/views/admin.php:102
    197208msgid "characters"
    198209msgstr "tegn"
    199210
    200 #: admin/views/admin.php:94
     211#: admin/views/admin.php:102
    201212msgid "e.g. 30"
    202213msgstr "f.eks. 30"
    203214
    204 #: admin/views/admin.php:99
     215#: admin/views/admin.php:107
    205216msgid "Call-to-action content"
    206217msgstr "Call to action-indhold"
    207218
    208 #: admin/views/admin.php:102
     219#: admin/views/admin.php:110
    209220msgid ""
    210221"Present ordering offers and a login option. If you link to separate ordering "
     
    220231"side efter at have bestilt eller logget ind."
    221232
    222 #: admin/views/admin.php:107
     233#: admin/views/admin.php:115
    223234msgid "Validation method"
    224235msgstr "Verifikationsmåde"
    225236
    226 #: admin/views/admin.php:109
     237#: admin/views/admin.php:117
    227238msgid "Enable server-side validation of access pass cookie"
    228239msgstr "Aktiver serverkontrol af adgangstegn-cookie"
    229240
    230 #: admin/views/admin.php:112
     241#: admin/views/admin.php:120
    231242msgid ""
    232243"With server-side validation, the ITERAS API key will be used to check the "
     
    247258"serverkontrol."
    248259
    249 #: admin/views/admin.php:117
     260#: admin/views/admin.php:125
    250261msgid "Paywall integration method"
    251262msgstr "Integrationsmåde for betalingsmur"
    252263
    253 #: admin/views/admin.php:125
     264#: admin/views/admin.php:133
    254265msgid ""
    255266"For custom integration use either <code>[iteras-paywall-content]...[/iteras-"
     
    261272"<code>Iteras::get_instance().potentially_paywall_content(...)</code>."
    262273
    263 #: admin/views/admin.php:137
     274#: admin/views/admin.php:145
    264275msgid ""
    265276"For more information about the ITERAS API check out the <a target=\"_blank\" "
     
    290301"href='%url%'>siden med indstillinger</a> for at rette dem."
    291302
    292 #: public/iteras-public.php:425 public/iteras-public.php:596
     303#: public/iteras-public.php:429 public/iteras-public.php:604
    293304msgid "This content is paywalled"
    294305msgstr "Dette indhold er bag betalingsmur"
    295306
    296 #: public/iteras-public.php:425 public/iteras-public.php:603
    297 #: public/iteras-public.php:651
     307#: public/iteras-public.php:429 public/iteras-public.php:611
     308#: public/iteras-public.php:659
    298309msgid "You are seeing the content because you are logged into WordPress admin."
    299310msgstr "Du ser indholdet da du er logget ind i WordPress admin."
    300311
    301 #: public/iteras-public.php:434
     312#: public/iteras-public.php:438
    302313msgid "ITERAS plugin improperly configured. Paywall box content is missing"
    303314msgstr ""
    304315"ITERAS-plugin er ikke konfigureret rigtigt. Call to action-indhold mangler."
    305316
    306 #: public/iteras-public.php:577
     317#: public/iteras-public.php:585
    307318msgid "You need to be logged in to see this content"
    308319msgstr "Du skal være logget ind for at se indholdet"
    309320
    310 #: public/iteras-public.php:600
     321#: public/iteras-public.php:608
    311322msgid "paywallid not declared"
    312323msgstr "paywallid ikke udfyldt"
     324
     325#~ msgid "e.g. drurhphapaikr5fcywk158n93ghat0vz"
     326#~ msgstr "f.eks. drurhphapaikr5fcywk158n93ghat0vz"
    313327
    314328#~ msgid "Paying subscribers"
  • iteras/trunk/public/iteras-public.php

    r3012163 r3016412  
    1616class Iteras {
    1717
    18   const VERSION = '1.6.0';
     18  const VERSION = '1.7.0';
    1919
    2020  const SETTINGS_KEY = "iteras_settings";
     
    194194        $settings['paywall_server_side_validation'] = true;
    195195      }
     196      if (version_compare($old_version, "1.7", "lt")) {
     197        $settings['signing_key'] = $settings['api_key'];
     198      }
    196199
    197200      wp_cache_delete(self::SETTINGS_KEY);
     
    261264    if (empty($settings)) {
    262265      $settings = array(
     266        'signing_key' => "",
    263267        'api_key' => "",
    264268        'profile_name' => "", // outphase
     
    340344  }
    341345
    342   private function pass_authorized($pass, $restriction, $key) {
     346  private function pass_authorized($pass, $restriction, $signing_key) {
    343347    // check signature
    344348    $pos = strrpos($pass, "/");
     
    357361      return false;
    358362
    359     $computed_hmac = hash_hmac($algo, $data, $key);
    360 
    361     if ($computed_hmac !== false && $key && (function_exists("hash_equals") ? !hash_equals($computed_hmac, $hmac) : $computed_hmac != $hmac))
     363    $computed_hmac = hash_hmac($algo, $data, $signing_key);
     364
     365    if ($computed_hmac !== false && $signing_key && (function_exists("hash_equals") ? !hash_equals($computed_hmac, $hmac) : $computed_hmac != $hmac))
    362366      return false;
    363367
     
    399403
    400404    $user_authorized = (
    401       isset($_COOKIE['iteraspass']) && $this->pass_authorized($_COOKIE['iteraspass'], $paywall_ids, $this->settings['api_key'])
     405      isset($_COOKIE['iteraspass']) && $this->pass_authorized($_COOKIE['iteraspass'], $paywall_ids, $this->settings['signing_key'])
    402406    );
    403407
     
    610614      $content = $admin_paywall_notice . $content;
    611615    } else {
    612       if (isset($_COOKIE['iteraspass']) && $this->pass_authorized($_COOKIE['iteraspass'], $paywall_ids, $this->settings['api_key'])) {
     616      if (isset($_COOKIE['iteraspass']) && $this->pass_authorized($_COOKIE['iteraspass'], $paywall_ids, $this->settings['signing_key'])) {
    613617        // User has access
    614618      } else {
     
    655659      $content = __("You are seeing the content because you are logged into WordPress admin.") . $content;
    656660    } else {
    657       if ((isset($_COOKIE['iteraspass']) && $this->pass_authorized($_COOKIE['iteraspass'], $paywall_ids, $this->settings['api_key'])) == $show_if_logged_in) {
     661      if ((isset($_COOKIE['iteraspass']) && $this->pass_authorized($_COOKIE['iteraspass'], $paywall_ids, $this->settings['signing_key'])) == $show_if_logged_in) {
    658662        // Returns the content without manipulation
    659663      } else {
Note: See TracChangeset for help on using the changeset viewer.