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 getThemes($path = false) { if (!$path) { $path = site_docroot() . '/inc/app/sitepresenter/themes'; } $themes = array(); //'' => 'Default'); loader_import('saf.File.Directory'); $dir = new Dir(); if (!$dir->open($path)) { return $themes; } foreach ($dir->read_all() as $file) { if (strpos($file, '.') === 0 || !@is_dir($path . '/' . $file)) { continue; } //if (preg_match ('/^html.([^\.]+)\.tpl$/', $file, $regs)) { //if ($regs[1] == 'default') { // continue; //} $themes[$file] = ucfirst($file); //} } return $themes; }
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 sitegallery_can_resize($ext) { if ($ext != 'jpg' && $ext != 'jpeg') { return false; } if (!@is_writeable(site_docroot() . '/inc/app/sitegallery/pix/thumbnails')) { return false; } if (!extension_loaded('gd')) { return false; } if (@imagetypes() & IMG_JPG) { return true; } return false; }
function monoslideshow_can_resize($ext) { if ($ext != 'jpg' && $ext != 'jpeg') { return false; } if (!@is_writeable(site_docroot() . '/inc/app/monoslideshow/pix')) { return false; } if (!extension_loaded('gd')) { return false; } if (@imagetypes() & IMG_JPG) { return true; } return false; }
<?php global $cgi; if (empty($cgi->appname) || strstr($cgi->appname, '..') || !@is_dir('inc/app/' . $cgi->appname)) { header('Location: ' . site_prefix() . '/index/appdoc-app'); exit; } if (empty($cgi->lang) || strstr($cgi->lang, '..') || !@is_dir('inc/app/' . $cgi->appname . '/docs/' . $cgi->lang)) { header('Location: ' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $cgi->appname); exit; } if (!is_array($cgi->_key)) { if (strstr($cgi->_key, '..')) { continue; } unlink(site_docroot() . '/inc/app/' . $cgi->appname . '/docs/' . $cgi->lang . '/' . $cgi->_key); } else { foreach ($cgi->_key as $file) { if (strstr($file, '..')) { continue; } unlink(site_docroot() . '/inc/app/' . $cgi->appname . '/docs/' . $cgi->lang . '/' . $file); } } header('Location: ' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $cgi->appname . '&lang=' . $cgi->lang); exit;
if (empty($cgi->format)) { $cgi->format = 'html'; } $data = array('location' => $cgi->location, 'up' => false, 'err' => false, 'subfolders' => array(), 'images' => array()); // get all the data page_title(intl_get('Adding image in') . ': ' . $data['location']); if (empty($cgi->filename)) { $filename = $cgi->file->name; } else { $filename = $cgi->filename; } if ($cgi->file) { if (@file_exists(site_docroot() . $cgi->location . '/' . $filename)) { $data['err'] = intl_get('The file name you have chosen already exists. Please choose another.'); } elseif (preg_match('/^[^a-zA-Z0-9\\. _-]+$/', $filename)) { $data['err'] = intl_get('Your file name contains invalid characters. Allowed characters are') . ': A-Z 0-9 . _ - and space.'; } elseif (!preg_match('/\\.(jpg|gif|png)$/i', $filename)) { $data['err'] = intl_get('Your image file must be in one of the following formats') . ': JPG, GIF or PNG'; } else { if (!$cgi->file->move(site_docroot() . '/inc/html/' . $cgi->location . '/pix', $filename)) { $data['err'] = intl_get('Unknown error attempting to create file.'); } else { umask(00); chmod('inc/html/' . $cgi->location . '/pix/' . $filename, 0777); header('Location: ' . site_prefix() . '/index/sitetemplate-templateselect-action?set_name=' . $cgi->location); exit; } } } // show me the money echo template_simple('newimage.spt', $data);
appconf_set('rss_title', site_domain() . ' ' . intl_get('news')); /** * Set this to whatever you want your RSS <description> field to * contain. */ appconf_set('rss_description', intl_get('News from') . ' ' . site_domain()); /** * Set this to either left or right so that thumbnails will align themselves. */ appconf_set('align_thumbnails', 'right'); define('NEWS_TODAY', date('Y-m-d')); appconf_set('shortdate', 'M/d'); appconf_set('date', 'F j, Y'); appconf_set('time', 'g:i A'); appconf_set('date_time', 'M d, Y g:i A'); appconf_set('path', site_docroot() . '/inc/app/news/data'); appconf_set('webpath', site_prefix() . '/inc/app/news/data'); /** * Set this to the template you wish to use to display the app, otherwise * the default is used. */ appconf_set('template', false); /** * Set this to the page ID of the page you would like to be the parent of * the app. This affects the web site navigation while within the * app itself, and the breadcrumb trail as well. */ appconf_set('page_below', false); /** * Set this to the ID of the page which is an alias of the app. */
<?php // settings stuff global $cgi; if (empty($cgi->format)) { $cgi->format = 'html'; } // get the path root from the imagechooser-path session variable, // and if not then default to /pix. $path = session_get('filechooser_path'); if (!$path) { $path = '/inc/data'; } $data = array('location' => false, 'src' => $cgi->src, 'onload' => ''); if (empty($cgi->location) || strpos($cgi->location, $path . '/') !== 0 || strstr($cgi->location, '..') || !@is_dir(site_docroot() . $cgi->location)) { $data['location'] = $path; } else { $data['location'] = $cgi->location; $up = preg_replace('|/[^/]+$|', '', $data['location']); if (!empty($up)) { $data['up'] = $up; } } // get all the data page_title(intl_get('Image') . ': ' . $data['src']); //list ($data['width'], $data['height']) = getimagesize (site_docroot () . $data['location'] . '/' . $data['src']); if ($cgi->attrs == 'false') { $data['onload'] = 'filechooser_select (\'' . $data['location'] . '/' . $data['src'] . '\')'; } // show me the money echo template_simple('select.spt', $data);
$sloppy = new SloppyDOM(); $doc = $sloppy->parse($data); if (!$doc) { echo '<p>Error: ' . $sloppy->error . '</p>'; return; } ob_start(); echo '<h1>' . intl_get('Not Installed') . '</h1>'; echo '<p align="center"><table border="0" cellpadding="10" cellspacing="1" width="100%">'; loader_import('saf.Misc.Alt'); $alt = new Alt('#fff', '#eee'); $count = 0; $shown = false; foreach ($doc->_apps->children as $child) { $item = $child->makeObj(); if (@is_dir(site_docroot() . '/inc/app/' . $item->id)) { continue; } $shown = true; $count++; if ($count == 1) { echo '<tr style="background-color: ' . $alt->next() . '">'; } if (empty($item->icon)) { $item->icon = site_prefix() . '/inc/app/cms/pix/default_icon.gif'; } echo template_simple('<td align="center" valign="bottom" width="25%"><a href="{link}" target="_blank"><img src="{icon}" alt="{description}" title="{description}" border="0" /><br />{name}{if not empty (obj.price)} - ${price}{end if}</a></td>', $item); if ($count == 4) { $count = 0; echo '</tr>'; }
if (empty($cgi->format)) { $cgi->format = 'html'; } // get the path root from the imagechooser-path session variable, // and if not then default to /pix. $path = session_get('imagechooser_path'); if (!$path) { $path = '/pix'; } $data = array('location' => false, 'src' => $cgi->src, 'onload' => '', 'name' => $cgi->name); if (empty($cgi->location) || strpos($cgi->location, $path . '/') !== 0 || strstr($cgi->location, '..') || !@is_dir(site_docroot() . $cgi->location)) { $data['location'] = $path; if (strpos($data['src'], $data['location']) === 0) { $data['src'] = substr($data['src'], strlen($data['location'] . '/')); } } else { $data['location'] = $cgi->location; $up = preg_replace('|/[^/]+$|', '', $data['location']); if (!empty($up)) { $data['up'] = $up; } } // get all the data page_title(intl_get('Image') . ': ' . $data['src']); list($data['width'], $data['height']) = getimagesize(site_docroot() . $data['location'] . '/' . $data['src']); if ($cgi->attrs == 'false') { $data['onload'] = 'imagechooser_' . $cgi->name . '_select (\'' . $data['location'] . '/' . $data['src'] . '\')'; } // show me the money echo template_simple('select.spt', $data); exit;
$data['base_nice_url'] = "Web Files"; } else { $data['base_nice_url'] = $path; } if (empty($cgi->location) || strpos($cgi->location, $path . '/') !== 0 || strstr($cgi->location, '..') || !@is_dir(site_docroot() . $cgi->location)) { $data['location'] = $path; } else { $data['location'] = $cgi->location; $up = preg_replace('|/[^/]+$|', '', $data['location']); if (!empty($up)) { $data['up'] = $up; } } // get all the data page_title(intl_get('Folder') . ': ' . $data['location']); $dir = site_docroot() . $data['location']; if ($dh = opendir($dir)) { while (false !== ($file = readdir($dh))) { if (strpos($file, '.') === 0 || $file == 'CVS') { continue; } if (@is_dir($dir . '/' . $file)) { $data['subfolders'][] = $file; } else { //it must be a file, include it in data's files $data['files'][] = array('name' => $file); } } } function filechooser_sort($a, $b) {
<?php echo loader_box('cms/nav'); loader_import('saf.HTML'); echo template_simple(CMS_JS_ALERT_MESSAGE, $GLOBALS['cgi']); if (false && @is_dir(site_docroot() . '/inc/app/sitetracker')) { echo html::table(html::tr(html::td(html::h1(intl_get('Inbox')) . loader_box('cms/messages/inbox') . html::hr() . html::h1(intl_get('Bookmarks')) . loader_box('cms/bookmarks'), array('valign' => 'top', 'width' => '66%', 'style' => 'padding-right: 10px')) . html::td(loader_box('sitetracker/stats/summary'), array('valign' => 'top', 'width' => '33%', 'style' => 'padding-left: 10px'))), array('border' => 0, 'cellpadding' => 0, 'cellspacing' => 0, 'width' => '100%')); } else { echo html::table(html::tr(html::td(html::h1(intl_get('Inbox')) . loader_box('cms/messages/inbox') . html::h1(intl_get('Drafts')) . loader_box('cms/autosave/drafts'), array('valign' => 'top', 'width' => '66%', 'style' => 'padding-right: 10px')) . html::td(html::h1(intl_get('Bookmarks')) . loader_box('cms/bookmarks'), array('valign' => 'top', 'width' => '33%', 'style' => 'padding-left: 10px'))), array('border' => 0, 'cellpadding' => 0, 'cellspacing' => 0, 'width' => '100%')); }
$path = '/inc/data'; } $data = array('location' => false, 'up' => false, 'err' => false, 'subfolders' => array(), 'images' => array()); if (empty($cgi->location) || strpos($cgi->location, $path . '/') !== 0 || strstr($cgi->location, '..') || !@is_dir(site_docroot() . $cgi->location)) { $data['location'] = $path; } else { $data['location'] = $cgi->location; $up = preg_replace('|/[^/]+$|', '', $data['location']); if (!empty($up)) { $data['up'] = $up; } } // get all the data page_title(intl_get('Creating folder in') . ': ' . $data['location']); if (!empty($cgi->folder)) { if (@file_exists(site_docroot() . $cgi->location . '/' . $cgi->folder)) { $data['err'] = intl_get('The folder name you have chosen already exists. Please choose another.'); } elseif (preg_match('/^[^a-zA-Z0-9\\. _-]+$/', $cgi->folder)) { $data['err'] = intl_get('Your folder name contains invalid characters. Allowed characters are') . ': A-Z 0-9 . _ - and space.'; } else { if (!mkdir(site_docroot() . $cgi->location . '/' . $cgi->folder)) { $data['err'] = intl_get('Unknown error attempting to create folder.'); } else { header('Location: ' . site_prefix() . '/index/imagechooser-app?format=' . urlencode($cgi->format) . '&location=' . urlencode($cgi->location . '/' . $cgi->folder) . '&attrs=' . urlencode($cgi->attrs)); exit; } } } // show me the money echo template_simple('folder.spt', $data); exit;
<?php define('FPDF_FONTPATH', site_docroot() . '/inc/app/sitesearch/lib/Ext/fpdf/font/'); //loader_import ('sitesearch.Ext.fpdf'); loader_import('sitesearch.Ext.fpdi'); class PDF_Extractor_fpdi extends fpdi { var $error_msg = false; function error($msg) { $this->error_msg = $msg; return false; } } class PDF_Extractor extends SiteSearch_Extractor { var $mime = 'application/pdf'; var $supply = 'file'; function process($file) { $pdf = new PDF_Extractor_fpdi(); $pagecount = $pdf->setSourceFile($file); if ($pdf->error_msg) { return ''; } $body = ''; for ($i = 1; $i <= $pagecount; $i++) { $tpl = $pdf->ImportPage($i); $body .= ' ' . $pdf->tpls[$tpl]['buffer']; } $text = '';
$up = preg_replace('|/[^/]+$|', '', $data['location']); if (!empty($up)) { $data['up'] = $up; } } // get all the data page_title(intl_get('Adding image in') . ': ' . $data['location']); if (empty($cgi->filename)) { $filename = $cgi->file->name; } else { $filename = $cgi->filename; } if ($cgi->file) { if (@file_exists(site_docroot() . $cgi->location . '/' . $filename)) { $data['err'] = intl_get('The file name you have chosen already exists. Please choose another.'); } elseif (preg_match('/^[^a-zA-Z0-9\\. _-]+$/', $filename)) { $data['err'] = intl_get('Your file name contains invalid characters. Allowed characters are') . ': A-Z 0-9 . _ - and space.'; } elseif (!preg_match('/\\.(jpg|gif|png)$/i', $filename)) { $data['err'] = intl_get('Your image file must be in one of the following formats') . ': JPG, GIF or PNG'; } else { if (!$cgi->file->move(site_docroot() . $cgi->location, $filename)) { $data['err'] = intl_get('Unknown error attempting to create file.'); } else { header('Location: ' . site_prefix() . '/index/imagechooser-app?format=' . urlencode($cgi->format) . '&location=' . urlencode($cgi->location) . '&attrs=' . urlencode($cgi->attrs)); exit; } } } // show me the money echo template_simple('new.spt', $data); exit;
} elseif (preg_match('/\\.(jpg|gif|png)$/i', $file)) { list($w, $h) = getimagesize(site_docroot() . $data['location'] . '/' . $file); $data['images'][] = array('name' => $file, 'width' => $w, 'height' => $h); } } } function image_sort($a, $b) { if ($a['name'] == $b['name']) { return 0; } return strtolower($a['name']) < strtolower($b['name']) ? -1 : 1; } sort($data['subfolders']); usort($data['images'], 'image_sort'); if (!is_writeable(site_docroot() . $data['location'])) { $data['writeable'] = false; } else { $data['writeable'] = true; } if (!session_allowed('imagechooser_delete', 'rw', 'resource')) { $data['delete'] = false; } else { $data['delete'] = true; } if (session_get('imagechooser_err')) { $data['err'] = session_get('imagechooser_err'); session_set('imagechooser_err', null); } if (session_get('imagechooser_pagelist')) { $data['pagelist'] = session_get('imagechooser_pagelist');
<?php if (strpos($parameters['image'], '/pix') !== 0) { list($tmp, $parameters['image']) = explode('/pix', $parameters['image'], 2); $parameters['image'] = '/pix' . $parameters['image']; } list($width, $height) = getimagesize(site_docroot() . $parameters['image']); $float = $parameters['float']; if (empty($float)) { $float = false; } echo template_simple('protected.spt', array('image' => $parameters['image'], 'watermark' => $parameters['watermark'], 'width' => $width, 'height' => $height, 'float' => $float));
<?php if (!session_allowed('imagechooser_delete', 'rw', 'resource')) { die('Delete not permitted.'); } $res = db_shift_array('select id from sitellite_page where body like ?', '%' . $parameters['location'] . '/' . $parameters['src'] . '%'); if (count($res) > 0) { $parameters['deleted'] = false; page_title(intl_get('Image in Use') . ': ' . $parameters['location'] . '/' . $parameters['src']); $parameters['err'] = intl_get('Unable to delete image because it is still in use on the following pages:'); $parameters['list'] = $res; } else { if (!@unlink(site_docroot() . $parameters['location'] . '/' . $parameters['src'])) { $parameters['deleted'] = false; page_title(intl_get('Delete Failed') . ': ' . $parameters['location'] . '/' . $parameters['src']); $parameters['err'] = intl_get('Unable to delete image. Check your server filesystem permissions and try again.'); } else { $parameters['deleted'] = true; page_title(intl_get('Image Deleted') . ': ' . $parameters['location'] . '/' . $parameters['src']); } } if ($parameters['admin']) { $app = '-admin-action'; } else { $app = '-app'; } global $cgi; if ($parameters['err']) { session_set('imagechooser_err', $parameters['err']); session_set('imagechooser_pagelist', $parameters['list']); } else {