/**
  * Formata o valor
  * @param mixed $value
  * @param string $type
  * @param boolean $formatar
  * @return mixed
  */
 function formatValue($value, $type, $formatar)
 {
     switch (strtolower($type)) {
         case 'data':
         case 'dt':
         case 'date':
             $value = Date::data((string) $value);
             return $formatar ? Date::formatData($value) : $value;
             break;
         case 'timestamp':
         case 'datatime':
             $value = Date::timestamp((string) $value);
             return $formatar ? Date::formatDataTime($value) : $value;
             break;
         case 'real':
             return $formatar ? Number::real($value) : Number::float($value, 2);
         case 'hide':
             return $formatar ? null : $value;
             break;
         case 'array':
             return $formatar ? stringToArray($value) : arrayToString($value);
             break;
         default:
             return $value;
     }
 }
示例#2
0
 /**
  * Method:search
  */
 public function getSize($doc, $page, $mode)
 {
     $output = array();
     try {
         if ($this->configManager->getConfig('splitmode') == 'true') {
             $swfdoc = $doc . "_" . $page . ".swf";
         } else {
             $swfdoc = $doc . ".swf";
         }
         $swfFilePath = $this->configManager->getConfig('path.swf') . $swfdoc;
         // check for directory traversal & access to non pdf files and absurdely long params
         if (!validSwfParams($swfFilePath, $swfdoc, $page)) {
             return;
         }
         if ($mode == 'width') {
             $command = $this->configManager->getConfig('cmd.query.swfwidth');
         }
         if ($mode == 'height') {
             $command = $this->configManager->getConfig('cmd.query.swfheight');
         }
         $command = str_replace("{path.swf}", $this->configManager->getConfig('path.swf'), $command);
         $command = str_replace("{swffile}", $swfFilePath, $command);
         $return_var = 0;
         exec($command, $output, $return_var);
         if ($return_var == 0) {
             return strip_non_numerics(arrayToString($output));
         } else {
             return "[Error Extracting]";
         }
     } catch (Exception $ex) {
         return $ex;
     }
 }
示例#3
0
 /**
  * 生成缓存文件
  */
 public function createCache()
 {
     $path_file = UPLOAD_PATH . '/cache/';
     $file_name = $path_file . date('Ymd', time()) . '.txt';
     if (!file_exists($file_name)) {
         foreach ($data2 as $v) {
             $pinyin = $this->pinyin($v['name']);
             $array['arr'][] = [$pinyin => $v['name']];
         }
         $data3 = $this->m['columns']->getAllByField('module', 'ksys', 'id');
         $data4 = $this->m['article']->getAll(arrayToString($data3), 'title');
         foreach ($data4 as $v) {
             $pinyin = $this->pinyin($v['title']);
             $array['arr'][] = [$pinyin => $v['title']];
         }
         if (!file_exists($path_file)) {
             mkdirs($path_file);
         }
         $open = fopen($file_name, "a");
         fwrite($open, serialize($array));
         fclose($open);
     } else {
         return;
     }
 }
示例#4
0
 public function groupEdit()
 {
     if (IS_POST) {
         $id = I("id");
         $rules = I("list");
         $title = I("title");
         if (!id || !is_array($rules) || empty($rules) || !$title) {
             $this->error("请填写相关数据");
         }
         $arr = arrayToString($rules);
         $data = array("title" => $title, "rules" => $arr);
         $save = M("auth_group")->where(array("id" => $id))->save($data);
         if (!$save) {
             $this->error("保存失败");
         }
         $this->success("操作成功");
     } else {
         $id = I("id");
         $info = M("auth_group")->where(array("id" => $id))->find();
         $rules = explode(",", $info['rules']);
         $this->rules = $rules;
         $this->info = $info;
         $arr = getRules($column, $rules);
         //dump($column);
         $this->arr = $arr;
         $this->display();
     }
 }
示例#5
0
 function runclass($function, $params, $content, $arrayin = false)
 {
     switch ($function) {
         case "vdir":
             # {vdir|path} - will remove paths if using domainTranslation or any different context.
             # path should be the FULL path FROM ROOT (ignoring CONS_INSTALL_ROOT)
             # WILL ADD CONS_INSTALL_ROOT if necessary
             $vdir = "";
             if ($this->parent->forceVDIRTL && count($this->parent->languageTL) > 1) {
                 foreach ($this->parent->languageTL as $f => $l) {
                     if ($l == $_SESSION[CONS_SESSION_LANG]) {
                         $vdir = $f . "/";
                         break;
                     }
                 }
             }
             if (!isset($params[0]) || $params[0] == '' || $params[0] == '/') {
                 return CONS_INSTALL_ROOT . $vdir;
             }
             if ($params[0] != '' && substr($params[0], 0, strlen(CONS_INSTALL_ROOT)) != CONS_INSTALL_ROOT) {
                 $params[0] = CONS_INSTALL_ROOT . $vdir . $params[0];
             } else {
                 if ($vdir != '') {
                     $params[0] = CONS_INSTALL_ROOT . $vdir . substr($params[0], strlen(CONS_INSTALL_ROOT));
                 }
             }
             $params[0] = preg_replace("@/{1,}@", "/", $params[0]);
             return $params[0];
             break;
         case "query_strings":
             # {query_strings} or {query_strings|comma separated list of query items to exclude}
             if (!isset($params[0]) || $params[0] == '') {
                 $itemsToExclude = array();
             } else {
                 $itemsToExclude = explode(",", $params[0]);
             }
             if (!in_array("haveinfo", $itemsToExclude)) {
                 $itemsToExclude[] = "haveinfo";
             }
             if (!in_array("debugmode", $itemsToExclude)) {
                 $itemsToExclude[] = "debugmode";
             }
             if (!in_array("nocache", $itemsToExclude)) {
                 $itemsToExclude[] = "nocache";
             }
             if (!in_array("nosession", $itemsToExclude)) {
                 $itemsToExclude[] = "nosession";
             }
             $qs = arrayToString(false, $itemsToExclude);
             return "?" . $qs;
             break;
         default:
             if (isset($this->parent->tClass[$function])) {
                 return $this->parent->loadedPlugins[$this->parent->tClass[$function]]->tclass($function, $params, $content, $arrayin);
             }
             break;
     }
     return $content;
 }
示例#6
0
 /**
  * Method:convert
  */
 public function convert($doc, $page, $subfolder)
 {
     $output = array();
     $pdfFilePath = $this->configManager->getConfig('path.pdf') . $subfolder . $doc;
     $swfFilePath = $this->configManager->getConfig('path.swf') . $subfolder . $doc . $page . ".swf";
     if ($this->configManager->getConfig('splitmode') == 'true') {
         $command = $this->configManager->getConfig('cmd.conversion.splitpages');
     } else {
         $command = $this->configManager->getConfig('cmd.conversion.singledoc');
     }
     $command = str_replace("{path.pdf}", $this->configManager->getConfig('path.pdf') . $subfolder, $command);
     $command = str_replace("{path.swf}", $this->configManager->getConfig('path.swf') . $subfolder, $command);
     $command = str_replace("{pdffile}", $doc, $command);
     try {
         if (!$this->isNotConverted($pdfFilePath, $swfFilePath)) {
             array_push($output, utf8_encode("[Converted]"));
             return arrayToString($output);
         }
     } catch (Exception $ex) {
         array_push($output, "Error," . utf8_encode($ex->getMessage()));
         return arrayToString($output);
     }
     $return_var = 0;
     if ($this->configManager->getConfig('splitmode') == 'true') {
         $pagecmd = str_replace("%", $page, $command);
         $pagecmd = $pagecmd . " -p " . $page;
         exec($pagecmd, $output, $return_var);
         $hash = getStringHashCode($command);
         if (!isset($_SESSION['CONVERSION_' . $hash])) {
             exec(getForkCommandStart() . $command . getForkCommandEnd());
             $_SESSION['CONVERSION_' . $hash] = true;
         }
     } else {
         exec($command, $output, $return_var);
     }
     if ($return_var == 0 || strstr(strtolower($return_var), "notice")) {
         $s = "[Converted]";
     } else {
         $errmsgs = arrayToString($output);
         if (strrpos($errmsgs, "too complex") > 0 && !$this->configManager->getConfig('splitmode') == 'true') {
             $s = " This document is too complex to render in simple mode. Please use split mode when rendering documents like these.";
         } else {
             if (strpos($errmsgs, "FATAL") > 0) {
                 if (strpos($errmsgs, "\n", strpos($errmsgs, "FATAL")) > 0) {
                     $s = " " . substr($errmsgs, strpos($errmsgs, "FATAL") + 8, strpos($errmsgs, "\n", strpos($errmsgs, "FATAL")) - strpos($errmsgs, "FATAL"));
                 } else {
                     $s = " " . substr($errmsgs, strpos($errmsgs, "FATAL") + 8, strpos($errmsgs, "\n", strpos($errmsgs, "FATAL")) - strpos($errmsgs, "FATAL"));
                 }
                 $s = str_replace("Internal error", "PDF conversion error", $s);
             } else {
                 $s = " Error converting document, make sure the conversion tool is installed and that correct user permissions are applied to the SWF Path directory" . $this->configManager->getDocUrl();
             }
         }
     }
     return $s;
 }
示例#7
0
 function cacheFile()
 {
     # Returns which cache file should be used for this page
     $keyOne = $this->parent->original_context_str . $this->parent->original_action . $this->cacheseed . $this->cacheuid();
     $keyTwo = arrayToString($_GET, array("__utma", "__utmb", "__utmc", "__utmz", "__atuvc", "PHPSESSID"), true);
     # Remove Google big-brother shit
     $keyOne = md5($keyOne);
     // shorten and standardize a little
     $keyTwo = md5($keyTwo);
     return $this->cachepath . $keyOne . $keyTwo . ".cache";
 }
示例#8
0
 function write()
 {
     $write = '$' . $this->getName() . ' = new Template(';
     $write .= '\'' . $this->getName() . '\', ';
     $write .= array_search($this->getType(), returnConstants("TEMPLATE_")) . ', ';
     $write .= '\'' . addcslashes($this->getLocation(), '\'') . '\', ';
     $write .= arrayToString($this->content);
     //        $write .= arrayToString($this->getContent());
     //        $write .= '\'' . addcslashes($this->getContent(), '\'') . '\'';
     $write .= ');';
     return $write;
 }
示例#9
0
function getJoin($table1, $table2, $joinOn, $t1_constraints, $t2_constraints)
{
    $t1_q = getTableQuote($table1);
    $t2_q = getTableQuote($table2);
    $jo = getJoinOn($table1, $table2, $joinOn);
    $tables = [];
    $tables[$table1] = $t1_constraints;
    $tables[$table2] = $t2_constraints;
    $con = getConstraintsWithTables($tables);
    $t2_columns = arrayToString(getColumnNamesWithTable($table2));
    $query = "SELECT " . $t1_q . ".*, " . $t2_columns . " FROM " . $t1_q . " INNER JOIN " . $t2_q . " ON " . $jo . " " . $con . ";";
    return $query;
}
示例#10
0
function getJoin($table1, $table2, $joinOn, $t1_constraints, $t2_constraints)
{
    $t1_q = getTableQuote($table1);
    $t2_q = getTableQuote($table2);
    $jo = getJoinOn($table1, $table2, $joinOn);
    $tables = [];
    $tables[$table1] = $t1_constraints;
    $tables[$table2] = $t2_constraints;
    $con = getConstraintsWithTables($tables);
    $t2_columns = arrayToString(getColumnNamesWithTable($table2));
    $query = "SELECT {$t1_q}.*, {$t2_columns} FROM {$t1_q} INNER JOIN {$t2_q} ON {$jo} {$con};";
    return $query;
}
示例#11
0
function arrayToString($arr)
{
    $s = "Array(";
    $parts = array();
    foreach ($arr as $k => $v) {
        if (is_array($v)) {
            $v = arrayToString($v);
        }
        $parts[] = sprintf("%s => %s", $k, $v);
    }
    $s .= implode(", ", $parts);
    $s .= ")";
    return $s;
}
示例#12
0
function inStrRev($content, $search)
{
    if (is_array($content)) {
        $content = arrayToString($content, "");
    }
    if ($search != "") {
        if (strstr($content, $search) != '') {
            return mb_strrpos($content, $search, 0, "gb2312") + 1;
        } else {
            return 0;
        }
    } else {
        return 0;
    }
}
示例#13
0
 /**
  * 文章首页
  * @return array
  */
 public function index()
 {
     $classid = $this->get('classid') ? $this->m['columns']->columnsIsdonw($this->get('classid')) : 0;
     $levelid = arrayToString($this->m['columns']->getLevelId($this->get('classid')));
     if ($this->get('classid')) {
         if ($levelid) {
             $num_id = $this->get('classid') . ',' . $levelid;
         } else {
             $num_id = $this->get('classid');
         }
     } else {
         $num_id = $levelid;
     }
     $data['columns'] = $this->m['columns']->getAll($classid);
     if ($num_id) {
         if ($this->judge_power('article', 'aprrove') && $_SESSION['power_id']) {
             $data['article'] = $this->m['article']->ShgetPage($num_id, $this->get('field'), $this->get('title'), 20);
         } else {
             $data['article'] = $this->m['article']->getPage($num_id, $this->get('field'), $this->get('title'), 20);
         }
     }
     foreach ($data['article']['list'] as $k => $v) {
         $template = $this->m['columns']->getOne($v['columnsid'], 'template');
         if (!$v['html']) {
             $url = $template . $v['id'] . '.shtml';
         } else {
             $url = $v['html'];
         }
         $v['url'] = $url;
         $data['article']['list'][$k] = $v;
     }
     $array['article_list']['columns'] = $data['columns'];
     $array['article_list']['article'] = $data['article'];
     $array['fy'] = $data['article']['fy'];
     foreach ($array['article_list']['columns'] as $k => $v) {
         if ($this->m['columns']->getAll($v['id'])) {
             $array['article_list']['columns'][$k]['pid'] = 1;
         } else {
             $array['article_list']['columns'][$k]['pid'] = 0;
         }
     }
     $this->display('Article/index.html', $array);
 }
示例#14
0
 public function get_header($header = array())
 {
     if (isset($header['css_page_style'])) {
         $this->load->helper('array');
         //把css样式组成字符串
         $data['css_page_style'] = arrayToString($header['css_page_style']);
     } else {
         $data['css_page_style'] = '';
     }
     if (isset($header['meta'])) {
         $data['meta'] = $header['meta'];
     } else {
         $data['meta'] = '';
     }
     if (isset($header['title'])) {
         $data['title'] = $header['title'];
     } else {
         $data['title'] = '';
     }
     if (isset($header['style'])) {
         $data['style'] = $header['style'];
     } else {
         $data['style'] = '';
     }
     $this->load->model('setting/base_setting');
     $data['website_title'] = $this->base_setting->get_setting('website_title');
     if (isset($header['meta_key'])) {
         $data['mate_key'] = $header['meta_key'];
     } else {
         $data['mate_key'] = $this->base_setting->get_setting('mate_key');
     }
     if (isset($header['meta_description'])) {
         $data['mate_description'] = $header['meta_description'];
     } else {
         $data['mate_description'] = $this->base_setting->get_setting('mate_description');
     }
     $data['mate_author'] = $this->base_setting->get_setting('mate_author');
     $this->report_access();
     //$this->output->enable_profiler(TRUE);
     return $this->load->view('common/header', $data);
 }
示例#15
0
 /**
  * Method:extractText
  */
 public function findText($doc, $page, $searchterm, $numPages = -1)
 {
     $output = array();
     if (strlen($searchterm) == 0) {
         return "[{\"page\":-1, \"position\":-1}]";
     }
     try {
         $swf_file = $this->configManager->getConfig('path.swf') . $doc . "_" . $page . ".swf";
         if (!file_exists($swf_file)) {
             return "[{\"page\":-1, \"position\":-1}]";
         }
         // check for directory traversal & access to non pdf files and absurdely long params
         $pdfFilePath = $this->configManager->getConfig('path.pdf') . $doc;
         if ($numPages == -1) {
             $pagecount = count(glob($this->configManager->getConfig('path.swf') . $doc . "*"));
         } else {
             $pagecount = $numPages;
         }
         if (!validPdfParams($pdfFilePath, $doc, $page)) {
             return;
         }
         $command = $this->configManager->getConfig('cmd.searching.extracttext');
         $command = str_replace("{swffile}", $this->configManager->getConfig('path.swf') . $doc . "_" . $page . ".swf", $command);
         $return_var = 0;
         exec($command, $output, $return_var);
         $pos = strpos(strtolower(arrayToString($output)), strtolower($searchterm));
         if ($return_var == 0 && $pos > 0) {
             return "[{\"page\":" . $page . ", \"position\":" . $pos . "}]";
         } else {
             if ($page < $pagecount) {
                 $page++;
                 return $this->findText($doc, $page, $searchterm, $pagecount);
             } else {
                 return "[{\"page\":-1, \"position\":-1}]";
             }
         }
     } catch (Exception $ex) {
         return $ex;
     }
 }
示例#16
0
 /**
  * Method:search
  */
 public function extractText($doc, $page)
 {
     $output = array();
     try {
         // check for directory traversal & access to non pdf files and absurdely long params
         if (!validSwfParams($this->configManager->getConfig('path.swf') . $doc . $page . ".swf", $doc, $page)) {
             return;
         }
         $command = $this->configManager->getConfig('cmd.searching.extracttext');
         $command = str_replace("{path.swf}", $this->configManager->getConfig('path.swf'), $command);
         $command = str_replace("{swffile}", $doc . $page . ".swf", $command);
         $return_var = 0;
         exec($command, $output, $return_var);
         if ($return_var == 0) {
             return arrayToString($output);
         } else {
             return "[Error Extracting]";
         }
     } catch (Exception $ex) {
         return $ex;
     }
 }
示例#17
0
 /**
  * Method:convert
  */
 public function convert($doc, $page)
 {
     $output = array();
     $pdfFilePath = $this->configManager->getConfig('path.pdf') . $doc;
     $swfFilePath = $this->configManager->getConfig('path.swf') . $doc . $page . ".swf";
     // traversal and file name check
     if (!validPdfParams($pdfFilePath, $doc, $page)) {
         $s = "Incorrect document file specified, file may not exist or insufficient permissions to read file" . $configManager->getDocUrl();
         return $s;
     }
     if (strlen($page) > 0) {
         $command = $this->configManager->getConfig('cmd.conversion.splitpages');
     } else {
         $command = $this->configManager->getConfig('cmd.conversion.singledoc');
     }
     $command = str_replace("{path.pdf}", $this->configManager->getConfig('path.pdf'), $command);
     $command = str_replace("{path.swf}", $this->configManager->getConfig('path.swf'), $command);
     $command = str_replace("{pdffile}", $doc, $command);
     try {
         if (!$this->isNotConverted($pdfFilePath, $swfFilePath)) {
             array_push($output, utf8_encode("[Converted]"));
             return arrayToString($output);
         }
     } catch (Exception $ex) {
         array_push($output, "Error," . utf8_encode($ex->getMessage()));
         return arrayToString($output);
     }
     $return_var = 0;
     exec($command, $output, $return_var);
     if ($return_var == 0) {
         $s = "[Converted]";
     } else {
         $s = "Error converting document, make sure the conversion tool is installed and that correct user permissions are applied to the SWF Path directory" . $configManager->getDocUrl();
     }
     return $s;
 }
示例#18
0
function base32_decode($input, $outputLength)
{
    $inputLength = strlen($input);
    // echo "legnth is: $inputLength output:$outputLength\n$input\n";
    $bytes = 0;
    $currentByte = 0;
    $output = '';
    for ($offset = 0; $offset < $inputLength && $bytes < $outputLength; $offset += 8) {
        // print "offset: $offset\n";
        $output[$bytes] = decode_bits($input[$offset + 0]) << 3;
        $currentByte = decode_bits($input[$offset + 1]);
        $output[$bytes] += $currentByte >> 2;
        $output[$bytes + 1] = ($currentByte & 0x3) << 6;
        if ($input[$offset + 2] == '=') {
            // print "Return + 2 bytes:$bytes\n";
            return arrayToString($output, $bytes + 1);
        } else {
            $bytes++;
        }
        $output[$bytes] += decode_bits($input[$offset + 2]) << 1;
        $currentByte = decode_bits($input[$offset + 3]);
        $output[$bytes] += $currentByte >> 4;
        $output[$bytes + 1] = $currentByte << 4;
        $z = $input[$offset + 4];
        // print "off4 = $z\n";
        if ($input[$offset + 4] == '=') {
            // print "Return + 4 bytes:$bytes\n";
            return arrayToString($output, $bytes + 1);
        } else {
            $bytes++;
        }
        $currentByte = decode_bits($input[$offset + 4]);
        $output[$bytes] += $currentByte >> 1;
        $output[$bytes + 1] = $currentByte << 7;
        if ($input[$offset + 5] == '=') {
            // print "Return + 5 bytes:$bytes\n";
            return arrayToString($output, $bytes + 1);
        } else {
            $bytes++;
        }
        $output[$bytes] += decode_bits($input[$offset + 5]) << 2;
        $currentByte = decode_bits($input[$offset + 6]);
        $output[$bytes] += $currentByte >> 3;
        $output[$bytes + 1] = ($currentByte & 0x7) << 5;
        if ($input[$offset + 7] == '=') {
            // print "Return + 7 bytes:$bytes\n";
            return arrayToString($output, $bytes + 1);
        } else {
            $bytes++;
        }
        $output[$bytes] += decode_bits($input[$offset + 7]) & 0x1f;
        $bytes++;
    }
    return arrayToString($output, $bytes);
}
示例#19
0
$termArray = new TermArray();
$termArray->addTerm("New", 0);
$termArray->addTerm("York", 1);
$termArray->addTerm("City", 2);
$termArray->addTerm("New York", 0);
$termArray->addTerm("York City", 1);
$weightHelperResult = $termArray->weightHelper($termArray->getAllTerms());
echo arrayToString($weightHelperResult);
//var_dump($termArray->findGroups());
echo "<br>Weights:<br>";
var_dump($termArray->getWeights());
echo "<br>Alternate weights:<br>";
var_dump($termArray->getAlternateWeights());
echo "<br><br>";
echo "Test 10: The, New, York, City, New York, York City, New York City, The New, The New York, The New York City<br>Expected: <br>Actual: ";
$termArray = new TermArray();
$termArray->addTerm("The", 0);
$termArray->addTerm("New", 1);
$termArray->addTerm("York", 2);
$termArray->addTerm("City", 3);
$termArray->addTerm("The New", 0);
$termArray->addTerm("New York", 1);
$termArray->addTerm("York City", 2);
$termArray->addTerm("New York City", 1);
$termArray->addTerm("The New York", 0);
$termArray->addTerm("The New York City", 0);
$weightHelperResult = $termArray->weightHelper($termArray->getAllTerms());
echo arrayToString($weightHelperResult);
echo "<br>Weights:<br>";
var_dump($termArray->getWeights());
echo "<br><br>";
示例#20
0
 public function __toString()
 {
     $sql = $this->command . " ";
     if ($this->predicate) {
         $sql .= $this->predicate . " ";
     }
     $sql .= $this->getColumnsString();
     $sql .= " from " . $this->tablesToString();
     if (count($this->conditions) > 0) {
         $sql .= " where " . arrayToString($this->conditions, " and ");
     }
     if ($this->group) {
         $sql .= " group by " . $this->group;
     }
     if ($this->order) {
         $sql .= " order by " . $this->order;
     }
     if ($this->limit) {
         $sql .= " limit " . $this->limit;
     }
     return $sql;
 }
示例#21
0
function arrayToString($array, $array_name, $indent = '')
{
    global $LINEBREAK;
    if (is_array($array)) {
        if ($indent == '') {
            $array_string = $indent . $array_name . " = array(" . $LINEBREAK;
        } else {
            $array_string = $indent . "'" . $array_name . "' => array(" . $LINEBREAK;
        }
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $array_string .= arrayToString($value, $key, $indent . '     ');
            } else {
                $array_string .= $indent . "        '{$key}' => '{$value}'," . $LINEBREAK;
            }
        }
        if ($indent == '') {
            $array_string .= ');' . $LINEBREAK;
        } else {
            $array_string .= $indent . '),' . $LINEBREAK;
        }
    } else {
        return $array;
    }
    return $array_string;
}
示例#22
0
 function onEcho(&$PAGE)
 {
     if ($this->parent->layout == 2 || $this->parent->servingFile) {
         return;
     }
     # don't mess with ajax
     # Happens just after the template has been parsed (note it received the page as a STRING now), after this, is ECHO and DIE
     ###### -> Construct should add this module to the onEcho array
     if (!$this->devDisable) {
         $thereAreErrors = false;
         if ($this->devCheckHTML || isset($_REQUEST['dev_test'])) {
             if (!function_exists('checkHTML')) {
                 include CONS_PATH_INCLUDE . "checkHTML.php";
             }
             $log = checkHTML($PAGE, false);
             if (count($log) > 0) {
                 $thereAreErrors = true;
                 $this->log[] = implode("<br/>", $log);
                 // for dev_test
             }
             unset($log);
         }
         if (isset($_REQUEST['dev_test'])) {
             if (count($this->parent->log) > 0 || count($this->parent->warning) > 0) {
                 # failed basic test , log it
                 $_SESSION['affbidevut'][2][] = $this->parent->context_str . $this->parent->action . " Reports errors:";
                 foreach ($this->parent->log as $log) {
                     $_SESSION['affbidevut'][2][] = $log;
                 }
                 foreach ($this->parent->warning as $log) {
                     $_SESSION['affbidevut'][2][] = $log;
                 }
             }
             $this->unitTest();
         } else {
             $qs = $this->parent->action . ".html?" . arrayToString(false, array("login", "gfc", "haveinfo", "password", "debugmode", "nosession", "nocache", "dev_html"));
             $totalTime = scriptTime() * 1000;
             // ###############################---
             // ## This is the info strip that stays on top of the site:
             array_unshift($this->log, number_format($totalTime, 2) . "ms (" . CONS_AFF_DATABASECONNECTOR . ": " . number_format($this->parent->dbo->dbt, 2) . "ms, framework: " . number_format($this->overheadTime, 2) . " ms), SQL(s): " . $this->parent->dbo->dbc . ", caches: " . number_format($this->parent->cachetime / 1000) . "ms main, " . number_format($this->parent->cachetimeObj / 1000) . "ms obj" . (isset($this->parent->storage['CORE_CACHECONTROL']) ? " avg: " . number_format($this->parent->storage['CORE_CACHECONTROL'][0] / 1000) . "s factor " . number_format($this->parent->storage['CORE_CACHECONTROL'][1], 2) : "") . " (" . $_SESSION[CONS_SESSION_LANG] . ") (" . ($this->devCheckHTML ? "<a style='color:#" . $this->textColor . "' href='{$qs}&dev_html=0'><strong>checkHTML</strong> is on</a>" : "<a style='color:#" . $this->textColor . "' href='{$qs}&dev_html=1'><strong>checkHTML</strong> is off</a>") . ") (" . ($thereAreErrors ? "<strong><a style='color:#" . $this->textColor . "' href='?dev_log=1'>Errors!</a></strong>" : "no errors") . ") (<a style='color:#" . $this->textColor . "' href='?debugmode=true&nosession=true&nocache=true'>RESET</a>)" . " (<a style='color:#" . $this->textColor . "' href='?dev_help=1'>DEVELOPER OPTIONS</a>) (<a style='color:#" . $this->textColor . "' href=\"" . $qs . "&dev_disable=1\">disable</a>)" . ($this->parent->cacheControl->contentFromCache ? " CACHED CONTENT" : ""));
             // ###############################---
             $pl = strlen($PAGE);
             $tp = new CKTemplate();
             $tp->fetch(CONS_PATH_SYSTEM . "plugins/" . $this->name . "/payload/overlay.html");
             $tp->assign("AFFBIDEV_CONTENT", implode("<br/>", $this->log) . (count($this->parent->warning) != 0 ? "<br/>Warnings:" . implode("<br/>", $this->parent->warning) : ""));
             $arrowColor = $this->parent->cacheControl->contentFromCache ? "#000099" : ($thereAreErrors ? "#BB0000" : "#000000");
             $tp->assign("ARROWCOLOR", $arrowColor);
             $tp->assign("ARROWSIZE", $thereAreErrors ? 20 : 12);
             $PAGE = str_replace("</body>", $tp->techo() . "</body>", $PAGE);
             if (strlen($PAGE) == $pl) {
                 $this->log[] = "WARNING: no /body on page";
                 $PAGE .= $tp->techo();
             }
             $PAGE .= "<!-- bi_dev output logs. To stop this output, disable bi_dev";
             $PAGE .= "\nDbLOG:\n" . implode("\n", $this->parent->dbo->log);
             $C = $_SESSION;
             unset($C['prescia_cache']);
             // the cache can contain whole HTML that would cause havok
             $PAGE .= "\n" . print_r($C, 1) . "\n";
             $PAGE .= "-->";
         }
     }
 }
/**
 * Create a jquery.ui icon
 * @param string $icon the icon ID. Ex: ('lightbulb, plusthick, ...')
 * @param string $properties Html properties
 */
function ui_create_icon($icon = 'notice', $properties = '')
{
    if (is_array($properties)) {
        $class = sprinf(' ui-icon ui-icon-%s ', $icon);
        $properties['class'] = isset($properties['class']) ? $class . $properties['class'] : $class;
        $properties = arrayToString($properties);
        $pattern = '<span %s></span>';
    } else {
        $properties = $properties === '' ? 'style="z-index:2000"' : $properties;
        $pattern = '<span class="ui-icon ui-icon-%s ui-datepicker-prev" %s></span>';
    }
    return sprintf($pattern, $icon, $properties);
}
示例#24
0
文件: list.php 项目: Prescia/Prescia
$sqltoShow = array();
foreach ($toShow as $key) {
    $sqltoShow[$key] = 1;
}
foreach ($module->keys as $key) {
    if (!in_array($key, $toShow)) {
        $sqltoShow[$key] = 1;
    }
}
$sql = $module->get_advanced_sql($sqltoShow, "", "", "", "adminlist_" . $module->name);
unset($sqltoShow);
// Order and query controls
$hasOrder = false;
// this module has a "ordem" field
$qs = arrayToString(false, array("order", "layout", "p_init", "login"));
$fullqs = arrayToString(false, array("layout", "p_init", "login"));
$core->template->assign("qs", $fullqs);
$markOrder = array('', '');
$ord = array();
if (isset($_REQUEST['order']) && $_REQUEST['order'] != "") {
    $ord = array($_REQUEST['order']);
    $sql['ORDER'] = array();
} else {
    if ($module->order != "") {
        $ord = explode(",", $module->order);
        $ord = $ord[0];
        $markOrder = array(substr($ord, 0, strlen($ord) - 1), $ord[strlen($ord) - 1]);
        $ord = array();
    }
}
// builds order into SQL
示例#25
0
function getPostSql($id, $tableName, $fieldNameList)
{
    $valueStr = '';
    $editValueStr = '';
    $sql = '';
    $splStr = '';
    $splxx = '';
    $s = '';
    $fieldList = '';
    $fieldName = '';
    $defaultFieldValue = '';
    //字段名称
    $fieldSetType = '';
    //字段设置类型
    $fieldValue = '';
    //字段值
    $systemFieldList = '';
    //表字段列表
    $systemFieldList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段配置列表');
    $postFieldList = '';
    //post字段列表
    $splPost = '';
    $fieldContent = '';
    $fieldConfig = '';
    $postFieldList = getFormFieldList();
    //以后再把下面与上面这两种处理方法事成一种看看行不行
    $splPost = aspSplit($postFieldList, '|');
    foreach ($splPost as $key => $fieldName) {
        $fieldContent = @$_POST[$fieldName];
        if (inStr($systemFieldList, ',' . $fieldName . '|') > 0 && inStr(',' . $fieldList . ',', ',' . $fieldName . ',') == false) {
            //为自定义的
            if (inStr($fieldNameList, ',' . $fieldName . '|') > 0) {
                $fieldConfig = mid($fieldNameList, inStr($fieldNameList, ',' . $fieldName . '|') + 1, -1);
            } else {
                $fieldConfig = mid($systemFieldList, inStr($systemFieldList, ',' . $fieldName . '|') + 1, -1);
            }
            $fieldConfig = mid($fieldConfig, 1, inStr($fieldConfig, ',') - 1);
            //call echo("config",fieldConfig)
            //call echo(fieldName,fieldContent)
            //call echo("fieldConfig",fieldConfig)
            $splxx = aspSplit($fieldConfig . '|||', '|');
            $fieldName = $splxx[0];
            //字段名称
            $fieldSetType = $splxx[1];
            //字段设置类型
            $defaultFieldValue = $splxx[2];
            //默认字段值
            $fieldValue = ADSqlRf($fieldName);
            //代替上面,因为它处理了'符号
            //call echo("fieldValue",fieldValue)
            //排序密码不处理
            if ($fieldValue != '#NO******NO#') {
                //md5加密
                if ($fieldSetType == 'md5') {
                    $fieldValue = myMD5($fieldValue);
                }
                if ($fieldSetType == 'yesno') {
                    if ($fieldValue == '') {
                        $fieldValue = $defaultFieldValue;
                    }
                    //不为数字类型加单引号
                } else {
                    if ($fieldSetType == 'numb') {
                        if ($fieldValue == '') {
                            $fieldValue = $defaultFieldValue;
                        }
                    } else {
                        if ($fieldName == 'flags') {
                            //PHP里用法
                            if (EDITORTYPE == 'php') {
                                if ($fieldValue != '') {
                                    $fieldValue = '|' . arrayToString($fieldValue, '|');
                                }
                            } else {
                                $fieldValue = '|' . arrayToString(aspSplit($fieldValue, ', '), '|');
                            }
                            $fieldValue = '\'' . $fieldValue . '\'';
                            //为时间
                        } else {
                            if ($fieldSetType == 'time' || $fieldSetType == 'now') {
                                if ($fieldValue == '') {
                                    $fieldValue = now();
                                }
                                $fieldValue = '\'' . $fieldValue . '\'';
                                //为时期
                            } else {
                                if ($fieldSetType == 'date') {
                                    if ($fieldValue == '') {
                                        $fieldValue = aspDate();
                                    }
                                    $fieldValue = '\'' . $fieldValue . '\'';
                                } else {
                                    $fieldValue = '\'' . $fieldValue . '\'';
                                }
                            }
                        }
                    }
                }
                $fieldValue = unescape($fieldValue);
                //解码20160418
                if ($valueStr != '') {
                    $valueStr = $valueStr . ',';
                    $editValueStr = $editValueStr . ',';
                }
                $valueStr = $valueStr . $fieldValue;
                $editValueStr = $editValueStr . $fieldName . '=' . $fieldValue;
            }
            if ($fieldList != '') {
                $fieldList = $fieldList . ',';
            }
            $fieldList = $fieldList . $fieldName;
        }
    }
    //自定义字段是否需要写入默认值  有的
    $splStr = aspSplit($fieldNameList, ',');
    foreach ($splStr as $key => $s) {
        if (inStr($s, '|') > 0) {
            $splxx = aspSplit($s . '|||', '|');
            $fieldName = $splxx[0];
            //字段名称
            $fieldSetType = $splxx[1];
            //字段设置类型
            $fieldValue = $splxx[2];
            //默认字段值
            if (inStr($systemFieldList, ',' . $fieldName . '|') > 0 && inStr(',' . $fieldList . ',', ',' . $fieldName . ',') == false) {
                if ($fieldSetType == 'date' && $fieldValue == '') {
                    $fieldValue = aspDate();
                } else {
                    if (($fieldSetType == 'time' || $fieldSetType == 'now') && $fieldValue == '') {
                        $fieldValue = now();
                    }
                }
                if ($fieldSetType != 'yesno' && $fieldSetType != 'numb') {
                    $fieldValue = '\'' . $fieldValue . '\'';
                }
                if ($fieldList != '') {
                    $fieldList = $fieldList . ',';
                    $valueStr = $valueStr . ',';
                    $editValueStr = $editValueStr . ',';
                }
                $fieldList = $fieldList . $fieldName;
                $valueStr = $valueStr . $fieldValue;
                $editValueStr = $editValueStr . $fieldName . '=' . $fieldValue;
                //call echo(fieldName,fieldSetType)
            }
        }
    }
    if ($id == '') {
        $sql = 'insert into ' . $GLOBALS['db_PREFIX'] . '' . $tableName . ' (' . $fieldList . ',updatetime) values(' . $valueStr . ',\'' . now() . '\')';
    } else {
        $sql = 'update ' . $GLOBALS['db_PREFIX'] . '' . $tableName . ' set ' . $editValueStr . ',updatetime=\'' . now() . '\' where id=' . $id;
    }
    $getPostSql = $sql;
    return @$getPostSql;
}
示例#26
0
 public function edit_usergroup()
 {
     //判断权限
     $this->public_section->is_modify('setting/user_manage');
     $this->lang->load('setting/setting_form');
     //header部分
     $header['title'] = $this->lang->line('heading_title');
     $header['css_page_style'] = array('public/css/chosen.css', 'public/css/daterangepicker.css', 'public/css/summernote.css', 'public/css/jquery.fancybox.css', 'public/css/select2_metro.css', 'public/css/multi-select-metro.css', 'public/css/DT_bootstrap.css');
     $this->public_section->get_header($header);
     $this->public_section->get_usertop();
     //开始主体程序
     //接收一个选项卡位置($data['tab_position'])
     $data['tab_position'] = $this->input->get('tab_position');
     //1、设置语言
     $data['text_title'] = $this->lang->line('heading_title');
     $data['text_title_helper'] = $this->lang->line('text_title_helper');
     //面包导航
     $data['breadcrumbs'] = array('home' => array('name' => $this->lang->line('text_home'), 'url' => site_url()), 'user_center' => array('name' => $this->lang->line('text_user_home'), 'url' => site_url('user')), 'setting' => array('name' => $this->lang->line('heading_title'), 'this_url' => site_url('setting/Setting_form'), 'url' => ''));
     $this->load->helper(array('directory', 'array'));
     $maps = directory_map(APPPATH . 'controllers');
     $maps_image = directory_map(WWW_PATH . '/image', 1);
     //图片文件夹权限
     foreach ($maps_image as $ma_k => $ma_v) {
         //排除不管理的文件夹
         if (strpos($maps_image[$ma_k], '.') == TRUE || $maps_image[$ma_k] == 'cache\\') {
             unset($maps_image[$ma_k]);
         }
     }
     foreach ($maps_image as $map_k => $map_v) {
         $maps_image[$map_k] = substr($maps_image[$map_k], 0, strlen($maps_image[$map_k]) - 1);
     }
     //图片文件夹权限
     foreach ($maps as $k => $v) {
         if (is_int($k)) {
             $maps_new['1'][] = $v;
         }
         if (is_array($v)) {
             foreach ($v as $b => $c) {
                 $maps_new['2'][] = $k . $c;
             }
         }
     }
     $maps = arrayToString($maps_new);
     $maps = str_replace('\\', '/', $maps);
     $maps = explode(',', $maps);
     foreach ($maps as $k => $v) {
         if (pathinfo($v, PATHINFO_EXTENSION) == 'php') {
             $maps[$k] = strtolower(substr($v, 0, -4));
         } else {
             unset($maps[$k]);
         }
     }
     //到这这里$maps成了一个纯一维数组,并且去除了非php文件
     //排除前台,公共部分不用管理权限的文件
     $this->config->load('permission');
     //加载配置文件
     $ignore = $this->config->item('ignore');
     $maps = array_diff($maps, $ignore);
     //排除前台,公共部分不用管理权限的文件
     //获取用户分组信息
     $group_infos = array();
     if ($this->input->get('group_id') !== NULL) {
         $this->load->model('user/user_group');
         $group_infos = $this->user_group->get_infobygroup_id($this->input->get('group_id'));
     }
     if ($this->input->post('group_name')) {
         $data['group_name'] = $this->input->post('group_name');
     } elseif (isset($group_infos['name'])) {
         $data['group_name'] = $group_infos['name'];
     } else {
         $data['group_name'] = '';
     }
     if ($this->input->post('group_description')) {
         $data['group_description'] = $this->input->post('group_description');
     } elseif (isset($group_infos['description'])) {
         $data['group_description'] = $group_infos['description'];
     } else {
         $data['group_description'] = '';
     }
     /**
      * $permission=array(
      *		'access'=>array(
      * 			'0'=>'',
      * 			'1'=>''
      * 		), 
      * 		'modify'=>array(
      * 			'0'=>'',
      * 			'1'=>''
      * 		)
      * );
      * @var 
      * 
      */
     @($permission = unserialize($group_infos['permission']));
     //序列化转数组(权限)
     if ($this->input->post('my_multi_select1')) {
         $data['permission_view1'] = $this->input->post('my_multi_select1');
         //选中的查看权限
         $data['permission_view2'] = array_diff($maps, $this->input->post('my_multi_select1'));
         //未选中的查看权限/差集
     } elseif (count($permission['access']) > 1) {
         $data['permission_view1'] = $permission['access'];
         $data['permission_view2'] = array_diff($maps, $permission['access']);
     } else {
         $data['permission_view1'] = array();
         $data['permission_view2'] = $maps;
     }
     //编辑权限
     if ($this->input->post('my_multi_select2')) {
         $data['permission_edit1'] = $this->input->post('my_multi_select2');
         //选中的查看权限
         $data['permission_edit2'] = array_diff($maps, $this->input->post('my_multi_select2'));
         //未选中的查看权限/差集
     } elseif (count($permission['modify']) > 1) {
         $data['permission_edit1'] = $permission['modify'];
         $data['permission_edit2'] = array_diff($maps, $permission['modify']);
     } else {
         $data['permission_edit1'] = array();
         $data['permission_edit2'] = $maps;
     }
     if (empty($permission['file_manager'])) {
         $permission['file_manager'] = array();
     }
     if ($this->input->post('my_multi_select3')) {
         $data['file_manager1'] = $permission['file_manager'];
         $data['file_manager2'] = array_diff($maps_image, $permission['file_manager']);
     } elseif (count($permission['file_manager']) > 1) {
         $data['file_manager1'] = $permission['file_manager'];
         $data['file_manager2'] = array_diff($maps_image, $permission['file_manager']);
     } else {
         $data['file_manager1'] = array();
         $data['file_manager2'] = $maps_image;
     }
     //group_id
     if ($this->input->get('group_id') !== NULL) {
         $data['group_id'] = $this->input->get('group_id');
     } else {
         $data['group_id'] = '';
     }
     $this->load->view('setting/user_group_form', $data);
     $this->public_section->get_footer();
 }
示例#27
0
 public function getUrl($return_to = null)
 {
     $this->openIdParams['openid.return_to'] = $return_to ? $return_to : constructPageUrl();
     $url = self::openIdUrl . '?' . arrayToString($this->openIdParams);
     return $url;
 }
示例#28
0
 /**
  * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function doEdit()
 {
     $input = Request::all();
     $lab = Labs::find($input['id']);
     //Image handling
     if (empty($input['thumbnail'])) {
         $input['thumbnail'] = $lab->thumbnail;
     } else {
         $tmp_path = $input['thumbnail']->getRealPath();
         $extension = $input['thumbnail']->getClientOriginalExtension();
         $path = '/img/exp/' . uniqid() . '.' . $extension;
         //Image::make($tmp_path)->save(base_path() . '/public' . $path);
         Image::make($tmp_path)->resize(null, 300, function ($constraint) {
             $constraint->aspectRatio();
         })->save(base_path() . '/public' . $path);
         $input['thumbnail'] = $path;
     }
     //Array
     $input['target'] = arrayToString($input['target']);
     $input['subject'] = arrayToString($input['subject']);
     //Package
     if (!empty($input['package'])) {
         File::deleteDirectory(public_path('exp_data/' . $lab->id));
         unzipLab($input['package']->getRealPath(), $lab->id);
         unset($input['package']);
     }
     unset($input['_token']);
     if (array_key_exists("maintenance", $input)) {
         $input['maintenance'] == 'on' ? $input['maintenance'] = '1' : ($input['maintenance'] = '0');
     } else {
         $input['maintenance'] = '0';
     }
     if (array_key_exists("queue", $input)) {
         $input['queue'] == 'on' ? $input['queue'] = '1' : ($input['queue'] = '0');
     } else {
         $input['queue'] = '1';
     }
     if (!empty($input['docs'])) {
         $old = DocsLabs::where('lab_id', $input['id'])->delete();
         $docs = explode(',', $input['docs']);
         if (!empty($docs)) {
             foreach ($docs as $doc) {
                 $doclab = new DocsLabs();
                 $doclab->doc_id = $doc;
                 $doclab->lab_id = $input['id'];
                 $doclab->save();
             }
         }
     }
     unset($input['docs']);
     Labs::where('id', '=', $input['id'])->update($input);
     return redirect('labs');
 }
示例#29
0
文件: core.php 项目: Prescia/Prescia
 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();
 }
示例#30
0
function getInvalidSubsetString($var, $invalidsub)
{
    if ($invalidsub == PLACEHOLDER_INVALIDSUBSET_SELECTED) {
        return $invalidsub;
    }
    $subs = explode(SEPARATOR_COMPARISON, $invalidsub);
    foreach ($subs as $sub) {
        $expl = explode(",", $sub);
        $names = array();
        foreach ($expl as $e) {
            if (contains($e, "-")) {
                $sub = explode("-", $e);
                $subnames = array();
                for ($j = $sub[0]; $j <= $sub[1]; $j++) {
                    $subnames[] = $var->getOptionLabel($j);
                }
                $names[] = "{" . arrayToString($subnames) . "}";
            } else {
                $names[] = $var->getOptionLabel($e);
            }
        }
        $namestrings[] = arrayToString($names);
    }
    if (sizeof($namestrings) == 1) {
        return $namestrings[0];
    }
    return "(" . implode(") OR (", $namestrings) . ")";
}