Jump to content

requinix

Administrators
  • Posts

    15,259
  • Joined

  • Last visited

  • Days Won

    431

Everything posted by requinix

  1. Working backwards, you can see the breadcrumbs come from $items inside wrap(), which is called by render(). Inside that is a "breadcrumbs" which starts with "categories" and then will prepend the "bloginfo" as well as push (append) the $post. So try removing the bit to do with the push. That line also says "active" so you'll probably want to put that on the last item in the breadcrumb list, but honestly that's probably something better suited for CSS.
  2. If you're going to record all the data, wouldn't it be easier to just make the table mirror the user table and stick the old row in there? Or rather, stick the new row in there, and apply the trigger to INSERTs as well.
  3. So /blog/post-title does not exist as a file, right?
  4. Fix what? A null will be coerced to false.
  5. Isn't that what you first tried? It's not correct. Look at my second reply.
  6. PHP? There's basically always a home directory set up for each user, though it might not actually exist, but that's a system thing.
  7. On a typical Debian/Ubuntu system, website stuff is at /var/www. There's nothing wrong with putting their home directories in there - tons of system accounts do things like that, just check /etc/passwd. And make sure you've disabled logins for those users.
  8. I don't see what would be responsible. Did you alter any other files?
  9. The original line was $V341be97d = preg_replace('/\^([^\^<])/e', "'`' . \$V70dda5df[ord('\\1') % 8]", $V341be97d); That was updating $V341be97d, on the left-hand side of the = assignment, with a new value coming from preg_replace. Your updated version preg_replace_callback('/\^([^\^<])/', fn($matches) => '`' . $V70dda5df[ord($matches[1]) % 8], $V341be97d); changed the preg_replace into a preg_replace_callback but it lost the $V341be97d= that was there before. Still need it, otherwise whatever this replacement was designed to handle (namely the ^0s and ^7s and such that you're now seeing) won't happen.
  10. $V341be97d = preg_replace('/\^x([a-fA-F0-9]{6})/i', "`#\\1", $V341be97d); preg_replace_callback('/\^([^\^<])/', fn($matches) => '`' . $V70dda5df[ord($matches[1]) % 8], $V341be97d); On that second line you lost the assignment that was on the left of the function. So preg_replace_callback is running but the result isn't going anywhere. (what I posted was meant as only the bit about the function, not to be the whole line)
  11. It's a shame the code is open-source but extremely unreadable... I'll use those two as an example. Moving away from /e goes basically like: 1. Switch the function to preg_replace_callback and drop the /e flag, obviously. 2. Change the second argument (a string) to be a function following the template function($matches) { return ___; } where you put in there the replacement string but minus the outer quotes. 3. Replace "\\1" with $matches[1], "\\2" with $matches[2], and so on, and correct any issues with the PHP syntax. So this preg_replace("/\+([\x01-\x7F])#/e", "chr(ord('\\1') + 127)", $V341be97d) starts as preg_replace_callback("/\+([\x01-\x7F])#/", function($matches) { return chr(ord('\\1') + 127); }, $V341be97d) and you replace the '\\1' string to get preg_replace_callback("/\+([\x01-\x7F])#/", function($matches) { return chr(ord($matches[1]) + 127); }, $V341be97d) What you have now is quite a bit different to the point that it won't actually work correctly. If you're using PHP 7.4 or later, you can simplify the function syntax if you want by using a function shorthand: function(...) { return ... } can be shortened to fn(...) => ... preg_replace_callback("/\+([\x01-\x7F])#/", fn($matches) => chr(ord($matches[1]) + 127), $V341be97d) The second one preg_replace("/#(#|[0-9a-f]{2})/ie", "'\\1' == '#' ? '#' : chr(hexdec('\\1'))", $V341be97d) is similar preg_replace_callback("/#(#|[0-9a-f]{2})/i", function($matches) { return '\\1' == '#' ? '#' : chr(hexdec('\\1')); }, $V341be97d) but has a little more to replace, creating preg_replace_callback("/#(#|[0-9a-f]{2})/i", function($matches) { return $matches[1] == '#' ? '#' : chr(hexdec($matches[1])); }, $V341be97d) or with the PHP 7.4 shorthand, preg_replace_callback("/#(#|[0-9a-f]{2})/i", fn($matches) => $matches[1] == '#' ? '#' : chr(hexdec($matches[1])), $V341be97d) The latest one you're working on preg_replace('/\^([^\^<])/e', "'`' . \$V70dda5df[ord('\\1') % 8]", $V341be97d) goes very much the same way preg_replace_callback('/\^([^\^<])/', function($matches) { return '`' . \$V70dda5df[ord('\\1') % 8]; }, $V341be97d) preg_replace_callback('/\^([^\^<])/', function($matches) { return '`' . \$V70dda5df[ord($matches[1]) % 8]; }, $V341be97d) except it has a wrinkle: it tries to use the $V70dda5df variable. You need to adjust the syntax a bit by removing the backslash (it was needed because the code lived inside a string) but also for the fact that variables aren't accessible inside functions... unless you explicitly tell PHP you want that with a "use" attached to the function. That results in, preg_replace_callback('/\^([^\^<])/', function($matches) use ($V70dda5df) { return '`' . $V70dda5df[ord($matches[1]) % 8]; }, $V341be97d) The thing about variables doesn't apply to shorthand functions, so with PHP 7.4 you could simply write preg_replace_callback('/\^([^\^<])/', fn($matches) => '`' . $V70dda5df[ord($matches[1]) % 8], $V341be97d)
  12. No offense but I've removed the file from your post. It doesn't look like something that's meant to be shared, but it also doesn't need to be to address this particular problem. I don't suppose there's a more up to date version of this script available, right? Because that would be ideal. If not, what did you try? The second argument is essentially PHP code, so you just need to translate that string into normal code and use it with preg_replace_callback...
  13. Simple: don't do the routing in your PHP code. Set up your web server to automatically rewrite /blog/* to /views/blog/page.php?page_slug=*. The term you'll want to research is "URL rewriting"...
  14. I take it that means you don't plan to try to restate your question?
  15. If you're going with an OOP model (and that's a completely separate discussion) then you should continue with it. Typically the Car class will handle any type of search against its data, meaning that there would be a method like Car::getByUser(user id). In addition to that, you can provide a shorthand from the User class to find that - namely, $user->getCars() that obviously can supply the user ID to getByUser automatically.
  16. Does it make sense for the model to have a method related to its data? Does it make sense to do the same thing over and over again? Code belongs in the one, single place (hopefully) that it is most related to. If the name is related to the model then it should be the model that deals with the name. If code is related to the controller, that being the place where you have code to deal with requests and responses and deciding what to render, then that is where it should go. Is finding the most recent user something that relates mostly to the data managed by your model or to process managed by the controller?
  17. Your composer.json says it needs to use PHP ^7.2, meaning 7.2 or 7.3 or 7.4. laravel/passport needs ^7.2 as well. So downgrade your version of PHP to 7.2/7.3/7.4, or update your composer.json and laravel/passport dependency such that you can use PHP 8.1 with it.
  18. The error seems clear to me. What don't you understand about it?
  19. Sure would help if you posted the rest of the output, not just the first line of it.
  20. I don't see those lines included in your first post. Please post the full thing.
  21. And what lines are PHP saying that have $total_price and $total_quantity undefined? Make sure to read the message carefully for exactly which lines it says that happens on.
  22. I'm not sure how you're getting that error. Are you sure the code you posted is exactly what you are running that creates the warnings? Because you very clearly do set those two variables with values ahead of time - they are not undefined.
  23. https://www.google.com/search?q=download+mysql+8 The first few links all looked relevant. If that's not working for you then tell us which page you tried to download from.
  24. There is no single best provider. They all have different offerings at different prices. Compare and decide what serves your purposes best.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.