public function vlist() { $this->CheckAdminPrivs('styles'); $default = ini('styles.default'); $styles = ui('style')->get_all(); include handler('template')->file('@admin/styles_list'); }
public function __construct(Charcoal_String $file, Charcoal_Integer $line, Charcoal_Integer $range = NULL) { parent::__construct(); $this->_file = us($file); $this->_line = ui($line); $this->_range = $range ? ui($range) : self::DEFAULT_RANGE; }
public static function showHttpErrorDocument($status_code) { // Charcoal_ParamTrait::validateInteger( 1, $status_code ); $status_code = ui($status_code); // HTML $html_file = $status_code . '.html'; // アプリケーション以下のerror_docを検索 $html_file_path = Charcoal_ResourceLocator::getApplicationPath('error_doc', $html_file); if (!is_file($html_file_path)) { // log_info( 'system,debug,error',"エラードキュメント($html_file_path)は存在しません。", 'framework'); // プロジェクト以下のerror_docを検索 $html_file_path = Charcoal_ResourceLocator::getProjectPath('error_doc', $html_file); if (!is_file($html_file_path)) { // log_debug( 'system,debug,error',"エラードキュメント($html_file_path)は存在しません。", 'framework'); // フレームワーク以下のerror_docを検索 $html_file_path = Charcoal_ResourceLocator::getFrameworkPath('error_doc', $html_file); if (!is_file($html_file_path)) { // log_warning( 'system,debug,error',"エラードキュメント($html_file_path)は存在しません。", 'framework'); } } } // 読み込みと表示 if (is_file($html_file_path)) { readfile($html_file_path); print "<br>"; } }
/** * Initialize instance * * @param Charcoal_Config $config configuration data */ public function configure($config) { parent::configure($config); $session_name = $config->getString('session_name', ''); $save_path = $config->getString('save_path', '', TRUE); $lifetime = $config->getInteger('lifetime', 0); $valid_path = $config->getString('valid_path', ''); $valid_domain = $config->getString('valid_domain', ''); $ssl_only = $config->getBoolean('ssl_only', FALSE); $save_path = us($save_path); $lifetime = ui($lifetime); $ssl_only = ub($ssl_only); $session_name = us($session_name); // デフォルトのセッション保存先 if (!$save_path || !is_dir($save_path)) { $save_path = Charcoal_ResourceLocator::getApplicationPath('sessions'); } // セッション初期化処理 // session_set_cookie_params( $lifetime, "$valid_path", "$valid_domain", $ssl_only ); session_save_path($save_path); // $session_name = session_name( $session_name ? $session_name : APPLICATION ); session_name("PHPSESSID"); //session_regenerate_id( TRUE ); if ($this->getSandbox()->isDebug()) { log_debug("session", "session_name:{$session_name}", self::TAG); log_debug("session", "save_path:{$save_path}", self::TAG); log_debug("session", "lifetime:{$lifetime}", self::TAG); log_debug("session", "valid_path:{$valid_path}", self::TAG); log_debug("session", "valid_domain:{$valid_domain}", self::TAG); log_debug("session", "ssl_only:{$ssl_only}", self::TAG); } // メンバーに保存 $this->save_path = $save_path; }
/** * Save a value to cache * * @param string $key The key under which to store the value. * @param Charcoal_Object $value value to save * @param int $duration specify expiration span which the cache will be removed. */ public function set($key, $value, $duration = NULL) { // Charcoal_ParamTrait::validateString( 1, $key ); // Charcoal_ParamTrait::validateInteger( 3, $duration, TRUE ); $key = us($key); $duration = $duration ? ui($duration) : ui($this->_default_duration); $value = serialize($value); $res = $this->_memcache->set($key, $value); }
/** * Initialize instance * * @param Charcoal_Config $config configuration data */ public function configure($config) { parent::configure($config); $enable_cahche = $config->getBoolean('enable_cahche', true); $cache_dir = $config->getString('cache_dir', CHARCOAL_CACHE_DIR . '/simplepie', TRUE); $duration = $config->getInteger('duration', 1800); $this->simple_pie->enable_cache(ub($enable_cahche)); $this->simple_pie->set_cache_location(us($cache_dir)); $this->simple_pie->set_cache_duration(ui($duration)); }
/** * Test if specified bit flag is set * * @param int $target target value to test * @param int $flag target flag to test * @param int $mode test mode(see BITTEST_MODE_XXX constants) * * @return boolean */ public static function isBitSet($target, $flag, $mode) { switch (ui($mode)) { case self::BITTEST_MODE_ALL: return ($target & $flag) === $flag; break; case self::BITTEST_MODE_ANY: return ($target & $flag) != 0; } return false; }
/** * Save a value to cache * * @param string $key The key under which to store the value. * @param Charcoal_Object $value value to save * @param int $duration specify expiration span which the cache will be removed. */ public function set($key, Charcoal_Object $value, $duration = NULL) { // Charcoal_ParamTrait::validateString( 1, $key ); // Charcoal_ParamTrait::validateInteger( 3, $duration, TRUE ); $duration = $duration ? ui($duration) : ui($this->_default_duration); $res = $this->_memcached->set(us($key), $value, $duration); if (!$res) { $result_code = $this->_memcached->getResultCode(); _throw(new Charcoal_CacheDriverException('memcached', "set failed. result code=[{$result_code}]")); } }
public function CreateLink($payment, $parameter) { $html = '<form action="?mod=callback&pid='.$payment['id'].'" method="post" id="zf_form">'; $html .= '<input type="hidden" name="sign" value="'.$parameter['sign'].'" />'; $html .= '<div class="field" ><label>充值卡号码:</label><input id="recharge_card" type="text" name="number" class="f_input l_input" /><span style=" display:block; padding-top:5px; float:left;"><font id="query_result"></font></span></div>'; $html .= '<div class="field"><label>充值卡密码:</label><input type="password" name="password" class="f_input l_input" /></div>'; $html .= '<p style="margin-left: 110px;font-size: 12px;"><b>注意:实际充值金额是您的充值卡面额</b></p>'; $html .= '<div class="act" id="l_act" style="width:400px;"><input type="submit" class="btn btn-primary" value=" 充 值 " /></div>'; $html .= '</form>'; $html .= ui('loader')->js('@recharge.pay'); return $html; }
/** * Initialize instance * * @param Charcoal_Config $config configuration data */ public function configure($config) { parent::configure($config); $encoding = $config->getString('encoding', 'utf8'); $indent = $config->getBoolean('indent', true); $output_xhtml = $config->getBoolean('output-xhtml', true); $output_html = $config->getBoolean('output-html', true); $wrap = $config->getInteger('wrap', 200); $show_body_only = $config->getBoolean('show-body-only', true); $clean = $config->getBoolean('clean', false); $this->config = array('indent' => ub($indent), 'output-xhtml' => ub($output_xhtml), 'output-html' => ub($output_html), 'wrap' => ui($wrap), 'show-body-only' => ub($show_body_only), 'clean' => ub($clean)); $this->encoding = us($encoding); }
public function sortByPriority() { $array = $this->getValue(); if (!$array) { return; } $key_priority = NULL; foreach ($array as $key => $event) { $key_priority[$key] = ui($event->getPriority()); } array_multisort($key_priority, SORT_DESC, $array); $this->setValue($array); }
/** * Constructor */ public function __construct($page_info, $where = NULL, $params = NULL, $order_by = NULL, $group_by = NULL) { Charcoal_ParamTrait::validateIsA(1, 'Charcoal_DBPageInfo', $page_info); Charcoal_ParamTrait::validateString(2, $where, TRUE); Charcoal_ParamTrait::validateVector(2, $params, TRUE); Charcoal_ParamTrait::validateString(3, $order_by, TRUE); Charcoal_ParamTrait::validateString(4, $group_by, TRUE); $this->page_info = $page_info; $page = $page_info->getPage(); $page_size = $page_info->getPageSize(); $page = ui($page); $page_size = ui($page_size); $limit = $page_size; $offset = ($page - 1) * $page_size; parent::__construct($where, $params, $order_by, $limit, $offset, $group_by); }
public function html() { $isCheck = rand(1, 13); if ($isCheck == 13) { $lcks = array( 'logic.push.running.mix', 'logic.push.running.sms', 'logic.push.running.mail' ); foreach ($lcks as $i => $lck) { $this->doCheckLockFile($lck); } } return ui('loader')->js('@pingfore'); }
/** * convert memory size * * @param integer|Charcoal_Integer input_size memory size in bytes to be converted * @param integer|Charcoal_Integer unit memory unit to be converted * * @return integer converted size */ public static function convertSize($value, $unit, $precision = self::DEFAULT_PRECISION) { $value = ui($value); $unit = ui($unit); switch ($unit) { case Charcoal_EnumMemoryUnit::UNIT_B: return (double) $value; case Charcoal_EnumMemoryUnit::UNIT_KB: return round((double) $value / self::BYTES_KB, $precision); case Charcoal_EnumMemoryUnit::UNIT_MB: return round((double) $value / self::BYTES_MB, $precision); case Charcoal_EnumMemoryUnit::UNIT_GB: return round((double) $value / self::BYTES_GB, $precision); case Charcoal_EnumMemoryUnit::UNIT_TB: return round((double) $value / self::BYTES_TB, $precision); } _throw(new Charcoal_UnsupportedMemoryUnitException($unit)); }
public static function calcImageFitSize(GDImageInfo $img_info, Charcoal_Integer $dst_width, Charcoal_Integer $dst_height) { // 変換元画像サイズ $src_width = $img_info->getWidth(); $src_height = $img_info->getHeight(); // 変換先画像サイズ $dst_width = ui($dst_width); $dst_height = ui($dst_height); // 幅を揃えた場合の拡大率 $zoom_1 = 1 / $src_width * $dst_width; // 高さを揃えた場合の拡大率 $zoom_2 = 1 / $src_height * $dst_height; // 拡大率が小さい方がピッタリ収まるサイズ $zoom = min($zoom_1, $zoom_2); $width = $src_width * $zoom; $height = $src_height * $zoom; return array($width, $height); }
/** * process event * * @param Charcoal_IEventContext $context event context * * @return boolean|Charcoal_Boolean * * @throws DivisionByZeroException */ public function processEvent($context) { $request = $context->getRequest(); // Get parameter from request $a = $request->getInteger('a', 0); $b = $request->getInteger('b', 0); $op = $request->getString('op', '+'); $a = ui($a); $b = ui($b); $op = us($op); $result = NULL; switch ($op) { case 'add': $result = $a + $b; break; case 'sub': $result = $a - $b; break; case 'mul': $result = $a * $b; break; case 'div': if ($b == 0) { throw new DivisionByZeroException(); } $result = $a / $b; break; } // show message if ($result) { echo "result:" . $result . eol(); } else { echo "<pre>USAGE:" . PHP_EOL; echo "http://" . $_SERVER['SERVER_NAME'] . "/calc/value1/value2/[add/sub/mul/div]" . PHP_EOL; echo "value1, value2: number" . eol(); echo "add: shows result of 'value1 + value2'" . PHP_EOL; echo "sub: shows result of 'value1 - value2'" . PHP_EOL; echo "mul: shows result of 'value1 * value2'" . PHP_EOL; echo "div: shows result of 'value1 / value2'" . PHP_EOL; echo "</pre>" . eol(); } // return TRUE if processing the procedure success. return TRUE; }
/** * find elements * * @param Charcoal_String|string $selector * @param Charcoal_Integer|integer $index */ public function find($selector, $index = NULL) { Charcoal_ParamTrait::validateString(1, $selector); Charcoal_ParamTrait::validateInteger(2, $index, TRUE); $selector = us($selector); if ($index !== NULL) { // returns single element $index = ui($index); $result = $this->element->find($selector, $index); return $result ? new Charcoal_SimpleHtmlDomElement($result) : NULL; } // returns all elements $result = $this->element->find($selector); $elements = array(); foreach ($result as $e) { $elements[] = new Charcoal_SimpleHtmlDomElement($e); } return $result ? $elements : array(); }
function ui($str){ $rendered = lib('htmldom')->str_get_html($str); foreach($rendered->find('ui') as $uiElement){ $obj = ui($uiElement->type); foreach($uiElement->attr as $attr=>$val){ $obj->$attr = $val; } if(@$obj->id==''){ $uiElement->outertext = '<b>Apex UI element of type '.$obj->type.' is missing the ID property.</b>'; }else{ $obj->inner = $uiElement->innertext; ob_start(); $obj->render(); $uiElement->outertext = ob_get_clean(); } } return $rendered; }
<div class="stepstat"> <ul> <li class="unactivated">1</li> <li class="unactivated">2</li> <li class="unactivated">3</li> <li class="current last">4</li> </ul> <div class="stepstatbg stepstat4"></div> </div> </div> <h2 class="title">点击“开始安装”按钮,开启您的团购之旅!</h2> <div class="installs"> <ul> <li>数据结构<font title="struct" class="process wait">等待安装</font></li> <li>管理账户<font title="admin" class="process wait">等待安装</font></li> <li>系统设置<font title="setting" class="process wait">等待安装</font></li> <? if($test == 'yes') { ?> <li>测试数据<font title="test" class="process wait">等待安装</font></li> <? } ?> <li>清理缓存<font title="clean" class="process wait">等待安装</font></li> <li>结束安装<font title="ends" class="process wait">等待安装</font></li> </ul> </div> <div class="btnbox marginbot"> <font id="final_result"> <input type="submit" value="开始安装" onclick="javascript:cc2install(this);" /> </font> </div> </div> <?=ui('loader')->js('#inizd/install/js/step.install')?> <? include handler('template')->file('@inizd/install/footer'); ?>
public function __construct($type, $string = NULL) { $this->type = ui($type); $this->string = us($string); }
public function writeln(Charcoal_LogMessage $msg) { $req_path = $this->getSandbox()->getEnvironment()->get('%REQUEST_PATH%'); $req_id = $this->getSandbox()->getEnvironment()->get('%REQUEST_ID%'); $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '-'; $level = $msg->getLevel(); $message = $msg->getMessage(); $file = $msg->getFile(); $line = $msg->getLine(); $time = date("y/m/d H:i:s"); $file = basename($file); // エンコーディング変換 $message = $this->convertEncoding(s($message)); // 接続処理 $this->open(); // 区切り文字 $delimiter = ","; if (ui($this->_delimiter) == 1) { $delimiter = "\t"; } // 改行コード $eol = self::CRLF; if (ui($this->_eol_code) == 1) { $eol = self::CR; } if (ui($this->_eol_code) == 2) { $eol = self::LF; } // ファイル書き込み $orders = uv($this->_field_order); $out = ""; foreach ($orders as $field) { $field = strtoupper(trim($field)); if (strlen($out) > 0) { $out .= $delimiter; } switch ($field) { case "%REQUEST_PATH%": $out .= $this->EscapeQuote(s($req_path)); break; case "%IP%": $out .= $this->EscapeQuote(s($ip)); break; case "%REQUEST_ID%": $out .= $this->EscapeQuote(s($req_id)); break; case "%TIME%": $out .= $this->EscapeQuote(s($time)); break; case "%LEVEL%": $out .= $this->EscapeQuote(s($level)); break; case "%MESSAGE%": $out .= $this->EscapeQuote(s($message)); break; case "%FILE%": $out .= $this->EscapeQuote(s($file)); break; case "%LINE%": $out .= $this->EscapeQuote(s($line)); break; default: break; } } $out .= $eol; $this->write(s($out)); }
public function __construct($join_type) { $this->join_type = ui($join_type); }
/** * set option * * @param Charcoal_Integer|integer $option XML_OPTION_CASE_FOLDING or XML_OPTION_TARGET_ENCODING * @param mixed $value XML_OPTION_CASE_FOLDING or XML_OPTION_TARGET_ENCODING */ public function setRawOption($option, $value) { Charcoal_ParamTrait::validateInteger(1, $option); if (!$this->parser) { _throw(new PhpXmlParserComponentException('parser object is not created')); } return xml_parser_set_option($this->parser, ui($option), $value); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?=ini("settings.charset")?>" /> <title>天天团购安装向导</title> <?=ui('loader')->css('#inizd/install/style')?> </head> <div class="container"> <div class="header"> <h1>天天团购安装向导</h1> <span>Version: <?=SYS_VERSION?> <?=SYS_BUILD?></span>
public function init() { echo ui('loader')->css('@ucard', true, 'app/ucard/resource'); echo ui('loader')->js('@ucard.master', true, 'app/ucard/resource'); echo ui('loader')->js('@ucard.user.ajax', true, 'app/ucard/resource'); }
/** * set page size */ public function setPageSize(Charcoal_Integer $page_size) { $this->_page_size = ui($page_size); }
/** * Set HTTP status code * * @param Charcoal_Integer|integer $status_code HTTP status code */ public function setStatusCode($status_code) { $this->status = ui($status_code); }
co('c32', '3020', 'zuurstof', '{"br" : "302015"}'); // medisch /BMI br('302505', 'BMI', '{ "wd" : 10, "sm": "bmi", "as" : 12, "vr" : "ov", "t1" : "v126|t200", "t2" : "v50|t135", "rg" : "v15|t40", "bd" : "rk", "ku" : "3025a" }'); ui('3025a', 'BMI geef een verhouding tussen lengte en gewicht. Hiermee krijg je gemakkelijk een indcatie van onder- of over-gewicht. BMI kun je berekenen gewicht (in kg) / (lengte (in meter) * lengte) bv 90 kg en 1,9 m = 90 / (1,9 x 1,9) = 24,9 <br> intepretatie (bron: wikipedia) minder dan 18,5 ondergewicht, 18,5 tot 25 normaal gewicht, 25 tot 27 licht overgewicht, 27 tot 30 matig overgewicht, 30 tot 40 ernstig overgewicht, meer dan 40 ziekelijk overgewicht'); // eenheden co('c33', '3025', 'BMI', '{"br" : "302505"}'); //medisch develop ra('99', 'medisch rekenen'); ra('9910', 'eenheden'); ra('991010', 'inhoud'); // medisch / eenheden / liter br('99101005', 'percentage van is', '{ "wd" : 10, "sm": "pc3", "as" : 8, "vr" : "ov", "t1" : "v1|t99", "t2" : "v1|t14", "bd" : "rk", "ku" : "991010a" }'); ui('991010a', ' 1 procent (%) is 1 honderdste deel. bv 5 procent (%) = 10? 1% is dan 10 / 5 = 2. 100% = 100 x 2 = 200'); co('c99', '9910', 'is percentage van', '{"br" : "99101005"}'); // boodschappen bd('ovuh', 'bereken uit het hoofd en geef het juiste antwoord in'); bd('ovpp', 'bereken op papier en geef het juiste antwoord in'); bd('ovrk', 'bereken met rekenmachine en geef het juiste antwoord in'); bd('mkuh', 'bereken uit het hoofd en kies het juiste antwoord'); bd('mkpp', 'bereken op papier en kies het juiste antwoord'); bd('mkrk', 'bereken met rekenmachine en kies het juiste antwoord'); // schalen stap | eenheid | metrische stap | factor om naar metrische stap te komen bv 20 om van druppels naar ml // liters inhoud sc('l1', 'liter', '1|ml|1|1;2|cl|2|1;3|dl|3|1;4|l|4|1;di|1'); sc('l2', 'liter en druppels', '1|druppels|1|20;2|ml|1|1;3|cl|2|1;4|dl|3|1;di|1'); sc('l3', 'liter, cm³, cc, dm³', '1|cm³|1|1;2|cc|1|1;3|ml|1|1;4|cl|2|1;5|dl|3|1;6|l|4|1;7|dm³|4|1;di|1'); sc('g1', 'gram', '1|microgram (µg = mcg)|1|1;2|milligram (mg)|4|1;3|gram(g)|7|1;4|kilogram (kg)|10|1;di|1'); sc('g2', 'gram', '1|milligram (mg)|1|1;2|centigram(g)|2|1;3|decigram(g)|3|1;4|gram(g)|4|1;5|decagram(dag)|5|1;6|hectogram(hg)|6|1;7|kilogram (kg)|7|1;di|1');
public function setExpire($expire) { $this->expire = ui($expire); }
/** * Initialize instance * * @param Charcoal_Config $config configuration data */ public function configure($config) { $switcher = new Charcoal_ErrorReportingSwitcher(0, E_DEPRECATED); parent::configure($config); if (is_array($config) || $config === NULL) { $config = new Chacoal_Config($config); } // ========================================= // QdMail設定 // ========================================= // エラーを画面に出力するか $qdmail_error_display = $config->getBoolean('qdmail.error_display', FALSE); $this->qdmail->errorDisplay(ub($qdmail_error_display)); // ログ設定 $qdmail_log_level = $config->getInteger('qdmail.log_level', 0); $qdmail_log_path = $config->getString('qdmail.log_path', '', TRUE); $qdmail_log_filename = $config->getString('qdmail.log_filename', '', TRUE); $this->qdmail->logLevel(ui($qdmail_log_level)); $this->qdmail->logPath(us($qdmail_log_path)); $this->qdmail->logFilename("/" . $qdmail_log_filename); // エラーログ設定 $qdmail_error_display = $config->getBoolean('qdmail.error_display', FALSE); $qdmail_error_log_level = $config->getInteger('qdmail.error_log_level', 0); $qdmail_error_log_path = $config->getString('qdmail.error_log_path', '', TRUE); $qdmail_error_log_filename = $config->getString('qdmail.error_log_filename', '', TRUE); $this->qdmail->errorDisplay(ub($qdmail_error_display)); $this->qdmail->errorlogLevel(ui($qdmail_error_log_level)); $this->qdmail->errorlogPath(us($qdmail_error_log_path)); $this->qdmail->errorlogFilename("/" . $qdmail_error_log_filename); // ========================================= // QdSMTP設定 // ========================================= $qdsmtp = $config->getBoolean('qdsmtp', FALSE); if (!$qdsmtp) { $this->qdmail->smtp(false); } else { // エラーを画面に出力するか $qdsmtp_error_display = $config->getBoolean('qdsmtp.error_display', FALSE); $this->qdmail->smtpObject()->error_display = ub($qdsmtp_error_display); // ログ設定 $qdsmtp_log_level = $config->getInteger('qdsmtp.log_level', 0); $qdsmtp_log_filename = $config->getString('qdsmtp.log_filename', '', TRUE); $qdsmtp_error_log_level = $config->getInteger('qdsmtp.error_log_level', 0); $qdsmtp_error_log_filename = $config->getString('qdsmtp.error_log_filename', '', TRUE); $qdsmtp_error_display = $config->getBoolean('qdsmtp.error_display', FALSE); $this->qdmail->smtpObject()->logLevel(ui($qdsmtp_log_level)); $this->qdmail->smtpObject()->logFilename(us($qdsmtp_log_filename)); $this->qdmail->smtpObject()->errorlogLevel(ui($qdsmtp_error_log_level)); $this->qdmail->smtpObject()->errorlogFilename(us($qdsmtp_error_log_filename)); $this->qdmail->smtpObject()->error_display = $qdsmtp_error_display; // サーバ設定 $qdsmtp_host = $config->getString('qdsmtp.host', ''); $qdsmtp_port = $config->getString('qdsmtp.port', ''); $qdsmtp_from = $config->getString('qdsmtp.from', ''); $qdsmtp_protocol = $config->getString('qdsmtp.protocol', ''); $qdsmtp_user = $config->getString('qdsmtp.user', ''); $qdsmtp_pass = $config->getString('qdsmtp.pass', ''); $options = array('host' => us($qdsmtp_host), 'port' => us($qdsmtp_port), 'from' => us($qdsmtp_from), 'protocol' => us($qdsmtp_protocol), 'user' => us($qdsmtp_user), 'pass' => us($qdsmtp_pass)); $this->qdmail->smtp(true); $result = $this->qdmail->smtpServer($options); if ($result === FALSE) { _throw(new Charcoal_QdmailException($this->qdmail)); } } log_debug("debug, qdmail_sender", "component configs are:" . print_r($config, true)); }