Ejemplo n.º 1
0
 /**
  *	Форма фхода в админку
  * @access	protected
  */
 public function admin()
 {
     $args = request::get(array('user', 'secret'));
     $data = array('LC' => LC::get());
     try {
         if (!empty($args)) {
             authenticate::login();
         }
     } catch (Exception $e) {
         dbg::write($e->getMessage(), LOG_PATH . 'adm_access.log');
         $data['errors'] = $e->getMessage();
     }
     if (!authenticate::is_logged()) {
         $tmpl = new tmpl($this->pwd() . 'login.html');
         response::send($tmpl->parse($data), 'html');
     } else {
         response::redirect('/xxx/');
     }
 }
Ejemplo n.º 2
0
 public function writeMysqlConfig($mysqlData)
 {
     if ($this->mysqlConfigExists()) {
         return false;
     }
     if (!$this->mysqlConfigWritable()) {
         return false;
     }
     $configTmplPath = '../../.htsecret/etc/tmpl/';
     // from ../tmpl/setup/
     $mysql_cfg = new tmpl('mysql.php', $mysqlData, $configTmplPath);
     $mysql_cfg->data = $mysql_cfg->fdata;
     $mysql_cfg->path .= '../';
     $mysql_cfg->write();
     $mysql_cfg->chmod(0600);
     $random = md5($this->randomString());
     $randomTmplData = array('random' => $random);
     $random_pw = new tmpl('random.php', $randomTmplData, $configTmplPath);
     $random_pw->data = $random_pw->fdata;
     $random_pw->path .= '../';
     $random_pw->write();
     $random_pw->chmod(0600);
     return true;
 }
Ejemplo n.º 3
0
 /**
  *       Main Home Tab
  */
 protected function sys_home()
 {
     $tmpl = new tmpl($this->pwd() . 'home.js');
     response::send($tmpl->parse($this), 'js');
 }
Ejemplo n.º 4
0
<?php

/**
 * build.php - Build Jcrop demo files
 *
 * It's become easier to build the demo files from a template than to
 * manage them manually. To rebuild the demo files you should run
 * build/build-all.bash which in turn calls this file
 */
// Make sure we know what directory we're in
chdir(dirname(__FILE__));
// Require tmpl class which does our rendering
require_once '../lib/tmpl.php';
// Generic class for our demo pages
// Each of the demo files below will create one of these objects
class demoDef extends tmplDef
{
    public $js = array('../js/jquery.min.js', '../js/jquery.Jcrop.js');
    public $css = array('demo_files/main.css', 'demo_files/demos.css', '../css/jquery.Jcrop.css');
}
// Specify output directory
if (!defined('DEMO_DIR')) {
    define('DEMO_DIR', '../../demos');
}
// Specify the demo files to build
$build_these = array('hello-world' => 'tutorial1.html', 'basic-handler' => 'tutorial2.html', 'preview-pane' => 'tutorial3.html', 'transitions' => 'tutorial4.html', 'api-demo' => 'tutorial5.html', 'non-image' => 'non-image.html', 'styling' => 'styling.html');
// Build each one
foreach ($build_these as $key => $out) {
    file_put_contents($outfile = sprintf('%s/%s', DEMO_DIR, $out), tmpl::render(tmpl::loader($key)));
    printf("Wrote %s to %s\n", $key, $outfile);
}
Ejemplo n.º 5
0
    /**
     *	Convert passed data to XML
     * @param	mixed	$data	Data to convert
     * @return	string	Data converted to XML
     */
    public static function to_xml($data)
    {
        $xml_template = '<?xml version="1.0" encoding="UTF-8"?>
<package>
{__(foreach($. AS @n => @v)__}{__apply branch(@n, @v)__}{__foreach)__}
</package>
{__(template branch(name, value)__}
<{__@name__}>
{__(if(is_array(@value))__}
{__(foreach(@value AS @n => @v)__}{__apply branch(@n, @v)__}{__foreach)__}
{__else__}
<![CDATA[{__@value__}]]>
{__if)__}
</{__@name__}>
{__template)__}';
        $tmpl = new tmpl($xml_template, 'text');
        return $tmpl->_parse($data);
    }
Ejemplo n.º 6
0
 /**
  *	Parse tmpl according with THEME INSTANCE OR default options
  * @access	public
  * @param	string	$tmpl_name	array() $data to parse out 
  * @return	parsed template 	tmpl2
  */
 public function parse_tmpl($template_file_name, $data)
 {
     if ($this->UI_LANG) {
         $data = array_merge($data, $this->UI_LANG);
     }
     if ($tmpl_path = $this->get_resource_path($template_file_name, 'absolute')) {
         $tmpl = new tmpl($tmpl_path);
         $html = $tmpl->parse($data);
         return $html;
     } else {
         $dbgs = array_shift(debug_backtrace());
         dbg::write("TEMPLATE WAS NOT FOUND at user_interface::parse_tmpl() \nCall from:.....  " . $dbgs['file'] . "\nline:..........  " . $dbgs['line'] . "\ntemplate: {$template_file_name}\npath1: {$tmpl_path} \npath2: {$tmpl_path2}");
     }
     return false;
 }
Ejemplo n.º 7
0
 /**
  *       ExtJs Form
  */
 protected function sys_item_form()
 {
     $tmpl = new tmpl($this->pwd() . 'item_form.js');
     response::send($tmpl->parse($this), 'js');
 }
Ejemplo n.º 8
0
 /**
  *	ExtJS Grid of available entry points
  */
 protected function sys_interfaces()
 {
     $tmpl = new tmpl($this->pwd() . 'interfaces.js');
     response::send($tmpl->parse($this), 'js');
 }
Ejemplo n.º 9
0
 protected function sys_browser()
 {
     $tmpl = new tmpl($this->pwd() . 'file_browser.html');
     response::send($tmpl->parse($this), 'html');
 }
Ejemplo n.º 10
0
 /**
  *       Простой список пользователей, с возможностью выбора
  */
 protected function sys_user_list()
 {
     $tmpl = new tmpl($this->pwd() . 'user_list.js');
     response::send($tmpl->parse($this), 'js');
 }