public function on_ADDhang_Pc() { $argv = $this->argv(); $argc = count($argv); if ($argc === 1) { $hang_word = strtolower($argv[0]); $iso = Dog::getChannel()->getLangISO(); } elseif ($argc === 2) { $hang_word = strtolower($argv[0]); $iso = strtolower($argv[1]); } else { return $this->showHelp('+hang'); } if (GWF_String::strlen($hang_word) < 6 || GWF_String::strlen($hang_word) > 30) { return $this->rply('err_wordlen', array(6, 30)); } if (!preg_match('/^\\p{L}+$/Dui', $hang_word)) { return $this->rply('err_alpha'); } if (false !== ($word = Hangman_Words::getByWord($hang_word))) { return $this->rply('err_dup'); } if (false === ($word = Hangman_Words::insertWord($hang_word, $iso))) { return Dog::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $this->rply('msg_added', array($hang_word, $word->getID())); }
public static function user($user, $message) { if ($user !== false) { $server = $user->getServer(); if ($server->isLogging()) { $host = GWF_String::remove($server->getHost(), '/', '!'); $nickname = GWF_String::remove($user->getName(), '/', '!'); GWF_Log::rawLog("dog/{$host}/user/{$nickname}", $message); GWF_Log::flush(); } } }
public static function validate_other(Module_Helpdesk $m, $arg) { $len = GWF_String::strlen($arg); if ($len < 2) { return $m->lang('err_no_other'); } $maxlen = $m->cfgMaxTitleLen(); if ($len > $maxlen) { return $m->lang('err_other_len', array($maxlen)); } return false; }
public function validate_site_classname(Module_WeChall $m, $arg) { if (false !== WC_Site::getByClassName($arg)) { return $m->lang('err_classname_dup'); } $max = $m->cfgMaxSitenameLen(); if (1 !== preg_match('/^[a-z][a-z0-9_]+$/iD', $arg)) { return $m->lang('err_site_classname', array(1, $max)); } $len = GWF_String::strlen($arg); if ($len < 1 || $len > $max) { return $m->lang('err_site_classname', array(1, $max)); } return false; }
/** * * @param string $user the username * @param string|char $message the guess * @return the answer */ public function onGuess($user, $message) { $message = trim($message); if ($this->finish) { if ($message === 'false') { $this->CONFIG['solution_allowed_everytime'] = false; } $iso = Common::substrFrom($message, ' ', Dog::getChannel()->getLangISO()); $this->onStartGame($iso); } elseif ($message === '') { $this->sendOutput('The game has already started'); } else { if (GWF_String::strlen($message) !== 1) { $this->trySolution($user, $message); } else { $this->tryChar($user, $message); } if (GWF_String::toLower($this->grid) === GWF_String::tolower($this->solution)) { $this->winGame($nick); } } return $this->clearOutput(); }
<div> <?php echo SSYHTML::getBoxTitled($tLang->lang('soft_2_title'), $tLang->lang('soft_2_info')); #echo SSYHTML::softwareBoxFromID($tLang, 2) ?> <span class="t" style=""> <span class="ssy800v_R ssy_st_out3"> <span class="ssy_small_softbox"> <?php foreach ($tLang->lang('soft_2_3') as $txt) { echo sprintf('<a href="#">%s</a>', $txt); } ?> </span> <span class="ssy_st_out3_t ssy800h"><?php echo GWF_String::toUpper($tLang->lang('soft_2_title')); ?> </span> <span class="ssy800v ssy_st_out2"> <span class="ssy800v_R ssy_st_out1"> </span> </span> </span> </span> </div>
<?php echo SSYHTML::getBoxTitled($tLang->lang('soft2_title'), $tLang->lang('soft2_info')); ?> <div class="le" style="margin: 30px 10px 10px 20px;"> <?php for ($i = 1; $i <= 3; $i++) { $head = GWF_String::toUpper($tLang->lang('soft_busi_' . $i . 'a')); $sub = $tLang->lang('soft_busi_' . $i . 'b'); $txt = $tLang->lang('soft_busi_' . $i . 'c'); echo sprintf('<div style="font-size: 18px; margin-bottom: 20px; margin-top: 40px; margin-left: 50px;">%s</div>', $head); echo sprintf('<div style="font-size:16px; margin-top:20px;">%s</div>', $sub); echo '<div class="ssy1024h" style="height:2px; margin-right: 20%; margin-top: 4px; margin-bottom:8px;" ></div>'; echo sprintf('<div style="font-size: 14px; margin-left: 40px; margin-right: 20%%;">%s</div>', $txt); } ?> </div>
public static function validateClassname($m, $key, $arg, $min = 0, $max = 63, $unset = true) { $_POST[$key] = $arg = trim($arg); $len = GWF_String::strlen($arg); if ($len < $min || $len > $max || 0 === preg_match('/^[a-zA-Z][A-Za-z_0-9]+$/D', $arg)) { if ($unset) { $_POST[$key] = ''; } return $m->lang('err_' . $key, array($min, $max)); } return false; }
public function validate_message(Module_Guestbook $m, $arg) { $arg = $_POST['message'] = trim($arg); $len = GWF_String::strlen($arg); $max = $m->cfgMaxMessageLen(); if ($len < 1 || $len > $max) { return $m->lang('err_gbm_message', 1, $max); } return false; }
public function validate_opt(Module_Votes $m, $arg) { if ($this->checked_opt) { return false; } $this->checked_opt = true; $opts = Common::getPostArray('opt', array()); $post = array(); $min = $this->module->cfgMinOptionLen(); $max = $this->module->cfgMaxOptionLen(); $err = ''; foreach ($opts as $i => $op) { $op = trim($op); $i = (int) $i; // # XSS/SQLI escape! // if (!is_numeric($i)) { $i = GWF_HTML::display($i); } $len = GWF_String::strlen($op); if ($len < $min || $len > $max) { $err .= ', ' . $i; } $post[$i] = $op; // $_POST['opt'][$i] = $op; } $_POST['opt'] = $post; $this->onAddOption(false); if ($err === '') { return false; } return $this->module->lang('err_options', array(substr($err, 2), $min, $max)); }
<?php echo SSYHTML::getBoxTitled($tLang->lang('soft_title'), $tLang->lang('soft_info')); ?> <div class="le" style="margin: 30px 10px 10px 20px;"> <div style="font-size: 18px; margin-bottom: 20px; margin-left: 50px;"><?php echo GWF_String::toUpper($tLang->lang('all_soft_1')); ?> </div> <?php for ($i = 2; $i <= 4; $i++) { echo sprintf('<div style="font-size:16px; margin-top:20px;">%s</div>', $tLang->lang('all_soft_' . $i)); echo '<div class="ssy1024h" style="height:2px; margin-right: 20%; margin-top: 4px; margin-bottom:8px;" ></div>'; $data = $tLang->lang('all_soft_' . $i . 'd'); foreach ($data as $txt) { echo sprintf('<div style="font-size: 14px; margin-left: 40px; margin-right: 20%%;">%s</div>', $txt); } } ?> </div>
<span class="ssy_small_softbox"> <?php $index = Common::clamp(intval(Common::getGet('index')), 1, 5); for ($i = 1; $i <= 5; $i++) { $href = GWF_WEB_ROOT . $tLang->lang('menu_U221') . '/' . $i; echo sprintf('<a href="%s">%s</a>', $href, $tLang->lang('when' . $i . '_title')); } // foreach ($tLang->lang('soft_1_3') as $txt) // { // echo sprintf('<a href="#">%s</a>', $txt); // } ?> </span> <span class="ssy_st_out3_t ssy800h"><?php #echo GWF_String::toUpper($tLang->lang('soft_1_title_2')); echo GWF_String::toUpper($tLang->lang(sprintf('when%d_title', $index))); ?> </span> <span class="ssy800v ssy_st_out2"> <span class="ssy800v_R ssy_st_out1"> <?php echo $tLang->lang(sprintf('when%d_info', $index)); ?> <?php #echo $tLang->lang('when1_info'); ?> <?php #echo $tLang->lang('when2_info'); ?> <?php #echo $tLang->lang('when3_info');
<div> <?php echo SSYHTML::getBoxTitled($tLang->lang('soft_1_title'), $tLang->lang('soft_1_info')); ?> </div> <div class="le" style="margin: 30px 20% 10px 20px;"> <div style="font-size: 18px; margin-bottom: 20px; margin-left: 50px;"><?php echo GWF_String::toUpper($tLang->lang('soft_nachk1')); ?> </div> <?php echo '<div class="ssy1024h" style="height:2px; margin-top: 4px; margin-bottom:8px;" ></div>'; ?> <div style="margin-left: 10px;"> <div style="margin-top: 10px;"><?php echo $tLang->lang('soft_nachk2'); ?> </div> <div><?php echo $tLang->lang('soft_nachk3'); ?> </div> <ul style="margin-top: 10px; margin-left: 40px;"> <?php $data = $tLang->lang('soft_nachk3d'); foreach ($data as $txt) { echo sprintf('<li>%s</li>', $txt); }
private function onSetSlogan(SR_Player $player, $new_slogan) { $pname = $player->getName(); if (false === ($shop = SR_BazarShop::getShop($pname))) { if (false === SR_BazarShop::createShop($pname)) { $player->message('Database error 3!'); return false; } if (false === ($shop = SR_BazarShop::getShop($pname))) { $player->message('Database error 4!'); return false; } } if (GWF_String::strlen($new_slogan) > SR_BazarShop::MAX_SLOGAN_LEN) { $player->message('1117', array(SR_BazarShop::MAX_SLOGAN_LEN)); // $player->message(sprintf('Your new slogan exceeds the max length of %d characters.', SR_BazarShop::MAX_SLOGAN_LEN)); return false; } if (false === $shop->saveVar('sr4bs_message', $new_slogan)) { $player->message('Database error!'); return false; } $player->msg('5159', array($new_slogan)); // $player->message(sprintf('Your slogan has been set to: %s.', $new_slogan)); return true; }
/** * Send a message split into multiple. * @param string $prefix Prefix for all messages. * @param string $message The real message. * @param int $split_len The length for each chunk. */ private function sendSplitted($prefix, $message, $split_len = 420) { $len = strlen($message); if ($len <= $split_len) { return $this->send($prefix . $message); } $i = 0; while ($i < $len) { $to_read = $len - $i; if ($to_read > $split_len) { $j = GWF_String::strrchr($message, ' ', $i + $split_len); if ($j <= $i) { $j = $i + $split_len; } $m = substr($message, $i, $j - $i); $i = $j + 1; $this->send($prefix . $m); } else { $this->send($prefix . substr($message, $i)); $i = $len; } } return true; }
<?php $html = sprintf('%s<br/>%s<br/><ul><li>%s</li><li>%s</li><li>%s</li></ul>', $tLang->lang('soft_3_info'), $tLang->lang('soft_3_infoH'), $tLang->lang('soft_3_info1'), $tLang->lang('soft_3_info2'), $tLang->lang('soft_3_info3')); echo SSYHTML::getBoxTitled($tLang->lang('soft_5_title_2'), $html); ?> <span class="t" style=""> <span class="ssy800v_R ssy_st_out3"> <span class="ssy_small_softbox"> <?php foreach ($tLang->lang('soft_1_3') as $txt) { echo sprintf('<a href="#">%s</a>', $txt); } ?> </span> <span class="ssy_st_out3_t ssy800h"><?php echo GWF_String::toUpper($tLang->lang('soft_5_title_2')); ?> </span> <span class="ssy800v ssy_st_out2"> <span class="ssy800v_R ssy_st_out1"> </span> </span> </span> </span>
<?php $lang = array('en' => array('help' => 'Usage: %CMD% <string here>. Print the length of an utf8 string. See %T%strlen.', 'out' => 'UTF8 Length: %s.')); $plugin = Dog::getPlugin(); if ('' === ($message = $plugin->msg())) { return $plugin->showHelp(); } $plugin->rply('out', array(GWF_String::strlen($message)));
<?php echo SSYHTML::getBoxTitled($tLang->lang('service_0_title'), $tLang->lang('service_0_info')); ?> <span class="t" style=""> <span class="ssy800v_R ssy_st_out3"> <span class="ssy_small_softbox"> <?php /* foreach ($tLang->lang('soft_1_3') as $txt) { echo sprintf('<a href="#">%s</a>', $txt); }*/ ?> </span> <span class="ssy_st_out3_t ssy800h"><?php echo GWF_String::toUpper($tLang->lang('service_0_title')); ?> </span> <span class="ssy800v ssy_st_out2"> <span class="ssy800v_R ssy_st_out1"> </span> </span> </span> </span>
public function validate_foldername($arg) { $_POST['foldername'] = $arg = trim($arg); if (false !== GWF_PMFolder::getByName($arg)) { return $this->lang('err_folder_exists'); } $len = GWF_String::strlen($arg); $max = $this->cfgMaxFolderNameLen(); if ($len < 1 || $len > $max) { return $this->lang('err_folder_len', $max); } return false; }
?> <span class="t" style=""> <span class="ssy800v_R ssy_st_out3"> <span class="ssy_small_softbox"> <?php $keys = $tLang->lang('soft_nachk3_k'); $index = (int) Common::getGet('index', 0); $index = Common::clamp($index, 0, count($keys) - 1); $body = $tLang->lang('soft_nachk3_b'); foreach ($keys as $i => $txt) { $href = GWF_WEB_ROOT . 'nachkalkulation/eisdiele/' . $i; echo sprintf('<a href="%s">%s</a>', $href, $txt); } ?> </span> <span class="ssy_st_out3_t ssy800h"><?php echo GWF_String::toUpper($keys[$index]); ?> </span> <span class="ssy800v ssy_st_out2"> <span class="ssy800v_R ssy_st_out1"> <?php echo $body[$index]; ?> </span> </span> </span> </span> </div>
<?php echo SSYHTML::getBoxTitled($tLang->lang('kunde_0_title'), $tLang->lang('kunde_0_info')); ?> <span class="t" style=""> <span class="ssy800v_R ssy_st_out3"> <span class="ssy_small_softbox"> <?php /* foreach ($tLang->lang('soft_1_3') as $txt) { echo sprintf('<a href="#">%s</a>', $txt); }*/ ?> </span> <span class="ssy_st_out3_t ssy800h"><?php echo GWF_String::toUpper($tLang->lang('kunde_0_title')); ?> </span> <span class="ssy800v ssy_st_out2"> <span class="ssy800v_R ssy_st_out1"> </span> </span> </span> </span>