示例#1
0
 public function handleGetEvents()
 {
     $student = $this->getUser()->getIdentity()->student;
     $events = EventManager::getEvents($student);
     fd($events);
     $this->terminate(new JsonResponse($events));
 }
示例#2
0
 public static function register($module_name)
 {
     $installed = self::checkInstall($module_name);
     if ($installed === false || $installed === null) {
         $module_class = $module_name . 'Module';
         $module = new $module_class();
         try {
             $result = $module->install();
             fd($result);
             if ($result != false) {
                 Admin_ModulesModel::add($module_name);
                 $cache = Environment::getCache($module_name . 'Module');
                 $cache->save('installed', true);
             }
         } catch (Exception $e) {
         }
     }
 }
示例#3
0
文件: Model.php 项目: bazo/Mokuji
 public function __call($method_name, $args)
 {
     $method_name = '_' . $method_name;
     $tags = array('tags' => array('Models' . $this->getReflection()->getName()));
     if ($this->reflection->hasMethod($method_name)) {
         $method = $this->reflection->getMethod($method_name);
         if ($method->getAnnotation('cache') == 'update' || $method->getAnnotation('cache') == 'insert' || strpos(String::lower($method_name), 'update') > 0 || strpos(String::lower($method_name), 'insert') > 0 || strpos(String::lower($method_name), 'delete') > 0 || strpos(String::lower($method_name), 'edit') > 0 || strpos(String::lower($method_name), 'save') > 0 || strpos(String::lower($method_name), 'create') > 0) {
             fd('cache cleaned');
             if (!empty($args)) {
                 $method->invokeArgs($this, $args);
             } else {
                 $this->{$method_name}();
             }
             //WORKAROUND
             $cache_folder = Environment::getVariable('tempDir') . '/c-' . $this->cache->namespace;
             if (file_exists($cache_folder)) {
                 $files = glob($cache_folder . '/*');
                 if ($files != false) {
                     foreach ($files as $file) {
                         if (file_exists($file)) {
                             unlink($file);
                         }
                     }
                 }
             }
             //$this->cache->clean();
         } else {
             if (!empty($args)) {
                 $ckey = sha1($method_name . serialize($args));
                 if (!isset($this->cache[$ckey])) {
                     $this->cache->save($ckey, $method->invokeArgs($this, $args));
                 }
             } else {
                 $ckey = sha1($method_name);
                 if (!isset($this->cache[$ckey])) {
                     $this->cache->save($ckey, $this->{$method_name}());
                 }
             }
             return $this->cache[$ckey];
         }
     }
 }
 public function getComment($type, $miniId, $odd = false, $count = null, $time = null)
 {
     $map['type'] = $type;
     $map['appid'] = $miniId;
     //根据参数决定返回什么样的评论集合
     if (true == $odd) {
         //如果设置了时间。。
         if (isset($time)) {
             $map['cTime'] = array("lt", $time);
         }
         $result = $this->where($map)->findAll();
         fd($this->getLastSql());
     } else {
         $result['first'] = $this->where($map)->find();
         if ($count > 1) {
             $result['last'] = $this->where($map)->order('cTime desc')->find();
             $result['count'] = $count;
         }
         $result['id'] = $miniId;
     }
     return $result;
 }
示例#5
0
// non editable or "hidden"
# dimconfig
$data = array();
foreach ($core->dimconfig as $data['name'] => $data['value']) {
    if (!isset($dimconfigMD[$data['name']])) {
        $fieldType = CONS_TIPO_VC;
        $dimconfigMD[$data['name']] = array(CONS_XML_TIPO => CONS_TIPO_VC);
    } else {
        $fieldType = $dimconfigMD[$data['name']][CONS_XML_TIPO];
    }
    // format dates
    if ($fieldType == CONS_TIPO_DATE && isset($data['value'])) {
        $data['value'] = fd($data['value'], $core->intlControl->getDate());
    } else {
        if ($fieldType == CONS_TIPO_DATETIME && isset($data['value'])) {
            $data['value'] = fd($data['value'], "H:i:s " . $core->intlControl->getDate());
        }
    }
    // format in language mode
    $forceRO = isset($dimconfigMD[$data['name']][CONS_XML_RESTRICT]) && $dimconfigMD[$data['name']][CONS_XML_RESTRICT] > $_SESSION[CONS_SESSION_ACCESS_LEVEL] || $data['name'][0] == "_" || isset($dimconfigMD[$data['name']][CONS_XML_READONLY]);
    if ((!$forceRO || $_SESSION[CONS_SESSION_ACCESS_LEVEL] == 100) && !is_array($data['value']) && strpos($data['name'], '_pluginStarter') === false) {
        // forceRO will display as editable for master
        // arrays are never editable
        // _pluginStarter neither
        $fillDT = array('field' => $data['name'], 'width' => '99%');
        switch ($fieldType) {
            case CONS_TIPO_UPLOAD:
                // ############################################### FILE(s)
                $field_upload = $core->template->get("_upload_field");
                $using = clone $field_upload;
                $emptyme = array();
示例#6
0
$module = $core->loaded($undodata['modulo']);
if ($module === false) {
    // invalid module
    $core->errorControl->raise(518, $undodata['modulo'], $undodata['modulo']);
}
$missingField = false;
$temp = "";
$mytp = $core->template->get("_field");
foreach ($module->fields as $name => &$field) {
    $fieldDT = array('name' => $name, 'content' => '');
    switch ($field[CONS_XML_TIPO]) {
        case CONS_TIPO_DATE:
            $fieldDT['conteudo'] = fd($data[$name], $core->intlControl->getDate());
            break;
        case CONS_TIPO_DATETIME:
            $fieldDT['conteudo'] = fd($data[$name], "H:i:s " . $core->intlControl->getDate());
            break;
        case CONS_TIPO_ENUM:
            $fieldDT['conteudo'] = $core->langOut($data[$name]);
            break;
        case CONS_TIPO_UPLOAD:
            $keys = "";
            foreach ($module->keys as $key) {
                $keys = $data[$key] . "_";
            }
            $keys = substr($keys, 0, strlen($keys) - 1);
            // remove last _
            $file = CONS_FMANAGER . "_undodata/" . $module->name . $name . "_" . $keys;
            $ext = "";
            foreach ($files as $undofile => $true) {
                if (strpos($undofile, $module->name . $name . "_" . $keys) !== false) {
示例#7
0
 public function clean(array $conds, $namespace = null)
 {
     $all = !empty($conds[Cache::ALL]);
     $collector = empty($conds);
     if ($namespace != null) {
         $base = $this->dir . DIRECTORY_SEPARATOR . 'c' . $namespace;
         fd($base);
     }
     // cleaning using file iterator
     if ($all || $collector) {
         $now = time();
         $base = $this->dir . DIRECTORY_SEPARATOR . 'c';
         $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->dir), RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($iterator as $entry) {
             $path = (string) $entry;
             if (strncmp($path, $base, strlen($base))) {
                 // skip files out of cache
                 continue;
             }
             if ($entry->isDir()) {
                 // collector: remove empty dirs
                 @rmdir($path);
                 // intentionally @
                 continue;
             }
             if ($all) {
                 $this->delete($path);
             } else {
                 // collector
                 $meta = $this->readMeta($path, LOCK_SH);
                 if (!$meta) {
                     continue;
                 }
                 if (!empty($meta[self::META_EXPIRE]) && $meta[self::META_EXPIRE] < $now) {
                     $this->delete($path, $meta[self::HANDLE]);
                     continue;
                 }
                 fclose($meta[self::HANDLE]);
             }
         }
         if ($all && extension_loaded('sqlite')) {
             sqlite_exec("DELETE FROM cache", $this->getDb());
         }
         return;
     }
     // cleaning using journal
     if (!empty($conds[Cache::TAGS])) {
         $db = $this->getDb();
         foreach ((array) $conds[Cache::TAGS] as $tag) {
             $tmp[] = "'" . sqlite_escape_string($tag) . "'";
         }
         $query[] = "tag IN (" . implode(',', $tmp) . ")";
     }
     if (isset($conds[Cache::PRIORITY])) {
         $query[] = "priority <= " . (int) $conds[Cache::PRIORITY];
     }
     if (isset($query)) {
         $db = $this->getDb();
         $query = implode(' OR ', $query);
         $files = sqlite_single_query("SELECT file FROM cache WHERE {$query}", $db, FALSE);
         foreach ($files as $file) {
             $this->delete($file);
         }
         sqlite_exec("DELETE FROM cache WHERE {$query}", $db);
     }
 }
示例#8
0
文件: Uploader.php 项目: bazo/Mokuji
 public function handleUpload($name)
 {
     fd($_REQUEST);
     fd($_FILES);
     //header('Content-type: text/plain; charset=UTF-8');
     //header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     //header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     //header("Cache-Control: no-store, no-cache, must-revalidate");
     //header("Cache-Control: post-check=0, pre-check=0", false);
     //header("Pragma: no-cache");
     // Settings
     $targetDir = ini_get("upload_tmp_dir");
     $cleanupTargetDir = false;
     // Remove old files
     $maxFileAge = 60 * 60;
     // Temp file age in seconds
     // 5 minutes execution time
     //@set_time_limit(5 * 60);
     // usleep(5000);
     // Get parameters
     $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
     $chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
     $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
     // Clean the fileName for security reasons
     $fileName = preg_replace('/[^\\w\\._]+/', '', $fileName);
     // Create target dir
     if (!file_exists($targetDir)) {
         @mkdir($targetDir);
     }
     // Remove old temp files
     /*
     	if (is_dir($targetDir) && ($dir = opendir($targetDir)))
             {
     		while (($file = readdir($dir)) !== false) {
     			$filePath = $targetDir . DIRECTORY_SEPARATOR . $file;
     
     			// Remove temp files if they are older than the max age
     			if (preg_match('/\\.tmp$/', $file) && (filemtime($filePath) < time() - $maxFileAge))
     				@unlink($filePath);
     		}
     
     		closedir($dir);
     	} else
     		die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
     */
     // Look for the content type header
     if (isset($_SERVER["HTTP_CONTENT_TYPE"])) {
         $contentType = $_SERVER["HTTP_CONTENT_TYPE"];
     }
     if (isset($_SERVER["CONTENT_TYPE"])) {
         $contentType = $_SERVER["CONTENT_TYPE"];
     }
     if (strpos($contentType, "multipart") !== false) {
         if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
             // Open temp file
             $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
             if ($out) {
                 // Read binary input stream and append it to temp file
                 $in = fopen($_FILES['file']['tmp_name'], "rb");
                 if ($in) {
                     while ($buff = fread($in, 4096)) {
                         fwrite($out, $buff);
                     }
                 } else {
                     die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
                 }
                 fclose($out);
                 unlink($_FILES['file']['tmp_name']);
             } else {
                 die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
             }
         } else {
             die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
         }
     } else {
         // Open temp file
         $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
         if ($out) {
             // Read binary input stream and append it to temp file
             $in = fopen("php://input", "rb");
             if ($in) {
                 while ($buff = fread($in, 4096)) {
                     fwrite($out, $buff);
                 }
             } else {
                 die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
             }
             fclose($out);
         } else {
             die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
         }
     }
     // Return JSON-RPC response
     die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
     $this->presenter->terminate();
 }
示例#9
0
 public function handleBrowseFiles($dir, $ext)
 {
     $cache = Environment::getCache($this->getName());
     $ckey = __FUNCTION__ . $dir . $ext;
     fd(Environment::getVariables());
     if (!isset($cache[$ckey])) {
         $root = WWW_DIR . '/';
         $response = '';
         if (file_exists($root . $dir)) {
             $files = scandir($root . $dir);
             natcasesort($files);
             if (count($files) > 2) {
                 $response .= "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
                 foreach ($files as $file) {
                     if (file_exists($root . $dir . $file) && $file != '.' && $file != '..' && is_dir($root . $dir . $file)) {
                         $response .= "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlentities($dir . $file) . "/\">" . htmlentities($file) . "</a></li>";
                     }
                 }
                 foreach ($files as $file) {
                     $file_info = pathinfo($file);
                     if (file_exists($root . $dir . $file) && $file != '.' && $file != '..' && !is_dir($root . $dir . $file) && $file_info['extension'] == $ext) {
                         $ext = preg_replace('/^.*\\./', '', $file);
                         $response .= "<li class=\"file ext_{$ext}\"><a href=\"#\" rel=\"" . htmlentities($dir . $file) . "\">" . htmlentities($file) . "</a></li>";
                     }
                 }
                 $response .= "</ul>";
             }
         }
         $cache->save($ckey, $response, array('expire' => time() + 60 * 10));
     }
     echo $cache[$ckey];
     $this->terminate();
 }
示例#10
0
 function field_interface($field, $action, &$data)
 {
     // REMEMBER: fields must be declared in the construct, at customFields array
     # checks if this field should be displayed differently or not at all on an administrative environment
     # return TRUE to use default, FALSE not to display or the STRING that will replace the area
     if ($field == "history") {
         if ($action) {
             return false;
         }
         // do not show when adding
         $history = unserialize($data['history']);
         $output = "";
         if (is_array($history)) {
             foreach ($history as $item) {
                 $output .= "<b>" . fd($item['time'], "H:i:s " . $this->parent->intlControl->getdate()) . "</b> - ";
                 $output .= outputBrowserName($item['browser']) . " " . $item['browserVersion'];
                 $output .= " - IP=" . IPv6To4($item['ip']) . "<br/>";
             }
         }
         return $output == '' ? false : $output;
     } else {
         if ($field == "userprefs" && isset($this->parent->loadedPlugins['bi_adm'])) {
             // THIS IS ABOUT NEKOI'S bi_ADM
             $admObj = $this->parent->loadedPlugins['bi_adm'];
             $up = isset($data['userprefs']) ? $data['userprefs'] : '';
             $up = unserialize($up);
             if (!is_array($up)) {
                 $up = array();
             }
             if (!isset($up['skin'])) {
                 $up['skin'] = defined("CONS_ADM_BASESKIN") ? CONS_ADM_BASESKIN : 'base';
             }
             if (!isset($up['init'])) {
                 $up['init'] = 'index';
             }
             if (!isset($up['pfim'])) {
                 $up['pfim'] = CONS_DEFAULT_IPP;
             }
             if (!isset($up['menufont'])) {
                 $up['menufont'] = 12;
             }
             if (!isset($up['sf'])) {
                 $up['sf'] = '1';
             }
             if (!isset($up['floating'])) {
                 $up['floating'] = '0';
             }
             if (!isset($up['lang'])) {
                 $up['lang'] = CONS_DEFAULT_LANG;
             }
             // prefered language
             $output = "<div style='height:32px'><div style='width:100px;float:left;height:20px'>" . $this->parent->langOut('language') . "</div><div style='height:20px'><select name='user_prefs_lang' style='margin:0px'>";
             foreach (explode(",", CONS_POSSIBLE_LANGS) as $lang) {
                 $output .= "<option value='{$lang}'" . ($lang == $up['lang'] ? ' selected="selected"' : "") . ">{$lang}</option>";
             }
             $output .= "</select></div></div>";
             // skin
             $output .= "<div style='height:32px'><div style='width:100px;float:left;height:20px'>" . $this->parent->langOut('skin') . "</div><div style='height:20px'><select name='user_prefs_skin' style='margin:0px'>";
             if (defined('CONS_ADM_ACTIVESKINGS')) {
                 $skins = explode(",", CONS_ADM_ACTIVESKINGS);
             } else {
                 $skins = array('base');
             }
             foreach ($skins as $skin) {
                 $output .= "<option value='{$skin}'" . ($skin == $up['skin'] ? ' selected="selected"' : "") . ">{$skin}</option>";
             }
             $output .= "</select></div></div>";
             // start page
             $output .= "<div style='height:32px'><div style='width:100px;float:left;height:20px'>" . $this->parent->langOut('startpage') . "</div><div style='height:20px'><select name='user_prefs_init' style='margin:0px'>";
             $possibles = array('index', 'logs');
             if ($_SESSION[CONS_SESSION_ACCESS_LEVEL] == 100) {
                 $possibles[] = "master";
             }
             if (isset($this->parent->loadedPlugins['bi_stats'])) {
                 $possibles[] = "stats_analytics";
             }
             if (isset($this->parent->loadedPlugins['bi_pm'])) {
                 $possibles[] = "bi_pm_index";
             }
             foreach ($this->parent->modules as $modname => &$m) {
                 if ($m->options[CONS_MODULE_SYSTEM] || $m->linker) {
                     continue;
                 }
                 $possibles[] = $modname;
             }
             foreach ($possibles as $p) {
                 $output .= "<option value='{$p}'" . ($p == $up['init'] ? ' selected="selected"' : "") . ">" . (isset($this->parent->modules[$p]) ? $this->parent->langOut('list') . " " : "") . $this->parent->langOut($p) . "</option>";
             }
             $output .= "</select></div></div>";
             // pfim (ipp - itens per page)
             $output .= "<div style='height:32px'><div style='width:100px;float:left;height:20px'>" . $this->parent->langOut('pfimsize') . "</div><div style='height:20px'>";
             $output .= "<input type='text' style='width:50px;margin:0px' name='user_prefs_pfim' value='" . $up['pfim'] . "'/> " . $this->parent->langOut('itens') . "</div></div>";
             // smart filter
             $output .= "<div style='height:32px'><div style='width:100px;float:left;height:20px'>" . $this->parent->langOut('smartfilter') . "</div><div style='height:20px'>";
             $output .= "<input type='checkbox' name='user_prefs_sf' id='user_prefs_sf'" . ($up['sf'] == 1 ? " checked='checked'" : "") . "><label for='user_prefs_sf'>" . $this->parent->langOut('smartfilter_fulltext') . "</label></div></div>";
             // floater
             $output .= "<div style='height:32px'><div style='width:100px;float:left;height:20px'>" . $this->parent->langOut('floaterbar') . "</div><div style='height:20px'>";
             $output .= "<input type='checkbox' name='user_prefs_floating' id='user_prefs_floating'" . ($up['floating'] == 1 ? " checked='checked'" : "") . "><label for='user_prefs_floating'>" . $this->parent->langOut('floaterbar_fulltext') . "</label></div></div>";
             // menu font
             $output .= "<div style='height:32px'><div style='width:100px;float:left;height:20px'>" . $this->parent->langOut('menufont') . "</div><div style='height:20px'>";
             $output .= "<input type='text' style='width:50px;margin:0px' name='user_prefs_menufont' value='" . $up['menufont'] . "'/> px</div></div>";
             return $output;
         }
     }
     return true;
 }
示例#11
0
<?php

/* ---------------------------------
   | PART OF stats MODULE
--*/
$ip = cleanString($_REQUEST['ip']);
$rt = $core->loaded('statsrt');
if ($core->dbo->query("SELECT * from " . $rt->dbname . " WHERE ip='{$ip}'", $r, $n) && $n > 0) {
    $dados = $core->dbo->fetch_assoc($r);
    echo "Hora de entrada: " . fd($dados['data_ini'], "H:i:s") . "\n";
    echo "Último contato: " . fd($dados['data'], "H:i:s") . "\n";
    echo "Navegador: " . $dados['agent'] . "\nCaminho Percorrido:\n";
    echo str_replace(",", "\n⤹ ", $dados['fullpath']);
} else {
    echo "IP not found";
}
$core->close();
示例#12
0
文件: page.php 项目: iplayfast/sc
 public function ajax_page_list()
 {
     // make sure user is an admin
     if (!$this->ion_auth->is_group('editors') and !$this->ion_auth->is_admin()) {
         $this->session->set_flashdata('message', 'You must be an admin to view this page.');
         redirect('auth/login');
     }
     $pages = $this->Page_model->datatables_get_pages();
     // format data as required
     foreach ($pages['Result'] as &$row) {
         $row['date_created'] = fd($row['date_created']);
         $row['date_modified'] = fd($row['date_modified']);
         // add extra column for links
         $row['edit'] = '<a href="' . base_url() . 'page/edit/' . $row['id'] . '">Edit</a>';
     }
     // output our json
     echo $this->datatableshelper->jsonify($pages, 'title,slug,date_created,date_modified,edit');
 }
示例#13
0
     $content = $using->techo($fillDT);
     break;
 case CONS_TIPO_ENUM:
     // ############################################### LIST OF ITEMS IN ENUM FORM
     $content = $core->langOut($data[$name]);
     break;
 case CONS_TIPO_DATE:
     // ############################################### DATE / DATETIME
     $content = fd($data[$name], $core->intlControl->getDate());
     if ($content == '') {
         $content = false;
         continue;
     }
     break;
 case CONS_TIPO_DATETIME:
     $content = fd($data[$name], "H:i:s " . $core->intlControl->getDate());
     if ($content == '') {
         $content = false;
         continue;
     }
     break;
 case CONS_TIPO_VC:
     // ############################################### SIMPLE INPUT WITH HEAVY TYPESETTING
 // ############################################### SIMPLE INPUT WITH HEAVY TYPESETTING
 case CONS_TIPO_INT:
 case CONS_TIPO_FLOAT:
     $field_sel = $core->template->get("_normal_field");
     $using = clone $field_sel;
     $fillDT['value'] = isset($data[$name]) ? $data[$name] : '';
     if (isset($module->fields[$name][CONS_XML_META])) {
         if ($module->fields[$name][CONS_XML_META] == "masked" || $module->fields[$name][CONS_XML_META] == "password") {
示例#14
0
/**
 * fda 
 * SamPeng封装的FirePHP批量调试
 * @access public
 * @return void
 */
function fda($var_array, $null = true, $filter = null, $all = false)
{
    Import("@.Unit.FirePHPCore.FirePHP");
    $firephp = FirePHP::getInstance(true);
    if (is_array($var_array)) {
        foreach ($var_array as $key => $value) {
            if (is_string($key)) {
                !is_object($value) && $filter == null;
                fd($value, $null, $filter, $firephp, $key);
            }
        }
        if ($all == true) {
            $firephp->logo(debug_backtrace());
        }
        $firephp->trace("Trace Label");
        $firephp->group("全部系统变量");
        $firephp->fb($_SERVER, "SERVER变量");
        $firephp->groupEnd();
        $firephp->group("全部Session");
        $firephp->fb($_SESSION, "SESSION变量");
        $firephp->groupEnd();
        $firephp->group("全部请求变量");
        isset($_GET) && $firephp->fb($_GET, "GET传值");
        isset($_POST) && $firephp->fb($_POST, "POST传值");
        isset($_REQUEST) && $firephp->fb($_REQUEST, "REQUEST请求");
        $firephp->groupEnd();
        return;
    }
    fd($value, $null, $filter, $firephp);
    $firephp->group("全部系统变量");
    $firephp->fb($_SERVER, "SERVER变量");
    $firephp->groupEnd();
    $firephp->group("全部Session");
    $firephp->fb($_SESSION, "SESSION变量");
    $firephp->groupEnd();
    $firephp->group("全部请求变量");
    isset($_GET) && $firephp->fb($_GET, "GET传值");
    isset($_POST) && $firephp->fb($_POST, "POST传值");
    isset($_REQUEST) && $firephp->fb($_REQUEST, "REQUEST请求");
    $firephp->groupEnd();
    if ($all == true) {
        $firephp->log(debug_backtrace());
    }
    $firephp->trace("Trace Label");
}
示例#15
0
文件: edit.php 项目: iplayfast/sc
$this->form_validation->set_error_delimiters('<span class="error">', '</span>');
?>
				
<td colspan="20">

<h2>Editing User <?php 
echo $user->username;
?>
</h2>

<div style="border:1px solid #aaa;padding:0px 10px;">
<p><strong>Account Created:</strong> <?php 
echo fd($user->created_on);
?>
<br /><strong>Last Logged in:</strong> <?php 
echo fd($user->last_login);
?>
<br /><strong>Last User Agent:</strong> <?php 
echo $user->user_agent;
?>
</p>

</p>
</div>

    <?php 
echo form_open();
?>
    	
	<ul class="form" style="border:0">
    		<li>
 /**
  * deleteCategory
  * 删除分类
  * @param mixed $map
  * @access public
  * @return void
  */
 public function deleteCategory($map, $formCate = null, $obj = null)
 {
     //先判断合法性
     if (empty($map)) {
         throw new ThinkException("不能是空条件删除");
     }
     //转移被删分类下的日志到默认分类
     fd($map);
     if (isset($formCate)) {
         $result = $obj->setField('category', $formCate, 'category = ' . $map['id']);
         fd($obj->getLastSql());
         fd($result);
     } else {
         //删除分类下的所有日志
         $obj->where('category = ' . $map['id'])->delete();
         fd($obj->getLastSql());
     }
     //删除分类
     return $this->where($map)->delete();
 }
示例#17
0
文件: auth.php 项目: iplayfast/sc
 function ajax_user_list()
 {
     // make sure user is an admin
     if (!$this->ion_auth->is_admin()) {
         $this->session->set_flashdata('message', 'You must be an admin to view this page.');
         redirect('auth/login');
     }
     // get groups list
     $groups = $this->ion_auth->get_groups_array();
     // get user list
     $users = $this->ion_auth->datatables_get_users();
     // format data as required
     foreach ($users['Result'] as &$row) {
         $row['last_login'] = fd($row['last_login']);
         $row['group_id'] = $groups[$row['group_id']];
         // add extra column for links
         $row['edit'] = '<a href="' . base_url() . 'auth/edit/' . $row['id'] . '">Edit</a>';
     }
     // output our json
     echo $this->datatableshelper->jsonify($users, 'username,email,group_id,last_login,edit');
 }
示例#18
0
文件: files.php 项目: Prescia/Prescia
    include CONS_PATH_INCLUDE . "filetypeIcon.php";
}
// separated in two loops pratically the same for performance reasons:
if ($hasSafeFm && $isInsideSafePath) {
    $fm->cachePermissions($dir);
    foreach ($files as $file) {
        if (!$fm->canSee($dir . $file)) {
            continue;
        }
        // cannot see this
        $ext = explode(".", $file);
        $ext = strtolower(array_pop($ext));
        if (is_file(CONS_FMANAGER . $dir . $file) && $file[0] != "." && $ext != "php") {
            $c++;
            $p = $fm->getPermissions($dir . $file);
            $dados = array('absurl' => CONS_INSTALL_ROOT . CONS_FMANAGER . $dir . $file, 'domain' => $core->domain, 'file' => $file, 'ico' => filetypeIcon($ext), 'CLASS' => $c % 2 == 0 ? "lxmladm_lineeven" : "lxmladm_lineodd", 'size' => humanSize(filesize(CONS_FMANAGER . $dir . $file)), 'id_allowed_group' => $p[0], 'allowed_users' => implode(",", $p[1]), 'expiration_date' => fd($p[2]));
            if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png' || $ext == 'ico' || $ext == 'bmp') {
                $output .= $tp->techo($dados, !$canchangepermissions || !$isInsideSafePath ? array('_perm') : array());
            } else {
                $output .= $tp->techo($dados, !$canchangepermissions || !$isInsideSafePath ? array('_perm', "_isImage") : array("_isImage"));
            }
        }
    }
} else {
    foreach ($files as $file) {
        $ext = explode(".", $file);
        $ext = strtolower(array_pop($ext));
        if (is_file(CONS_FMANAGER . $dir . $file) && $file[0] != "." && $ext != "php") {
            $c++;
            $dados = array('absurl' => CONS_INSTALL_ROOT . CONS_FMANAGER . $dir . $file, 'domain' => $core->domain, 'file' => $file, 'ico' => filetypeIcon($ext), 'CLASS' => $c % 2 == 0 ? "lxmladm_lineeven" : "lxmladm_lineodd", 'size' => humanSize(filesize(CONS_FMANAGER . $dir . $file)));
            if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png' || $ext == 'ico' || $ext == 'bmp') {
示例#19
0
文件: edit.php 项目: Prescia/Prescia
function fillField(&$core, &$module, $name, &$field, &$data, &$p, $isSerialized = false, $basename = "")
{
    $content = "";
    // load l10n for datetimes
    if (!$p['isADD'] && $field[CONS_XML_TIPO] == CONS_TIPO_DATE && isset($data[$name])) {
        $data[$name] = fd($data[$name], $core->intlControl->getDate());
    } else {
        if (!$p['isADD'] && $field[CONS_XML_TIPO] == CONS_TIPO_DATETIME && isset($data[$name])) {
            $data[$name] = fd($data[$name], "H:i:s " . $core->intlControl->getDate());
        }
    }
    // format in language mode
    // pre-fill option arrays
    if (!$p['isADD'] && $field[CONS_XML_TIPO] == CONS_TIPO_OPTIONS && isset($data[$name])) {
        if (isset($data[$name])) {
            $l = strlen($data[$name]);
            for ($c = 0; $c < $l; $c++) {
                $data[$name . $c] = isset($data[$name . $c]) || $data[$name][$c] == "1";
            }
            unset($l);
        }
    }
    // If we are adding, check default values
    if ($p['isADD']) {
        if (strpos($field[CONS_XML_SQL], "AUTO_INCREMENT") !== false) {
            return;
        }
        // do not put autoincrement keys on add
        if (isset($field[CONS_XML_DEFAULT]) && !isset($data[$name])) {
            if ($field[CONS_XML_TIPO] == CONS_TIPO_LINK && $field[CONS_XML_DEFAULT] == "%UID%" && defined("CONS_AUTH_USERMODULE") && $field[CONS_XML_MODULE] == CONS_AUTH_USERMODULE && $_SESSION[CONS_SESSION_ACCESS_LEVEL] > 0 && isset($_SESSION[CONS_SESSION_ACCESS_USER]['id'])) {
                $data[$name] = $_SESSION[CONS_SESSION_ACCESS_USER]['id'];
            } else {
                if ($field[CONS_XML_TIPO] == CONS_TIPO_DATE) {
                    $data[$name] = fd($field[CONS_XML_DEFAULT], $core->intlControl->getDate());
                } else {
                    $data[$name] = $field[CONS_XML_DEFAULT];
                }
            }
        } else {
            if (isset($field[CONS_XML_TIMESTAMP]) || isset($field[CONS_XML_UPDATESTAMP])) {
                if ($field[CONS_XML_TIPO] == CONS_TIPO_DATE) {
                    $data[$name] = date($core->intlControl->getDate());
                } else {
                    $data[$name] = date("H:i:s " . $core->intlControl->getDate());
                }
            }
        }
    } else {
        if (isset($field[CONS_XML_UPDATESTAMP])) {
            if ($field[CONS_XML_TIPO] == CONS_TIPO_DATE) {
                $data[$name] = date($core->intlControl->getDate());
            } else {
                $data[$name] = date("H:i:s " . $core->intlControl->getDate());
            }
        }
    }
    // ajax exceptions?
    if ($core->layout == 2 && $field[CONS_XML_TIPO] == CONS_TIPO_UPLOAD) {
        // ajax mode does not accept uploads
        return;
    }
    // have permission to see this field?
    if ($_SESSION[CONS_SESSION_ACCESS_LEVEL] < 100 && isset($field[CONS_XML_RESTRICT]) && $field[CONS_XML_RESTRICT] > $_SESSION[CONS_SESSION_ACCESS_LEVEL]) {
        return;
    } else {
        // Does this field have a different interface handler? if so use it and continue to the next
        if (in_array($name, $p['cacheCustomFields'])) {
            // detect which plugin has the customHandler and use it. Use the first and leave, if there is more than one, ignore the conflict
            foreach ($module->plugins as $scriptname) {
                // if we didn't have the cache, this would run always, see?
                if (in_array($name, $core->loadedPlugins[$scriptname]->customFields)) {
                    // ok, handle it (if it returns TRUE, ignore this handler)
                    $content = $core->loadedPlugins[$scriptname]->field_interface($name, $p['isADD'], $data);
                    if ($content === false) {
                        return;
                    } else {
                        if ($content !== true) {
                            break;
                            // we will break this foreach plugin search, but continue normally the rest
                        }
                    }
                    $content = "";
                    // if we didn't continue (use the field or ignore), proceed as if this field was normal, thus erase the custom content
                }
            }
        }
        // This field is read-only?
        if (in_array($name, $p['hideKeys']) || isset($field[CONS_XML_READONLY])) {
            if ($p['isADD']) {
                return;
            } else {
                if (!$p['isMultiple']) {
                    $content = isset($data[$name]) ? $data[$name] : ' ';
                } else {
                    return;
                }
            }
        }
        $fillDT = array('field' => $name, 'isADD' => $p['isADD'] ? "true" : "false", 'affreferer' => $module->name, 'affrefererkeys' => implode("_", $p['refererKeys']), 'width' => '99%', 'helper' => '');
        if ($content == '') {
            // format according to type
            $helper = $core->langOut('helper_' . $module->name . "_" . $name);
            if ($helper != 'helper_' . $module->name . "_" . $name) {
                $fillDT['helper'] = $helper;
            }
            switch ($field[CONS_XML_TIPO]) {
                // for each fields ...
                case CONS_TIPO_UPLOAD:
                    // ############################################### FILE(s)
                    if ($p['isMultiple'] || $p['isMup']) {
                        $content = false;
                        continue;
                        // continue will leave only the switch, since switch is considered a loop (??? WHY PHP, WHY ???)
                    }
                    $field_upload = $core->template->get("_upload_field");
                    $using = clone $field_upload;
                    $emptyme = array();
                    if (!$p['isADD']) {
                        $tobjTemp = $core->template->get("_thumb");
                        $path = CONS_FMANAGER . $module->name . "/";
                        $fileName = $name . "_";
                        foreach ($module->keys as $key) {
                            $fileName .= $data[$key] . "_";
                        }
                        $FirstfileName = $path . $fileName . "1";
                        $hasFile = locateAnyFile($FirstfileName, $ext);
                        if (!$hasFile) {
                            $emptyme[] = "_hasFile";
                            if (isset($module->fields[$name][CONS_XML_THUMBNAILS])) {
                                $p['hasImages'] = true;
                                $fillDT['maxres'] = "max " . str_replace(",", "x", $module->fields[$name][CONS_XML_THUMBNAILS][0]);
                            }
                        } else {
                            $fillDT['filesize'] = humanSize(filesize($FirstfileName));
                            $ext = strtolower($ext);
                            $fillDT['download'] = CONS_INSTALL_ROOT . $FirstfileName . "?r=" . rand(0, 9990);
                            $fillDT['ico'] = filetypeIcon($ext);
                            if (in_array($ext, array("jpg", "gif", "swf", "png", "jpeg"))) {
                                $p['hasImages'] = true;
                                $h = getimagesize($FirstfileName);
                                $fillDT['width'] = $h[0];
                                $fillDT['height'] = $h[1];
                                $fillDT['dim'] = $h[0] . "x" . $h[1];
                                if ($h[0] < $p['maxWidth'] && $h[1] < $p['maxHeight']) {
                                    $emptyme[] = "_downloadable";
                                    if ($ext != "swf") {
                                        $emptyme[] = "_swf";
                                    } else {
                                        $emptyme[] = "_img";
                                    }
                                } else {
                                    $emptyme[] = "_presentable";
                                }
                                if (isset($field[CONS_XML_THUMBNAILS])) {
                                    $thumbVersions = count($field[CONS_XML_THUMBNAILS]);
                                    if ($thumbVersions > 1) {
                                        $tObj = clone $tobjTemp;
                                        $tTemp = "";
                                        for ($tv = 2; $tv <= $thumbVersions; $tv++) {
                                            $thumbFile = $path . "t/" . $fileName . $tv;
                                            locateFile($thumbFile, $ext);
                                            $h = getimagesize($thumbFile);
                                            $tTemp .= $tObj->techo(array('tdownload' => CONS_INSTALL_ROOT . $thumbFile));
                                        }
                                        $using->assign("_thumb", $tTemp);
                                    } else {
                                        $emptyme[] = "_hasThumbs";
                                    }
                                } else {
                                    $emptyme[] = "_hasThumbs";
                                }
                            } else {
                                $emptyme[] = "_isImage";
                                $emptyme[] = "_presentable";
                            }
                        }
                    } else {
                        $emptyme[] = "_hasFile";
                    }
                    if (isset($field[CONS_XML_THUMBNAILS])) {
                        $fillDT['maxres'] = "max " . str_replace(",", "x", $field[CONS_XML_THUMBNAILS][0]);
                    }
                    if (isset($field[CONS_XML_FILETYPES])) {
                        $fillDT['exts'] = "(" . $field[CONS_XML_FILETYPES] . ")";
                    }
                    $fillDT['maxsize'] = isset($field[CONS_XML_FILEMAXSIZE]) ? humanSize($field[CONS_XML_FILEMAXSIZE]) : ini_get('upload_max_filesize');
                    if (isset($field[CONS_XML_FILEMAXSIZE]) && $field[CONS_XML_FILEMAXSIZE] > $p['mfs']) {
                        $p['mfs'] = $field[CONS_XML_FILEMAXSIZE];
                    }
                    $content = $using->techo($fillDT, $emptyme);
                    unset($emptyme);
                    break;
                case CONS_TIPO_LINK:
                    // ############################################### LINK TO ANOTHER MODULE
                    $mod = $core->loaded($field[CONS_XML_MODULE]);
                    if ($mod !== false) {
                        $core->safety = false;
                        // <-- in the select, we should always show every item
                        $fillDT['rmodule'] = $field[CONS_XML_MODULE];
                        if ($mod->options[CONS_MODULE_PARENT]) {
                            $field_sel = $core->template->get("_selecttree_field");
                            $using = clone $field_sel;
                            $sql = $mod->get_base_sql();
                            if (isset($data[$name])) {
                                $sql['SELECT'][] = "if (" . $mod->name . "." . $mod->keys[0] . "='" . $data[$name] . "',1,0) as selected";
                            }
                            $sql['SELECT'][] = $mod->name . "." . $mod->title . " as treetitle";
                            $tree = $mod->getContents("", "treetitle", "", "\\", $sql);
                            $using->getTreeTemplate("_sdirs", "_ssubdirs", $tree);
                        } else {
                            $field_sel = $core->template->get("_select_field");
                            $using = clone $field_sel;
                            // checks if this field is/can be filtered by another, if can, leave empty on ADD
                            $canBeFilteredBy = array();
                            if (isset($field[CONS_XML_FILTEREDBY])) {
                                $canBeFilteredBy = $field[CONS_XML_FILTEREDBY];
                                // already a list of local fields
                                $using->assign('helper', $core->langOut("filtered_by") . ": " . implode(",", $canBeFilteredBy));
                                $havePreqs = true;
                                // either on add or edit, field that filter this could be present ... check them!
                                for ($cbf = 0; $cbf < count($canBeFilteredBy); $cbf++) {
                                    if (!isset($data[$canBeFilteredBy[$cbf]]) || $data[$canBeFilteredBy[$cbf]] == '' || $data[$canBeFilteredBy[$cbf]] == '0') {
                                        $havePreqs = false;
                                        break;
                                    }
                                }
                                if (!$havePreqs) {
                                    // we can't fill it, so display the select_other_field message
                                    $using->assign("_optional", "");
                                    $canBeFilteredBy_translated = array();
                                    for ($cbf = 0; $cbf < count($canBeFilteredBy); $cbf++) {
                                        $canBeFilteredBy_translated[$cbf] = $core->langOut($canBeFilteredBy[$cbf]);
                                    }
                                    $using->assign("_options", "<option value=\"\">" . $core->langOut("select_other_field") . ": " . implode(", ", $canBeFilteredBy_translated) . "</option>");
                                } else {
                                    // we can fill this since all prerequisites are present!
                                    $sql = $mod->get_base_sql();
                                    $sql['SELECT'] = array($mod->name . "." . $mod->keys[0] . " as ids", $mod->name . "." . $mod->title . " as title");
                                    if (isset($data[$name])) {
                                        $sql['SELECT'][] = "if (" . $mod->name . "." . $mod->keys[0] . "='" . $data[$name] . "',1,0) as selected";
                                    }
                                    // add filters
                                    foreach ($canBeFilteredBy as $filterfield) {
                                        // we know the data exists because this is an edit, but it could be empty
                                        if ($data[$filterfield] != '') {
                                            $remodeField = $mod->get_key_from($module->fields[$filterfield][CONS_XML_MODULE]);
                                            $sql['WHERE'][] = $mod->name . "." . $remodeField . "=\"" . $data[$filterfield] . "\"";
                                        }
                                    }
                                    if ($core->runContent($mod, $using, $sql, "_options") === false) {
                                        $using->assign("_options");
                                    }
                                }
                                // add the corresponding data for the ajaxContextHandler
                                $p['ajaxContextHandler'][$name] = $canBeFilteredBy;
                            } else {
                                $sql = $mod->get_base_sql();
                                # TODO: this probably won't work on multiple keys
                                $sql['SELECT'] = array($mod->name . "." . $mod->keys[0] . " as ids", $mod->name . "." . $mod->title . " as title");
                                if (isset($data[$name])) {
                                    $sql['SELECT'][] = "if (" . $mod->name . "." . $mod->keys[0] . "='" . $data[$name] . "',1,0) as selected";
                                }
                                //print_r($sql);
                                //die();
                                if ($core->runContent($mod, $using, $sql, "_options") === false) {
                                    $using->assign("_options");
                                }
                            }
                        }
                        $content = $using->techo($fillDT);
                        $core->safety = true;
                        // back to normal mode
                        unset($using);
                    }
                    break;
                case CONS_TIPO_TEXT:
                    // ############################################### TEXT (textarea/cke)
                    $field_txt = $core->template->get("_textarea_field");
                    $using = clone $field_txt;
                    $fillDT['value'] = isset($data[$name]) ? $data[$name] : '';
                    if (isset($field[CONS_XML_HTML])) {
                        $fillDT['value'] = htmlspecialchars($fillDT['value']);
                    }
                    // ckedit will remove entities, so we add an extra layer!
                    $useCKE = isset($field[CONS_XML_HTML]);
                    # CKEdit
                    $content = $using->techo($fillDT);
                    $p['endScript'] .= $useCKE ? "var CKE{$name} = CKEDITOR.replace( '{$name}' , { language : '" . $_SESSION[CONS_SESSION_LANG] . "'" . (isset($module->fields[$name][CONS_XML_SIMPLEEDITFORCE]) ? ",toolbar : 'MiniToolbar'" : "") . "} );\n\tCKFinder.setupCKEditor( CKE{$name}, '/pages/_js/ckfinder/' ) ;\n" : '';
                    # CKEdit + CKFinder
                    unset($using);
                    break;
                case CONS_TIPO_ENUM:
                    // ############################################### LIST OF ITEMS IN ENUM FORM
                    preg_match("@ENUM \\(([^)]*)\\).*@", $field[CONS_XML_SQL], $regs);
                    if ($p['isADD'] && isset($field[CONS_XML_DEFAULT]) && (!isset($data[$name]) || $data[$name] == "")) {
                        $data[$name] = $module->fields[$name][CONS_XML_DEFAULT];
                    }
                    $xtp = "<option value=\"{enum}\" {checked}>{enum_translated}</option>";
                    $tp = new CKTemplate($core->template);
                    $tp->tbreak($xtp);
                    $temp = isset($field[CONS_XML_MANDATORY]) ? '' : "<option value=''></option>";
                    $enums = explode(",", $regs[1]);
                    foreach ($enums as $x) {
                        $x = str_replace("'", "", $x);
                        $db = array('enum' => $x, 'enum_translated' => $core->langOut($x), 'checked' => isset($data[$name]) && $data[$name] == $x ? ' selected="selected"' : '');
                        $temp .= $tp->techo($db);
                    }
                    $content = "<select " . ($p['isMultiple'] ? "onchange=\"\$('me_edit_" . $name . "').checked = true;\"" : "onchange=\"checkConditions();\"") . " id=\"{$name}\" name=\"{$name}\" >" . $temp . "</select>";
                    unset($temp);
                    unset($enums);
                    break;
                case CONS_TIPO_OPTIONS:
                    // ############################################# CHECKBOX LIST
                    $xtp = "<input type=\"checkbox\" onclick=\"checkopts('{field}');\" name=\"{name}\" id=\"{name}\" {checked}/><label for=\"{name}\">{translated}</label><br/>";
                    $tp = new CKTemplate($core->template);
                    $tp->tbreak($xtp);
                    $citem = 0;
                    $temp = "<input type='hidden' name='{$name}' id='{$name}' value=\"" . (isset($data[$name]) ? $data[$name] : "") . "\"/>";
                    foreach ($field[CONS_XML_OPTIONS] as $opt) {
                        $db = array('name' => $name . "_" . $citem, 'field' => $name, 'translated' => $core->langOut(str_replace("'", "", $opt)), 'checked' => isset($data[$name]) && strlen($data[$name]) >= $citem && $data[$name][$citem] == 1 ? ' checked="checked"' : '');
                        $temp .= $tp->techo($db);
                        $citem++;
                    }
                    $content = $temp;
                    unset($temp);
                    break;
                case CONS_TIPO_DATE:
                    // ############################################### DATE / DATETIME
                // ############################################### DATE / DATETIME
                case CONS_TIPO_DATETIME:
                    // updatestamp & includestap already treated befpre switch
                    if ($core->layout != 2) {
                        $fillDT['calendar'] = "<img id='divcalendar_" . $name . "' onclick=\"calendarHandler.showCalendar('" . $name . "','divcalendar_" . $name . "',-80,-8);\" src=\"" . CONS_INSTALL_ROOT . CONS_PATH_PAGES . "_js/calendar/gifs/dyncalendar.gif\" style=\"width:16px;height:16px;position:relative;top:3px;left:2px\" alt=\"" . $core->langOut('calendar') . "\"/>";
                    }
                    $fillDT['width'] = "120px";
                    $p['hasCalendar'] = true;
                case CONS_TIPO_VC:
                    // ############################################### SIMPLE INPUT WITH HEAVY TYPESETTING
                // ############################################### SIMPLE INPUT WITH HEAVY TYPESETTING
                case CONS_TIPO_INT:
                case CONS_TIPO_FLOAT:
                    $field_sel = $core->template->get("_normal_field");
                    $using = clone $field_sel;
                    $fillDT['value'] = isset($data[$name]) ? $data[$name] : '';
                    $fillDT['type'] = "text";
                    if (isset($field[CONS_XML_META])) {
                        if ($field[CONS_XML_META] == "masked") {
                            $fillDT['type'] = "password";
                        }
                        if ($field[CONS_XML_META] == "password") {
                            $fillDT['type'] = "password";
                            if ($_SESSION[CONS_SESSION_ACCESS_LEVEL] != 100) {
                                $data[$name] = "";
                                $fillDT['value'] = "";
                            }
                        }
                    }
                    if ($field[CONS_XML_TIPO] == CONS_TIPO_INT) {
                        if ($fillDT['helper'] == '') {
                            $fillDT['helper'] = $core->langOut('helper_integer');
                        }
                        $p['validators']['integer'][] = "'{$name}'";
                    } else {
                        if ($field[CONS_XML_TIPO] == CONS_TIPO_FLOAT) {
                            if ($fillDT['helper'] == '') {
                                $fillDT['helper'] = $core->langOut('helper_float');
                            }
                            $p['validators']['float'][] = "'{$name}'";
                        } else {
                            if ($field[CONS_XML_TIPO] == CONS_TIPO_DATE) {
                                $p['validators']['date'][] = "'{$name}'";
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = '(' . $core->intlControl->getDate() . ')';
                                }
                            } else {
                                if ($field[CONS_XML_TIPO] == CONS_TIPO_DATETIME) {
                                    if ($fillDT['helper'] == '') {
                                        $fillDT['helper'] = $core->langOut('helper_time') . ' ' . $core->intlControl->getDate() . ')';
                                    }
                                    $p['validators']['datetime'][] = "'{$name}'";
                                }
                            }
                        }
                    }
                    if (isset($field[CONS_XML_SPECIAL])) {
                        switch ($field[CONS_XML_SPECIAL]) {
                            case 'login':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_login');
                                }
                                $p['validators']['login'][] = "'{$name}'";
                                break;
                            case 'mail':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = '(ex: login@servidor.com)';
                                }
                                $p['validators']['mail'][] = "'{$name}'";
                                break;
                            case 'number':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_integer');
                                }
                                $p['validators']['integer'][] = "'{$name}'";
                                break;
                            case 'float':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_float');
                                }
                                $p['validators']['float'][] = "'{$name}'";
                                break;
                            case 'cpf':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_cpf');
                                }
                                $p['validators']['is_cpf'][] = "'{$name}'";
                                break;
                            case 'cnpj':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_cnpj');
                                }
                                $p['validators']['is_cnpj'][] = "'{$name}'";
                                break;
                            case 'id':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_id');
                                }
                                $p['validators']['is_id'][] = "'{$name}'";
                                break;
                            case 'date':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->intlControl->getDate();
                                }
                                $p['validators']['date'][] = "'{$name}'";
                                break;
                            case 'datetime':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_time') . " " . $core->langOut('helper_followedby') . " " . $core->intlControl->getDate() . ')';
                                }
                                $p['validators']['datetime'][] = "'{$name}'";
                                break;
                                break;
                            case 'onlinevideo':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_video');
                                }
                                break;
                            case 'time':
                                if ($fillDT['helper'] == '') {
                                    $fillDT['helper'] = $core->langOut('helper_time');
                                }
                                $p['validators']['time'][] = "'{$name}'";
                                break;
                            default:
                                if (strlen($field[CONS_XML_SPECIAL]) > 10 && substr($field[CONS_XML_SPECIAL], 0, 6) == "slider") {
                                    if (preg_match("@([0-9]*)\\,([0-9]*)@", $field[CONS_XML_SPECIAL], $ereg)) {
                                        unset($using);
                                        unset($field_sel);
                                        $field_sel = $core->template->get("_slider_field");
                                        $using = clone $field_sel;
                                        $fillDT['minor'] = $ereg[1];
                                        $fillDT['major'] = $ereg[2];
                                        if (!is_numeric($fillDT['value'])) {
                                            $fillDT['value'] = $ereg[1];
                                        }
                                        $p['hasSlider'] = true;
                                        if ($fillDT['helper'] == '') {
                                            $fillDT['helper'] = $ereg[1] . " - " . $ereg[2];
                                        }
                                    }
                                }
                                break;
                        }
                    }
                    $content = $using->techo($fillDT);
                    break;
                case CONS_TIPO_ARRAY:
                    # data is an array
                    $p['hasSerializedArray'] = true;
                    $p['serializedArrays'][] = '"' . $name . '"';
                    $p['endScript'] .= "CScontroler.fillData('{$name}'," . JSON_encode($field[CONS_XML_OPTIONS]) . "," . JSON_encode(isset($data[$name]) ? $data[$name] : '') . ");\n";
                    $field_ser = $core->template->get("_serializearray_field");
                    $using = clone $field_ser;
                    $content = $using->techo($fillDT);
                    unset($using);
                    break;
            }
            # switch
            if (isset($field['conditional']) && strpos($field['conditional'], "=") !== false) {
                $temp = explode("=", $field['conditional']);
                $ltemp = trim(strtolower($temp[0]));
                $negation = strpos($ltemp, "!") !== false;
                if ($negation) {
                    $ltemp = trim(str_replace("!", "", $ltemp));
                }
                $rtemp = str_replace("'", "", trim($temp[1]));
                $p['condHandlers'][] = "\$('tableitem" . $name . "').style.display = \$('{$ltemp}').value " . ($negation ? "!=" : "==") . "'{$rtemp}' ? '' : 'none';";
            }
        }
        # content not blank
    }
    # permission to see?
    if ($content === false) {
        return '';
    }
    // if content is false, ignore alltogether
    // build a template object with this field and print it out
    $using = clone $p['objfield'];
    $outdata = array('field' => $content, 'title' => $isSerialized ? substr($name, strlen($basename) + 1) : $name, 'mandatory' => in_array($name, $module->keys) || isset($field[CONS_XML_MANDATORY]) && $field[CONS_XML_MANDATORY] ? "y" : "n");
    if (!$p['isMultiple'] && (!$p['isMup'] || $name != $module->title) && $outdata['mandatory'] == 'y' && !in_array($name, $p['hideKeys']) && $field[CONS_XML_TIPO] != CONS_TIPO_UPLOAD && !isset($field[CONS_XML_READONLY])) {
        // EXCEPTION: a ignorenedit field CAN be blank during EDIT only
        if (!isset($field[CONS_XML_IGNORENEDIT]) || $p['isADD']) {
            $p['$validators']['mandatory'][] = "'{$name}'";
            $p['$validators']['translation'][] = "'" . $core->langOut($name) . "'";
            $p['$validators']['defaults'][] = isset($field[CONS_XML_DEFAULT]) ? "'" . $field[CONS_XML_DEFAULT] . "'" : "''";
        }
    }
    $p['tempOutput'] .= $using->techo($outdata);
    unset($using);
}