Ejemplo n.º 1
0
function resizeImageCond($imagem, $maxw = 500, $maxh = 500, $watermarkArray = array(), $bg = "FFFFFF", $forceJPG = false)
{
    $ih = @getimagesize($imagem);
    if ($ih) {
        $ow = $ih[0];
        // original
        $oh = $ih[1];
        if (count($watermarkArray) > 0 && !is_array($watermarkArray[0]) && $watermarkArray[0][0] == "C" && $ow > $maxw && $oh >= $maxh) {
            // will crop, so $w and $h are the max (if original image is larger or equal to the thumb)
            $w = $maxw;
            $h = $maxh;
        } else {
            // either NOT crop, or crop but the image is smaller
            $w = $ow;
            $h = $oh;
            if ($maxw > 0) {
                // width surpassed, limit it
                if ($w > $maxw) {
                    $w = $maxw;
                    $h = floor($oh / $ow * $w);
                }
            }
            if ($maxh > 0) {
                // heiht surpassed, limit it
                if ($h > $maxh) {
                    $h = $maxh;
                    $w = floor($ow / $oh * $h);
                }
            }
        }
        if ($w != $ow || $h != $oh || count($watermarkArray) > 0) {
            // if reduce OR watermark present, proceed
            $imagemtmp = $imagem . "tmp";
            if (resizeImage($imagem, $imagemtmp, $w, $h, CONS_JPGQUALITY, $watermarkArray, $bg, $forceJPG)) {
                @unlink($imagem);
                locateFile($imagemtmp, $ext);
                // the resizeImage added .jpg or .png as per required
                if (!@copy($imagemtmp, $imagem)) {
                    @unlink($imagemtmp);
                    return 2;
                    // error copying temporary file to destination file
                }
                // save ok
                $temp = umask(0);
                chmod($imagem, 0775);
                umask($temp);
                @unlink($imagemtmp);
                return 1;
                // ok!
            } else {
                return 2;
            }
            // error
        }
    } else {
        return 2;
    }
    return 0;
    // no change required
}
Ejemplo n.º 2
0
function locateAnyFile(&$arquivo, &$ext, $extensionsToSearch = "")
{
    # locate ANY file with the mentioned name. Slow and resource intence.
    if ($extensionsToSearch != "") {
        $v = locateFile($arquivo, $ext, $extensionsToSearch);
        # fallback to locateFile
        return $v;
    }
    $dir = explode("/", $arquivo);
    $filename = array_pop($dir);
    // tira arquivo
    $dir = implode("/", $dir);
    $filename = str_replace("-", "\\-", $filename);
    $arquivos = listFiles($dir, '@^' . $filename . '(\\.)(.+)$@i', false, true);
    if (count($arquivos) > 0) {
        $ext = explode(".", $arquivos[0]);
        $ext = array_pop($ext);
        $arquivo .= "." . $ext;
        return true;
    }
    return false;
}
Ejemplo n.º 3
0
 function fulltest($quick = false)
 {
     $this->parent->loadAllModules();
     if (!$quick) {
         echo "<h1>LOCALE</h1>";
     }
     $localeError = $this->dev_locale(false, $quick);
     if (!$quick) {
         echo "<h1>INTEGRITY TEST</h1>";
     }
     $integrityError = $this->dev_maint(false, $quick);
     if (!$quick) {
         echo "<h1>LINK CHECK</h1>";
     }
     $linkError = $this->dev_link(false, $quick);
     if (!$quick) {
         echo "<h1>TODO CHECK</h1>";
     }
     $todoError = $this->dev_todo(false, $quick);
     if (!$quick) {
         echo "<h1>FAVICON</h1>";
     }
     $favfile = CONS_PATH_PAGES . $_SESSION['CODE'] . "/files/favicon";
     $lastError = "";
     if ($linkError !== false) {
         $lastError .= "<b>Links</b>:\n" . implode("\n", $linkError) . "\n";
     }
     if ($todoError !== false) {
         $lastError .= "<b>TODO</b>:\n" . implode("\n", $todoError) . "\n";
     }
     if ($localeError !== false) {
         $lastError .= "<b>Locale</b>:\n" . implode(", ", $localeError) . "\n";
     }
     if (!locateFile($favfile, $ext) && !CONS_DEFAULT_FAVICON) {
         $lastError .= "<b>Favicon missing</b>\n";
         if (!$quick) {
             echo "Warning: site has no favicon";
         }
     } else {
         if (!$quick) {
             echo "Favicon settings ok<br/>";
         }
     }
     if (!is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/mail/template.html")) {
         $lastError .= "<b>Mail template missing</b>\n";
         if (!$quick) {
             echo "Warning: no mail template";
         }
     } else {
         if (!$quick) {
             echo "Mail template settings ok<br/>";
         }
     }
     if (isset($this->parent->loadedPlugins['bi_newsletter']) && $this->parent->dimconfig['newslettersourcemail'] == '') {
         $lastError .= "<b>Newsletter outgout mail not set</b>\n";
     }
     if ($lastError == "" && is_file(CONS_PATH_LOGS . $_SESSION['CODE'] . "/fulltest.log")) {
         @unlink(CONS_PATH_LOGS . $_SESSION['CODE'] . "/fulltest.log");
     } else {
         cWriteFile(CONS_PATH_LOGS . $_SESSION['CODE'] . "/fulltest.log", $lastError);
     }
     if (!$quick) {
         echo "<h1>RESULTS</h1>";
         echo "LOCALE TAGS are " . ($localeError !== false ? "<b>not ok</b>" : "OK") . "<br/>";
         echo "DATABASE was " . ($integrityError !== false ? "<b>not ok</b>" : "OK") . "<br/>";
         echo "LINKS are " . ($linkError !== false ? "<b>not ok</b>" : "OK") . "<br/>";
         echo "TODO LIST is " . ($todoError !== false ? "<b>not ok</b>" : "OK") . "<br/>";
         echo "<h1>CONFIGURATION</h1>";
         echo "Administrator E-mail:" . $this->parent->dimconfig['adminmail'] . '<br/>';
         echo "Default page name:" . $this->parent->dimconfig['pagetitle'] . '<br/>';
         if (isset($this->parent->loadedPlugins['bi_newsletter'])) {
             echo "Default Newsletter outgoing mail: " . $this->parent->dimconfig['newslettersourcemail'] . "<br/>";
         }
         $this->parent->close(true);
         die;
     }
     return $localeError || $integrityError || $linkError || $todoError;
 }
Ejemplo n.º 4
0
 function showTemplate()
 {
     if (count($this->log) > 0) {
         $output = "";
         foreach ($this->log as $saida) {
             $output .= $saida . "\n<br/>";
         }
         $file = $this->debugFile;
         if ($this->debugFile == '' || !is_file($file)) {
             if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/_debugarea.html")) {
                 $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/_debugarea.html";
             } else {
                 $file = CONS_PATH_SETTINGS . "defaults/_debugarea.html";
             }
         }
         $tp = new CKTemplate($this->template);
         $tp->fetch($file);
         $tp->assign("CORE_DEBUG", $output);
         $tp->assign("CORE_DEBUGWARNING", $this->loglevel);
         // CONS_LOGGING_...
         $this->template->constants['CORE_DEBUG'] = $tp->techo();
         unset($tp);
     }
     if (!is_object($this->template) || get_class($this->template) != "CKTemplate") {
         return;
         // huh, no template? oh well
     }
     # Echo dimconfig if something should be outputed
     $data = $this->cacheControl->getCachedContent('dimconfig_auto');
     if ($data === false) {
         $data = $this->dimconfig;
         $dimconfigMD = unserialize(cReadFile(CONS_PATH_CACHE . $_SESSION['CODE'] . "/meta/_dimconfig.dat"));
         foreach ($data as $name => $content) {
             if (isset($dimconfigMD[$name])) {
                 if ($dimconfigMD[$name][CONS_XML_TIPO] == CONS_TIPO_UPLOAD) {
                     $FirstfileName = CONS_FMANAGER . $dimconfigMD[$name]['location'];
                     $path = explode("/", $FirstfileName);
                     $fileName = array_pop($path);
                     $path = implode("/", $path) . "/";
                     $hasFile = locateAnyFile($FirstfileName, $ext);
                     if (isset($dimconfigMD[$name][CONS_XML_THUMBNAILS])) {
                         // images
                         $imgs = count($dimconfigMD[$name][CONS_XML_THUMBNAILS]);
                         for ($c = 1; $c <= $imgs; $c++) {
                             $fnamedata = $name . "_" . $c;
                             $data[$fnamedata] = $FirstfileName;
                             $data[$fnamedata . "w"] = "";
                             $data[$fnamedata . "h"] = "";
                             $data[$fnamedata . "t"] = "";
                             $data[$fnamedata . "tr"] = "";
                             $data[$fnamedata . "s"] = "";
                             if ($hasFile) {
                                 $data[$fnamedata] = $FirstfileName;
                                 $popped = explode("/", $FirstfileName);
                                 $data[$fnamedata . "filename"] = array_pop($popped);
                                 if (in_array(strtolower($ext), array("jpg", "gif", "png", "jpeg", "swf"))) {
                                     // image/flash
                                     $h = getimagesize($FirstfileName);
                                     $data[$fnamedata . "w"] = $h[0];
                                     $data[$fnamedata . "h"] = $h[1];
                                     $data[$fnamedata . "s"] = humanSize(filesize($FirstfileName));
                                     if (in_array(strtolower($ext), array("jpg", "gif", "png", "jpeg"))) {
                                         $data[$fnamedata . "t"] = "<img src=\"" . $FirstfileName . "\" width='" . $h[0] . "' height='" . $h[1] . "' alt='' />";
                                         $data[$fnamedata . "tr"] = "<img src=\"" . $FirstfileName . "\" width='100%' height='100%' alt='' />";
                                     } else {
                                         if (strtolower($ext) == "swf") {
                                             $data[$fnamedata . "t"] = str_replace("{FILE}", $FirstfileName, str_replace("{H}", $h[1], str_replace("{W}", $h[0], SWF_OBJECT)));
                                             $data[$fnamedata . "tr"] = $data[$fnamedata . "t"];
                                         }
                                     }
                                 }
                             }
                         }
                     } else {
                         if ($hasFile) {
                             $fnamedata = $name . "_1";
                             $data[$fnamedata] = $FirstfileName;
                             $data[$fnamedata . "s"] = humanSize(filesize($FirstfileName));
                             $popped = explode("/", $FirstfileName);
                             $data[$fnamedata . "filename"] = array_pop($popped);
                         } else {
                             $fnamedata = $name . "_1";
                             $data[$fnamedata] = "";
                             $data[$fnamedata . "t"] = "";
                             $data[$fnamedata . "tr"] = "";
                             $data[$fnamedata . "s"] = "";
                         }
                     }
                     $this->template->fill($data);
                 } else {
                     $data[$name] = $content;
                 }
             } else {
                 $data[$name] = $content;
             }
         }
         $this->cacheControl->addCachedContent('dimconfig_auto', $data, true);
     }
     $this->template->fill($data);
     $this->template->constants['CHARSET'] = $this->charset;
     if ($this->doctype == "html" || CONS_BROWSER == "IE" && CONS_BROWSER_VERSION < 9) {
         $this->template->assign("_DOCTYPEXML");
     }
     # metadata - fill default values if not set yet (plugins can set)
     if ($this->layout != 2) {
         if ((!isset($this->template->constants['METAKEYS']) || $this->template->constants['METAKEYS'] == '') && $this->dimconfig['metakeys'] != '') {
             $this->template->constants['METAKEYS'] = $this->dimconfig['metakeys'];
         }
         if ((!isset($this->template->constants['METADESC']) || $this->template->constants['METADESC'] == '') && $this->dimconfig['metadesc'] != '') {
             $this->template->constants['METADESC'] = $this->dimconfig['metadesc'];
         }
         // METAS
         if ($this->template->constants['CANONICAL'] == '') {
             $this->template->constants['CANONICAL'] = "http://" . $_SESSION['CANONICAL'] . $this->context_str . $this->action . ".html";
             if (isset($_REQUEST['id'])) {
                 $this->template->constants['CANONICAL'] .= "?id=" . $_REQUEST['id'];
             }
         }
         $metadata = $this->template->constants['METATAGS'];
         if (CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/_meta.xml") {
             $metadata .= cReadFile(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/_meta.xml");
         }
         $metadata .= "\t<link rel=\"canonical\" href=\"" . $this->template->constants['CANONICAL'] . "\" />\n";
         if ($this->template->constants['METAKEYS'] != '') {
             $metadata .= "\t<meta name=\"keywords\" content=\"" . str_replace("\"", "", $this->template->constants['METAKEYS']) . "\"/>\n";
         }
         if ($this->template->constants['METADESC'] != '') {
             $metadata .= "\t<meta name=\"description\" content=\"" . str_replace("\"", "", $this->template->constants['METADESC']) . "\"/>\n";
             $metadata .= "\t<meta property=\"og:description\" content=\"" . str_replace("\"", "", $this->template->constants['METADESC']) . "\"/>\n";
         }
         $metadata .= "\t<meta property=\"og:type\" content=\"website\" />\n";
         $metadata .= "\t<meta property=\"og:title\" content=\"" . str_replace("\"", "", $this->template->constants['PAGE_TITLE']) . "\" />\n";
         $metadata .= "\t<meta property=\"og:url\" content=\"" . $this->template->constants['CANONICAL'] . "\" />\n";
         if (isset($this->template->constants['METAFIGURE']) && $this->template->constants['METAFIGURE'] != "") {
             if ($this->template->constants['METAFIGURE'][0] != '/') {
                 $this->template->constants['METAFIGURE'] = "/" . $this->template->constants['METAFIGURE'];
             }
             $metadata .= "\t<meta property=\"og:image\" content=\"http://" . $_SESSION['CANONICAL'] . $this->template->constants['METAFIGURE'] . "\" />\n";
             $metadata .= "\t<link rel=\"image_src\" href=\"http://" . $_SESSION['CANONICAL'] . $this->template->constants['METAFIGURE'] . "\" />\n";
         }
         $favfile = CONS_PATH_PAGES . $_SESSION['CODE'] . "/files/favicon";
         if (locateFile($favfile, $ext)) {
             $favfile = CONS_INSTALL_ROOT . $favfile;
             $metadata .= "\t<link rel=\"shortcut icon\" href=\"/favicon." . $ext . "\" />\n";
         } else {
             if (CONS_DEFAULT_FAVICON) {
                 $favfile = "favicon";
                 if (locateFile($favfile, $ext)) {
                     $favfile = CONS_INSTALL_ROOT . $favfile;
                     $metadata .= "\t<link rel=\"shortcut icon\" href=\"/favicon." . $ext . "\" />\n";
                 }
             }
         }
         // Alternate Language and domains versions (only on root index)
         if ($this->context_str == "/" && $this->action == "index") {
             if (CONS_USE_I18N) {
                 $langs = explode(",", CONS_POSSIBLE_LANGS);
                 foreach ($langs as $lang) {
                     if ($lang != $_SESSION[CONS_SESSION_LANG]) {
                         if (count($this->languageTL) > 0) {
                             foreach ($this->languageTL as $fl => $ln) {
                                 if ($ln == $lang) {
                                     $metadata .= "\t<link rel=\"alternate\" hreflang=\"{$lang}\" href=\"/{$fl}/index.html\"/>\n";
                                     break;
                                 }
                             }
                         } else {
                             $metadata .= "\t<link rel=\"alternate\" hreflang=\"{$lang}\" href=\"" . $this->template->constants['CANONICAL'] . "?lang={$lang}\"/>\n";
                         }
                     }
                 }
             }
             foreach ($this->parseRewrite as $domain => $settings) {
                 if ($domain != $this->domain) {
                     $metadata .= "\t<link rel=\"alternate\" hreflang=\"" . ($settings[0] == '' ? CONS_DEFAULT_LANG : $settings[0]) . "\" href=\"http://" . $domain . "\"/>\n";
                 }
             }
         }
         $this->template->constants['METATAGS'] = $metadata;
     }
     $this->removeAutoTags($this->template);
     // print version
     if ($this->template->get("printver") == '') {
         $printVersion = arrayToString($_GET, array("layout"));
         $printVersion .= "&layout=1";
         $this->template->assign("printver", $this->action . ".html?" . $printVersion);
     }
     return $this->template->techo();
 }
Ejemplo n.º 5
0
                 $emptyme[] = "_swf";
             } else {
                 $emptyme[] = "_img";
             }
         } else {
             $emptyme[] = "_presentable";
         }
         if (isset($dimconfigMD[$data['name']][CONS_XML_THUMBNAILS])) {
             $thumbVersions = count($dimconfigMD[$data['name']][CONS_XML_THUMBNAILS]);
             if ($thumbVersions > 1) {
                 $hasLB = true;
                 $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";
     }
 }
Ejemplo n.º 6
0
// get FORUM data
$core->dbo->query("SELECT f.title,f.operationmode, f2.title FROM (bb_forum as f) LEFT JOIN bb_forum as f2 ON (f2.id = f.id_parent) WHERE f.id=" . $_POST['id_forum'], $r, $n);
list($ftitle, $op, $ptitle) = $core->dbo->fetch_row($r);
$core->template->fill($_POST);
$core->template->assign("forum_title", $ftitle);
$core->template->assign("parent_title", $ptitle . ($ptitle != '' ? " - " : ""));
$core->template->assign("date", date("Y-m-d H:i:s"));
// so this will result in "now"
$core->template->assign("bbaction", $_POST['bbaction'] == 'tpreview' ? 'tpost' : 'post');
$core->template->assign("bbactionpreview", $_POST['bbaction']);
if (isset($_POST['video']) && $_POST['video'] != '') {
    $embed = getVideoFrame(trim($_POST['video']), 420, 315);
    if ($embed != '') {
        $core->template->assign('videoembed', $embed);
    } else {
        $core->template->assign("_hasvideo");
    }
} else {
    $core->template->assign("_hasvideo");
}
// user image?
$image = CONS_PATH_PAGES . $_SESSION['CODE'] . '/files/users/t/image_' . $_SESSION[CONS_SESSION_ACCESS_USER]['id'] . "_2";
if ($_SESSION[CONS_SESSION_ACCESS_USER]['image'] == 'n' || !locateFile($image, $ext)) {
    $core->template->assign("_imageyes");
} else {
    $core->template->assign("_imageno");
    $core->template->assign("image", $image);
}
if ($op == 'bb') {
    $core->template->assign("_notbb");
}
Ejemplo n.º 7
0
foreach ($codes as $code => $urls) {
    $outputData = array('favicon' => '', 'code' => $code, 'debug' => 2, 'debug_str' => '', 'config' => 0, 'e404' => 2, '404_str' => '0', 'config_str' => '', 'quota' => 2, 'quota_str' => '', 'errors' => 2, 'errors_str' => '', 'cron' => 0, 'cron_str' => '', 'hitaverage' => 1, 'hits_str' => '', 'botvisit' => 1, 'bots_str' => '', 'scripttimei' => 2, 'scripttime' => 0, 'backup' => 0, 'backup_str' => 'none', 'scheduledCronDay' => '', 'domains' => implode(",", $urls), 'onedomain' => $urls[0]);
    $isTest = false;
    if (strpos($outputData['domains'], $admObj->testDomainHash) !== false) {
        $outputData['debug'] = 3;
        $outputData['quota'] = 3;
        $outputData['errors'] = 3;
        $outputData['cron'] = 3;
        $outputData['hitaverage'] = 3;
        $outputData['botvisit'] = 3;
        $outputData['backup'] = 3;
        $isTest = true;
    }
    // favicon
    $file = CONS_PATH_PAGES . $code . "/files/favicon";
    if (locateFile($file, $ext)) {
        $outputData['favicon'] = "<img src=\"/" . $file . "\" alt=\"\" width=\"16\" height=\"16\"/>";
    }
    // 404
    $file = CONS_PATH_LOGS . $code . "/404.log";
    if (is_file($file)) {
        $temp404 = explode("\n", cReadFile($file));
        $outputData['404_str'] = count($temp404) - 1;
        if (count($temp404) > 10) {
            $outputData['e404']--;
        }
        if (count($temp404) > 100) {
            $outputData['e404']--;
        }
        unset($temp404);
    }
Ejemplo n.º 8
0
<?php

if (isset($_REQUEST['haveinfo'])) {
    $module = $core->loaded($_REQUEST['module']);
    $field = $_REQUEST['field'];
    $red = $_REQUEST['reduction'];
    # main image was reduced to this %
    # test each thumbnail
    $mainFile = CONS_FMANAGER . $module->name . "/" . $field . "_";
    $thumbStart = CONS_FMANAGER . $module->name . "/t/" . $field . "_";
    foreach ($module->keys as $key) {
        $mainFile .= $_REQUEST[$key] . "_";
        $thumbStart .= $_REQUEST[$key] . "_";
    }
    $mainFile .= "1";
    if (!locateFile($mainFile, $ext)) {
        $core->log[] = "Image not found: " . $mainFile;
        return;
    }
    $total = isset($module->fields[$field][CONS_XML_THUMBNAILS]) ? count($module->fields[$field][CONS_XML_THUMBNAILS]) : 1;
    $WM_TODO = array();
    if (isset($module->fields[$field][CONS_XML_TWEAKIMAGES])) {
        foreach ($module->fields[$field][CONS_XML_TWEAKIMAGES] as $c => $WM) {
            // stamp:over(filename@x,y)[r] # [r] not implemented yet
            // stamp:under(filename@x,y)[r]
            // croptofit
            // might have multiple with + separator
            $TODO = array();
            $WM = explode("+", $WM);
            foreach ($WM as $thisWM) {
                $concept = explode(":", $thisWM);
Ejemplo n.º 9
0
function getuseravatar(&$template, &$params, $data, $processed = false)
{
    if ($processed) {
        return $data;
    }
    if ($data['image'] == 'n') {
        $params['excludes'][] = "_imageyes";
    } else {
        $params['excludes'][] = "_imageno";
        $data['image'] = CONS_PATH_PAGES . $_SESSION['CODE'] . "/files/users/t/image_" . $data['id_author'] . "_2";
        $ext = "";
        locateFile($data['image'], $ext);
    }
    if (isset($params['mainpost']) && $data['includehtml'] != '') {
        $file = "";
        if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $data['includehtml'])) {
            $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $data['includehtml'];
        } else {
            if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $data['includehtml'] . ".html")) {
                $file = CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $data['includehtml'] . ".html";
            }
        }
        if ($file != '') {
            $tmpTP = new CKTemplate($params['core']->template);
            $tmpInner = new CKTemplate($params['core']->template);
            $tmpTP->append($data['content']);
            $tmpInner->fetch($file);
            $tmpTP->append($tmpInner);
            $params['core']->removeAutoTags($tmpTP);
            $data['content'] = $tmpTP;
        } else {
            $data['content'] .= "<br/><small>File not found: " . $data['includehtml'] . "</small>";
        }
    }
    return $data;
}
Ejemplo n.º 10
0
     $pathSeparator = PATH_SEPARATOR;
     $pathItems = explode($pathSeparator, getenv("PATH"));
     // Provide default values for the form fields:
     $formVars["adminUserName"] = "******";
     $formVars["adminPassword"] = "";
     $formVars["databaseStructureFile"] = "./install.sql";
     // Try to find the 'mysql' command line interpreter:
     $mysqlLocations = array_unique(array_merge($pathItems, array("/Program Files/MySQL/bin", "/wamp/mysql/bin", "/Program Files/xampp/mysql/bin", "/www/xampp/mysql/bin", "/xampp/mysql/bin", "/apachefriends/xampp/mysql/bin", "/usr/local/mysql/bin", "/usr/local/bin/mysql/bin", "/usr/bin/mysql/bin", "/usr/mysql/bin", "/opt/local/bin/", "/opt/local/lib/mysql4/bin/", "/opt/local/lib/mysql5/bin/")));
     $mysqlNames = array("mysql", "mysql.exe");
     $formVars["pathToMYSQL"] = locateFile($mysqlLocations, $mysqlNames, false);
     // function 'locateFile()' is defined in 'install.inc.php'
     // Try to find the Bibutils programs:
     $bibutilsLocations = array_unique(array_merge($pathItems, array("/usr/bin", "/usr/local/bin", "/opt/local/bin/", ".", "./refbase", "./bibutils")));
     // We'll only check for one program to save time (and because, we currently don't allow the script to have a subset of the functionality provided by Bibutils)
     $bibutilsNames = array("xml2bib", "xml2bib.exe");
     $formVars["pathToBibutils"] = locateFile($bibutilsLocations, $bibutilsNames, true);
     $formVars["defaultCharacterSet"] = "latin1";
 }
 // If there's no stored message available:
 if (!isset($_SESSION['HeaderString'])) {
     if (empty($errors)) {
         // provide the default message:
         $HeaderString = "To install the refbase package please fill out the form below and click the <em>Install</em> button:";
     } else {
         // -> there were errors when validating the fields
         $HeaderString = "<b><span class=\"warning\">There were validation errors regarding the details you entered. Please check the comments above the respective fields:</span></b>";
     }
 } else {
     $HeaderString = $_SESSION['HeaderString'];
     // extract 'HeaderString' session variable (only necessary if register globals is OFF!)
     // Note: though we clear the session variable, the current message is still available to this script via '$HeaderString':
Ejemplo n.º 11
0
 switch ($dimconfigMD[$name][CONS_XML_TIPO]) {
     case CONS_TIPO_UPLOAD:
         $FirstfileName = CONS_FMANAGER . $dimconfigMD[$name]['location'];
         $path = explode("/", $FirstfileName);
         $filename = array_pop($path);
         $path = implode("/", $path) . "/";
         // perform delete test
         if (isset($_REQUEST[$name . "_delete"]) || isset($_FILES[$name]) && $_FILES[$name]['error'] == 0) {
             // delete ou update
             if (locateFile($FirstfileName, $ext)) {
                 @unlink($FirstfileName);
                 $thumbVersions = isset($dimconfigMD[$name][CONS_XML_THUMBNAILS]) ? count($dimconfigMD[$name][CONS_XML_THUMBNAILS]) : 1;
                 for ($tb = 1; $tb < $thumbVersions; $tb++) {
                     # for all thumbs ...
                     $thisFilenameT = $path . "t/" . $filename . ($tb + 1);
                     if (locateFile($thisFilenameT, $ext)) {
                         @unlink($thisFilenameT);
                     }
                 }
             }
         }
         if (isset($_FILES[$name]) && $_FILES[$name]['error'] != 4) {
             $isImg = isset($dimconfigMD[$name][CONS_XML_TWEAKIMAGES]) || isset($dimconfigMD[$name][CONS_XML_THUMBNAILS]);
             # quota test
             if (isset($core->dimconfig['_usedquota']) && isset($core->dimconfig['quota']) && $core->dimconfig['quota'] > 0) {
                 if ($core->dimconfig['_usedquota'] > $core->dimconfig['quota']) {
                     $core->errorControl->raise(210, $name, 'dincomfig');
                     continue;
                 }
             }
             #specials
Ejemplo n.º 12
0
     if ($h[0] !== 100 || $h[1] != 100 || $h2[0] !== 200 || $h[2] != 200) {
         $this->log[] = "<b>ERROR</b>: conditioned file-size were cropped to wrong size (tested key_1 and chave_1 conditionedimages)";
         $ok = false;
     } else {
         $this->log[] = "Conditioned file-size seems working";
     }
     $this->log[] = "Testing delete a file, no error expected";
     $data = array('alpha' => 'key', 'beta' => 1, 'somefile_delete' => 'on');
     $ok = $this->runAction('presciator', CONS_ACTION_UPDATE, $data);
     // will succeed, and delete somefile
     $this->errorState = false;
     clearstatcache();
     $f = CONS_FMANAGER . "presciator/somefile_key_1_1";
     $yes1 = locateAnyFile($f, $e);
     $f = CONS_FMANAGER . "presciator/someimage_key_1_1";
     $yes2 = locateFile($f, $e);
     if (!$yes1 && $yes2) {
         $this->log[] = "Success, file has been deleted, other file fields intact!";
     } else {
         $this->log[] = "<b>ERROR</b>: " . ($yes1 ? "File was not deleted!" : "") . (!$yes2 ? "Other files were also deleted, should only delete one field!" : "");
         $ok = false;
     }
 } else {
     $this->log[] = "<b>ERROR</b>: some files on presciator key_1 were not found, all should be present:" . ($yes1 ? "somefile ok," : "somefile missing,") . ($yes2 ? "someimage ok," : "someimage missing,") . ($yes3 ? "conditionedimage ok." : "conditionedimage missing.");
     $ok = false;
 }
 $this->log[] = "Logging off ...";
 $this->authControl->logsGuest();
 if ($ok) {
     // automatic log should have set we are in deep trouble for all the errors, set we are not, they were expected
     $this->setLog(CONS_LOGGING_SUCCESS, "", true);
Ejemplo n.º 13
0
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);
}