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'; }
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); }
$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); }
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); }
<?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();