Esempio n. 1
0
File: db.php Progetto: poef/ariadne
 public static function client($dsn, $username = '', $password = '', $driverOptions = array())
 {
     try {
         return new ar_connect_dbClient(new PDO($dsn, $username, $password, $driverOptions));
     } catch (Exception $e) {
         return ar::error($e->getMessage(), $e->getCode());
     }
 }
Esempio n. 2
0
 public function _soapCall($name, $arguments, $options = array(), $inputHeaders = array(), &$outputHeaders = array())
 {
     try {
         $result = $this->wrapped->__soapCall($name, $arguments, $options, $inputHeaders, $outputHeaders);
     } catch (Exception $e) {
         $result = ar::error($e->getMessage(), $e->getCode());
     }
     return $result;
 }
Esempio n. 3
0
 public function send($protocol, $target, $message)
 {
     // Open socket
     $socket = @fsockopen($this->host, $this->port, $this->errorNr, $this->errorStr);
     if ($socket) {
         if ($this->isSupported($protocol)) {
             $matches = array("\n", "\r");
             $replaces = array("¶", "");
             // newlines are \xb6 in the internal multigate protocol. \r is replaced to make sure the socket is not abused.
             $result = fwrite($socket, str_replace($matches, $replaces, "TOPROTOCOL {$protocol} {$target} {$message}"));
             if ($result !== false) {
                 return true;
             } else {
                 $this->errorNr = 42;
                 $this->errorStr = "Couldn't write to Multigate socket.";
             }
         }
         fclose($socket);
     }
     return ar::error($this->errorStr, $this->errorNr);
 }
Esempio n. 4
0
<?php

if (($this->CheckLogin('layout') || $this->CheckLogin('layout:read')) && $this->CheckConfig()) {
    $file = "";
    if (isset($this->data->config->pinp[$type][$function][$language])) {
        $template = $type . "." . $function . "." . $language . ".pinp";
        $templates = $this->store->get_filestore("templates");
        if ($templates->exists($this->id, $template)) {
            $ARCurrent->arResult = $templates->read($this->id, $template);
        } else {
            $ARCurrent->arResult = ar::error('Template not accessible', 501);
        }
    } else {
        $ARCurrent->arResult = ar::error('Template not found', 404);
    }
}
Esempio n. 5
0
 public function _find($criteria, $function = "list.html", $args = "", $limit = 100, $offset = 0)
 {
     $this->error = '';
     // remove possible path information (greedy match)
     if (!$function instanceof \Closure) {
         $function = basename((string) $function);
     }
     $result = $this->store->call($function, $args, $this->store->find($this->path, $criteria, $limit, $offset));
     if ($this->store->error) {
         $this->error = ar::error('' . $this->store->error, 1107, $this->store->error);
     }
     return $result;
 }
Esempio n. 6
0
 public function validate($inputs = null)
 {
     $valid = array();
     if (!$this->validateConditional()) {
         return $valid;
     }
     foreach ($this->children as $key => $child) {
         $result = $child->validate($inputs);
         $valid = array_merge($valid, $result);
     }
     $value = $this->getValue();
     if (is_array($this->checks)) {
         foreach ($this->checks as $check) {
             if (is_array(ar_html_form::$checks[$check]) && isset(ar_html_form::$checks[$check]['check'])) {
                 $checkMethod = ar_html_form::$checks[$check]['check'];
                 $message = ar_html_form::$checks[$check]['message'];
                 if (is_callable($checkMethod)) {
                     if (!$checkMethod($value)) {
                         $valid[$this->name] = ar::error(sprintf($message, $value), $check);
                     }
                 } else {
                     $valid[$this->name] = ar::error('incompatible check for this field', $check);
                 }
             }
         }
     }
     return $valid;
 }
Esempio n. 7
0
File: ar.php Progetto: poef/ariadne
 public static function _error($message, $code)
 {
     return ar::error($message, $code);
 }
Esempio n. 8
0
File: ftp.php Progetto: poef/ariadne
 public function pasv($pasv = true)
 {
     $this->options['pasv'] = $pasv;
     if (!ftp_pasv($this->connection, $pasv)) {
         return ar::error("Could not switch passive mode.", 6);
     }
     return $this;
 }
Esempio n. 9
0
if (($this->CheckLogin('layout') || $this->CheckLogin('layout:read')) && $this->CheckConfig()) {
    $file = "";
    if ($this->data->config->pinp[$type][$function][$language]) {
        $template = $type . "." . $function . "." . $language . ".pinp";
        $svn_enabled = $AR->SVN->enabled;
        if ($svn_enabled) {
            $filestore = $this->store->get_filestore_svn("templates");
            $svn = $filestore->connect($this->id);
            $svn_info = $filestore->svn_info($svn);
            if ($svn_info['revision']) {
                $svn_status = $filestore->svn_status($svn);
            } else {
                $svn_enabled = false;
                // this library is not under revision control
            }
        } else {
            $filestore = $this->store->get_filestore("templates");
        }
        if ($filestore->exists($this->id, $template)) {
            $arResult = array('svn' => $svn_enabled, 'ctime' => $filestore->mtime($this->id, $template), 'mtime' => $filestore->mtime($this->id, $template), 'size' => $filestore->size($this->id, $template));
            if ($svn_enabled) {
                $arResult += array('svn-info' => $svn_info, 'svn-status' => $svn_status[$template]);
            }
        } else {
            $arResult = ar::error('Template not accessible', 501);
        }
    } else {
        $arResult = ar::error('Template not found', 404);
    }
}