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>'; }
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; }
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; }
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>'; }
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"'; }
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; }
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; }
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; }
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; }
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); }
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; }
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; }
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; }
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')); }
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>'; }
function onSubmit($vals) { loader_import('siteforum.Topic'); $t = new SiteForum_Topic(); $t->add(array('name' => $vals['name'], 'description' => $vals['description'], 'sitellite_access' => $vals['sitellite_access'], 'sitellite_status' => $vals['sitellite_status'])); header('Location: ' . site_prefix() . '/index/siteforum-app'); exit; }
function digger_filter_user($user) { $pub = db_shift('select public from sitellite_user where username = ?', $user); if ($pub == 'yes') { return '<a href="' . site_prefix() . '/index/sitemember-profile-action/user.' . $user . '">' . $user . '</a>'; } return $user; }
function sitewiki_filter_body($body) { $wiki = new Text_Wiki(); $wiki->setRenderConf('xhtml', 'wikilink', 'view_url', site_prefix() . '/index/sitewiki-app/show.'); $wiki->setRenderConf('xhtml', 'wikilink', 'new_url', site_prefix() . '/index/sitewiki-app/show.'); $pages = db_shift_array('select distinct id from sitewiki_page'); $wiki->setRenderConf('xhtml', 'wikilink', 'pages', $pages); return $wiki->transform($body, 'Xhtml'); }
function onSubmit($vals) { db_execute('insert into siteinvoice_client (id, code, name, contact_name, contact_email, contact_phone, address) values (null, ?, ?, ?, ?, ?, ?)', $vals['code'], $vals['name'], $vals['contact_name'], $vals['contact_email'], $vals['contact_phone'], $vals['address']); page_title('SiteInvoice - Client Added'); echo '<p><a href="' . site_prefix() . '/index/siteinvoice-clients-action">Continue</a></p>'; }
function onSubmit($vals) { // update devnotes_config table and respond if ($vals['notes'] == 'date') { $vals['notes'] = $vals['notes_date']; } db_execute('update devnotes_config set notes = ?, contact = ?, ignore_list = ?', $vals['notes'], $vals['contact'], $vals['ignore_list']); header('Location: ' . site_prefix() . '/index/devnotes-admin-action'); exit; }
function onSubmit($vals) { if ($vals['src'] != $vals['new_name'] || $vals['location'] != $vals['new_location']) { if (imagechooser_rename($vals['location'] . '/' . $vals['src'], $vals['new_location'] . '/' . $vals['new_name'])) { imagechooser_update_pages($vals['location'] . '/' . $vals['src'], $vals['new_location'] . '/' . $vals['new_name']); } } header('Location: ' . site_prefix() . '/index/imagechooser-admin-action?name=&location=' . $vals['new_location'] . '&format=html&attrs='); exit; }
/** * If you would like glossary terms to be automatically highlighted in your * web pages, add "siteglossary.Terms" to the [Server][content_filters] line * in inc/conf/config.ini.php. */ function siteglossary_terms_content_filter($body) { if (strpos($_SERVER['REQUEST_URI'], '/index/siteglossary-app') === false) { $terms = db_fetch_array('select * from siteglossary_term'); foreach (array_keys($terms) as $k) { $body = str_replace('\\"', '"', substr(preg_replace('#(\\>(((?' . '>([^><]+|(?R)))*)\\<))#se', "preg_replace('#\\b(" . str_replace("'", "", $terms[$k]->word) . ")\\b#i', '<a href=\"" . site_prefix() . "/index/siteglossary-app#" . $terms[$k]->word . "\" class=\"glossary-term\" title=\"" . str_replace('"', '\\"', $terms[$k]->description) . "\">\\\\1</a>', '\\0')", '>' . $body . '<'), 1, -1)); } } return $body; }
function onSubmit($vals) { loader_import('siteforum.Topic'); loader_import('siteforum.Post'); $t = new SiteForum_Topic(); $t->modify($vals['id'], array('name' => $vals['name'], 'description' => $vals['description'], 'sitellite_access' => $vals['sitellite_access'], 'sitellite_status' => $vals['sitellite_status'])); $p = new SiteForum_Post(); $p->modify(array('topic_id' => $vals['id']), array('sitellite_access' => $vals['sitellite_access'], 'sitellite_status' => $vals['sitellite_status'])); header('Location: ' . site_prefix() . '/index/siteforum-app'); exit; }
function onSubmit($vals) { if (!file_overwrite('inc/html/' . $vals['path'], $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; } list($set, $tpl) = explode('/', $vals['path']); page_title('Template Saved'); echo '<p><a href="' . site_prefix() . '/index/sitetemplate-templateselect-action?set_name=' . $set . '">' . intl_get('Return to template set') . '</a></p>'; }
function msg_show_user($user) { if (strstr($user, '@')) { return '<a href="mailto:' . $user . '">' . $user . '</a>'; } $info = session_get_user($user); if (!$info || empty($info->lastname)) { return '<a href="' . site_prefix() . '/index/cms-user-view-action?user='******'">' . $user . '</a>'; } return '<a href="' . site_prefix() . '/index/cms-user-view-action?user='******'">' . $info->lastname . ', ' . $info->firstname . '</a>'; }
function onSubmit($vals) { loader_import('cms.Versioning.Rex'); $collection = $vals['collection']; unset($vals['collection']); if (empty($collection)) { $collection = 'sitellite_page'; } $return = $vals['_return']; unset($vals['_return']); $changelog = $vals['changelog']; unset($vals['changelog']); $rex = new Rex($collection); //$vals['sitellite_owner'] = session_username (); //$vals['sitellite_team'] = session_team (); unset($vals['submit_button']); unset($vals['tab1']); unset($vals['tab2']); unset($vals['tab3']); unset($vals['tab-end']); unset($vals['header_properties']); unset($vals['header_contact']); unset($vals['header_loc']); if ($vals['contact_url'] == 'http://') { $vals['contact_url'] = ''; } if ($vals['loc_map'] == 'http://') { $vals['loc_map'] = ''; } $res = $rex->create($vals, $changelog); if (isset($vals[$rex->key])) { $key = $vals[$rex->key]; } elseif (!is_bool($res)) { $key = $res; } else { $key = 'Unknown'; } if (!$res) { if (!$return) { $return = site_prefix() . '/index/cms-browse-action?collection=siteevent_event'; } echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return)); } else { loader_import('cms.Workflow'); echo Workflow::trigger('add', array('collection' => $collection, 'key' => $key, 'data' => $vals, 'changelog' => intl_get('Item added.'), 'message' => 'Collection: ' . $collection . ', Item: ' . $key)); session_set('sitellite_alert', intl_get('Your item has been created.')); if ($return) { header('Location: ' . $return); exit; } } header('Location: ' . site_prefix() . '/index/siteevent-app/id.' . $res); exit; }
function onSubmit($vals) { $res = db_execute('insert into timetracker_project (id, name, description) values (null, ?, ?)', $vals['name'], $vals['description']); if (!$res) { return '<p>Unknown error: ' . db_error() . '</p>'; } header('Location: ' . site_prefix() . '/index/timetracker-app/added.project'); exit; }
/** * Returns the display HTML for this widget. The optional * parameter determines whether or not to automatically display the widget * nicely, or whether to simply return the widget (for use in a template). * * @access public * @param boolean $generate_html * @return string * */ function display($generate_html = 0) { parent::display($generate_html); global $intl, $simple; $attrstr = $this->getAttrs(); $len = $this->length > 0 ? 'maxlength="' . $this->length . '" ' : ''; if ($generate_html) { return "\t" . '<tr>' . "\n\t\t" . '<td class="label" valign="top"><label for="' . $this->name . '" id="' . $this->name . '-label"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . '</label></td>' . "\n\t\t" . '<td class="field"><textarea rows="' . $this->rows . '" cols="' . $this->cols . '" ' . $attrstr . ' ' . $len . $this->extra . '>' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '</textarea><br />' . '<a href="#" onclick="this.blur (); window.open (\'' . site_prefix() . '/index/cms-keywords-action?el=' . $this->name . '&sel=\' + document.forms[0].elements.' . $this->name . '.value, \'KeywordsWindow\', \'top=100,left=100,width=350,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,fullscreen=no\'); return false">' . intl_get('Global Keyword List') . '</a>' . '</td>' . "\n\t" . '</tr>' . "\n"; } else { return '<input type="text" ' . $attrstr . ' value="' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '" ' . $this->extra . ' />'; } }
/** * Returns the display HTML for this widget. The optional * parameter determines whether or not to automatically display the widget * nicely, or whether to simply return the widget (for use in a template). * * @access public * @param boolean $generate_html * @return string * */ function display($generate_html = 0) { parent::display($generate_html); global $intl, $simple; $attrstr = $this->getAttrs(); $len = $this->length > 0 ? 'maxlength="' . $this->length . '" ' : ''; if ($generate_html) { return "\t" . '<tr>' . "\n\t\t" . '<td class="label"><label for="' . $this->name . '" id="' . $this->name . '-label"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . '</label></td>' . "\n\t\t" . '<td class="field"><input type="text" ' . $attrstr . ' value="' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '" ' . $len . $this->extra . ' />' . ' <a href="#" onclick="window.open (\'' . site_prefix() . '/index/siteinvoice-currencies-action?sel=\' + document.forms[0].elements.' . $this->name . '.value, \'CurrencyWindow\', \'top=100,left=100,width=300,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,fullscreen=no\'); return false">Currency List</a>' . '</td>' . "\n\t" . '</tr>' . "\n"; } else { return '<input type="text" ' . $attrstr . ' value="' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '" ' . $this->extra . ' />'; } }
function onSubmit($vals) { $set = $vals['set']; unset($vals['set']); file_overwrite('inc/html/' . $set . '/modes.php', $vals['modes']); unset($vals['submit_button']); unset($vals['modes']); $r = ini_write($vals); file_overwrite('inc/html/' . $set . '/config.ini.php', $r); header('Location: ' . site_prefix() . '/index/sitetemplate-templateselect-action?set_name=' . $set); exit; }