本文整理汇总了PHP中sotf_Utils::makeValidName方法的典型用法代码示例。如果您正苦于以下问题:PHP sotf_Utils::makeValidName方法的具体用法?PHP sotf_Utils::makeValidName怎么用?PHP sotf_Utils::makeValidName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sotf_Utils
的用法示例。
在下文中一共展示了sotf_Utils::makeValidName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectAudioVideo
function selectAudioVideo(&$prg)
{
global $config;
$files = $prg->listAudioFiles('TRUE', 'kbps DESC');
if (is_array($files)) {
foreach ($files as $f) {
if ($f['download_access'] == 't') {
/* sun 8.2.06 added to format properly the enclosure url --rama */
$station = sotf_Utils::makeValidName($prg->get('station'), 23);
$series = sotf_Utils::makeValidName($prg->get('series'), 23);
$title = sotf_Utils::makeValidName($prg->get('title'), 30);
if ($station != "" && $series != "" && $title != "") {
$fname = "{$station}-{$series}-{$title}";
} elseif ($station != "" && $title != "") {
$fname = "{$station}-{$title}";
} elseif ($title != "") {
$fname = $title;
}
/* end properly format enclosure url */
//$f['url'] = $config['rootUrl'] . '/getFile.php/' . $f['filename'] . '?audio=1&id=' . $prg->id . '&filename=' . $f['filename'];
//$f['url'] = $config['rootUrl'] . '/getFile.php?audio=1&id=' . $prg->id . '&filename=' . $f['filename'];
$baseUrl = sotf_Node::getHomeNodeRootUrl($prg);
//$f['url'] = $baseUrl . '/getFile.php/fid__' . $f['id'].".mp3"; // wreutz: very dirty hack for ipooder to work on os x
//MODIFIED BY Martin Schmidt
$f = array_merge($f, sotf_AudioFile::decodeFormatFilename($f['format']));
if ($prg->isVideoPrg() && $f['format'] == "mp4") {
//echo "drinnen";
$f['url'] = $baseUrl . '/getFile.php/' . 'fid__' . $f['id'] . '__' . $fname . ".mp4";
return $f;
} else {
if ($prg->isAudioPrg()) {
$f['url'] = $baseUrl . '/getFile.php/' . 'fid__' . $f['id'] . '__' . $fname . ".mp3";
//rjankowski changed order to get parsed by getFile.php
return $f;
}
}
//////////////////////////
// rama: included $fname as formatted name $station-$series-$title
}
}
}
/*
if(!$retval and is_array($files)) {
foreach($files as $f) {
if($f['stream_access']=='t') {
$f['url'] = $config['rootUrl'] . '/listen.php?id=' . $prg->id . '&fileid=' . $f['id'];
return $f;
}
}
}
*/
return NULL;
}
示例2: register
/** static method: Register new user with given data. */
function register($password, $name, $realname, $language, $email)
{
// TODO: check not to change user name!!
/// TODO: check if user name is unique!
global $page;
$storage =& sotf_User::getStorageObject();
if (strlen($name) == 0) {
debug("USERDB", "attempt to register with empty userid");
return $page->getlocalized("invalid_username");
}
debug("USERDB", "registering user: " . $name);
$name1 = sotf_Utils::makeValidName($name, 32);
if ($name1 != $name) {
//$page->addStatusMsg('illegal_name');
return $page->getlocalized("illegal_name");
}
$fields['password'] = sotf_Utils::magicQuotes($password);
$fields['username'] = sotf_Utils::magicQuotes($name);
$fields['language'] = sotf_Utils::magicQuotes($language);
$fields['realname'] = sotf_Utils::magicQuotes($realname);
$fields['email'] = sotf_Utils::magicQuotes($email);
$storage->userDbInsert($fields);
}
示例3: create
function create($stationOrSeriesId, $track = '')
{
global $db, $repository;
$db->begin();
// TODO may need some locking to get unique track id
$container =& $repository->getObject($stationOrSeriesId);
// echo get_class($container);
switch (strtolower(get_class($container))) {
case 'sotf_series':
$this->set('series_id', $container->id);
$station = $container->getStation();
$this->set('station_id', $station->id);
$stationName = $station->get('name');
break;
case 'sotf_station':
$this->set('station_id', $container->id);
$stationName = $container->get('name');
break;
default:
raiseError("Invalid station or series id!");
}
if (empty($stationName)) {
raiseError("station does not exist");
}
if (empty($track)) {
$track = 'prg';
}
$this->getStation();
$this->set('entry_date', date('Y-m-d'));
$this->set('modify_date', date('Y-m-d'));
$this->set('track', sotf_Utils::makeValidName($track, 32));
$this->getNextAvailableTrackId();
// guid is obsolete, but anyway:
$this->set('guid', $this->station->id . GUID_DELIMITER . $this->get('entry_date') . GUID_DELIMITER . $this->get('track'));
if (parent::create()) {
debug("created new programme", $this->id);
$db->commit();
return true;
}
$db->rollback();
raiseError("Could not create new programme");
}
示例4: debug
$language = sotf_Utils::getParameter('language');
$okURL = sotf_Utils::getParameter('okURL');
$change = $page->loggedIn();
debug("realname2", $realname);
if ($filled) {
// save changes
// check data
$error = false;
if (strlen($username) == 0) {
$error = true;
$smarty->assign('INVALID_USERNAME', true);
//$errorMsg = appendWith($errorMsg, $page->getlocalized("invalid_username"));
}
// check if username acceptible
if (!$error) {
$name1 = sotf_Utils::makeValidName($username, 32);
if ($name1 != $username) {
$username = $name1;
$smarty->assign('ERRORMSG', $page->getlocalized("illegal_name"));
$error = true;
}
if (!$change && sotf_User::userNameCheck($username)) {
// check if username is not already in use
$error = true;
$smarty->assign('USERNAME_RESERVED', true);
//$errorMsg = appendWith($errorMsg, userNameCheck($username));
}
}
if (!$change && strlen($password) < 2) {
$error = true;
$smarty->assign('PASSWORD_SHORT', true);
示例5: raiseError
$new = sotf_Utils::getParameter('new');
$desc = sotf_Utils::getParameter('desc');
$manager = sotf_Utils::getParameter('username');
$page->forceLogin();
if (!hasPerm('node', 'create')) {
raiseError($page->getlocalized('no_permission'));
exit;
}
if ($new) {
$userid = $user->getUserid($manager);
if (empty($userid) || !is_numeric($userid)) {
$page->addStatusMsg('select_manager');
$problem = 1;
}
$station_old = $station;
$station = sotf_Utils::makeValidName($station, 32);
if ($station != $station_old) {
$page->addStatusMsg('illegal_name');
$problem = 1;
}
if (sotf_Station::isNameInUse($station)) {
$page->addStatusMsg('name_in_use');
$problem = 1;
}
if (!$problem) {
$st =& new sotf_Station();
$st->create($station, $desc);
$permissions->addPermission($st->getID(), $userid, 'admin');
$page->addStatusMsg('station_created');
$page->redirect("stations.php");
}