本文整理汇总了PHP中site_prefix函数的典型用法代码示例。如果您正苦于以下问题:PHP site_prefix函数的具体用法?PHP site_prefix怎么用?PHP site_prefix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了site_prefix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSubmit
function onSubmit($vals)
{
unset($vals['submit_button']);
loader_import('saf.File');
file_overwrite('inc/app/sitewiki/conf/settings.php', ini_write($vals));
echo '<p>Settings saved. <a href="' . site_prefix() . '/index/sitewiki-app">Continue</a></p>';
}
示例2: sitegallery_get_thumbnail
function sitegallery_get_thumbnail($file, $file_store = false)
{
$full_path = sitegallery_get_path($file, $file_store);
$info = pathinfo($full_path);
$ext = strtolower($info['extension']);
if (!sitegallery_can_resize($ext)) {
return sitegallery_url_path($file, $file_store);
}
$save_to = md5($file) . '.' . $ext;
$save_path = 'inc/app/sitegallery/data/';
if (@file_exists($save_path . $save_to) && @filemtime($full_path) <= @filemtime($save_path . $save_to)) {
return site_prefix() . '/inc/app/sitegallery/pix/thumbnails/' . $save_to;
}
list($w, $h) = getimagesize($full_path);
$width = appconf('thumbnail_width');
$height = appconf('thumbnail_height');
if ($h > $w) {
// cropping the height
$hoffset = ($h - $w) / 2;
$woffset = 0;
$h -= $hoffset * 2;
} else {
// cropping the width
$woffset = ($w - $h) / 2;
$hoffset = 0;
$w -= $woffset * 2;
}
$jpg = @imagecreatefromjpeg($full_path);
$new = @imagecreatetruecolor($width, $height);
@imagecopyresampled($new, $jpg, 0, 0, $woffset, $hoffset, $width, $height, $w, $h);
@imagejpeg($new, 'inc/app/sitegallery/pix/thumbnails/' . $save_to);
@imagedestroy($jpg);
@imagedestroy($new);
return site_prefix() . '/inc/app/sitegallery/pix/thumbnails/' . $save_to;
}
示例3: onSubmit
function onSubmit($vals)
{
$file = $this->_file;
$info = ini_parse($file);
$code = $vals['code'];
if (!empty($vals['locale'])) {
$code .= '-' . $vals['locale'];
}
$info[$code] = array('name' => $vals['name'], 'code' => $vals['code'], 'locale' => $vals['locale'], 'charset' => $vals['charset'], 'fallback' => $vals['fallback'], 'default' => $vals['default']);
$fp = fopen($file, 'w');
if (!$fp) {
echo 'Error: Failed to open languages.php file!';
return;
}
fwrite($fp, ini_write($info));
fclose($fp);
/*header (
sprintf (
'Location: %s/index/appdoc-translation-strings-action?appname=%s&lang=%s&charset=%s',
site_prefix (),
$vals['appname'],
$code,
$vals['charset']
)
);*/
header('Location: ' . site_prefix() . '/index/multilingual-languages-action');
exit;
}
示例4: onSubmit
function onSubmit($vals)
{
$vals['name'] = strtolower($vals['name']);
//make sure that file doesnt exit
if (file_exists('inc/html/' . $vals['set_name'] . '/' . $vals['name'] . '.css')) {
echo '<p>' . intl_get('A file with that name already exists. Choose a different file name.') . '</p>';
echo '<p>' . intl_get('Go <a href=javascript:history.back()>back</a> to choose a different file name.') . '</p>';
}
if (preg_match('/\\.css$/i', $vals['name'])) {
$ext = '';
} else {
$ext = '.css';
}
if (!file_overwrite('inc/html/' . $vals['set_name'] . '/' . $vals['name'] . $ext, $vals['body'])) {
page_title(intl_get('An Error Occurred'));
echo '<p>' . intl_get('The file was unable to be saved. Please verify your server settings before trying again.') . '</p>';
return;
}
umask(00);
chmod('inc/html/' . $vals['set_name'] . '/' . $vals['name'] . $ext, 0777);
list($set, $tpl) = explode('/', $vals['path']);
echo $set . ' ' . $tpl;
page_title('File Saved');
echo '<p><a href="' . site_prefix() . '/index/sitetemplate-templateselect-action?set_name=' . $vals['set_name'] . '">' . intl_get('Return to template set') . '</a></p>';
}
示例5: DevtoolsTplForm
function DevtoolsTplForm()
{
parent::MailForm();
$this->parseSettings('inc/app/devtools/forms/tpl/settings.php');
page_title(intl_get('Create a New Template Set'));
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/devtools-app\'; return false"';
}
示例6: onSubmit
function onSubmit($vals)
{
loader_import('saf.File');
if (!preg_match('/\\.html$/', $vals['filename'])) {
$vals['filename'] .= '.html';
}
if (!preg_match('/\\.html$/', $vals['helpfile'])) {
$vals['helpfile'] .= '.html';
}
$vals['body'] = '<h1>' . $vals['title'] . '</h1>' . NEWLINEx2 . $vals['body'];
if (!file_overwrite(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $vals['filename'], $vals['body'])) {
echo '<p>Error: Unable to write to the file. Please verify your file and folder permissions.</p>';
return;
}
if ($vals['helpfile'] != $vals['filename']) {
// erase old file, this is a rename
$res = @unlink(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $vals['helpfile']);
if (!$res) {
echo '<p>Error: Unable to remove the old file. Please verify your file and folder permissions.</p>';
return;
}
}
header('Location: ' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $vals['appname'] . '&lang=' . $vals['lang']);
exit;
}
示例7: onSubmit
function onSubmit($vals)
{
loader_import('saf.File');
loader_import('saf.File.Directory');
loader_import('saf.Misc.Ini');
$info = help_get_langs($vals['appname']);
$info[$vals['lang_code']] = $vals['lang_name'];
if (!@mkdir(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang_code'], 0777)) {
echo '<p>Error: Unable to create language folder. Please verify your folder permissions.</p>';
return;
}
if (!file_overwrite(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/languages.php', ini_write($info))) {
echo '<p>Error: Unable to write to the file. Please verify your folder permissions.</p>';
return;
}
if (!empty($vals['copy_from'])) {
// copy help files from specified lang to new dir
$pages = help_get_pages($vals['appname'], $vals['lang']);
foreach ($pages as $page) {
$id = help_get_id($page);
$res = copy(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $id . '.html', site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang_code'] . '/' . $id . '.html');
if (!$res) {
echo '<p>Error: Unable to duplicate help files. Please verify your folder permissions.</p>';
return;
}
}
}
// go to new language
header('Location: ' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $vals['appname'] . '&lang=' . $vals['lang_code']);
exit;
}
示例8: onSubmit
function onSubmit($vals)
{
global $cgi;
if ($vals['submit_buttons'] == 'Cancel') {
header('Location: ' . $vals['refer']);
exit;
}
loader_import('cms.Versioning.Rex');
$rex = new Rex('siteblog_post');
$id = $cgi->_key;
$subject = $vals['subject'];
$author = $vals['author'];
$status = $vals['status'] == 1 ? 'not visible' : 'visible';
if (empty($vals['category'])) {
$vals['category'] = $vals['oldcat'];
}
$category = $vals['category'];
$body = $vals['body'];
$data = array('subject' => $subject, 'author' => $author, 'status' => $status, 'category' => $category, 'body' => $body);
if (!empty($id)) {
$method = $rex->determineAction($id);
$rex->{$method}($id, $data);
} else {
$data['created'] = date('Y-m-d H:i:s');
$id = $rex->create($data);
}
//view post
header('Location: ' . site_prefix() . '/index/siteblog-view-action?id=' . $id);
exit;
}
示例9: onSubmit
function onSubmit($vals)
{
//echo '<pre>';
//print_r ($vals);
//exit;
$duration = (strtotime($vals['ended']) - strtotime($vals['started'])) / 60 / 60;
$res = db_execute('insert into timetracker_entry
(id, project_id, task_description, started, duration)
values
(null, ?, ?, ?, ?)', $vals['project'], $vals['description'], $vals['started'], $duration);
if (!$res) {
return '<p>Unknown error: ' . db_error() . '</p>';
}
$eid = db_lastid();
if (!is_array($vals['users'])) {
$vals['users'] = preg_split('/, ?/', $vals['users']);
}
foreach ($vals['users'] as $user) {
db_execute('insert into timetracker_user_entry
(id, user_id, entry_id)
values
(null, ?, ?)', $user, $eid);
}
header('Location: ' . site_prefix() . '/index/timetracker-app/added.entry');
exit;
}
示例10: _link
function _link()
{
// display a button that pops up the boxchooser app
static $included = false;
if (!$included) {
page_add_script(site_prefix() . '/js/dialog.js');
page_add_script(loader_box('boxchooser/js', $this));
$included = true;
}
return template_simple('
<script language="javascript" type="text/javascript">
function boxchooser_{name}_handler () {
if (typeof dialogWin.returnedValue == \'object\') {
url = dialogWin.returnedValue[\'src\'];
} else {
url = dialogWin.returnedValue;
}
boxchooser_{name}_form.elements[boxchooser_{name}_element].value = unescape (url);
}
</script>
<input type="submit" onclick="boxchooser_{name}_get_file (this.form, \'{name}\'); return false" value="{intl Choose}" />
', $this);
}
示例11: onSubmit
function onSubmit($vals)
{
global $cgi;
if ($vals['submit_buttons'] == 'Cancel') {
header('Location: ' . $vals['refer']);
exit;
}
loader_import('cms.Versioning.Rex');
$rex = new Rex('siteblog_post');
$id = $cgi->_key;
$subject = $vals['subject'];
$author = $vals['author'];
$status = $vals['status'];
$category = $vals['category'];
$created = $vals['created'];
$body = $vals['body'];
$data = array('subject' => $subject, 'author' => $author, 'status' => $status, 'category' => $category, 'created' => $created, 'body' => $body);
if (!empty($id)) {
if (!$data['created']) {
unset($data['created']);
}
$method = $rex->determineAction($id);
$rex->{$method}($id, $data);
} else {
if (!$data['created']) {
$data['created'] = date('Y-m-d H:i:s');
}
$id = $rex->create($data);
}
session_set('sitellite_alert', intl_get('Your item has been saved.'));
// view post
if (!empty($vals['_return'])) {
header('Location: ' . $vals['_return']);
} else {
header('Location: ' . site_prefix() . '/index/siteblog-post-action/id.' . $id . '/title.' . siteblog_filter_link_title($subject));
}
// ping blog directories via pingomatic.com
$host = 'rpc.pingomatic.com';
$path = '';
$out = template_simple('ping.spt', $obj);
$len = strlen($out);
$req = 'POST /' . $path . " HTTP/1.0\r\n";
$req .= 'User-Agent: Sitellite ' . SITELLITE_VERSION . "/SiteBlog\r\n";
$req .= 'Host: ' . $host . "\r\n";
$req .= "Content-Type: text/xml\r\n";
$req .= 'Content-Length: ' . $len . "\r\n\r\n";
$req .= $out . "\r\n";
if ($ph = @fsockopen($host, 80)) {
@fputs($ph, $req);
//echo '<pre>';
//echo htmlentities ($req);
while (!@feof($ph)) {
$res = @fgets($ph, 128);
//echo htmlentities ($res);
}
@fclose($ph);
}
exit;
}
示例12: onSubmit
function onSubmit($vals)
{
loader_import('cms.Workspace.Message');
$msg = new WorkspaceMessage();
$msg->renameCategory($vals['name'], $vals['category']);
header('Location: ' . site_prefix() . '/index/cms-messages-action');
exit;
}
示例13: onSubmit
function onSubmit($vals)
{
db_execute('update sitepresenter_slide
set title = ?, body = ?
where id = ?', $vals['title'], $vals['body'], $vals['id']);
header('Location: ' . site_prefix() . '/index/sitepresenter-slides-action?id=' . $vals['presentation']);
exit;
}
示例14: PetitionSignForm
function PetitionSignForm()
{
parent::MailForm(__FILE__);
$this->action = site_prefix() . '/index/petition-sign-form';
global $cgi;
$this->widgets['id']->setValue($cgi->id);
$this->widgets['submit_button']->setValues(intl_get('Submit now'));
}
示例15: onSubmit
function onSubmit($vals)
{
db_execute('update siteinvoice_client
set code = ?, name = ?, contact_name = ?, contact_email = ?, contact_phone = ?, address = ?
where id = ?', $vals['code'], $vals['name'], $vals['contact_name'], $vals['contact_email'], $vals['contact_phone'], $vals['address'], $vals['id']);
page_title('SiteInvoice - Client Updated');
echo '<p><a href="' . site_prefix() . '/index/siteinvoice-clients-action">Continue</a></p>';
}