J'ai besoin d'intimité. Non pas parce que mes actions sont douteuses, mais parce que votre jugement et vos intentions le sont.
5163 links
Cool :)
Tu nous mettras des screenshots ???
Tout est dans le titre.
Merci de tester et de me dire ce que vous en pensez :)
Si vous tombez sur une erreur de ce type en php, vérifiez que vous n'avez pas testé qu'une constante n'est pas vide via la fonction empty (syntaxe du style if (empty(MACONSTANTE))...).
Pour résoudre le problème, préférez la syntaxe suivante :
if (MACONSTANTE == '') etc.
Pour info, T_PAAMAYIM_NEKUDOTAYIM signifie double deux points (::) (PAAMAYIM = "double", NEKUDOTAYIM = : = "נקודותיים") [http://stackoverflow.com/questions/592322/php-expects-t-paamayim-nekudotayim]
Si ça peut vous éviter de péter une durite à trop chercher :)
"Petit" site intéressant à explorer.
Ok, vu comme ça c'est plus clair. Peut-être peux-tu utiliser les fonctions javascript de zerobin pour sécuriser ton mp ?
Pour l'id de l'article, tu as une fonction dans plxMotor qui te permet de trouver le suivant.
Désolé mais je n'ai pas bien compris ce que tu souhaites faire au départ :(
Si tu rediriges vers la page admin, c'est donc du côté privé et donc c'est la page /core/admin/prepend.php qui filtre les connexions.
Le risque en plaçant le mot de passe dans la session, c'est de se le faire voler...
Perso, j'aurai préféré l'inverse :)
"Just one more time, in the simplest terms possible:
An Interface is like a protocol. It doesn't designate the behavior of the object; it designates how your code tells that object to act. An interface would be like the English Language: defining an interface defines how your code communicates with any object implementing that interface.
An interface is always an agreement or a promise. When a class says "I implement interface Y", it is saying "I promise to have the same public methods that any object with interface Y has".
On the other hand, an Abstract Class is like a partially built class. It is much like a document with blanks to fill in. It might be using English, but that isn't as important as the fact that some of the document is already written.
An abstract class is the foundation for another object. When a class says "I extend abstract class Y", it is saying "I use some methods or properties already defined in this other class named Y".
So, consider the following PHP:
<?php
class X implements Y { } // this is saying that "X" agrees to speak language "Y" with your code.
class X extends Y { } // this is saying that "X" is going to complete the partial class "Y".
?>
You would have your class implement a particular interface if you were distributing a class to be used by other people. The interface is an agreement to have a specific set of public methods for your class.
You would have your class extend an abstract class if you (or someone else) wrote a class that already had some methods written that you want to use in your new class.
These concepts, while easy to confuse, are specifically different and distinct. For all intents and purposes, if you're the only user of any of your classes, you don't need to implement interfaces."
Quelques précisions supplémentaires et l'explication de la différence entre abstraction et interface.
"It seems like many contributors are missing the point of using an INTERFACE. An INTERFACE is not specifically provided for abstraction. That's what a CLASS is used for. Most examples in this article of interfaces could be achieved just as easily using just classes alone.
An INTERFACE is provided so you can describe a set of functions and then hide the final implementation of those functions in an implementing class. This allows you to change the IMPLEMENTATION of those functions without changing how you use it.
For example: I have a database. I want to write a class that accesses the data in my database. I define an interface like this:
interface Database {
function listOrders();
function addOrder();
function removeOrder();
...
}
Then let's say we start out using a MySQL database. So we write a class to access the MySQL database:
class MySqlDatabase implements Database {
function listOrders() {...
}
we write these methods as needed to get to the MySQL database tables. Then you can write your controller to use the interface as such:
$database = new MySqlDatabase();
foreach ($database->listOrders() as $order) {
Then let's say we decide to migrate to an Oracle database. We could write another class to get to the Oracle database as such:
class OracleDatabase implements Database {
public function listOrders() {...
}
Then - to switch our application to use the Oracle database instead of the MySQL database we only have to change ONE LINE of code:
$database = new OracleDatabase();
all other lines of code, such as:
foreach ($database->listOrders() as $order) {
will remain unchanged. The point is - the INTERFACE describes the methods that we need to access our database. It does NOT describe in any way HOW we achieve that. That's what the IMPLEMENTing class does. We can IMPLEMENT this interface as many times as we need in as many different ways as we need. We can then switch between implementations of the interface without impact to our code because the interface defines how we will use it regardless of how it actually works."
ET :
"When should you use interfaces? What are they good for?
Here are two examples.
This allows you to write reusable calling code that can work
for any number of different objects -- you don't need to know
what kind of object it is, as long as it obeys the common
interface.
When I came back to make the changes, I was able to create
some new implementations of these interfaces that added the
extra features I needed. Some of my classes still used
the "basic" implementations, but others needed the
specialized ones. I was able to add the new features to the
objects themselves without rewriting the calling code in most
cases. It was easy to evolve my code in this way because
the changes were mostly isolated -- they didn't spread all
over the place like you might expect."
Enfin, je comprends à quoi sert une interface (Merci à dlovell2001 at yahoo dot com et erik dot zoltan at msn dot com) ! Je n'avais jamais lu les commentaires associés à cette page. J'aurais dû le faire plus tôt.
Moralité : TOUJOURS LIRE LES COMMENTAIRES DES PAGES DE LA DOCUMENTATION PHP !
Voir ma réponse précédente, si tu me lis (si Bronco et les autres peuvent lui passer le message, je ne suis pas sûr que Timo me lise. Merci) : http://bookmarks.ecyseo.net/?XGS28Q
Une documentation php un peu différente mais pertinente.
Mouairf :/ moyennement convaincu sur le coup.
Comme quelqu'un disait en commentaire, pourquoi alourdir un projet alors que ce sont globalement des fonctions déjà supportées par php ?
Le framework c'est bien mais s'en passer c'est mieux.
À tester...
VerbalExpressions is a PHP library that helps to construct hard regular expressions.
En réaction à cet article (via SenSauvage : http://sebsauvage.net/links/?xCmoQw), ce comportement peut être réglé via le php.ini en mettant la directive implicit_flush à On. C'est le comportement par défaut en mode CLI SAPI.
Les fonctions php réécrites en javascript.
A voir si la roue n'est pas réinventée et qu'il n'existe pas déjà des fonctions javascript équivalentes.
Un peu d'autopromotion pour une librairie php que je viens d'écrire et qui permet de générer des graphiques svg.
Des exemples ici : http://www.ecyseo.net/?static8/phpgraph
La page Github : http://jerrywham.github.io/phpGraph/
Le dépôt Github : https://github.com/jerrywham/phpGraph
La page sur mon blog : http://www.ecyseo.net/article/29/phpgraph-afficher-des-graphiques-svg-grace-a-php.html
Les sources : https://github.com/jerrywham/phpGraph/zipball/master
Enjoy...
1) créer un fichier install.php qui contient:
<?php
$zip_file = "install.zip";
$php_install_script = "install_zip.php";
$content;
if(file_exists($zip_file)) {
$content = base64_encode(file_get_contents($zip_file));
$install_script= '<?php
// assuming file.zip is in the same directory as the executing script.
$file = \'install.zip\';
$fp = fopen($file,\'wb\');
fwrite($fp,base64_decode(\''.$content.'\'));
fclose($fp);
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
// extract it to the path we determined above
$zip->extractTo(\'.\');
$zip->close();
echo "WOOT! $file extracted to here";
} else {
echo "Doh! I couldn\'t open $file";
}
';
$fp = fopen($php_install_script,'wb');
fwrite($fp,$install_script);
fclose($fp);
echo "Creation of $php_install_script DONE !!";
} else {
echo "unable to found $zip_file";
}
(ou récupérer le fichier ici : http://shaarli.memiks.fr/snippets/install.txt)
2) mettre dans le même répertoire un fichier install.zip de votre application
3) lancer le fichier install.php
4) vous obtenez un fichier intall_zip.php qui va:
a) lors de l’exécution créer le fichier install.zip d'origine
b) l'extraire la ou est le fichier install_zip.php
voila ;)
@Seb je partage car tu nous fait partager tes "petits bouts de codes"
Attention il faut l'extension zip d'activer dans php...
Fréd.