Jump to content

androbey

Members
  • Posts

    91
  • Joined

  • Last visited

Posts posted by androbey

  1. Hi @Markus (Blue Tomato)

    I also think this is awesome!

    I wanted to try it, but I have some strange problems getting in running. I don't know if it is only me, but nevertheless I wanted to post here. Maybe someone can help. 

    One strange issue at first: 
    When an image is saved, the hash is not stored in the db table (although the "insertBlurhash" function returns true).

    And the second issue comes when calling the "getBlurhashDataUri" function. (I manually inserted the hash string to the database, because of the before mentioned issue). 
    Then I'll get based on the image up to several 100-thousands warnings like "PHP Notice: Undefined offset: 208 in .../ImageBlurhash/ImageBlurhash.module.php:122".

    Maybe there is some config issue on my side or anything else I missed. But maybe someone has an idea. 

    Btw. I checked it both on Windows and Linux with PHP 7.2 and latest ProcessWire dev version.

  2. Hi everybody,

    I am currently developing a configurable module (no ProcessModule).

    Some time ago I stumbled upon a forum post about using the VEX library in the backend. 

     

     Now, I wanted to try this in my module. But with the example code I get an almost useless dialog: 

    <?php
    //in init method
    $this->modules->get('JqueryUI')->use('vex');
    //javascript
    ProcessWire.confirm('Are you sure you want to continue?', function() {
      //ok
    },function() {
      // canceled
    });

    leads to following screen: 

    vex-pw.thumb.PNG.cbb47384a7e5d36acb0da0b266690fe6.PNG

    There are no erros in console. I am using ProcessWire 3.0.148.
    Did I miss something or doing something wrong?
     

  3. Hi Robert,

    on first look I didn't look to close to your code. Please try the following:

     

    wire()->addHookAfter("Pages::saveReady", function (HookEvent $event) {
    	$page = $event->arguments("page");
    
    	if ( $page->hasField('my_repeater') ) {
    
    		$repeater = $page->my_repeater;
    
    		foreach ( $repeater as $item ) {
    			$dateStart = $item->date_start;
    			$dateEnd = $item->date_end;
    			if ( $dateStart && $dateEnd && $dateStart >=  $dateEnd ) {
    				$item->date_end = ''; 
    				$item->save();
    				
            		throw new WireException('start date must be earlier than end date');
    			}//endif
    		}//endforeach
    	}//endif
    });


    Hope it helps.

  4. Hi @JeevanisM,

    did you declare $pagefile before the call of "httpUrl()"? Maybe there are even log entries which give more information. 


    In general it depends on wether you set a specific format for that specific field (single element or array) how to get the URL of the file. 

    Assuming that your file field is named "pdffile":

    Case 1 - Single element

    $pdfUrl = $page->PDFFILE->httpUrl();

    Case 2 - Array

    You either have to loop through all files or e.g. to get the first file: 

    $pdfUrl = $page->PDFFILE->first()->httpUrl();

    You can check format settings on details tab of your field.

  5. Hi @teppo,

    I recently thought about writing a small module to record the last login of a user, in order to show the user when he logged in the last time before the current login.
    The data, which is necessary for this feature, is already built in your module.
    What do you think, would that be a good addition to your module? So maybe a public function which just returns the second recent login. 

    Just thought it may be useful for someone else, too.

  6. In addition to @louisstephens response: I think number 2 is more likely to be an input place for other meta tags (see overview). There you can also find info about what "robots" tag is used for and also info about "canonical".

    As for your other question on how to "improve your SEO": you may find more info when looking up the meta tags. Not all of them are used by search engines for the ranking (if this is your primary concern).

    • Like 1
  7. Hi @horst

    I just wanted to draw attention to a problem that might affect some in the future if TLS (or STARTTLS) is used.

    I wasn't sure where to put my concerns, so I decided to write them down in the support forum. 

    Some email hosting providers will shut down TLS 1.0 support in the future (or already did so). The way your module currently relies on the SMTP class (when using PHP version >= 5.6.7) it only (and exclusively) supports TLS version 1.0 (see here https://github.com/horst-n/WireMailSmtp/blob/master/smtp_classes/smtp.php#L1295).

    The issue is better described by one comment on the PHP forum: https://www.php.net/manual/en/function.stream-socket-enable-crypto.php#119122.

    Can you maybe integrate an option to allow specifying one of the available PHP crypto type constants?

    Hopefully I don't bother you with this and maybe it is useful for somebody.

    Thank you for your work in any case!

     

    • Like 1
  8. Hi everybody, 

    unfortunately I am facing an issue, which I am both not able to resolve and don't know if here is the "right" place to ask for help. 

    However, I am hoping that some of you can give me advice. 

    To summarize what I want to do: 

    From inside a template file I want to get page content from a file which is outside the site directory and using current ProcessWire session information (to "authenticate" the user, or rather just check if user is logged in or not). The external script is in a folder which lies on the same level as site and wire directories.

    Inside my template file I have: 
     

    <?php
    function getContents($url){
      $c = curl_init($url);
      curl_setopt($c, CURLOPT_VERBOSE, 1);
      curl_setopt($c, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
      curl_setopt($c, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
      curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($c, CURLOPT_COOKIE, $_SERVER['HTTP_COOKIE']);
      $content = curl_exec($c);
      curl_close($c);
      return $content;
    }
    
    $url = $config->externalURL . 'data/getEntries.php';
    $response = getContents($url);


    From inside the external script ("getEntries.php") I "check" if user is logged in like: 

     

    <?php namespace ProcessWire;
    //bootstrapping ProcessWire
    require('../../index.php');
    
    function getAccessStatus(){
      $session = wire('session');
      //following does not work, because $session is empty, also $_SERVER['HTTP_COOKIE'] is null.
      if(wire('user')->isLoggedin() == true){
        $res['success'] = true;
    	$res['status'] = 'OK';
      }else{
        $res['success'] = false;
    	$res['status'] = 'No Auth';
    	}
      return $res;
    }


    Am I missing something or is what I want to achieve not possible this way?

    Hopefully someone can help. 

    Thank you, 

    Andreas

  9. Hi everyone, 

    I have problems once again. This time it's about setting a certain field of a repeater item from a different page. 

    This is what I have so far: 

    I create a new repeater item on Page A via api using following code:

    // template of page A
    $item = $page->repeater_field->getNewItem();
    //set content to fields..
    $item->save();
    $item_id = $item->id;
    //returns e.g. for $item_id = 1222

    Now the goal is to set a field of that particular repeater item from Page B. But I am not able to get to the particular repater item to set a field. 

     

    // template of page B
    $ref = $pages->get($page->page_a_reference->id);
    
    //With following code I get the repeater field items, but I cannot access (or determine) the repeater item I would like to get (with ID 1222).
    $rep = $ref->repeater_field;
    
    //Following code returns null
    //$rep = $ref->get(1222);


    What do I do wrong, or better asked, how can I set a field of a repeater item from different page?

  10. Hi @Flashmaster82,

    according to your post I assume two things:

    • you try to build a navigation option to switch languages on the frontend of your site
    • you have a plain text field called "language_icon" (and you store there a string representing the filename e.g. se.svg)
    If the above is not the case, please correct me or follow @macrura's post if you mean the admin page. Otherwise the following:
     
    • You need to get the path to where the image or icon is stored. If that is e.g. in your site/templates/img folder, one way woul be: 
      $config->urls->templates . "img/" . $language->language_icon

       

    • Also, to actually display the icon you would have to use an image/picture tag inside the option tag. 

  11. HI @hellboy and welcome to ProcessWire ? 
     

    2 hours ago, hellboy said:

     

    
        function sendMail() {
    
            $.ajax({
                method: "POST",
                url: "<?php echo $pages->get('/shopping-cart')->url ?>",
                data: { test: "test" }
            })
                .done(function( msg ) {
                    console.log( "return: " + msg );
                });
        }

     

    In your function sendMail() you write :

    data: {test: "test"}


    The first test in this case wouldn't be a string but a variable.
    Try to change that into: 

    data: {"test":"test"}

     

    • Thanks 1
  12. I also did some research the last days about GDPR and want to share some notes on that. 
    Most of the information is taken off official sources, but is without engagement.

    To add one thing to @szabesz note:

    On 2/12/2018 at 12:51 PM, szabesz said:

    The good thing is that the silly automatic cookie consent does not seem to apply anymore, as setting cookies is not data collection in itself. In GDPR there is only one sentence where cookies are mentioned: https://gdpr-info.eu/recitals/no-30/  And it is just about listing a few technical possibilities of possible personal profile building. However, if there is no profile building – meaning there is no data collection this way – then cookies are non-issues. I still need to read up on this one, but this is my current understanding. Of course, if cookies are used for profiling then it is a different story and they must be considered when dealing with GDPR.

    Beginning with GDPR in May 18 the state will be that you are allowed to set cookies without any further approval from the user, if they (the cookies) are necessary so that you site or service works. Usually that are session cookies, or cookies that store the user's language. 

    Every other cookie (to track or analyse user data) needs permission to be set (the so called "opt-in"). In this case you are not allowed to set the cookie without user permission.


    In general (and in most situations enough) you need some things in order to be compliant with GDPR: 

    • a up-to-date data protection policy on the website frontend
    • a GDPR compliant data processing contract with all companies that handle  personal user data according to your order (like the hosting provider, or e.g. Google Analytics, or whatever..)
    • a documentation of technical and organisational measures
    • a list of all data processing activities

    That does not take into account if you handle very sensitive personal data (e.g. race or relegion). 

    So of course, not all is related to ProcessWire, but only implementing technical measures is not enough to get compliant. 

    At the end the note, that a very important part is also to document all things related to data privacy (regulations). We - as the data processors - have to burden of proof. 

    • Like 3
×
×
  • Create New...