Example #1
0
 $object->setComment($comment);
 // proceed for $passport
 $files = explode("\n", trim($passport));
 $rtn = array();
 foreach ($files as $file) {
     $file = trim($file);
     // for cache file, we move it to its proper location
     if (strpos($file, str_replace(WEBROOT . DS, "", CACHE_DIR)) === 0) {
         $oldname = WEBROOT . DS . $file;
         $newname = WEBROOT . DS . "files/application" . str_replace(CACHE_DIR, "", WEBROOT . DS . $file);
         rename($oldname, $newname);
         $file = str_replace(WEBROOT . DS, "", $newname);
     }
     $rtn[] = $file;
 }
 $object->setPassport(implode("\n", $rtn));
 // proceed for $graduation_certificate
 $files = explode("\n", trim($graduation_certificate));
 $rtn = array();
 foreach ($files as $file) {
     $file = trim($file);
     // for cache file, we move it to its proper location
     if (strpos($file, str_replace(WEBROOT . DS, "", CACHE_DIR)) === 0) {
         $oldname = WEBROOT . DS . $file;
         $newname = WEBROOT . DS . "files/application" . str_replace(CACHE_DIR, "", WEBROOT . DS . $file);
         rename($oldname, $newname);
         $file = str_replace(WEBROOT . DS, "", $newname);
     }
     $rtn[] = $file;
 }
 $object->setGraduationCertificate(implode("\n", $rtn));