示例#1
3
文件: Bcrypt.php 项目: vkaran101/sase
 private function getRandomBytes($count)
 {
     $bytes = '';
     if (function_exists('openssl_random_pseudo_bytes') && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
         // OpenSSL slow on Win
         $bytes = openssl_random_pseudo_bytes($count);
     }
     if ($bytes === '' && @is_readable('/dev/urandom') && ($hRand = @fopen('/dev/urandom', 'rb')) !== FALSE) {
         $bytes = fread($hRand, $count);
         fclose($hRand);
     }
     if (strlen($bytes) < $count) {
         $bytes = '';
         if ($this->randomState === null) {
             $this->randomState = microtime();
             if (function_exists('getmypid')) {
                 $this->randomState .= getmypid();
             }
         }
         for ($i = 0; $i < $count; $i += 16) {
             $this->randomState = md5(microtime() . $this->randomState);
             if (PHP_VERSION >= '5') {
                 $bytes .= md5($this->randomState, true);
             } else {
                 $bytes .= pack('H*', md5($this->randomState));
             }
         }
         $bytes = substr($bytes, 0, $count);
     }
     return $bytes;
 }
示例#2
1
function verifyTiezi_send($uid, $tid, $pid, $water = 'StusGame Tieba Cloud Sign Plugin "verifyTiezi"', $device = 4)
{
    if (empty($uid) || empty($tid) || empty($pid)) {
        return array('status' => '1', 'msg' => '');
    }
    $ck = misc::GetCookie($pid);
    $xs = verifyTiezi_gettie($tid, $ck);
    $x = array('BDUSS' => $ck, '_client_id' => 'wappc_136' . rand_int(10) . '_' . rand_int(3), '_client_type' => $device, '_client_version' => '5.0.0', '_phone_imei' => md5(rand_int(16)), 'anonymous' => '0', 'content' => $water, 'fid' => $xs['fid'], 'kw' => $xs['word'], 'net_type' => '3', 'tbs' => $xs['tbs'], 'tid' => $tid, 'title' => '');
    $y = '';
    foreach ($x as $key => $value) {
        $y .= $key . '=' . $value;
    }
    $x['sign'] = strtoupper(md5($y . 'tiebaclient!!!'));
    $c = new wcurl('http://c.tieba.baidu.com/c/c/post/add', array('Content-Type: application/x-www-form-urlencoded'));
    /* //Note:普通的
    	$x = verifyTiezi_gettie($tid,$ck);
    	$c = new wcurl('http://tieba.baidu.com'.$x['__formurl']);
    	unset($x['__formurl']);
    	$x['co'] = $water;
    	*/
    $c->addcookie('BDUSS=' . $ck);
    $return = json_decode($c->post($x), true);
    $c->close();
    if (!empty($return['error_code']) && $return['error_code'] != '1') {
        return array('status' => $return['error_code'], 'msg' => $return['error_msg']);
    } else {
        return array('status' => '1', 'msg' => '');
    }
}
示例#3
0
 public function getMethod($address, $total)
 {
     $this->load->language('payment/alipay_direct');
     $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $this->config->get('pp_standard_geo_zone_id') . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')");
     if ($this->config->get('alipay_direct_total') > $total) {
         $status = false;
     } elseif (!$this->config->get('alipay_direct_geo_zone_id')) {
         $status = true;
     } elseif ($query->num_rows) {
         $status = true;
     } else {
         $status = false;
     }
     //判断是否移动设备访问
     $this->load->helper('mobile');
     if (is_mobile()) {
         $status = false;
     }
     $currencies = array('CNY');
     if (!in_array(strtoupper($this->currency->getCode()), $currencies)) {
         $status = false;
     }
     $method_data = array();
     if ($status) {
         $method_data = array('code' => 'alipay_direct', 'title' => $this->language->get('text_title'), 'terms' => '', 'sort_order' => $this->config->get('alipay_direct_sort_order'));
     }
     return $method_data;
 }
 /**
  * Render the information header for the view
  * 
  * @param string $title
  * @param string $title
  */
 public function writeInfo($title, $subtitle, $description = false)
 {
     echo wordwrap(strtoupper($title), 100) . "\n";
     echo wordwrap($subtitle, 100) . "\n";
     echo str_repeat('-', min(100, max(strlen($title), strlen($subtitle)))) . "\n";
     echo wordwrap($description, 100) . "\n\n";
 }
示例#5
0
function get_group_names()
{
    if (!isset($GLOBALS['TT2_GNAMES'])) {
        $sql = "SELECT `groups` FROM `user` WHERE `is_closed` = 0 ";
        $groupstring = '|';
        if ($data = get_data($sql)) {
            foreach ($data as $item) {
                if (strlen(trim($item['groups'])) > 1) {
                    $groupstring = $groupstring . strtoupper($item['groups']) . '|';
                }
            }
        }
        if ($groupstring == '|') {
            $groups = null;
        } else {
            $groups = explode('|', trim($groupstring, '|'));
        }
        $groups = array_unique($groups);
        foreach ($groups as $k => $v) {
            if (strlen(trim($v)) < 1) {
                unset($groups[$k]);
            }
        }
        $GLOBALS['TT2_GNAMES'] = $groups;
    }
    return $GLOBALS['TT2_GNAMES'];
}
示例#6
0
function smarty_block_form($params, $content, &$smarty, $repeat)
{
    if (!empty($content)) {
        // set default output vars
        $data = array('search_id' => FALSE, 'submit_token_id' => FALSE, 'class' => '', 'content' => $content, 'method' => 'post');
        $modules = $smarty->getTemplateVars('modules');
        if (!empty($modules)) {
            $module = '';
            $prefix = 'module=';
            foreach ($modules as $mod) {
                $module .= $prefix . $mod . '&amp;';
                $prefix = 'sub' . $prefix;
            }
        }
        if (isset($params['target'])) {
            $data['action'] = $params['target'];
        } else {
            $access = AccessObject::Instance();
            $pid = $access->getPermission($modules, $params['controller'], $params['action']);
            $data['action'] = '/?pid=' . $pid . '&' . $module . 'controller=' . $params['controller'] . '&amp;action=' . $params['action'];
        }
        if (isset($params['subfunction'])) {
            $data['action'] .= '&amp;subfunction=' . $params['subfunction'];
            if (isset($params['subfunctionaction'])) {
                $data['action'] .= '&amp;subfunctionaction=' . $params['subfunctionaction'];
            }
        }
        if (isset($params['id'])) {
            $data['action'] .= '&amp;id=' . $params['id'];
        }
        foreach ($params as $name => $value) {
            if ($name[0] === '_') {
                $data['action'] .= '&amp;' . substr($name, 1) . '=' . $value;
            }
        }
        if (isset($params['additional_data'])) {
            foreach ($params['additional_data'] as $name => $value) {
                $data['action'] .= '&amp;' . $name . '=' . $value;
            }
        }
        if (isset($params['class'])) {
            $data['class'] = $params['class'];
        }
        $data['original_action'] = $smarty->getTemplateVars('action');
        if (isset($_GET['search_id'])) {
            $data['search_id'] = $_GET['search_id'];
        }
        // there are some instances where we don't want the submit token
        if (strtoupper($params['submit_token']) !== 'FALSE') {
            $data['submit_token_id'] = uniqid();
            $_SESSION['submit_token'][$data['submit_token_id']] = TRUE;
        }
        $data['display_tags'] = !isset($params['notags']);
        if (isset($params['form_id'])) {
            $data['form_id'] = $params['form_id'];
        }
        // fetch smarty plugin template
        return smarty_plugin_template($smarty, $data, 'block.form');
    }
}
示例#7
0
 function MetaType($t, $len = -1)
 {
     if (is_object($t)) {
         $fieldobj = $t;
         $t = $fieldobj->type;
         $len = $fieldobj->max_length;
     }
     switch (strtoupper($t)) {
         case 'C':
             if ($len <= $this->blobSize) {
                 return 'C';
             }
         case 'M':
             return 'X';
         case 'D':
             return 'D';
         case 'T':
             return 'T';
         case 'L':
             return 'L';
         case 'I':
             return 'I';
         default:
             return 'N';
     }
 }
 public function execute(CommandSender $sender, array $args)
 {
     if (count($args) !== 1) {
         return false;
     }
     $player = $sender->getServer()->getPlayer($sender->getName());
     $biome = strtoupper($args[0]);
     $plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
     if ($plot === null) {
         $sender->sendMessage(TextFormat::RED . "You are not standing on an island");
         return true;
     }
     if ($plot->owner !== $sender->getName()) {
         $sender->sendMessage(TextFormat::RED . "You are not the owner of this island");
         return true;
     }
     if (!isset($this->biomes[$biome])) {
         $sender->sendMessage(TextFormat::RED . "That biome doesn't exist");
         $biomes = implode(", ", array_keys($this->biomes));
         $sender->sendMessage(TextFormat::RED . "The possible biomes are: {$biomes}");
         return true;
     }
     $biome = Biome::getBiome($this->biomes[$biome]);
     if ($this->getPlugin()->setPlotBiome($plot, $biome)) {
         $sender->sendMessage(TextFormat::GREEN . "Changed the island biome");
     } else {
         $sender->sendMessage(TextFormat::RED . "Could not change the island biome");
     }
     return true;
 }
示例#9
0
 public function __construct()
 {
     global $cookie;
     $lang = strtoupper(Language::getIsoById($cookie->id_lang));
     $this->className = 'Configuration';
     $this->table = 'configuration';
     /* Collect all font files and build array for combo box */
     $fontFiles = scandir(_PS_FPDF_PATH_ . 'font');
     $fontList = array();
     $arr = array();
     foreach ($fontFiles as $file) {
         if (substr($file, -4) == '.php' and $file != 'index.php') {
             $arr['mode'] = substr($file, 0, -4);
             $arr['name'] = substr($file, 0, -4);
             array_push($fontList, $arr);
         }
     }
     /* Collect all encoding map files and build array for combo box */
     $encodingFiles = scandir(_PS_FPDF_PATH_ . 'font/makefont');
     $encodingList = array();
     $arr = array();
     foreach ($encodingFiles as $file) {
         if (substr($file, -4) == '.map') {
             $arr['mode'] = substr($file, 0, -4);
             $arr['name'] = substr($file, 0, -4);
             array_push($encodingList, $arr);
         }
     }
     $this->_fieldsPDF = array('PS_PDF_ENCODING_' . $lang => array('title' => $this->l('Encoding:'), 'desc' => $this->l('Encoding for PDF invoice'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => $encodingList), 'PS_PDF_FONT_' . $lang => array('title' => $this->l('Font:'), 'desc' => $this->l('Font for PDF invoice'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => $fontList));
     parent::__construct();
 }
示例#10
0
 private function calculate($complexity, $bgst)
 {
     //THE FORMULA STEP BY STEP CALCULATION
     //1) Material Expense
     //already submitted when declaring object
     //2) Indirect Material Expense
     $this->indirect_material_expense = $bgst['cogs_matexp_indirect'] / 100 * $this->material_expense;
     //3) Cost based on Products Complexity
     if (strlen($complexity) > 1) {
         $complexity = substr($complexity, 0, 1);
     }
     $complexity = strtoupper($complexity);
     $this->cost_based_on_complexity = $bgst['cogs_complexity_' . $complexity];
     //4) Variable Cost
     $this->cost_variable = $bgst['cogs_variable'];
     //5) Fixed Cost
     $this->cost_fixed = $bgst['cogs_fixed'];
     //Sum Point 1-5
     $sum_1to5 = $this->material_expense + $this->indirect_material_expense + $this->cost_based_on_complexity + $this->cost_variable + $this->cost_fixed;
     //6) Handling Cost
     $this->cost_handling = $bgst['cogs_handling'] / 100 * $sum_1to5;
     //FINALLY, COGS
     $cogs = $sum_1to5 + $this->cost_handling;
     $this->value = round($cogs, 2);
     //Purchase Price from cogs
     $this->purchase_price = $this->value * $bgst['cogs_purchase_price_multiplier'];
 }
示例#11
0
 /**
  * @param string $sIncCapa
  * @param bool $bForce = false
  * @return bool
  */
 public function IsSupported($sIncCapa, $bForce = false)
 {
     if (null === $this->aCapa || $bForce) {
         $sTag = $this->getNextTag();
         if ($this->WriteLine($sTag . ' CAPABILITY')) {
             $sResponse = $this->GetResponse($sTag);
             if ($this->CheckResponse($sTag, $sResponse)) {
                 $this->aCapa = array();
                 $aCapasLineArray = explode("\n", $sResponse);
                 foreach ($aCapasLineArray as $sCapasLine) {
                     $sCapa = strtoupper(trim($sCapasLine));
                     if (substr($sCapa, 0, 12) === '* CAPABILITY') {
                         $sCapa = substr($sCapa, 12);
                         $aArray = explode(' ', $sCapa);
                         foreach ($aArray as $sSubLine) {
                             if (strlen($sSubLine) > 0) {
                                 $this->aCapa[] = $sSubLine;
                             }
                         }
                     }
                 }
             }
         }
     }
     return is_array($this->aCapa) && in_array($sIncCapa, $this->aCapa);
 }
 /**
  * Constructor.
  *
  * @param callable|object $classLoader Passing an object is @deprecated since version 2.5 and support for it will be removed in 3.0
  */
 public function __construct($classLoader)
 {
     $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
     if ($this->wasFinder) {
         @trigger_error('The ' . __METHOD__ . ' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
         $this->classLoader = array($classLoader, 'loadClass');
         $this->isFinder = true;
     } else {
         $this->classLoader = $classLoader;
         $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
     }
     if (!isset(self::$caseCheck)) {
         $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
         $i = strrpos($file, DIRECTORY_SEPARATOR);
         $dir = substr($file, 0, 1 + $i);
         $file = substr($file, 1 + $i);
         $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
         $test = realpath($dir . $test);
         if (false === $test || false === $i) {
             // filesystem is case sensitive
             self::$caseCheck = 0;
         } elseif (substr($test, -strlen($file)) === $file) {
             // filesystem is case insensitive and realpath() normalizes the case of characters
             self::$caseCheck = 1;
         } elseif (false !== stripos(PHP_OS, 'darwin')) {
             // on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
             self::$caseCheck = 2;
         } else {
             // filesystem case checks failed, fallback to disabling them
             self::$caseCheck = 0;
         }
     }
 }
示例#13
0
function name_case($name)
{
    $newname = strtoupper($name[0]);
    for ($i = 1; $i < strlen($name); $i++) {
        $subed = substr($name, $i, 1);
        if (ord($subed) > 64 && ord($subed) < 123 || ord($subed) > 48 && ord($subed) < 58) {
            $word_check = substr($name, $i - 2, 2);
            if (!strcasecmp($word_check, 'Mc') || !strcasecmp($word_check, "O'")) {
                $newname .= strtoupper($subed);
            } else {
                if ($break) {
                    $newname .= strtoupper($subed);
                } else {
                    $newname .= strtolower($subed);
                }
            }
            $break = 0;
        } else {
            // not a letter - a boundary
            $newname .= $subed;
            $break = 1;
        }
    }
    return $newname;
}
示例#14
0
 /**
  * @param $test
  * @param $expected
  *
  * @dataProvider providerPlurals
  */
 public function testAutomaticCapitalCasing($test, $expected)
 {
     $test = strtoupper($test);
     $expected = strtoupper($expected);
     $pluralize = new Pluralize();
     $this->assertEquals($expected, $pluralize->fix($test));
 }
示例#15
0
 public function checkSign($callbackParams)
 {
     $string = $callbackParams['action'] . ';' . $callbackParams['orderSumAmount'] . ';' . $callbackParams['orderSumCurrencyPaycash'] . ';' . $callbackParams['orderSumBankPaycash'] . ';' . $callbackParams['shopId'] . ';' . $callbackParams['invoiceId'] . ';' . $callbackParams['customerNumber'] . ';' . $this->password;
     $md5 = strtoupper(md5($string));
     $this->log_save('kassa: sign ' . ($callbackParams['md5'] == $md5) . ' ' . $callbackParams['md5'] . ' ' . $md5);
     return $callbackParams['md5'] == $md5;
 }
示例#16
0
 public function actionRedeem()
 {
     $cart = $this->getCart();
     $promocode = strtoupper(Yii::app()->request->getPost("coupon", null));
     if (!$promocode || $promocode === "") {
         throw new CHttpException(400, 'The request is invalid.');
     }
     $coupon_array = array();
     if ($promocode === "FALL14") {
         Yii::app()->session['applicable_rebate'] = 0.15;
         Yii::app()->session['promocode'] = "FALL14";
         // Apply the coupon to items already in the cart
         $itemsInCart = OrderHasProduct::model()->findAll("order_id=:order_id", array(":order_id" => $cart->id));
         foreach ($itemsInCart as $relationship) {
             $relationship->price_paid = $relationship->product->getCurrentPrice();
             $relationship->save();
         }
         // Build a json array that could be used by our
         $coupon_array["valid"] = true;
         $coupon_array["code"] = Yii::app()->session['promocode'];
         $coupon_array["expired"] = false;
         $coupon_array["type"] = "percent";
         $coupon_array["details"] = array("rebate" => Yii::app()->session['applicable_rebate'] * 100);
     } else {
         $coupon_array["valid"] = false;
     }
     $this->renderJSON($coupon_array);
 }
示例#17
0
 function getarchiveOptions($order = 'DESC', $limit = '', $show_post_count = false, $showMonths = true)
 {
     $order = strtoupper($order);
     $collection = Mage::getModel('gallery/gallery')->getCollection()->addFieldToFilter('status', 3)->setOrder('created_time', $order);
     $collection->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns('heading');
     if ($showMonths) {
         $collection->getSelect()->group(array('YEAR(created_time)', 'MONTH(created_time)'));
     } else {
         $collection->getSelect()->group(array('YEAR(created_time)'));
     }
     if ('' != $limit) {
         $collection->limit($limit);
     }
     //$collection->printLogQuery(true);die;
     $output = '';
     $route = Mage::helper('gallery')->getRoute('archive');
     foreach ($collection as $item) {
         $tm = mktime(0, 0, 0, $item->month, 1, $item->year);
         if ($showMonths) {
             $url = $route . "/y/" . $item->year . "/m/" . $item->month;
             $text = date('F Y', $tm);
         } else {
             $url = $route . "/y/" . $item->year;
             $text = date('Y', $tm);
         }
         $after = "";
         if ($show_post_count) {
             $after = '&nbsp;(' . $item->posts . ')';
         }
         $output .= "<div class='nav_link'><a href='" . $url . "'>" . $text . " " . $after . "</a></div>";
     }
     return $output;
 }
示例#18
0
 private function initFilters($limit)
 {
     //pageing
     $selectedFilterPage = 1;
     if (isset(NGS()->args()->pg)) {
         $selectedFilterPage = intval(NGS()->args()->pg);
     }
     $this->addParam('selectedFilterPage', $selectedFilterPage);
     $offset = 0;
     if ($selectedFilterPage > 1) {
         $offset = ($selectedFilterPage - 1) * intval($limit);
     }
     //sorting
     $sortByFields = $this->getSortByFields();
     $this->addParam('sortFields', $sortByFields);
     $selectedFilterSortBy = 0;
     if (isset(NGS()->args()->srt)) {
         if (array_key_exists(NGS()->args()->srt, $sortByFields)) {
             $selectedFilterSortBy = NGS()->args()->srt;
         }
     }
     $selectedFilterSortByAscDesc = 'ASC';
     if (isset(NGS()->args()->ascdesc)) {
         if (in_array(strtoupper(NGS()->args()->ascdesc), ['ASC', 'DESC'])) {
             $selectedFilterSortByAscDesc = strtoupper(NGS()->args()->ascdesc);
         }
     }
     $this->addParam('selectedFilterSortByAscDesc', $selectedFilterSortByAscDesc);
     $this->addParam('selectedFilterSortBy', $selectedFilterSortBy);
     return [$offset, $selectedFilterSortBy, $selectedFilterSortByAscDesc];
 }
示例#19
0
 /**
  * Retrieve Indexes(s) for Flat
  *
  * @return array
  */
 public function getFlatIndexes()
 {
     $indexes = array();
     $index = 'IDX_' . strtoupper($this->getAttribute()->getAttributeCode());
     $indexes[$index] = array('type' => 'index', 'fields' => array($this->getAttribute()->getAttributeCode()));
     return $indexes;
 }
示例#20
0
 /**
  * Set related list information between other module
  * @param Vtiger_Module Instance of target module with which relation should be setup
  * @param String Label to display in related list (default is target module name)
  * @param Array List of action button to show ('ADD', 'SELECT')
  * @param String Callback function name of this module to use as handler
  *
  * @internal Creates table vtiger_crmentityrel if it does not exists
  */
 function setRelatedList($moduleInstance, $label = '', $actions = false, $function_name = 'get_related_list')
 {
     $adb = PearDatabase::getInstance();
     if (empty($moduleInstance)) {
         return;
     }
     if (empty($label)) {
         $label = $moduleInstance->name;
     }
     $result = $adb->pquery("SELECT relation_id FROM vtiger_relatedlists WHERE tabid=? AND related_tabid = ? AND name = ? AND label = ?;", array($this->id, $moduleInstance->id, $function_name, $label));
     if ($adb->num_rows($result) > 0) {
         self::log("Setting relation with {$moduleInstance->name} [{$useactions_text}] ... Error, the related module already exists");
         return;
     }
     $relation_id = $this->__getRelatedListUniqueId();
     $sequence = $this->__getNextRelatedListSequence();
     $presence = 0;
     // 0 - Enabled, 1 - Disabled
     // Allow ADD action of other module records (default)
     if ($actions === false) {
         $actions = array('ADD');
     }
     $useactions_text = $actions;
     if (is_array($actions)) {
         $useactions_text = implode(',', $actions);
     }
     $useactions_text = strtoupper($useactions_text);
     $adb->pquery("INSERT INTO vtiger_relatedlists(relation_id,tabid,related_tabid,name,sequence,label,presence,actions) VALUES(?,?,?,?,?,?,?,?)", array($relation_id, $this->id, $moduleInstance->id, $function_name, $sequence, $label, $presence, $useactions_text));
     self::log("Setting relation with {$moduleInstance->name} [{$useactions_text}] ... DONE");
 }
 function show_analyse($tree = "")
 {
     if ($tree == "") {
         $tree = $this->tree;
     }
     foreach ($tree as $elem) {
         if ($elem->start_with == 0) {
             //PubMed veut ses opérateurs en MAJ
             if ($elem->operator) {
                 $r .= " " . strtoupper($elem->operator) . " ";
             }
             $r .= "(";
             if ($elem->not) {
                 $r .= "not";
             }
             if ($elem->sub == null) {
                 if ($elem->literal) {
                     $r .= "\"";
                 }
                 $r .= $elem->word;
                 if ($elem->literal) {
                     $r .= "\"";
                 }
                 if ($elem->not) {
                     $r .= ")";
                 }
                 $r .= $this->field;
             } else {
                 $r .= "( " . $this->show_analyse($elem->sub) . ") ";
             }
             $r .= ")";
         }
     }
     return $r;
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $state = $this->getState();
     $mode = $input->getArgument('mode');
     $stateName = 'system.maintenance_mode';
     $modeMessage = null;
     $cacheRebuild = true;
     if ('ON' === strtoupper($mode)) {
         $state->set($stateName, true);
         $modeMessage = 'commands.site.maintenance.messages.maintenance-on';
     }
     if ('OFF' === strtoupper($mode)) {
         $state->set($stateName, false);
         $modeMessage = 'commands.site.maintenance.messages.maintenance-off';
     }
     if ($modeMessage === null) {
         $modeMessage = 'commands.site.maintenance.errors.invalid-mode';
         $cacheRebuild = false;
     }
     $io->info($this->trans($modeMessage));
     if ($cacheRebuild) {
         $this->getChain()->addCommand('cache:rebuild', ['cache' => 'all']);
     }
 }
示例#23
0
文件: create.php 项目: rhertzog/lcs
function maj_vieille_base_1927_create() {
  global $tables_principales, $tables_auxiliaires, $tables_images, $tables_sequences, $tables_documents, $tables_mime;

	// ne pas revenir plusieurs fois (si, au contraire, il faut pouvoir
	// le faire car certaines mises a jour le demandent explicitement)
	# static $vu = false;
	# if ($vu) return; else $vu = true;

	foreach($tables_principales as $k => $v)
		spip_create_vieille_table($k, $v['field'], $v['key'], true);

	foreach($tables_auxiliaires as $k => $v)
		spip_create_vieille_table($k, $v['field'], $v['key'], false);

	foreach($tables_images as $k => $v)
		sql_query("INSERT IGNORE INTO spip_types_documents (extension, inclus, titre, id_type) VALUES ('$k', 'image', '" .
			      (is_numeric($v) ?
			       (strtoupper($k) . "', $v") :
			       "$v', 0") .
			      ")");

	foreach($tables_sequences as $k => $v)
		sql_query("INSERT IGNORE INTO spip_types_documents (extension, titre, inclus) VALUES ('$k', '$v', 'embed')");

	foreach($tables_documents as $k => $v)
		sql_query("INSERT IGNORE INTO spip_types_documents (extension, titre, inclus) VALUES ('$k', '$v', 'non')");

	foreach ($tables_mime as $extension => $type_mime)
	  sql_query("UPDATE spip_types_documents
		SET mime_type='$type_mime' WHERE extension='$extension'");
}
示例#24
0
 function load()
 {
     $this->values = array();
     if (JRequest::getCmd('from_display', false) == false) {
         $this->values[] = JHTML::_('select.option', '', JText::_('HIKA_INHERIT'));
     }
     $this->values[] = JHTML::_('select.optgroup', '-- ' . JText::_('FROM_HIKASHOP') . ' --');
     foreach ($this->default as $d) {
         $this->values[] = JHTML::_('select.option', $d, JText::_(strtoupper($d)));
     }
     if (version_compare(JVERSION, '1.6.0', '>=')) {
         $this->values[] = JHTML::_('select.optgroup', '-- ' . JText::_('FROM_HIKASHOP') . ' --');
     }
     $closeOpt = '';
     $values = $this->getLayout();
     foreach ($values as $value) {
         if (substr($value, 0, 1) == '#') {
             if (version_compare(JVERSION, '1.6.0', '>=') && !empty($closeOpt)) {
                 $this->values[] = JHTML::_('select.optgroup', $closeOpt);
             }
             $value = substr($value, 1);
             $closeOpt = '-- ' . JText::sprintf('FROM_TEMPLATE', basename($value)) . ' --';
             $this->values[] = JHTML::_('select.optgroup', $closeOpt);
         } else {
             $this->values[] = JHTML::_('select.option', $value, $value);
         }
     }
     if (version_compare(JVERSION, '1.6.0', '>=') && !empty($closeOpt)) {
         $this->values[] = JHTML::_('select.optgroup', $closeOpt);
     }
 }
示例#25
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     JHtml::_('jquery.framework');
     NNFrameworkFunctions::addScriptVersion(JUri::root(true) . '/media/nnframework/js/script.min.js');
     if ($file = $this->get('file')) {
         $label = $this->get('label', 'the main extension');
         NNFieldDependency::setMessage($file, $label);
         return '';
     }
     $path = $this->get('path') == 'site' ? '' : '/administrator';
     $label = $this->get('label');
     $file = $this->get('alias', $label);
     $file = preg_replace('#[^a-z-]#', '', strtolower($file));
     $extension = $this->get('extension');
     switch ($extension) {
         case 'com':
             $file = $path . '/components/com_' . $file . '/com_' . $file . '.xml';
             break;
         case 'mod':
             $file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml';
             break;
         case 'plg_editors-xtd':
             $file = '/plugins/editors-xtd/' . $file . '.xml';
             break;
         default:
             $file = '/plugins/system/' . $file . '.xml';
             break;
     }
     $label = JText::_($label) . ' (' . JText::_('NN_' . strtoupper($extension)) . ')';
     NNFieldDependency::setMessage($file, $label);
     return '';
 }
 function Header()
 {
     //Logo
     //$this->Image('logo_pb.png',10,8,33);
     //Arial bold 15
     $this->Image('../images/ebpls_logo.jpg', 10, 8, 33);
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(340, 5, 'Republic of the Philippines', 0, 1, 'C');
     /* =====================================================================
     frederick >>> change this.  SEE correction made on line# 116 & 118
     also added the words "Province of & MUNICIPALITY OF"
     	$this->Cell(340,5,$this->lgu,0,1,'C');
     	$this->Cell(340,5,$this->prov,0,2,'C');
     =========================================================================*/
     $this->Cell(340, 5, 'Province of ' . $this->prov, 0, 1, 'C');
     $this->Cell(340, 5, 'MUNICIPALITY OF  ' . strtoupper($this->lgu), 0, 2, 'C');
     $this->SetFont('Arial', 'B', 14);
     $this->Cell(340, 5, $this->office, 0, 2, 'C');
     $this->Cell(340, 5, '', 0, 2, 'C');
     $this->SetFont('Arial', 'B', 16);
     $this->Cell(340, 5, 'ANNUAL COMPARATIVE STATEMENT OF BUSINESS ESTABLISHMENTS', 0, 1, 'C');
     $this->SetFont('Arial', 'B', 14);
     $this->Cell(340, 5, 'REGISTERED AND RENEWED', 0, 1, 'C');
     $this->SetFont('Arial', 'B', 14);
     $this->Cell(340, 5, 'FOR THE YEARS ' . $this->yearnow . ', ' . $this->yearnext . ' & ' . $this->yearnextnext, 0, 1, 'C');
     $this->SetFont('Arial', 'BU', 12);
     $this->Ln(22);
 }
示例#27
0
 /**
  * Tests invalid data.
  */
 public function testInvalidDates()
 {
     $composer = new Composer();
     // Invalid date/time parts
     $units = array('second' => array(-1, 61, '-1', '61'), 'minute' => array(-1, 61, '-1', '61'), 'hour' => array(-1, 24, '-1', '24'), 'day' => array(0, 32, '0', '32'), 'month' => array(0, 13, '0', '13'), 'year' => array(1901, 2038, '1901', '2038'));
     foreach ($units as $unit => $tests) {
         foreach ($tests as $test) {
             try {
                 $composer->{'set' . ucfirst($unit)}($test);
             } catch (\Exception $e) {
                 $this->assertInstanceOf('\\Jyxo\\Time\\ComposerException', $e);
                 $this->assertSame(constant('\\Jyxo\\Time\\ComposerException::' . strtoupper($unit)), $e->getCode(), sprintf('Failed test for unit %s and value %s.', $unit, $test));
             }
         }
     }
     // Incomplete date
     try {
         $date = $composer->getTime();
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\Jyxo\\Time\\ComposerException', $e);
         $this->assertSame(ComposerException::NOT_COMPLETE, $e->getCode());
     }
     // Invalid dates
     $tests = array('2002-04-31', '2003-02-29', '2004-02-30', '2005-06-31', '2006-09-31', '2007-11-31');
     foreach ($tests as $test) {
         try {
             list($year, $month, $day) = explode('-', $test);
             $composer->setDay($day)->setMonth($month)->setYear($year);
             $time = $composer->getTime();
         } catch (\Exception $e) {
             $this->assertInstanceOf('\\Jyxo\\Time\\ComposerException', $e);
             $this->assertSame(ComposerException::INVALID, $e->getCode(), sprintf('Failed test for %s.', $test));
         }
     }
 }
示例#28
0
function printevent($record, $prettydate)
{
    print "\n" . strtoupper($record["title"]) . "\n";
    $again = repeatfirstinstance($record, $prettydate);
    if ($again) {
        print "See {$again[date]} for details\n";
    } else {
        print hmmpm($record["eventtime"]) . "\n";
        if ($record["locname"]) {
            print "{$record[locname]}, {$record[address]}\n";
        } else {
            print "{$record[address]}\n";
        }
        print wordwrap($record["printdescr"], 68) . "\n";
        if (!$record["hideemail"]) {
            $email = preg_replace("/@/", " at ", $record["email"]);
            $email = preg_replace("/\\./", " dot ", $email);
            if ($record["weburl"] != "") {
                print "{$email}, {$record[weburl]}\n";
            } else {
                print "{$email}\n";
            }
        } else {
            if ($record["weburl"] != "") {
                print "{$record[weburl]}\n";
            }
        }
    }
}
 /**
  * Retrieve Indexes(s) for Flat
  *
  * @return array
  */
 public function getFlatIndexes()
 {
     $indexes = array();
     $index = "IDX_" . strtoupper($this->getAttribute()->getAttributeCode());
     $indexes[$index] = array("type" => "index", "fields" => array($this->getAttribute()->getAttributeCode()));
     return $indexes;
 }
示例#30
0
 public function loadModule($module)
 {
     if (!isset($_GET['module'])) {
         if (isset($_GET["r"])) {
             $d = explode("/", $_GET["r"]);
             if (count($d) != 2) {
                 echo "Invalid R parameters";
                 exit;
             } else {
                 if ($d[0] != "" && $d[1] != "") {
                     $this->default_controller = $d[0];
                     $this->default_view = $d[1];
                 }
             }
         }
         $this->default_controller = $this->default_controller . "Controller";
         $this->default_controller[0] = strtoupper($this->default_controller[0]);
         require_once "app/controllers/" . $this->default_controller . ".php";
         $controller = new $this->default_controller();
         $method = $this->default_view . "Action";
         if (method_exists($controller, $method)) {
             $data = call_user_method($method, $controller);
         } else {
             echo "<b>" . $method . "</b> not found in " . $this->default_controller;
         }
     } else {
     }
 }