Phiras\’s Blog

January 10, 11

Aspect Oriented Software Engineering, seminar keynotes

Filed under: life — Tags: — phiras @ 1:26 pm

Attached is the keynotes of my talk in the RCSE program about Aspect Oriented Software Engineering.

Download

 

GWT File Manager

Filed under: java, WEB-APP — Tags: , , — phiras @ 1:14 pm

I’ve been asked in my university to build a simple File Manager based on Google Web Toolkit (GWT), I am sharing my code here. it would be a good example to those who are new with the framework.

 

GWT File Manager

Download

February 25, 10

XSS safe content in yii

Filed under: WEB-APP — Tags: , , — phiras @ 4:43 pm

In this post I am going to describe a solution to make your yii-based web application safe from illegal content injections.

I am going to make a use of the the yii wrapped htmlpurifier class inside a behavior. this behavior could be attached to any model with declaring the attributes we would like to make them XSS safe.

I have wrote the following behavior :

class CSafeContentBehavior extends CActiveRecordBehavior
{
   public $attributes =array();
   protected $purifier;

   function __construct(){
      $this->purifier = new CHtmlPurifier;
   }

   public function beforeSave($event)
   {
      foreach($this->attributes as $attribute){
         $this->getOwner()->{$attribute} = $this->purifier->purify($this->getOwner()->{$attribute});
      }
   }
}

place this class in a file in your application directory, for example : application/behaviors/CSafeContentBehavior.php
Now in your model you attach the behavior like this :

class Post extends CActiveRecord
{
   public function behaviors(){
      return array(
         'CSafeContentBehavor' => array(
         'class' => 'application.behaviors.CSafeContentBehavior',
         'attributes' => array('title', 'body'),
      ),
   );
}

Here we go. Our Post model will now purify title and body columns before each save operation.

December 12, 09

صور من حماه

Filed under: Uncategorized — Tags: , — phiras @ 4:13 am

اخذت هذه الصور من على قلعة حماه عام 2009 . حماة مدينة رائعة, تجمع بين عراقة الماضي و جمال الطبيعة

أتمنى ان تحافظ المدينة على رونقها على مر الزمن

hama

hama

hama

Arabic enable rich text editor for mac

Filed under: mac — Tags: — phiras @ 3:09 am

Hey,

It has been a long while suffering with the bad arabic support from Apple on Mac OS.

IWork09 is more than amazing, but it sucks when it comes to write right to left arabic texts.
MSOffice08 for mac is also nice, but it does not support writing in arabic.
NeoOffice can handle arabic texts well, but it has a very bad user interface and it consumes a lot of resources.

I spend a lot of time looking for the free rich text editor that runs on mac lightly and treats arabic well. till I find Bean.

Bean is a “small, easy-to-use word processor (or more precisely, a rich text editor), designed to make writing convenient, efficient and comfortable. Bean is Open Source, fully Cocoa, and is available free of charge! MS Word, OpenOffice, etc. try to be all things to all people. But sometimes you just want the right tool for the job. That is Bean’s niche.”

Finally a I would like to have an answer for this question : When Apple is going to

show more respect to the Arabic language? if the arabic world doesn’t deserve it, I am sure the arabic man who has 5% share in Apple Prince AlWaleed deserves it.

Older Posts »

The Shocking Blue Green Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.