/**
  * saves the data of the document
  *
  * @return boolean
  * @param boolean $resave
  */
 public function we_save($resave = false, $skipHook = false)
 {
     // get original width and height of the image
     $arr = $this->getOrigSize(true, true);
     $this->setElement('origwidth', isset($arr[0]) ? $arr[0] : 0, 'attrib');
     $this->setElement('origheight', isset($arr[1]) ? $arr[1] : 0, 'attrib');
     $docChanged = $this->DocChanged;
     // will be reseted in parent::we_save()
     if (parent::we_save($resave, $skipHook)) {
         $this->unregisterMediaLinks();
         $ret = $this->registerMediaLinks();
         $thumbs = $this->getThumbs();
         if ($docChanged) {
             we_thumbnail::deleteByImageID($this->ID);
         }
         if ($thumbs) {
             foreach ($thumbs as $thumbID) {
                 $thumbObj = new we_thumbnail();
                 $thumbObj->initByThumbID($thumbID, $this->ID, $this->Filename, $this->Path, $this->Extension, $this->getElement('origwidth'), $this->getElement('origheight'), $this->getDocument());
                 if (($docChanged || !$thumbObj->exists()) && $thumbObj->createThumb() == we_thumbnail::BUILDERROR) {
                     t_e('Error creating thumbnail for file', $this->Filename . $this->Extension);
                 }
             }
         }
         return $ret;
     }
     return false;
 }
function logApiRequests($errorMessage)
{
    if (!empty($errorMessage)) {
        if (!($handle = fopen($_SERVER['DOCUMENT_ROOT'] . '/api/v1/logs/api-logfile-' . date("Ymd") . ".txt", "a"))) {
            t_e("API Logfile could not be created");
        } else {
            !fwrite($handle, date("Y-m-d H:i:s") . " : " . $errorMessage . "\n") ? t_e('API Logfile is not writable') : '';
        }
        fclose($handle);
    }
}
 public function __construct($request, $origin)
 {
     parent::__construct($request);
     // Abstracted out for example
     $APIKey = new apiKey();
     $user = new neurologUser();
     switch (true) {
         case !array_key_exists('apiKey', $this->request):
             t_e('neurolog API: No API Key provided');
             throw new Exception('No API Key provided');
         case !$APIKey->verifyKey($this->request['apiKey'], $origin):
             t_e('neurolog API: Invalid API Key =' . $this->request['apiKey']);
             throw new Exception('Invalid API Key');
         case array_key_exists('token', $this->request) && !$user->verifyUserByHash($this->request['token']):
             t_e('neurolog API: Invalid User Token =' . $this->request['token']);
             throw new Exception('Invalid User Token');
         default:
             $this->user = $user;
     }
 }
Exemple #4
0
}
$datetime = '';
if ($action == "all_name" || $action == "all_date") {
    $title = "All Pages";
} else {
    if ($action == "upload") {
        $title = "Upload Image";
    } else {
        if ($action == "new") {
            $title = "New";
        } else {
            if ($action == "search") {
                $title = "Search";
            } else {
                $title = $page;
                $date_format = t_e('date_format') ? t('date_format') : TITLE_DATE;
                if ($date_format) {
                    $datetime = "<span class=\"titledate\">" . date($date_format, @filemtime($filename)) . "</span>";
                }
            }
        }
    }
}
// Disable caching on the client (the iPhone is pretty agressive about this
// and it can cause problems with the editing function)
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
print defined('LOCALE') ? '<html lang="' . LOCALE . '">' . "\n" : "<html>\n";