Categories
php

php e mvc

interessante articolo di John Lim sull’uso del paradigma di programmazione MVC all’interno di applicazioni PHP, molto interessanti anche i commenti dove lo stesso fuecks ammette che non tutte le applicazioni per il web possono utilizzare tale paradigma. Oltre all’articolo consiglio la lettura di un infuocato thread sul forum di sitepoint che cerca di spiegare a cosa serve MVC.

ciauz

Categories
altri linguaggi php

jpspan

Ho scovato per errore JpSpan, una classe che permette di richiamare tramite javascript uno script php senza dover ricaricare la pagina. JpSpan ha decisamente molte potenzialità, partendo dal completamento automatico delle form alla gestione dei log degli errori alla creazione di applicazioni XUL complete. Merita di darci un occhio…

JPSpan provides tools to “hook up” PHP and Javascript, for the purpose of fetching data from PHP into a web page which has already loaded, without reloading the entire page.

The objective is to make connecting a Javascript client with a PHP server as painless and error-free as possible. To this end JPSpan allows you to define a class in PHP and call it’s methods directly (and remotely) from Javascript.

aggiornamento:
ho appena scoperto che jpspan è stato scritto da quel geniaccio di harry fuecks

ciuaz

Categories
php tecnologia

wordpress: rss per commenti moderati

sulla mailing list hacker di wordpress ho scoperto un interessante hack su come far visualizzare al feed RSS i commenti moderati, in questo modo sarà più semplice controllare che ce ne siano senza dover intasare la propria casella di posta elettronica o dover andare sul pannello di amministrazione del blog.

[php]
if (is_single()) {
$comments = $wpdb->get_results(“SELECT comment_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_content, comment_post_ID, $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = ‘$id’ AND $wpdb->comments.comment_approved = ‘1’ AND $wpdb->posts.post_status = ‘publish’ AND post_date < '".date("Y-m-d H:i:59")."' ORDER BY comment_date LIMIT " . get_settings('posts_per_rss') ); } else if (isset($_GET["view"]) && $_GET["view"] == 'moderated_comments') { $comments = $wpdb->get_results(“SELECT comment_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_content, comment_post_ID, $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->comments.comment_approved = ‘0’ AND $wpdb->posts.post_status = ‘publish’ AND post_date < '".date("Y-m-d H:i:59")."' ORDER BY comment_date LIMIT " . get_settings('posts_per_rss') ); } else { // if no post id passed in, we'll just ue the last 10 comments. $comments = $wpdb->get_results(“SELECT comment_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_content, comment_post_ID, $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = ‘publish’ AND $wpdb->comments.comment_approved = ‘1’ AND post_date < '".date("Y-m-d H:i:s")."' ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') ); } [/php]

Find the SQL queries in wp-commentsrss2.php and replace with this code.
Then subscribe to:
http://www.example./com/wp-commentsrss2.php?view=moderated_comments
This is from a recent nightly build, it will be slightly different in 1.2.1 or previous versions.

Cheers,
–Alex
http://www.alexking.org/

ciuaz

Categories
php

wordpress fickr gallery

This plugin allows you to display your Flickr photos and photosets on your site like a photo gallery using Flickr’s API. Some of the salient features include:

* Flickr photosets as “albums” – complete with descriptions and meta
* Support for Flickr “notes” feature (looks kind of like this)
* EXIF data support to display camera settings the photo was snapped with — in addition to the description and meta info from Flickr
* Valid XHTML output

An example installation can be found here.

ciauz

Categories
php tecnologia

php|architect novembre

è uscito il numero di novembre di php|architect, in questo numero:

PHP 5 & XML
When most people talk about PHP 5, they tend to concentrate on the many improvements in the way it works with objects, which is certainly a significant component of the new release. This often leaves equally important improvements, such as the changes made to the way PHP works with XML, neglected. This article’s goal is to familiarize you with how XML is handled by PHP 5 and how these changes make working with XML much easier. Join PHP developer and author Ilia Alshanetsky for the ultimate tour of all that is PHP 5 & XML!

PHP – XML Generator
Developing a UI that manipulates large data sets is difficult. Developing a UI dynamically upon user request is even more difficult. In this article, Man-ping Grace Chau aims to discuss the difficulties in developing a complex UI, demonstrated by the XML/XSL generator made in the Infospheres Lab at the California Institute of Technology. Examples of how to generate JavaScript dynamically at run time and how to represent a complex DOM tree with simple HTML data structure will also be shown. Furthermore, the article will discuss the optimization of input validation. Several error checking/correction algorithms will be demonstrated. This application is developed in PHP5, with extensive use of the new XML library.

Confronting the Object-Oriented vs. Relational “Impedance Mismatch” – Part II: Managing Distractions
To many object-oriented developers, there is a sense that the relational model for data management is at odds with the concepts of object-oriented development. Are these views justified? Are they practical? In part II of this two-part series, author Rick Morris builds a simple example of an object-oriented application that derives business logic from the database without object/relational mapping.

Hiding Your Sins – Practical Caching for the PHP Developer
After code acceleration (also called opcode cache), caching is one the easiest ways to make an existing website faster by saving the result of a time-consuming operation in a temporary storage medium from which it can be retrieved until a particular event takes place. Allen Smithee illustrates a practical caching approach that requires no external dependencies.

Secure Your System with a Port Security Guard
Intrusion prevention and detection are two essential components of a successful security strategy. In this article, Ron Goff discusses the creation of a “port guard”–a PHP-based system designed exclusively to detect and act upon malicious activity on your server’s Internet connection.

ciauz

Categories
php tecnologia

wp-mail hack

john blade ha realizzato un piccolo hack per wordpress che permette di pubblicare direttamente post contenenti immagini e file inviati via email (prima era possibile pubblicare solo email testuali).

ciuaz

Categories
php

nameko

nameko è un webmailer scritto in php, l’unica cosa che lo differenzia dagli altri webmailer è che l’installazione è mostruosamente semplice, infatti nameko ha solo un file!

ciuaz

Categories
php tecnologia

wordpress FOAF plugin

nonostante sia da un pò che non sento più parlare di FOAF nella blogsfera ho trovato qualcuno a cui interessa ancora l’argomento e che ha creato addirittura un plugin per wordpress che genera un file FOAF per ogni autore di un blog, includendo in questo anche i recenti post e sfruttanto la gestione di wordpress dei link per gli amici.

ciuaz

Categories
php tecnologia

phpCollab 2.5 rc 2

Today I’ve released the Release Candidate 2 for phpCollab, this is the only changes I made [I’m focusing on the buglist]

report: fixed pdf export
various: updated htmlarea
various: fixed minor code issue
various: cleaned php code
various: cleaned html code
various: updated jpgraph
newsdesk: multidelete fix
calendar: added broadcast support
calendar: added subtask view
calendar: upgraded to 0.9.6 dhtml js calendar

note that the release previous than php 4.1.2 are no more supported!

you can download it there:
https://sourceforge.net/project/shownotes.php?release_id=280891

please test this release a lot and specially on different OS/browsers the new version on htmlarea and dhtml calendar should fix a lot of the old compatibility problems

ciuaz

Categories
php tecnologia

spam attack!

stanotte ho ricevuto un altro attacco spammatorio (e pare non solo io ) ed ho deciso di documentarmi per bene, pare che l’infame che manda un commento ad ogni messaggio (leggi a me circa 1300 commenti a botta) non sia altro che un bot che sfrutta il file wp-comments-post.php, una buona soluzione sarebbe quindi quella di cambiare il nome del suddetto, ciò però è infattibile se come me siete attaccati al CVS di wordpress ed ogni modifica al codice si traduce nel classico pain in the ass.

Siccome abilitare solamente la moderazione non è una vera soluzione, in quanto alla fine hai sempre 1300 messaggi da cancellare a mano mi sono dato ulteriormente da fare ed ho scovato un luuuungo post nel support forum di wordpress dove vengono spiegati ed annunciati plugin antispam avanzati. Per ora ho messo su il Three Strikes and Out abbinato al Kitten Spaminator. Vi saprò dire al prossimo attacco il risultato.

ciuaz