Exemplo n.º 1
0
Arquivo: c2Log.php Projeto: hornos/C2
 public function __construct($log = NULL)
 {
     if (empty($log)) {
         throw new coEx(__METHOD__);
     }
     $log = __k_str($log);
     $c2 = __k_fetch("c2");
     $this->__log = $c2['path.log'] . '/' . $log . '.log';
 }
Exemplo n.º 2
0
Arquivo: c2UAC.php Projeto: hornos/C2
 protected function _rpc_logout()
 {
     $c2 = __k_fetch('c2');
     $se = new c2Sys($c2['sys.c']);
     $se->start();
     try {
         $se->logout();
     } catch (Exception $e) {
         $se->stop(false);
         throw $e;
     }
     return $se->stop(false);
 }
Exemplo n.º 3
0
Arquivo: cache.php Projeto: hornos/C2
                    $bn = basename($f);
                    $cn = str_replace('.php', '', $bn);
                    $c = array_merge($c, array($cn => $f));
                }
            }
            break;
    }
    return $c;
}
function __c_cache($root = NULL, $cf = NULL, $rec = true, $v = true)
{
    $c = __c_dir($root, $rec);
    if (empty($c)) {
        return false;
    }
    if ($v) {
        print_r($c);
    }
    if (!($ch = fopen($cf, 'w'))) {
        return false;
    }
    fwrite($ch, serialize($c));
    fclose($ch);
}
// main
if (!($c2 = __k_fetch("c2"))) {
    die(__FILE__ . '(' . __LINE__ . ')');
}
foreach ($c2['sys.cache'] as $c => $d) {
    __c_cache($d['path'], $c2['path.cache'] . '/' . $c . '.php', true);
}
Exemplo n.º 4
0
Arquivo: k.php Projeto: hornos/C2
function __k_die($s = '', $obc = true)
{
    if (C2_CLI) {
        __k_prn($s, $obc);
    } else {
        try {
            $c2 = __k_fetch("c2");
        } catch (Exception $e) {
            __k_json($s, "e", $obc);
            exit(1);
        }
        $er = $c2['path.err'] . '/' . __k_str($s) . ".html";
        if (is_readable($er)) {
            readfile($er);
        } else {
            __k_json($s, "e", $obc);
        }
    }
    exit(1);
}
Exemplo n.º 5
0
Arquivo: test.php Projeto: hornos/C2
<?php

require_once "../php/h.php";
echo sha1('test');
$c2 = __k_fetch("c2");
#__k_r( $c2 );
# $l = new c2Log( "test" );
# $l->log( "test" );
$db = new c2PDB($c2["sys.c"]);
if (!$db->Connect()) {
    __k_die("connection error");
}
echo $db->time();
$db->Disconnect();
echo $db->time();