function getAuth() { if (HTML_FlexyFramework::get()->cli) { return true; } return parent::getAuth(); }
function getAuth() { if (!HTML_FlexyFramework::get()->cli) { die("not cli"); } return true; }
function getAuth() { if (!HTML_FlexyFramework::get()->cli) { return false; } return true; }
function loadIniFiles() { // will create the combined ini cache file for the running user. $ff = HTML_FlexyFramework::get(); $ff->generateDataobjectsCache(true); $this->dburl = parse_url($ff->database); $dbini = 'ini_' . basename($this->dburl['path']); $iniCache = $ff->DB_DataObject[$dbini]; $this->schema = parse_ini_file($iniCache, true); $this->links = parse_ini_file(preg_replace('/\\.ini$/', '.links.ini', $iniCache), true); $lcfg =& $this->links; $cfg = HTML_FlexyFramework::get()->DB_DataObject; if (!empty($cfg['table_alias'])) { $ta = $cfg['table_alias']; foreach ($lcfg as $k => $v) { $kk = $k; if (isset($ta[$k])) { $kk = $ta[$k]; if (!isset($lcfg[$kk])) { $lcfg[$kk] = array(); } } foreach ($v as $l => $t_c) { $bits = explode(':', $t_c); $tt = isset($ta[$bits[0]]) ? $ta[$bits[0]] : $bits[0]; if ($tt == $bits[0] && $kk == $k) { continue; } $lcfg[$kk][$l] = $tt . ':' . $bits[1]; } } } }
function getAuth() { $ff = HTML_FlexyFramework::get(); if (!$ff->cli) { die("cli only"); } }
function get($s = '') { $this->sessionState(0); $bits = explode('/', $s); if (empty($bits[0]) || empty($bits[1]) || !isset($this->types[$bits[0]])) { $this->jerr("invalid url"); } $s = str_replace('/', '-', $bits[1]); $ui = posix_getpwuid(posix_geteuid()); $ff = HTML_FlexyFramework::get(); $compile = session_save_path() . '/' . $ui['name'] . '-' . $ff->project . '-' . $ff->version . '-' . $bits[0] . 'compile'; $fn = $compile . '/' . $s . '.' . $bits[0]; if (!file_exists($fn)) { header('Content-Type: ' . $this->types[$bits[0]]); echo "// compiled file not found = {$fn}"; exit; } $last_modified_time = filemtime($fn); if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time || isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == md5($fn)) { header("HTTP/1.1 304 Not Modified"); exit; } header('Content-Type: ' . $this->types[$bits[0]]); header("Pragma: public"); header('Content-Length: ' . filesize($fn)); header('Cache-Control: max-age=2592000, public'); header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 2592000)); header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $last_modified_time)); header('Etag: ' . md5($fn)); $fh = fopen($fn, 'r'); fpassthru($fh); fclose($fh); exit; }
function get() { $fopts = HTML_FlexyFramework::get()->HTML_Template_Flexy; $templateDir = explode(PATH_SEPARATOR, $fopts['templateDir']); $base = 'http://' . $_SERVER['SERVER_NAME'] . $this->rootURL; // $path = '/home/edward/gitlive/web.madeinnz/Pman/Shop/templates/mail/register.body.html'; // // $data = $this->convertStyle($base, $path, false); // // print_r($data);exit; $ret = array(); foreach ($templateDir as $dir) { if (!file_exists($dir . '/mail')) { continue; } if ($handle = opendir($dir . '/mail')) { while (false !== ($entry = readdir($handle))) { if ($entry == "." || $entry == ".." || !preg_match('/\\.html$/', $entry)) { continue; } $path = "{$dir}/mail/{$entry}"; $ret[] = array('file' => $entry, 'content' => $this->convertStyle($base, $path, false)); } closedir($handle); } } $this->jok($ret); }
function post() { $pc = HTML_FlexyFramework::get()->Pman_Core; if (empty($pc['googlekey'])) { $this->jerr("Google API Key not configured"); } $key = $pc['googlekey']; $this->jdata($key); }
function getAuth() { $ff = HTML_FlexyFramework::get(); if (!$ff->cli) { die("access denied"); } HTML_FlexyFramework::ensureSingle($_SERVER["SCRIPT_NAME"] . '|' . __FILE__, $this); return true; }
function getAuth() { $ff = HTML_FlexyFramework::get(); if (!empty($ff->cli)) { $this->cli = true; return true; } die("NOT ALLOWED"); }
function getAuth() { $ff = HTML_FlexyFramework::get(); if (!empty($ff->cli)) { $this->cli = true; return true; } // return true;// for test only return false; }
function getAuth() { // command line only ATM $this->cli = HTML_FlexyFramework::get()->cli; // var_dump($this->cli); if ($this->cli) { return true; } return false; }
function getAuth() { if (HTML_FlexyFramework::get()->cli) { return true; } $this->authUser = $this->getAuthUser(); if (!$this->authUser) { return false; } return true; }
function get($args, $opts) { //print_r($opts);exit; // technically it would be good to trash the cached ini files here.. // however we can not really do that, as the ownships are off.. //we can however regen our own files.. //DB_DataObject::debugLevel(1); //HTML_FlexyFramework::get()->debug = 1; HTML_FlexyFramework::get()->generateDataobjectsCache(true); die("done!"); }
function get() { // should be in the root directory... $opts = HTML_FlexyFramework::get(); $this->src = isset($opts->Pman_Builder['roojs1_path']) ? $opts->Pman_Builder['roojs1_path'] . '/docs/json' : realpath($opts->rootDir . '/roojs1/docs/json'); if (!$this->src) { $this->jerr("roojs1 directory is not in top level folder, or Builder.roojs1_path is not set"); } if (empty($_REQUEST['xtype'])) { $this->jerr("no xtype"); } if ($_REQUEST['xtype'] == '*all') { $this->allProps(); } if ($_REQUEST['xtype'] == 'Array') { $this->jdata(array()); } $view = empty($_REQUEST['view']) ? 'props' : 'events'; $ret = array(); if ($_REQUEST['xtype'] == '*Module' && $view == 'props') { $this->jdata($this->defModule()); } // strip non alpha chars == our dummy xtype use '*' $xtype = preg_replace('/[^a-z0-9_.-]+/i', '', $_REQUEST['xtype']); //var_dump($xtype);exit; $guess = array('Roo', 'Roo.menu', 'Roo.form', 'Roo.data', 'Roo.grid', 'Roo.Toolbar'); if (!empty($_REQUEST['xns'])) { $guess = array(preg_replace('/[^a-z0-9_.-]+/i', '', $_REQUEST['xns'])); } foreach ($guess as $p) { $fp = $this->src . '/' . $p . '.' . $xtype . '.json'; if (!file_exists($fp)) { continue; } // var_dump(file_get_contents($fp) ); // is this needed?? can we just dump it out.. with a bit of kluding? $jd = json_decode(file_get_contents($fp)); //print_r($jd); foreach ($jd->{$view} as $n => $inf) { $ret[] = (array) $inf; } if ($view == 'props') { $ret = array_merge($ret, $this->defProps()); } $this->jdata($ret); exit; } if (isset($_REQUEST['dataonly'])) { $this->jerr('Not available'); } return $this->jdata(array()); }
function loadIniFiles() { // will create the combined ini cache file for the running user. $ff = HTML_FlexyFramework::get(); $ff->generateDataobjectsCache(true); $this->dburl = parse_url($ff->database); $dbini = 'ini_' . basename($this->dburl['path']); $iniCache = $ff->DB_DataObject[$dbini]; if (!file_exists($iniCache)) { return; } $this->schema = parse_ini_file($iniCache, true); $this->links = parse_ini_file(preg_replace('/\\.ini$/', '.links.ini', $iniCache), true); }
function getAuth() { parent::getAuth(); // load company! //return true; $au = $this->getAuthUser(); //if (!$au) { // $this->jerr("Not authenticated", array('authFailure' => true)); //} $this->authUser = $au; $ff = HTML_FlexyFramework::get(); $opts = empty($ff->Pman_Core_I18N) ? empty($ff->Pman_I18N) ? array() : $ff->Pman_I18N : $ff->Pman_Core_I18N; return true; }
function get() { require_once 'HTML/FlexyFramework/Generator.php'; HTML_FlexyFramework_Generator::$generateClasses = true; $ff = HTML_FlexyFramework::get(); $ff->DB_DataObject['debug'] = 1; $ff->debug = 1; if (empty($ff->dataObjectsCache)) { die("make sure dataObjectsCache in set to true the index file"); } // make sure the cache generator is on.. $ff->dataObjectsCache = true; $ff->generateDataobjectsCache(true); die("Generation done.."); }
function get($app) { if (empty($app)) { die("Invalid Application"); } $mod = DB_DataObject::factory('builder_modules'); if (!$mod->get('app', $app)) { die("invalid module"); } if (!empty($_REQUEST['no_parts'])) { // used to do the previewer $this->builderJs = array(); //should it try and load the core??? $o = HTML_FlexyFramework::get(); $o->enable = ''; $o->enableArray = array(''); $o->disable = 'Core'; $this->disable_jstemplate = true; return; } $p = DB_DataObject::factory('builder_part'); $p->module_id = $mod->id; $p->selectAdd(); $p->selectAdd('module'); if (!$p->find()) { die("Invalid Application (2)"); } $this->builderJs = array(); $ff = HTML_FlexyFramework::get(); while ($p->fetch()) { // file exists in file system - dont add it twice! // this is a bit questionable.. - we may need to check if the // db version is more recent. $fl = $ff->rootDir . '/Pman/' . $app . '/' . $p->module . '.js'; //if (file_exists($fl) && filesize($fl)) { // continue; //} $this->builderJs[] = $p->module; } $o = HTML_FlexyFramework::get(); //echo '<PRE>';print_r($o);exit; $o->enable = 'Core'; $o->enableArray = array('Core'); //$o->options = 'Core,'.$o->options; return parent::get(''); }
function get() { $ff = HTML_FlexyFramework::get(); $top = $ff->rootDir . '/Pman/'; $ret = array(); foreach (scandir($top) as $m) { if ($m == 'Builder') { continue; } $vf = "{$top}{$m}/{$m}.readers.js"; // print_R($vf); if (!strlen($m) || $m[0] == '.' || !file_exists($vf)) { continue; } $ret[] = "Pman/{$m}/{$m}.readers.js"; } $this->jdata($ret); }
function get($sub) { if (empty($sub)) { return $this->roousage(); } // list of properties or events. // gets xns+xtype+list $ff = HTML_FlexyFramework::get(); $cls = $_REQUEST['xns'] . '.' . $_REQUEST['xtype']; $data = json_decode(file_get_contents($ff->rootDir . '/roojs1/docs/json/roodata.json')); //echo '<PRE>'; print_R($data); $out = $data->data->{$cls}->{$_REQUEST['list']}; if ($sub == 'Prop') { foreach (array(array('name' => "builder.sharedname", 'desc' => "This is a shared part, between different parts (modifying it will change other pages", 'memberOf' => "Builder", 'type' => "Boolean"), array('name' => "flexy:foreach", 'desc' => "Loop foreach (array,key,val|array,val)", 'memberOf' => "Flexy", 'type' => "String"), array('name' => "flexy:if", 'desc' => "if condition - put 0 to always disable it", 'memberOf' => "Flexy", 'type' => "String"), array('name' => "flexy:nameuses", 'desc' => "nameuses", 'memberOf' => "Flexy", 'type' => "String")) as $add) { array_push($out, $add); } } $this->jdata($out); // }
function convertTo($target = false) { if (!$target) { return false; } $roo = HTML_FlexyFramework::get()->page; $old = clone $this; // this shold not really happen... if ($target->get('email', $this->email)) { return false; } $target->setFrom($this->toArray()); $target->insert(); $this->person_id = $target->id; $this->person_table = $target->tableName(); $this->update($old); if (!empty($this->inviter_id) && method_exists($target, 'createFriend')) { $target->createFriend($this->inviter_id); } return $target; }
function jerror($type, $str, $errors = array(), $content_type = false) { if ($type !== false) { $this->addEvent($type, false, $str); } $cli = HTML_FlexyFramework::get()->cli; if ($cli) { echo "ERROR: " . $str . "\n"; exit; } if ($content_type == 'text/plain') { header('Content-Disposition: attachment; filename="error.txt"'); header('Content-type: ' . $content_type); echo "ERROR: " . $str . "\n"; exit; } require_once 'Services/JSON.php'; $json = new Services_JSON(); $retHTML = isset($_SERVER['CONTENT_TYPE']) && preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']); if ($retHTML) { if (isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] == 'NO') { $retHTML = false; } } else { $retHTML = isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] != 'NO'; } if ($retHTML) { header('Content-type: text/html'); echo "<HTML><HEAD></HEAD><BODY>"; echo $json->encodeUnsafe(array('success' => false, 'errorMsg' => $str, 'message' => $str, 'errors' => $errors ? $errors : true, 'authFailure' => !empty($errors['authFailure']))); echo "</BODY></HTML>"; exit; } if (isset($_REQUEST['_debug'])) { echo '<PRE>' . htmlspecialchars(print_r(array('success' => false, 'data' => array(), 'errorMsg' => $str, 'message' => $str, 'errors' => $errors ? $errors : true, 'authFailure' => !empty($errors['authFailure'])), true)); exit; } echo $json->encode(array('success' => false, 'data' => array(), 'errorMsg' => $str, 'message' => $str, 'errors' => $errors ? $errors : true, 'authFailure' => !empty($errors['authFailure']))); exit; }
/** * initalizie the cfg aray * */ function cfg() { static $loaded = false; if ($loaded) { return self::$cfg; } $loaded = true; $ff = HTML_FlexyFramework::get(); // BC compatible.. if any of these are set, then we use them as the settings.. $opts = array(); foreach (array('Pman_Core_I18n', 'Pman_Core_I18N', 'Pman_I18N', 'Pman_I18n') as $pk) { if (isset($ff->{$pk})) { //var_dump($pk); $opts = $ff->{$pk}; break; } } //echo '<PRE>';print_R($opts);//exit; // var_dump($opts);exit; $i = DB_DataObject::Factory('I18n'); // load the cofiguration foreach ($opts as $k => $v) { if ($v == '*') { // everything.. // self::$cfg[$k] = $i->availableCodes($k, false); continue; } self::$cfg[$k] = is_array($v) ? $v : explode(',', $v); } // available codes recursively calls this... -- so the above has to be set first.. foreach ($opts as $k => $v) { if ($v == '*') { // everything.. self::$cfg[$k] = '*'; //$i->availableCodes($k, false); continue; } } return self::$cfg; }
function get($args, $opts) { //print_r($opts);exit; if (empty($opts['noupdate'])) { HTML_FlexyFramework::run('Core/UpdateDatabase'); } require_once 'Pman/Core/Generator.php'; ini_set('pcre.backtrack_limit', 2000000); ini_set('pcre.recursion_limit', 2000000); $this->init(); $x = new Pman_Core_Generator(); // $x->page = clone($this); $modules = $opts['module']; // overwrite can be multiple $overwrite = is_string($opts['overwrite']) ? array($opts['overwrite']) : $opts['overwrite']; $x->start($this->cli, $modules, $overwrite); // technically it would be good to trash the cached ini files here.. // however we can not really do that, as the ownships are off.. //we can however regen our own files.. HTML_FlexyFramework::get()->generateDataobjectsCache(true); die("done!"); }
function check() { $ff = HTML_FlexyFramework::get(); if (empty($ff->Core_Notify) || empty($ff->Core_Notify['routes'])) { return; } $helo = $this->getHelo(); echo "HELO : {$helo} \n"; $error = array(); foreach ($ff->Core_Notify['routes'] as $server => $settings) { if (empty($settings['domains']) || empty($settings['username']) || empty($settings['password'])) { $error[] = "{$server} - Missing domains / username / password"; continue; } $socket_options = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false)); if (empty($settings['port'])) { $settings['port'] = 25; } $smtp = new Net_SMTP($server, $settings['port'], $helo, false, 0, $socket_options); // $smtp->setDebug(true); echo "Connecting : {$server}:{$settings['port']} \n"; $res = $smtp->connect(10); if (is_a($res, 'PEAR_Error')) { $error[] = "{$server} - Cound not connect"; continue; } echo "Login As : {$settings['username']}:{$settings['password']} \n"; $res = $smtp->auth($settings['username'], $settings['password']); if (is_a($res, 'PEAR_Error')) { $error[] = "{$server} - Cound not login"; continue; } } if (!empty($error)) { print_r($error); exit; } return; }
function get() { $this->sessionState(0); // get the modules. header('Content-type: text/javascript'); $ff = HTML_FlexyFramework::get(); $pr = $ff->project; $mods = $this->modulesList(); //print_r($mods); //$ar = explode(PATH_SEPARATOR, $ff->HTML_Template_Flexy['templateDir']); array_push($mods, $pr); foreach ($mods as $mod) { $prefix = $mod == $pr ? "" : "{$pr}."; //var_dump($prefix); $pdir = $mod == $pr ? '' : $pr . '/'; $dir = $this->rootDir . '/' . $pdir . $mod . '/jtemplates'; if (!file_exists($dir)) { echo '// missing directory ' . htmlspecialchars($dir) . "\n"; continue; } // got a directory.. $ar = glob("{$dir}/*.html"); if (empty($ar)) { echo '// no template is directory ' . htmlspecialchars($dir) . "\n"; continue; } echo "{$prefix}{$mod} = {$prefix}{$mod} || {};\n"; echo "{$prefix}{$mod}.template = {$prefix}{$mod}.template || {};\n\n"; foreach (glob("{$dir}/*.html") as $fn) { $name = "{$prefix}{$mod}.template." . preg_replace('/\\.html$/i', '', basename($fn)); echo $this->compile($fn, $name) . "\n"; } // testing.. //new HTML_FlexyFramework_JsTemplate('/home/alan/gitlive/web.mtrack/MTrackWeb/jtemplates/TimelineTicket.html', 'Pman.template.TimelineTicket'); } exit; }
function outputBody() { if ($this->timer) { $this->timer->setMarker(__CLASS__ . '::outputBody - start'); } $ff = HTML_FlexyFramework::get(); $proj = $ff->project; // DB_DataObject::debugLevel(1); $m = DB_DAtaObject::factory('Builder_modules'); $m->get('name', $proj); //var_dump($m->path);exit; // needs to modify the template directory?? // use the builder_module == app name // look for part with same name. if (empty($ff->Pman_Builder['from_filesystem'])) { $template_engine = new HTML_Template_Flexy(array('templateDir' => $m->path)); } else { $template_engine = new HTML_Template_Flexy(); } $template_engine->debug = 1; //print_R($template_engine); $template_engine->compile($this->template); if ($this->elements) { /* BC crap! */ $this->elements = HTML_Template_Flexy_Factory::setErrors($this->elements, $this->errors); } $template_engine->elements = $this->elements; if ($this->timer) { $this->timer->setMarker(__CLASS__ . '::outputBody - render template'); } //DB_DataObject::debugLevel(1); $template_engine->outputObject($this, $this->elements); if ($this->timer) { $this->timer->setMarker(__CLASS__ . '::outputBody - end'); } }
function post() { $pc = HTML_FlexyFramework::get()->Pman_Core; if (empty($pc['googlekey'])) { $this->jerr("Google API Key not configured"); } if (!strlen(trim($_REQUEST['text']))) { $this->jok(array("translatedText" => "")); } $param = array('key' => $pc['googlekey'], 'q' => $_REQUEST['text'], 'source' => $_REQUEST['src'], 'target' => $_REQUEST['dest'], 'format' => 'text'); $url = 'https://www.googleapis.com/language/translate/v2'; $handle = curl_init(); curl_setopt($handle, CURLOPT_URL, $url); curl_setopt($handle, CURLOPT_POST, count($param)); curl_setopt($handle, CURLOPT_POSTFIELDS, $param); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_HTTPHEADER, array('X-HTTP-Method-Override: GET')); $response = curl_exec($handle); // $responseDecoded = json_decode($response); curl_close($handle); header("content-type: text/json"); echo $response; exit; }
function downloadEvent($bits) { $popts = PEAR::getStaticProperty('Pman', 'options'); $ev = DB_DAtaObject::Factory('events'); if (!$ev->get($bits[1])) { die("could not find event id"); } // technically same user only.. -- normally www-data.. if (function_exists('posix_getpwuid')) { $uinfo = posix_getpwuid(posix_getuid()); $user = $uinfo['name']; } else { $user = getenv('USERNAME'); // windows. } $ff = HTML_FlexyFramework::get(); $file = $ff->Pman['event_log_dir'] . '/' . $user . date('/Y/m/d/', strtotime($ev->event_when)) . $ev->id . ".json"; $filesJ = json_decode(file_get_contents($file)); //print_r($filesJ); foreach ($filesJ->FILES as $k => $f) { if ($f->tmp_name != $bits[2]) { continue; } $src = $ff->Pman['event_log_dir'] . '/' . $user . date('/Y/m/d/', strtotime($ev->event_when)) . $f->tmp_name; if (!file_exists($src)) { die("file was not saved"); } header('Content-Type: ' . $f->type); header("Content-Disposition: attachment; filename=\"" . basename($f->name) . "\";"); @ob_clean(); flush(); readfile($src); exit; } }