Example #1
0
function creatureinfo2(&$Row)
{
    global $smarty;
    // Номер создания
    $creature['entry'] = $Row['entry'];
    // Имя создания
    $creature['name'] = localizedName($Row);
    // Заменяем " (1)" на " (героич.)"
    $creature['name'] = str_replace(' (1)', LOCALE_HEROIC, $creature['name']);
    // Подимя создания
    $creature['subname'] = localizedName($Row, 'subname');
    // Min/Max уровни
    $creature['minlevel'] = $Row['minlevel'];
    $creature['maxlevel'] = $Row['maxlevel'];
    // TODO: Месторасположение
    //	$creature['location'] = location($creature['entry'],'creature');
    // TODO: Реакция на фракции
    $creature['react'] = $Row['A'] . ',' . $Row['H'];
    // Тип NPC
    $creature['type'] = $Row['type'];
    // Тег NPC
    $creature['tag'] = str_normalize($Row['subname']);
    // Ранг NPC
    $creature['classification'] = $Row['rank'];
    return $creature;
}
Example #2
0
/**
 * [strUriNormalize description]
 *
 * @param [type]  $str   [description]
 * @param boolean $lower [description]
 * @param string  $glue  [description]
 *
 * @return [type]         [description]
 */
function str_url_normalize($str, $lower = true, $glue = "-")
{
    $str = str_normalize($str);
    $str = preg_replace("~[^\\pL\\d]+~u", $glue, $str);
    $str = trim($str, $glue);
    return $lower ? strtolower($str) : $str;
}
Example #3
0
function creatureinfo2(&$Row)
{
    // Номер создания
    $creature['entry'] = $Row['entry'];
    // Имя создания
    $creature['name'] = !empty($Row['name_loc']) ? $Row['name_loc'] : $Row['name'];
    // Подимя создания
    $creature['subname'] = !empty($Row['subname_loc']) ? $Row['subname_loc'] : $Row['subname'];
    // Min/Max уровни
    $creature['minlevel'] = $Row['minlevel'];
    $creature['maxlevel'] = $Row['maxlevel'];
    // TODO: Месторасположение
    //	$creature['location'] = location($creature['entry'],'creature');
    // TODO: Реакция на фракции
    $creature['react'] = $Row['A'] . ',' . $Row['H'];
    // Тип NPC
    $creature['type'] = $Row['type'];
    // Тег NPC
    $creature['tag'] = str_normalize($Row['subname']);
    // Ранг NPC
    $creature['classification'] = $Row['rank'];
    return $creature;
}
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
require_once "../models/config.php";
set_error_handler('logAllErrors');
// Request method: POST
$ajax = checkRequestMode("post");
// User must be logged in
checkLoggedInUser($ajax);
$validator = new Validator();
// Required: csrf_token, user_id
$csrf_token = $validator->requiredPostVar('csrf_token');
$user_id = $validator->requiredNumericPostVar('user_id');
$display_name = trim($validator->optionalPostVar('display_name'));
$email = str_normalize($validator->optionalPostVar('email'));
$title = trim($validator->optionalPostVar('title'));
$rm_groups = $validator->optionalPostVar('remove_groups');
$add_groups = $validator->optionalPostVar('add_groups');
$enabled = $validator->optionalPostVar('enabled');
$primary_group_id = $validator->optionalPostVar('primary_group_id');
// For updating passwords.  The user's current password must also be included (passwordcheck) if they are resetting their own password.
$password = $validator->optionalPostVar('password');
$passwordc = $validator->optionalPostVar('passwordc');
$passwordcheck = $validator->optionalPostVar('passwordcheck');
// Add alerts for any failed input validation
foreach ($validator->errors as $error) {
    addAlert("danger", $error);
}
// Validate csrf token
checkCSRF($ajax, $csrf_token);
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
require_once "../models/config.php";
set_error_handler('logAllErrors');
// Publically accessible API
// Request method: POST
$ajax = checkRequestMode("post");
//Forward the user to their default page if he/she is already logged in
if (isUserLoggedIn()) {
    addAlert("warning", "You're already logged in!");
    apiReturnError($ajax, getReferralPage());
}
$validate = new Validator();
$postedUsername = str_normalize($validate->requiredPostVar('username'));
global $email_login;
$isEmail = count(explode('@', $postedUsername));
if ($isEmail == 2 && $email_login == 1) {
    $email = 1;
    $email_address = $postedUsername;
} elseif ($isEmail == 1 && $email_login == 1) {
    $email = 0;
    $username = $postedUsername;
} else {
    // ($email_login == 0){
    $email = 0;
    $username = $postedUsername;
}
$errors = array();
$password = $validate->requiredPostVar('password');
Example #6
0
function php2js($data)
{
    if (is_array($data)) {
        // Массив
        if (is_single_array($data)) {
            // Простой массив []
            $ret = "[";
            $first = true;
            foreach ($data as $key => $obj) {
                if (!$first) {
                    $ret .= ',';
                }
                $ret .= php2js($obj);
                $first = false;
            }
            $ret .= "]";
        } else {
            // Ассоциативный массив {}
            $ret = '{';
            $first = true;
            foreach ($data as $key => $obj) {
                if (!$first) {
                    $ret .= ',';
                }
                $ret .= $key . ':' . php2js($obj);
                $first = false;
            }
            $ret .= '}';
        }
    } else {
        // Просто значение
        $ret = is_string($data) ? "'" . nl2br(str_normalize($data)) . "'" : $data;
    }
    return $ret;
}
        apiReturnError($ajax, SITE_ROOT);
    }
    // If registration is disabled, send them back to the home page with an error message
    if (!$can_register) {
        addAlert("danger", lang("ACCOUNT_REGISTRATION_DISABLED"));
        apiReturnError($ajax, SITE_ROOT);
    }
    //Prevent the user visiting the logged in page if he/she is already logged in
    if (isUserLoggedIn()) {
        addAlert("danger", "I'm sorry, you cannot register for an account while logged in.  Please log out first.");
        apiReturnError($ajax, ACCOUNT_ROOT);
    }
}
$user_name = str_normalize($validator->requiredPostVar('user_name'));
$display_name = trim($validator->requiredPostVar('display_name'));
$email = str_normalize($validator->requiredPostVar('email'));
// If we're in admin mode, require title.  Otherwise, use the default title
if ($admin == "true") {
    $title = trim($validator->requiredPostVar('title'));
} else {
    $title = $new_user_title;
}
// Don't trim passwords
$password = $validator->requiredPostVar('password');
$passwordc = $validator->requiredPostVar('passwordc');
// Requires admin mode and appropriate permits
$add_groups = $validator->optionalPostVar('add_groups');
$skip_activation = $validator->optionalPostVar('skip_activation');
$primary_group_id = $validator->optionalPostVar('primary_group_id');
// Required for non-admin mode
$captcha = $validator->optionalPostVar('captcha');
Example #8
0
        if ($spell['name']) {
            $x .= 'name: \'' . str_normalize($spell['name']) . '\',';
        }
        if ($spell['icon']) {
            $x .= 'icon: \'' . str_normalize($spell['icon']) . '\',';
        }
        if ($spell['info']) {
            $x .= 'tooltip: \'' . str_normalize($spell['info']) . '\'';
        }
        $x .= '});';
        break;
    case 'quest':
        if (!($quest = load_cache(11, $id))) {
            require_once 'includes/allquests.php';
            $quest = GetDBQuestInfo($id, QUEST_DATAFLAG_AJAXTOOLTIP);
            $quest['tooltip'] = GetQuestTooltip($quest);
            save_cache(11, $id, $quest);
        }
        $x .= '$WowheadPower.registerQuest(' . $id . ', 0,{';
        if ($quest['name']) {
            $x .= 'name: \'' . str_normalize($quest['name']) . '\',';
        }
        if ($quest['tooltip']) {
            $x .= 'tooltip: \'' . str_normalize($quest['tooltip']) . '\'';
        }
        $x .= '});';
        break;
    default:
        break;
}
echo $x;
Example #9
0
function php2js($data)
{
    if (is_array($data)) {
        // Массив
        if (array_key_exists(0, $data)) {
            // Простой массив []
            $ret = "[";
            $first = true;
            foreach ($data as $key => $obj) {
                if (!$first) {
                    $ret .= ',';
                }
                $ret .= php2js($obj);
                $first = false;
            }
            $ret .= "]";
        } else {
            // Ассоциативный массив {}
            $ret = "{";
            $first = true;
            foreach ($data as $key => $obj) {
                if (!$first) {
                    $ret .= ',';
                }
                $ret .= $key . ':' . php2js($obj) . "";
                $first = false;
            }
            $ret .= "}";
        }
    } else {
        // Просто значение
        $ret = is_string($data) ? "'" . str_replace("\n", "<br>", str_normalize($data)) . "'" : $data;
    }
    return $ret;
}
Example #10
0
 public function testNormalize()
 {
     $this->assertEquals(str_normalize('æøå'), 'aoa');
 }
Example #11
0
    protected function _event_home()
    {
        global $warning;
        $v = $this->__(array('e_title', 'e_text', 'e_time' => array(0), 'e_artists' => array(0)));
        $v_check = array('e_title' => 'INVALID_NAME', 'e_cat' => 'INVALID_CATEGORY');
        foreach ($v_check as $vk => $vv) {
            if (empty($v->{$vk})) {
                $warning->set($vv);
            }
        }
        if (!$warning->exist) {
            $v['e_alias'] = _alias($v['e_title']);
            if (empty($v['e_alias'])) {
                $arning->set('INVALID_ALIAS');
            }
        }
        if (!$warning->exist) {
            $sql = 'SELECT cat_id
				FROM _events_category
				WHERE cat_id = ?';
            if (!sql_fieldrow(sql_filter($sql, $v->e_cat))) {
                $this->warning->set('invalid_category');
            }
        }
        if (!$this->warning->exist) {
            $core->require('upload');
            $core->upload->init();
            $f = $core->upload->process(LIB . 'tmp/', $_FILES['e_flyer'], w('jpg'), max_upload_size());
            if ($f === false && count($core->upload->warning)) {
                $this->warning->set($core->upload->warning);
            }
        }
        if (!$this->warning->exist()) {
            $sql_insert = array('alias' => $v['e_alias'], 'subject' => str_normalize($v['e_title']), 'text' => str_normalize($v['e_text']), 'approved' => 0, 'views' => 0, 'posts' => 0, 'start' => $e_start, 'end' => $e_end, 'images' => 0);
            sql_put('_events', prefix('event', $sql_insert));
            $v['e_id'] = sql_nextid();
            if (is_array($v->e_artists)) {
                foreach ($v['e_artists'] as $row) {
                    $sql_insert = array('id' => (int) $v['e_id'], 'artist' => (int) $row);
                    sql_put('_events_artists', prefix('event', $sql_insert));
                }
            }
            foreach ($f as $row) {
                $f2 = $upload->resize($row, LIB . 'tmp', LIB . 'events/future/', $v['e_id'], array(600, 400), false, false, true);
                if ($f2 === false) {
                    continue;
                }
                $f3 = $upload->resize($row, LIB . 'events/future/', LIB . 'events/preview/', $v['e_id'], array(210, 210), false, false);
            }
            redirect(_link('events', $v['e_alias']));
        }
        return;
    }