Compdigitec Labs

PHP

Phabricator LDAP (and other) account integration table

Sunday, January 17th, 2016

See also https://secure.phabricator.com/T4279 For LDAP, the following structure is used: id – auto-increment phid – random unique id userPHID – associated user or NULL accountType – “ldap” accountDomain – “self” accountSecret` – random characters accountID – LDAP username displayName – NULL dateCreated – Unix timestamp dateModified – Unix timestamp username – registration pre-fill for username […]

Possible crash in method_exists() with PHP 5.3

Saturday, August 9th, 2014

Apparently in some versions of PHP 5.3, calling method_exists() on a class which doesn’t exist seems to cause a crash. The solution, seen here, apparently involves checking class_exists() to prevent a potentially crashing call to method_exists(). This particular bug was causing the administration page of the MathJax-LaTeX WordPress plugin to be blank in the admin […]

Adding custom profile fields in WordPress (fully automatic)

Monday, October 17th, 2011

Custom profile fields are additional custom-defined fields in the WordPress usermeta database that permit us to store additional information about a user. To add custom profile fields, add the following line to your functions.php in your theme folder: Now create a new file called customfields.php in the theme folder (the same folder as function.php) with […]

WP No-bot Question plugin for WordPress

Sunday, October 9th, 2011

Most spam on your WordPress blog is caused by automated robots (spambots) which keep submitting to your comment form to inflate some shady website’s rank. Short of completely disabling or turning on blog moderation and wasting your time filtering through the mess, you can now use the new WP No-bot Question plugin developed by Compdigitec […]

Debugging comments on old posts in WordPress

Monday, March 7th, 2011

Sometimes on a WordPress blog all comment entry points on old blog posts will stop working. This can be caused by a number of problems: Posts are set to expire. If you select the option “Automatically close comments on articles older than x days” under Settings->Discussion, then posts will automatically close comments after x days. […]

Getting the direct link of a SkyDrive file transparently using PHP

Monday, January 31st, 2011

Windows Live SkyDrive is one of the best online storage/file hosting solutions available online. It provides you with 25 GBs of free storage associated with your Windows Live ID, and allows you to upload as many files as you want to it. However, Windows Live SkyDrive’s direct links are not stable for more than a […]

Reverse proxy (X-Forwarded-For) patches for WordPress comments and Bad Behaviour

Saturday, October 30th, 2010

Update: Reverse proxy support is now built into Bad Behaviour as of 2.1.x. Therefore the following patch is obsolete and should only be applied to Bad Behaviour 2.0.x. You can configure the built-in reverse proxy either through your settings.ini or in WordPress administration. Normally, when PHP scripts access the remote IP of a client through […]

Updated Roadsend PHP Compiler 2.9.8 packages

Wednesday, July 21st, 2010

Due to the vast interest in our previous binary package of Roadsend PHP, we have decided to compile a newer, updated version of the Roadsend PHP compiler (v2.9.8). However, due to previous flaws in the way that we compiled the previous PHP compile, many of our readers struggled or were entirely unable to get the […]

Solving “Fatal error: Exception thrown without a stack frame in Unknown on line 0”

Sunday, August 2nd, 2009

If you attempt to throw an exception from a PHP destructor or an PHP exception handler, your script will execute fine for the most part and then crash with the rather cryptic error message, “Fatal error: Exception thrown without a stack frame in Unknown on line 0“. This message is unfortunately very cryptic if you […]

Simple Template Engine – your lightweight templating engine in PHP

Monday, February 2nd, 2009

The Simple Template Engine is a very lightweight template engine to use in PHP if your webhost does not allow you to run something like Smarty. It is simple, lightweight and fast. To parse a file: example.tpl is: <html><head><title>{content}</title></head><body><h1>{content}</h1></body></html> If you found this article useful or helpful, please help Compdigitec spread the word. Don’t forget […]

« Previous Entries