Jump to content

pwFoo

Members
  • Posts

    708
  • Joined

  • Last visited

Posts posted by pwFoo

  1. 26 minutes ago, da² said:

    I was afraid to read this. ? I use a CMS to avoid having to develop things like this, I just want to focus on my site content, coding a login/register module is reinventing the wheel, this has be done thousands of time by developers with a better knowledge than me in security.

    Hi,

    I'm moved away from PW some time ago because I stopped build websites or server site web applications and so unhappily have no use case for Processwire...

    For me Processwire is still the best CMS. Create content types / pages and fields and create content / pages with the backend and enjoy the flexibility to build your page with html, css, js and the awesome PW api ? 

    With more complex applications, you also benefit from the flexibility and the powerful API, but more like from a framework / CMF. Without restrictions regarding the frontend. Write own modules, plugins and hooks is really easy to learn. Frontend User was one of my first modules I wrote.

    And the community is great ?

     

     

  2. Hi,

    I would build a website with embedded videos (because of used video source maybe need to use iframe...) and would like to export sites to PDFs. Before I start with PW / pages2pdf... is it possible to export a page to pdf with the embedded video? Anyone tested that use case?

    Regards

  3. I thought about different cms/f and headless cms (for example directus, cockpit). 

    Processwire can be used as headless cms out of the box (response with json) or with a rest api module.  Directus / cockpit looks great, but it would be so much easier to use processwire with custom code / modules to add some server side features I think?

    Will PW as headless cms bloated by template system and some more non-headless features? Maybe best would be a rest api module with a process module? Would that skip some not needed core parts like template parser? Will that reduce overhead or maybe there isn't really overhead by not needed core features?

  4. It isn't really difficult to setup with php and javascript.

    Working example:
    https://webpushdemo.azurewebsites.net/

    Custom server php lib for testing:
    https://github.com/web-push-libs/web-push-php

    I tried to build it with php and js, which works. But the js part isn't a library for simple use... I tested it some time ago, but the code should work...
    https://notify.it-dengler.de/index.php

    Just subscribe / enable notifications and wait 5 seconds (configured delay). It also works if you disable and enable notifications and close the browser during delay. You will get a notification and click opens a new tab.

  5. SQLite would be nice, but not really needed. If possible and changes to database abstraction is needed a move to PDO would make it possible.

    At the moment it would be interesting because of a small private php project which should run on cheap webhostings without extra features. So sqlite would reduce the requirements *g*
    With a small private projects I would try to keep hosting cost low...

    But web hostings with mysql isn't expensive today...

     

  6. Hi @stikki,

    thanks for take a look into it. Additional / instead of GUI field selection I use a array to filter the fields to convert / output. At the moment I have some other topics and can't work & play with PW. My code seems to work for my needs and I like the multidimensional filter array to filter sub-pages and wirearray / pagearray / image fields too.

    So if you could implement it a nice and easy way it would be fine. I like to have one module for one job and not some similar modules ?

  7. UPDATE

    I can't test self signed certificate to work because WireHttp don't respect given connection port?

    The following url:

    https://127.0.0.1:10000/api/...

    Will return that error message:

    2: fsockopen(): unable to connect to ssl://127.0.0.1:443 (Operation timed out), 110: Operation timed out

    Looks like port 10000 is changed to default https port 443 by WireHttp? php curl is installed and also tried to force it with option 'use' (if it falls back to another method).

    Need it solved or drop WireHttp for that use ☹️

  8. I won't enable UrlSegments for each template, but have a autoload module with should react based on path / urlSegments. Don't like the way to do it with query string. So allow one urlSegment by name (string) would be nice without the need to activate urlSegments at all.

    • Like 1
  9. Thanks! Tested the permissions, but have a problem with permissions or understanding how it works.
    "page-create" is activated for "basic-page". Don't know if needed... just activated to test...

    My role has the following permissions set.

    image.thumb.png.1ae081b9e48745edccbd57d9b81293bd.png

     

    Tried to add a page to home ("/") with template ""basic-page".

    Do some permission check before...

    Page owner: test
    Current user: test
    Current user roles: guest, writer
    Current user permissions: page-view, page-edit  // --> missing allowed permissions "page-edit-created, page-edit-trash-created"
    Addable (parent): 0         // --> 1 (allowed to add child to "/")
    Addable (child to page): 0  // --> OK, add to parent should work, not add children to that page
    Editable: 1                 // --> OK, but by page-edit or as should page-edit-created???
    Trashable: 0                // --> 1 (allowed by page-edit-trash-created)
    Deleteable: 0               // --> OK, just allowed to trash the page...

    User test has role "writer" (screenshot with permissions), is page owner(!). Added expected values to the permission check output above.

    Checked by addable(), editable(), trashable() and deleteable() methods.

  10. Hi,

    I try to add page-edit-own and page-delete-own permissions, but it's strange...

    If a add the custom permissions it looks like both are children of page-edit respectively page-delete. I played with added / revoked permissions, but I can't get it work, that a user of a role just can delete own content.
    First the user can't delete any content and now the user can delete own and foreign pages ?

    Is there a tutorial to learn more about the PW permissions?
    Or do I have to rename the permissions to page-own-edit and page-own-delete to be independent from page-edit and page-delete?

  11. I tried to add a new page with $pages->add() with a custom method inside of a module. It looks like the method is called each page load (as should) and also if the backend page tree is loaded / refreshed (bug??)?

        public function create($template, $parent, Array $data = array(), $name = false) {
            $name = wire('sanitizer')->pageName($name ? $name : $data['title']);
            $obj = wire('pages')->add($template, $parent, $name, $data);
            return $obj;
        }

    called inside of home page ("/"):

    $api->create('basic-page', '/', array('title' => 'ApiCreatedTest1'));

    Works fine. Load it twice (create duplicate page) results in an error.

     

    But without "/" requested the page gets created if I view the backend?!

    Checked it by delete the page, check the page tree again and it looks fine. But if I reload the backend page the page appears again. So backend page tree load executes the home page ("/") and create the page?

    Is it a bug or I'm missing anything...?

  12. I do some tests with custom code because I need a simple way to set (recursive) fields to view for different page types and fields.

        public function ___WireToArray($obj, $filter = array()) {
            $values = array();
            foreach ($obj AS $item) {
                $array = array();
                foreach ($filter AS $key => $val) {
                    if (is_array($val)) {
                        $array[$key] = WireToArray($item->$key, $val);
                    } else {
                        $string = (string)$item->$val;
                        $array[$val] = strpos($string, '|') ? explode('|', $string) : $string;
                    }
                }
                $values[] = $array;
            }
            return $values;
        }

    I built a module which used that way:

    $userFilter = array('id', 'name', 'email', 'roles' => array('id', 'name'));
    $pages->find('template=user')->toJSON($userFilter, JSON_PRETTY_PRINT)

    Output

    [
        {
            "id": "40",
            "name": "guest",
            "email": "",
            "roles": [
                {
                    "id": "37",
                    "name": "guest"
                }
            ]
        },
        {
            "id": "41",
            "name": "admin",
            "email": "andre.hoeg@gmail.com",
            "roles": [
                {
                    "id": "37",
                    "name": "guest"
                },
                {
                    "id": "38",
                    "name": "superuser"
                }
            ]
        }
    ]

     

    Example with images

    $wa = $pages->find('template=basic-page');
    $filter = array(
        'id',
        'name', 
        'images' => array('url', 'width', 'height'),
        'files' => array('url', 'name', 'filesize'),
        'pageref',
    );

    Output

    [
        {
            "id": "1016",
            "name": "test1",
            "images": [
                {
                    "url": "\/site\/assets\/files\/1016\/dscn2585.jpg",
                    "width": "4608",
                    "height": "3456"
                },
                {
                    "url": "\/site\/assets\/files\/1016\/dscn2823.jpg",
                    "width": "4608",
                    "height": "3456"
                }
            ],
            "files": [
                {
                    "url": "\/site\/assets\/files\/1016\/aufstellung_und_taktische_aufgaben.pdf",
                    "name": "aufstellung_und_taktische_aufgaben.pdf",
                    "filesize": "68628"
                },
                {
                    "url": "\/site\/assets\/files\/1016\/1und1_leistungsbeschreibung_mobilfunk.pdf",
                    "name": "1und1_leistungsbeschreibung_mobilfunk.pdf",
                    "filesize": "207816"
                }
            ],
            "pageref": [
                "1017",
                "27"
            ]
        },
        {
            "id": "1017",
            "name": "test2",
            "images": [
                {
                    "url": "\/site\/assets\/files\/1017\/dscn2813.jpg",
                    "width": "4608",
                    "height": "3456"
                }
            ],
            "files": [],
            "pageref": ""
        }
    ]

    Because Pageimages and Pagefiles are based on WireArray it's possible to get just images as JSON

    $img = $page->images;
    $imgFilter = array('url', 'name', 'filesize', 'width');
    $img->toJSON($imgFilter);

    Output

    [
        {
            "url": "\/site\/assets\/files\/1016\/dscn2585.jpg",
            "name": "dscn2585.jpg",
            "filesize": "4085826",
            "width": "4608"
        },
        {
            "url": "\/site\/assets\/files\/1016\/dscn2823.jpg",
            "name": "dscn2823.jpg",
            "filesize": "3225062",
            "width": "4608"
        }
    ]

     

    • Like 1
×
×
  • Create New...