/** * A convenience function to test if the site is marked as down according to the config panel. * This method includes handling the preference that indicates that site-down behaviour should * be disabled for certain IP address ranges. * * @return boolean */ function is_sitedown() { global $CMS_INSTALL_PAGE; if (isset($CMS_INSTALL_PAGE)) { return TRUE; } if (get_site_preference('enablesitedownmessage') !== '1') { return FALSE; } if (get_site_preference('sitedownexcludeadmins')) { $uid = get_userid(FALSE); if ($uid) { return FALSE; } } if (!isset($_SERVER['REMOTE_ADDR'])) { return TRUE; } $excludes = get_site_preference('sitedownexcludes', ''); if (empty($excludes)) { return TRUE; } $tmp = explode(',', $excludes); $ret = cms_ipmatches($_SERVER['REMOTE_ADDR'], $excludes); if ($ret) { return FALSE; } return TRUE; }
function smarty_modifier_cms_date_format($string, $format = '', $default_date = '') { $gCms = cmsms(); if ($format == '') { $format = get_site_preference('defaultdateformat'); if ($format == '') { $format = '%b %e, %Y'; } if (!isset($gCms->variables['page_id'])) { $uid = get_userid(false); if ($uid) { $tmp = get_preference($uid, 'date_format_string'); if ($tmp != '') { $format = $tmp; } } } } $config = $gCms->GetConfig(); $fn = cms_join_path($config['root_path'], 'lib', 'smarty', 'plugins', 'modifier.date_format.php'); if (!file_exists($fn)) { die; } require_once $fn; return smarty_modifier_date_format($string, $format, $default_date); }
function __construct(&$content_obj, &$params = array()) { $params['type'] = 'image'; parent::__construct($content_obj, $params); $config = cmsms()->GetConfig(); $this->SetBlockProperty('prefix', isset($params['prefix']) ? $params['prefix'] : 'thumb_'); $this->SetBlockProperty('exclude', isset($params['exclude']) && $this->content_obj->IsFalse($params['exclude'])); $this->SetBlockProperty('dir', cms_join_path($config['uploads_path'], isset($params['dir']) ? $params['dir'] : get_site_preference('contentimage_path'))); $this->SetBlockProperty('inputname', isset($params['inputname']) ? $params['inputname'] : $this->GetBlockProperty('id')); }
function smarty_function_sitename($params, &$template) { $smarty = $template->smarty; $result = get_site_preference('sitename', 'CMSMS Site'); if (isset($params['assign'])) { $gCms = cmsms(); $smarty->assign(trim($params['assign']), $result); return; } return $result; }
function smarty_cms_function_sitename($params, &$smarty) { $result = get_site_preference('sitename', 'CMSMS Site'); if (isset($params['assign'])) { $gCms = cmsms(); $smarty =& $gCms->GetSmarty(); $smarty->assign(trim($params['assign']), $result); return; } return $result; }
public function execute($time = '') { if (!$time) { $time = time(); } // do the task. $age_days = (int) get_site_preference(self::CACHEDFILEAGE_SITEPREF, 0); $gCms = cmsms(); $gCms->clear_cached_files($age_days); return TRUE; }
public function execute($time = '') { if (!$time) { $time = time(); } // do the task. $lifetime = (int) get_site_preference(self::LIFETIME_SITEPREF, 60 * 60 * 24 * 31); $db = cmsms()->GetDB(); $q = "DELETE FROM " . cms_db_prefix() . "adminlog WHERE timestamp<?"; $p = array(time() - $lifetime); $dbresult = $db->Execute($q, $p); //$gCms->clear_cached_files($age_days); return TRUE; }
protected function fetch($name, &$source, &$mtime) { $gCms = cmsms(); $config = $gCms->GetConfig(); $contentobj = $gCms->variables['content_obj']; if (!is_object($contentobj)) { // We've a custom error message... return it here header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); if ($name == 'content_en') { $source = get_site_preference('custom404'); } else { $source = null; } $mtime = time(); return; } else { if (isset($_SESSION['cms_preview_data']) && $contentobj->Id() == '__CMS_PREVIEW_PAGE__') { if (!isset($_SESSION['cms_preview_data']['content_obj'])) { $contentops = $gCms->GetContentOperations(); $_SESSION['cms_preview_data']['content_obj'] = $contentops->LoadContentFromSerializedData($_SESSION['cms_preview_data']); $contentobj =& $_SESSION['cms_preview_data']['content_obj']; } $contentobj =& $_SESSION['cms_preview_data']['content_obj']; $source = $contentobj->Show($name); $mtime = $contentobj->GetModifiedDate(); // So no one can do anything nasty, take out the php smarty tags. Use a user // defined plugin instead. if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) { $source = preg_replace("/\\{\\/?php\\}/", "", $source); } return; } else { if (isset($contentobj) && $contentobj !== FALSE) { $source = $contentobj->Show($name); $mtime = $contentobj->GetModifiedDate(); // So no one can do anything nasty, take out the php smarty tags. Use a user // defined plugin instead. if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) { $source = preg_replace("/\\{\\/?php\\}/", "", $source); } return; } } } $source = null; $mtime = null; return; }
public function execute($time = '') { if (!$time) { $time = time(); } // do the task. if (!get_site_preference('enablenotifications', 1)) { return TRUE; } $allmodules = ModuleOperations::get_instance()->GetInstalledModules(); $loadedmods = ModuleOperations::get_instance()->GetLoadedModules(); foreach ($allmodules as $modulename) { $did_load = FALSE; $module = ''; if (isset($loadedmods[$modulename])) { $module = $loadedmods[$modulename]; } else { $module = ModuleOperations::get_instance()->get_module_instance($modulename); $did_load = TRUE; } if (!is_object($module)) { continue; } // now see if this module has notifications $data = $module->GetNotificationOutput(3); if (empty($data)) { continue; } if (is_object($data)) { $data = array($data); } for ($i = 0; $i < count($data); $i++) { if (!isset($data[$i]->name)) { $data[$i]->name = $modulename; } if (!isset($data[$i]->friendlyname)) { $data[$i]->friendlyname = $module->GetFriendlyName(); } } if (!is_array($this->_notifications)) { $this->_notifications = array(); } $this->_notifications = array_merge($this->_notifications, $data); } return TRUE; }
function __construct(&$content_obj, $params = array()) { $params['block_type'] = 'image'; parent::__construct($content_obj, $params); $config = cmsms()->GetConfig(); $this->SetProperty('prefix', isset($params['prefix']) ? $params['prefix'] : 'thumb_'); $this->SetProperty('exclude', !isset($params['exclude']) || ac_utils::IsFalse($params['exclude'])); $this->SetProperty('dir', cms_join_path($config['uploads_path'], isset($params['dir']) ? $params['dir'] : get_site_preference('contentimage_path'))); $this->SetProperty('inputname', isset($params['inputname']) ? $params['inputname'] : $this->GetProperty('id')); $this->SetProperty('urlonly', isset($params['urlonly']) && ac_utils::IsTrue($params['urlonly'])); $this->SetProperty('class', isset($params['class']) ? $params['class'] : ''); $this->SetProperty('alt', isset($params['alt']) ? $params['alt'] : ''); $this->SetProperty('css_id', isset($params['id']) ? $params['id'] : ''); $this->SetProperty('width', isset($params['width']) ? $params['width'] : ''); $this->SetProperty('height', isset($params['height']) ? $params['height'] : ''); $this->SetProperty('title', isset($params['title']) ? $params['title'] : ''); }
/** * A function to send lost password recovery email to a specified admin user (by name) * * @internal * @access private * @param string the username * @return results from the attempt to send a message. */ function send_recovery_email($username) { $gCms = cmsms(); $config = $gCms->GetConfig(); $userops = $gCms->GetUserOperations(); $user = $userops->LoadUserByUsername($username); $obj = cms_utils::get_module('CMSMailer'); if ($obj == null) { return false; } $obj->AddAddress($user->email, html_entity_decode($user->firstname . ' ' . $user->lastname)); $obj->SetSubject(lang('lostpwemailsubject', html_entity_decode(get_site_preference('sitename', 'CMSMS Site')))); $url = $config['admin_url'] . '/login.php?recoverme=' . md5(md5($config['root_path'] . '--' . $user->username . md5($user->password))); $body = lang('lostpwemail', html_entity_decode(get_site_preference('sitename', 'CMSMS Site')), $user->username, $url); $obj->SetBody($body); audit('', 'Core', 'Sent Lost Password Email for ' . $username); return $obj->Send(); }
function smarty_cms_function_metadata($params, &$smarty) { $gCms = cmsms(); $config = $gCms->GetConfig(); $content_obj =& $gCms->variables['content_obj']; $result = ''; $showbase = true; #Show a base tag unless showbase is false in config.php #It really can't hinder, only help. if (isset($config['showbase'])) { $showbase = $config['showbase']; } # but allow a parameter to override it. if (isset($params['showbase'])) { if ($params['showbase'] == 'false') { $showbase = false; } } if ($showbase) { $base = $config['root_url']; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { $base = $config['ssl_url']; } $result .= "\n<base href=\"" . $base . "/\" />\n"; } $result .= get_site_preference('metadata', ''); if (is_object($content_obj) && $content_obj->Metadata() != '') { $result .= "\n" . $content_obj->Metadata(); } if (!strpos($result, $smarty->left_delimiter) === false and !strpos($result, $smarty->right_delimiter) === false) { $smarty->_compile_source('metadata template', $result, $_compiled); @ob_start(); $smarty->_eval('?>' . $_compiled); $result = @ob_get_contents(); @ob_end_clean(); } if (isset($params['assign'])) { $smarty->assign(trim($params['assign']), $result); return; } return $result; }
public function execute($target = '', $data = array(), $age = '') { $mod = cms_utils::get_module('ModuleManager'); if (!$age) { $age = get_site_preference('browser_cache_expiry', 60); } if ($age) { $age = max(1, (int) $age); } // build a signature $this->_signature = md5(serialize(array($target, $data))); $fn = $this->_getCacheFile(); if (!$fn) { return; } // check for the cached file $atime = time() - $age * 60; $status = ''; $resutl = ''; if ($mod->GetPreference('disable_caching', 0) || !file_exists($fn) || filemtime($fn) <= $atime) { // execute the request $req = new cms_http_request(); if ($this->_timeout) { $req->setTimeout($this->_timeout); } $req->execute($target, '', 'POST', $data); $this->_status = $req->getStatus(); $this->_result = $req->getResult(); @unlink($fn); if ($this->_status == 200) { // create a cache file $fh = fopen($fn, 'w'); fwrite($fh, serialize(array($this->_status, $this->_result))); fclose($fh); } } else { // get data from the cache. $data = unserialize(file_get_contents($fn)); $this->_status = $data[0]; $this->_result = $data[1]; } }
public function getUserFormat($fmt = '') { $config = cmsms()->GetConfig(); $stz = new DateTimeZone($config['timezone']); $utz = new DateTimeZone($config['user_timezone']); // this calls the cms_date_format stuff. if (empty($fmt)) { $fmt = get_site_preference('defaultdateformat', '%b %e, %Y'); global $gCms; if (!isset($gCms->variables['page_id'])) { $uid = get_userid(FALSE); if ($uid) { $fmt = get_preference($uid, 'date_format_string', $fmt); } } } $this->setTimeZone($utz); $when = $this->format('U'); $this->setTimeZone($stz); return strftime($fmt, $when); }
function smarty_function_cms_init_editor($params, &$template) { $smarty = $template->smarty; // if the editor is not specified. $wysiwyg = ''; if (isset($params['wysiwyg'])) { $wysiwyg = trim($params['wysiwyg']); } // get the frontend editor preference if (!$wysiwyg) { $wysiwyg = get_site_preference('frontendwysiwyg'); } if (!$wysiwyg || (int) $wysiwyg < 0) { return; } $mod = cms_utils::get_module($wysiwyg); if (!is_object($mod)) { return; } if (!$mod->IsWYSIWYG()) { return; } // check to see if it is active if (!isset($params['force']) || $params['force'] != 0) { if (!$mod->WYSIWYGActive()) { return; } } // get the output $output = $mod->WYSIWYGGenerateHeader(); if (!$output) { return; } // assign it or echo it. if (isset($params['assign'])) { $smarty->assign(trim($params['assign']) . $output); return; } return $output; }
function smarty_function_metadata($params, &$template) { $smarty = $template->smarty; $gCms = cmsms(); $config = $gCms->GetConfig(); $content_obj = $gCms->variables['content_obj']; $result = ''; $showbase = true; #Show a base tag unless showbase is false in config.php #It really can't hinder, only help. if (isset($config['showbase'])) { $showbase = $config['showbase']; } # but allow a parameter to override it. if (isset($params['showbase'])) { if ($params['showbase'] == 'false') { $showbase = false; } } if ($showbase) { $base = $config['root_url']; if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') { $base = $config['ssl_url']; } $result .= "\n<base href=\"" . $base . "/\" />\n"; } $result .= get_site_preference('metadata', ''); if (is_object($content_obj) && $content_obj->Metadata() != '') { $result .= "\n" . $content_obj->Metadata(); } if (!strpos($result, $smarty->left_delimiter) === false and !strpos($result, $smarty->right_delimiter) === false) { $result = $smarty->fetch('string:' . $result); } if (isset($params['assign'])) { $smarty->assign(trim($params['assign']), $result); return; } return $result; }
function DisplayTopMenu() { echo '<div><p class="logocontainer"><img src="themes/default/images/logo.gif" alt="" /><span class="logotext">' . lang('adminpaneltitle') . ' - ' . get_site_preference('sitename') . ' ' . lang('welcome_user') . ': ' . $this->cms->variables['username'] . '</span></p></div>'; echo "<div class=\"topmenucontainer\">\n\t<ul id=\"nav\">"; foreach ($this->menuItems as $key => $menuItem) { if ($menuItem['parent'] == -1) { echo "\n\t\t"; $this->renderMenuSection($key, 0, -1); } } echo "\n\t</ul>\n"; //ICON VIEW SITE echo "\n\t<div id=\"nav-icons_all\"><ul id=\"nav-icons\">\n"; echo "\n\t<li class=\"viewsite-icon\"><a rel=\"external\" title=\"" . lang('viewsite') . "\" href=\"../\">" . lang('viewsite') . "</a></li>\n"; //ICON LAGOUT echo "\n\t<li class=\"logout-icon\"><a title=\"" . lang('logout') . "\" href=\"logout.php\">" . lang('logout') . "</a></li>\n"; echo "\n\t</ul></div>\n"; //END ICONS echo "\t<div class=\"clearb\"></div>\n"; echo "</div>\n"; echo '<div class="breadcrumbs"><p class="breadcrumbs">'; $counter = 0; foreach ($this->breadcrumbs as $crumb) { if ($counter > 0) { echo " » "; } if (isset($crumb['url']) && str_replace('&', '&', $crumb['url']) != basename($_SERVER['REQUEST_URI'])) { echo '<a class="breadcrumbs" href="' . $crumb['url']; echo '">' . $crumb['title']; echo '</a>'; } else { echo $crumb['title']; } $counter++; } echo '</p></div>'; echo '<div class="hstippled"> </div>'; }
/** * Smarty date_format modifier plugin * * Type: modifier<br> * Name: cms_date_format<br> * Purpose: format datestamps via strftime<br> * Input:<br> * - string: input date string * - format: strftime format for output * - default_date: default date if $string is empty * * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param string $string input date string * @param string $format strftime format for output * @param string $default_date default date if $string is empty * @param string $formatter either 'strftime' or 'auto' * @return string |void * @uses smarty_make_timestamp() * * Modified by Tapio Löytty <*****@*****.**> */ function smarty_cms_modifier_cms_date_format($string, $format = '', $default_date = '') { if ($format == '') { $format = get_site_preference('defaultdateformat'); if ($format == '') { $format = '%b %e, %Y'; } if (!cmsms()->is_frontend_request()) { if ($uid = get_userid(false)) { $tmp = get_preference($uid, 'date_format_string'); if ($tmp != '') { $format = $tmp; } } } } $fn = cms_join_path(SMARTY_PLUGINS_DIR, 'modifier.date_format.php'); if (!file_exists($fn)) { die; } require_once $fn; return smarty_modifier_date_format($string, $format, $default_date); }
public static function smarty_fetch_imageblock($params, &$template) { $smarty = $template->smarty; $gCms = cmsms(); $config = $gCms->GetConfig(); $contentobj = $gCms->variables['content_obj']; if (isset($_SESSION['cms_preview_data']) && $contentobj->Id() == '__CMS_PREVIEW_PAGE__') { // it's a preview. if (!isset($_SESSION['cms_preview_data']['content_obj'])) { $contentops =& $gCms->GetContentOperations(); $_SESSION['cms_preview_data']['content_obj'] = $contentops->LoadContentFromSerializedData($_SESSION['cms_preview_data']); } $contentobj =& $_SESSION['cms_preview_data']['content_obj']; } if (!is_object($contentobj) || $contentobj->Id() <= 0) { return self::content_return('', $params, $smarty); } $adddir = get_site_preference('contentimage_path'); if (isset($params['dir']) && $params['dir'] != '') { $adddir = $params['dir']; } $dir = cms_join_path($config['uploads_path'], $adddir); $basename = basename($config['uploads_path']); $result = ''; if (isset($params['block'])) { $oldvalue = $smarty->caching; $smarty->caching = false; $result = $smarty->fetch(str_replace(' ', '_', 'content:' . $params['block']), '|' . $params['block'], $contentobj->Id() . $params['block']); $smarty->caching = $oldvalue; } $img = $result; if ($img == -1 || empty($img)) { return; } // create the absolute url. if (startswith($img, $basename)) { // old style url. if (!startswith($img, 'http')) { $img = str_replace('//', '/', $img); } $img = substr($img, strlen($basename . '/')); $img = $config['uploads_url'] . '/' . $img; } else { $img = $config['uploads_url'] . '/' . $adddir . '/' . $img; } $name = ''; $alt = ''; $width = ''; $height = ''; $urlonly = false; $xid = ''; $class = ''; if (isset($params['name'])) { $name = $params['name']; } if (isset($params['class'])) { $class = $params['class']; } if (isset($params['id'])) { $xid = $params['id']; } if (isset($params['alt'])) { $alt = $params['alt']; } if (isset($params['width'])) { $width = $params['width']; } if (isset($params['height'])) { $height = $params['height']; } if (isset($params['urlonly'])) { $urlonly = true; } if (!isset($params['alt'])) { $alt = $img; } $out = ''; if ($urlonly) { $out = $img; } else { $out = '<img src="' . $img . '" '; if (!empty($name)) { $out .= 'name="' . $name . '" '; } if (!empty($class)) { $out .= 'class="' . $class . '" '; } if (!empty($xid)) { $out .= 'id="' . $xid . '" '; } if (!empty($width)) { $out .= 'width="' . $width . '" '; } if (!empty($height)) { $out .= 'height="' . $height . '" '; } if (!empty($alt)) { $out .= 'alt="' . $alt . '" '; } $out .= '/>'; } if (isset($params['assign'])) { $smarty->assign(trim($params['assign']), $out); return; } return $out; }
/** * Encrypts and sets password for the User * * @since 0.6.1 */ function SetPassword($password) { $this->password = md5(get_site_preference('sitemask', '') . $password); }
// add a priority 1 dashboard item if (file_exists(dirname(dirname(__FILE__)) . '/install')) { $themeObject->AddNotification(1, 'Core', lang('installdirwarning')); } // Display a warning if safe mode is enabled if (ini_get_boolean('safe_mode') && get_site_preference('disablesafemodewarning', 0) == 0) { $themeObject->AddNotification(1, 'Core', lang('warning_safe_mode')); } // Display a warning sitedownwarning $sitedown_message = lang('sitedownwarning', TMP_CACHE_LOCATION . '/SITEDOWN'); $sitedown_file = TMP_CACHE_LOCATION . '/SITEDOWN'; if (file_exists($sitedown_file)) { $themeObject->AddNotification(1, 'Core', $sitedown_message); } $timelastchecked = get_site_preference('lastcmsversioncheck', 0); if (get_site_preference('checkversion', 1) && time() - $timelastchecked > 24 * 60 * 60 || isset($_GET['forceversioncheck'])) { $req = new cms_http_request(); $req->setTimeout(10); $req->execute(CMS_DEFAULT_VERSIONCHECK_URL); if ($req->getStatus() == 200) { $remote_ver = trim($req->getResult()); if (strpos($remote_ver, ':') !== FALSE) { list($tmp, $remote_ver) = explode(':', $remote_ver, 2); $remote_ver = trim($remote_ver); } if (version_compare(CMS_VERSION, $remote_ver) < 0) { set_site_preference('cms_is_uptodate', 0); $themeObject->AddNotification(1, 'Core', lang('new_version_available')); audit('', 'Core', 'CMSMS version ' . $remote_ver . ' is available'); } else { set_site_preference('cms_is_uptodate', 1);
function DisplayTopMenu() { $urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; echo '<div id="ncleangrey-container">'; //LOGO echo '<div id="logocontainer"> <img src="themes/NCleanGrey/images/layout/logoTM.png" alt="' . get_site_preference('sitename') . '" title="' . get_site_preference('sitename') . '" /> <div class="logotext">' . lang('adminpaneltitle') . ' - ' . get_site_preference('sitename') . '<br />' . lang('welcome_user') . ': ' . $this->cms->variables['username']; echo "</div>\n"; echo "</div>\n"; //MENU echo "<div class=\"topmenucontainer\">\n\t<ul id=\"nav\">"; foreach ($this->menuItems as $key => $menuItem) { if ($menuItem['parent'] == -1) { echo "\n\t\t"; $this->renderMenuSection($key, 0, -1); } } echo "\n\t</ul>\n"; echo "\t<div class=\"clearb\"></div>\n"; echo "</div>\n"; //breadcrumbs echo '<div class="breadcrumbs">'; //ICON VIEW SITE echo "\n\t<div id=\"nav-icons_all\"><ul id=\"nav-icons\">\n"; echo "\n\t<li class=\"viewsite-icon\"><a rel=\"external\" title=\"" . lang('viewsite') . "\" href=\"" . $this->_viewsite_url . "\">" . lang('viewsite') . "</a></li>\n"; //ICON LAGOUT echo "\n\t<li class=\"logout-icon\"><a title=\"" . lang('logout') . "\" href=\"logout.php\">" . lang('logout') . "</a></li>\n"; echo "\n\t</ul></div>\n"; echo '<p class="breadcrumbs">'; $counter = 0; if (!is_array($this->breadcrumbs) || count($this->breadcrumbs) == 0) { echo ' '; } else { foreach ($this->breadcrumbs as $crumb) { if ($counter > 0) { echo " » "; } if (isset($crumb['url']) && str_replace('&', '&', $crumb['url']) != basename($_SERVER['REQUEST_URI'])) { echo '<a class="breadcrumbs" href="' . $crumb['url']; echo '">' . $crumb['title']; echo '</a>'; } else { echo $crumb['title']; } $counter++; } } echo '</p></div>'; //LINE AFETER breadcrumbs echo '<div class="hstippled"> </div>'; }
function display_content_list($themeObject = null) { $gCms = cmsms(); global $thisurl; global $urlext; check_login(); $userid = get_userid(); // setup which columns to display. $mypages = author_pages($userid); $columnstodisplay = array(); $columnstodisplay['expand'] = 1; $columnstodisplay['hier'] = 1; $columnstodisplay['page'] = 1; $columnstodisplay['alias'] = get_site_preference('listcontent_showalias', 1); $columnstodisplay['url'] = get_site_preference('listcontent_showurl', 1); $columnstodisplay['template'] = 1; $columnstodisplay['friendlyname'] = 1; $columnstodisplay['owner'] = 1; $columnstodisplay['active'] = check_permission($userid, 'Manage All Content'); $columnstodisplay['default'] = check_permission($userid, 'Manage All Content'); $columnstodisplay['move'] = check_permission($userid, 'Manage All Content') || check_permission($userid, 'Reorder Content'); $columnstodisplay['view'] = 1; $columnstodisplay['copy'] = check_permission($userid, 'Add Pages') || check_permission($userid, 'Manage All Content'); $columnstodisplay['edit'] = 1; $columnstodisplay['delete'] = check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content'); $columnstodisplay['multiselect'] = check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content'); $page = 1; if (isset($_GET['page'])) { $page = $_GET['page']; } //$limit = get_preference($userid, 'paging', 0); $limit = 0; //Took out pagination $thelist = ''; $count = 0; $currow = "row1"; if ($themeObject == null) { $themeObject = AdminTheme::GetThemeObject(); } // construct true/false button images $image_true = $themeObject->DisplayImage('icons/system/true.gif', lang('true'), '', '', 'systemicon'); $image_set_false = $themeObject->DisplayImage('icons/system/true.gif', lang('setfalse'), '', '', 'systemicon'); $image_set_true = $themeObject->DisplayImage('icons/system/false.gif', lang('settrue'), '', '', 'systemicon'); $expandImg = $themeObject->DisplayImage('icons/system/expand.gif', lang('expand'), '', '', 'systemicon'); $contractImg = $themeObject->DisplayImage('icons/system/contract.gif', lang('contract'), '', '', 'systemicon'); $downImg = $themeObject->DisplayImage('icons/system/arrow-d.gif', lang('down'), '', '', 'systemicon'); $upImg = $themeObject->DisplayImage('icons/system/arrow-u.gif', lang('up'), '', '', 'systemicon'); $viewImg = $themeObject->DisplayImage('icons/system/view.gif', lang('view'), '', '', 'systemicon'); $editImg = $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'), '', '', 'systemicon'); $copyImg = $themeObject->DisplayImage('icons/system/copy.gif', lang('copy'), '', '', 'systemicon'); $deleteImg = $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'), '', '', 'systemicon'); #Setup array so we don't load more templates than we need to $templateops = TemplateOperations::get_instance()->LoadTemplates(); #Ditto with users $users = array(); $menupos = array(); $openedArray = array(); if (get_preference($userid, 'collapse', '') != '') { $tmp = explode('.', get_preference($userid, 'collapse')); foreach ($tmp as $thisCol) { $colind = substr($thisCol, 0, strpos($thisCol, '=')); if ($colind != "") { $openedArray[] = $colind; } } } debug_buffer('At Start of Display Content List'); $hierarchy = $gCms->GetHierarchyManager(); $rowcount = 0; if ($hierarchy->hasChildren()) { $pagelist = array(); $children = $hierarchy->getChildren(false, true); $author_allpages = check_permission($userid, 'Reorder Content') && check_peer_authorship($userid, $children[0]->getId()); foreach ($children as $child) { display_hierarchy($child, $userid, check_modify_all($userid), $users, $menupos, $openedArray, $pagelist, $image_true, $image_set_false, $image_set_true, $upImg, $downImg, $viewImg, $editImg, $copyImg, $deleteImg, $expandImg, $contractImg, $mypages, $page, $columnstodisplay, $author_allpages); } $rowcount += count($pagelist); foreach ($pagelist as $item) { $thelist .= $item; } $thelist .= '</tbody>'; $thelist .= "</table>\n"; } $headoflist = ''; $headoflist .= '<div class="pageoverflow"><p class="pageoptions">'; if (check_permission($userid, 'Add Pages') || check_permission($userid, 'Manage All Content')) { $headoflist .= '<a href="addcontent.php' . $urlext . '" class="pageoptions">'; $headoflist .= $themeObject->DisplayImage('icons/system/newobject.gif', lang('addcontent'), '', '', 'systemicon') . '</a>'; $headoflist .= ' <a class="pageoptions" href="addcontent.php' . $urlext . '">' . lang("addcontent") . '</a>'; } $headoflist .= '<a style="margin-left: 10px;" href="' . $thisurl . '&expandall=1" onclick="xajax_content_expandall(); return false;">'; $headoflist .= $themeObject->DisplayImage('icons/system/expandall.gif', lang('expandall'), '', '', 'systemicon') . '</a>'; $headoflist .= ' <a class="pageoptions" href="' . $thisurl . '&expandall=1" onclick="xajax_content_expandall(); return false;">' . lang("expandall") . '</a> '; $headoflist .= ' <a href="' . $thisurl . '&collapseall=1" onclick="xajax_content_collapseall(); return false;">'; $headoflist .= $themeObject->DisplayImage('icons/system/contractall.gif', lang('contractall'), '', '', 'systemicon') . '</a>'; $headoflist .= ' <a class="pageoptions" href="' . $thisurl . '&collapseall=1" onclick="xajax_content_collapseall(); return false;">' . lang("contractall") . '</a>'; if (check_permission($userid, 'Manage All Content')) { $reorderurl = "ordercontent.php?" . CMS_SECURE_PARAM_NAME . "=" . $_SESSION[CMS_USER_KEY]; $headoflist .= ' <a href="' . $reorderurl . '">'; $headoflist .= $themeObject->DisplayImage('icons/system/reorder.gif', lang('reorderpages'), '', '', 'systemicon') . '</a>'; $headoflist .= ' <a class="pageoptions" href="' . $reorderurl . '">' . lang('reorderpages') . '</a>'; } $headoflist .= '</p></div>'; $headoflist .= '<form action="multicontent.php" method="post">'; $headoflist .= '<div class="hidden" ><input type="hidden" name="' . CMS_SECURE_PARAM_NAME . '" value="' . $_SESSION[CMS_USER_KEY] . '"/></div>' . "\n"; $headoflist .= '<table cellspacing="0" class="pagetable">' . "\n"; $headoflist .= '<thead>'; $headoflist .= "<tr>\n"; // setup column titles. if ($columnstodisplay['expand']) { $headoflist .= "<th> </th>"; } if ($columnstodisplay['hier']) { $headoflist .= "<th> </th>"; } if ($columnstodisplay['page']) { $str = lang('menutext'); if (get_site_preference('listcontent_showtitle')) { $str = lang('title'); } $headoflist .= '<th scope="col" class="pagew25" title="' . lang('lctitle_page') . '">' . lang('page') . " <em>({$str})</em></th>\n"; } if ($columnstodisplay['alias']) { $headoflist .= '<th scope="col" title="' . lang('lctitle_alias') . '">' . lang('pagealias') . "</th>\n"; } if ($columnstodisplay['url']) { $headoflist .= '<th scope="col" title="' . lang('lctitle_url') . '">' . lang('url') . "</th>\n"; } if ($columnstodisplay['template']) { $headoflist .= '<th scope="col" title="' . lang('lctitle_template') . '">' . lang('template') . "</th>\n"; } if ($columnstodisplay['friendlyname']) { $headoflist .= "<th scope=\"col\" >" . lang('type') . "</th>\n"; } if ($columnstodisplay['owner']) { $headoflist .= '<th scope="col" title="' . lang('lctitle_owner') . '">' . lang('owner') . "</th>\n"; } if ($columnstodisplay['active']) { $headoflist .= '<th scope="col" title="' . lang('lctitle_active') . '" class="pagepos">' . lang('active') . "</th>\n"; } if ($columnstodisplay['default']) { $headoflist .= '<th scope="col" title="' . lang('lctitle_default') . '" class="pagepos">' . lang('default') . "</th>\n"; } if ($columnstodisplay['move']) { $headoflist .= '<th scope="col" title="' . lang('lctitle_move') . '" class="move">' . lang('move') . "</th>\n"; } if ($columnstodisplay['view']) { $headoflist .= "<th class=\"pageicon\"> </th>\n"; } if ($columnstodisplay['copy']) { $headoflist .= "<th class=\"pageicon\"> </th>\n"; } if ($columnstodisplay['edit']) { $headoflist .= "<th class=\"pageicon\"> </th>\n"; } if ($columnstodisplay['delete']) { $headoflist .= "<th class=\"pageicon\"> </th>\n"; } if ($columnstodisplay['multiselect']) { $headoflist .= '<th scope="col" title="' . lang('lctitle_multiselect') . '" class="checkbox"><input id="selectall" type="checkbox" onclick="select_all();" /><label for="selectall" class="invisible">' . lang('toggle') . '</label></th>' . "\n"; // checkbox column } $headoflist .= "</tr>\n"; $headoflist .= '</thead>'; $headoflist .= '<tbody>'; ob_start(); $opts = array(); if (check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content')) { bulkcontentoperations::register_function(lang('delete'), 'delete'); } if (check_permission($userid, 'Manage All Content')) { bulkcontentoperations::register_function(lang('active'), 'active'); bulkcontentoperations::register_function(lang('inactive'), 'inactive'); bulkcontentoperations::register_function(lang('cachable'), 'setcachable'); bulkcontentoperations::register_function(lang('noncachable'), 'setnoncachable'); bulkcontentoperations::register_function(lang('showinmenu'), 'showinmenu'); bulkcontentoperations::register_function(lang('hidefrommenu'), 'hidefrommenu'); bulkcontentoperations::register_function(lang('secure'), 'secure'); bulkcontentoperations::register_function(lang('insecure'), 'insecure'); bulkcontentoperations::register_function(lang('settemplate'), 'settemplate'); bulkcontentoperations::register_function(lang('changeowner'), 'changeowner'); } $opts = bulkcontentoperations::get_operation_list(); if (!empty($opts)) { echo '<div class="pageoptions">' . "\n"; echo '<div style="margin-top: 0; float: right; text-align: right">' . "\n"; echo '<label for="multiaction">' . lang('selecteditems') . '</label>: '; echo '<select name="multiaction" id="multiaction">'; foreach ($opts as $key => $value) { echo '<option value="' . $key . '">' . $value . '</option>'; } echo '</select>' . "\n"; echo '<input type="submit" accesskey="s" value="' . lang('submit') . '"/></div></div>' . "\n"; } /* } */ ?> <div style="float: left;"> <?php if (check_permission($userid, 'Add Pages') || check_permission($userid, 'Manage All Content')) { ?> <a href="addcontent.php<?php echo $urlext; ?> " class="pageoptions"> <?php echo $themeObject->DisplayImage('icons/system/newobject.gif', lang('addcontent'), '', '', 'systemicon') . '</a>'; echo ' <a class="pageoptions" href="addcontent.php' . $urlext . '">' . lang("addcontent"); ?> </a> <?php } ?> <a style="margin-left: 10px;" href="'.$thisurl.'&expandall=1" onclick="xajax_content_expandall(); return false;"> <?php echo $themeObject->DisplayImage('icons/system/expandall.gif', lang('expandall'), '', '', 'systemicon') . '</a>'; echo ' <a class="pageoptions" href="' . $thisurl . '&expandall=1" onclick="xajax_content_expandall(); return false;">' . lang("expandall"); ?> </a> <a href="<?php echo $thisurl; ?> &collapseall=1" onclick="xajax_content_collapseall(); return false;"> <?php echo $themeObject->DisplayImage('icons/system/contractall.gif', lang('contractall'), '', '', 'systemicon') . '</a>'; echo ' <a class="pageoptions" href="' . $thisurl . '&collapseall=1" onclick="xajax_content_collapseall(); return false;">' . lang("contractall") . '</a>'; if (check_permission($userid, 'Manage All Content')) { $image_reorder = $themeObject->DisplayImage('icons/system/reorder.gif', lang('reorderpages'), '', '', 'systemicon'); $reorderurl = "ordercontent.php?" . CMS_SECURE_PARAM_NAME . "=" . $_SESSION[CMS_USER_KEY]; echo ' <a class="pageoptions" href="' . $reorderurl . '">' . $image_reorder . '</a> <a class="pageoptions" href="' . $reorderurl . '">' . lang('reorderpages') . '</a>'; } ?> </div> <br /> <div class="clearb"></div> <?php $footer = ob_get_contents(); ob_end_clean(); return $headoflist . $thelist . $footer . '</form></div>'; }
/** * A function to return the name of the default admin theme. * * @returns string */ public static function GetDefaultTheme() { $tmp = self::GetAvailableThemes(); if (is_array($tmp) && count($tmp)) { $tmp = array_keys($tmp); $logintheme = get_site_preference('logintheme'); if ($logintheme && in_array($logintheme, $tmp)) { return $logintheme; } return $tmp[0]; } }
/** * Constructor * * @param array The hash of CMSMS config settings */ public function __construct() { parent::__construct(); global $CMS_ADMIN_PAGE; // <- Still needed? global $CMS_INSTALL_PAGE; $config = cmsms()->GetConfig(); // Do not allow any absolute paths in template resolution. $this->no_absolute_templates = TRUE; // Set template_c and cache dirs $this->setCompileDir(TMP_TEMPLATES_C_LOCATION); $this->setCacheDir(TMP_CACHE_LOCATION); $this->assign('app_name', 'CMS'); if ($config["debug"] == true) { $this->force_compile = true; $this->debugging = false; } // Set plugins dirs $this->addPluginsDir(cms_join_path($config['root_path'], 'plugins')); // common resources. $this->registerResource('module_db_tpl', new CMSModuleDbTemplateResource()); $this->registerResource('module_file_tpl', new CMSModuleFileTemplateResource()); $this->registerResource('template', new CMSPageTemplateResource()); // <- Should proably be global and removed from parser? // Load User Defined Tags if (!cmsms()->test_state(CmsApp::STATE_INSTALL)) { $utops = cmsms()->GetUserTagOperations(); $usertags = $utops->ListUserTags(); $caching = false; if (get_site_preference('smarty_cacheudt', 'never') == 'always' && cmsms()->is_frontend_request()) { $caching = true; } foreach ($usertags as $id => $udt_name) { $function = $utops->CreateTagFunction($udt_name); $this->registerPlugin('function', $udt_name, $function, $caching); } } // register default plugin handler $this->registerDefaultPluginHandler(array(&$this, 'defaultPluginHandler')); if (cmsms()->is_frontend_request()) { $this->setTemplateDir(cms_join_path($config['root_path'], 'tmp', 'templates')); $this->setConfigDir(cms_join_path($config['root_path'], 'tmp', 'templates')); // Check if we are at install page, don't register anything if so, cause nothing below is needed. if (isset($CMS_INSTALL_PAGE)) { return; } if (is_sitedown()) { $this->setCaching(false); $this->force_compile = true; } // Load resources $this->registerResource('tpl_top', new CMSPageTemplateResource('top')); $this->registerResource('tpl_head', new CMSPageTemplateResource('head')); $this->registerResource('tpl_body', new CMSPageTemplateResource('body')); $this->registerResource('content', new CMSContentTemplateResource()); //$this->registerResource('htmlblob',new CMSGlobalContentTemplateResource()); $this->registerResource('globalcontent', new CMSGlobalContentTemplateResource()); // just for frontend actions. $this->registerPlugin('compiler', 'content', array('CMS_Content_Block', 'smarty_compile_fecontentblock'), false); $this->registerPlugin('function', 'content_image', 'CMS_Content_Block::smarty_fetch_imageblock', false); $this->registerPlugin('function', 'content_module', 'CMS_Content_Block::smarty_fetch_moduleblock', false); $this->registerPlugin('function', 'process_pagedata', 'CMS_Content_Block::smarty_fetch_pagedata', false); // Autoload filters $this->autoloadFilters(); // compile check can only be enabled, if using smarty cache... just for safety. if (get_site_preference('use_smartycache', 0)) { if (version_compare(phpversion(), '5.3') >= 0) { $this->setCompileCheck(get_site_preference('use_smartycompilecheck', 1)); } } } else { if (cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE)) { $this->setCaching(false); $this->force_compile = true; $this->setTemplateDir(cms_join_path($config['root_path'], $config['admin_dir'], 'templates')); $this->setConfigDir(cms_join_path($config['root_path'], $config['admin_dir'], 'configs')); $this->registerResource('globalcontent', new CMSNullTemplateResource()); } } $this->AddTemplateDir(cms_join_path($config['root_path'], 'lib', 'smarty', 'libs')); // Enable security object // Note: Buggy, disabled prior to release of CMSMS 1.11 //$this->enableSecurity('CMSSmartySecurityPolicy'); }
} # # Set all of the values from the preferences # or from hardcoded defaults # $page_secure = get_site_preference('page_secure', '0'); $page_active = get_site_preference('page_active', "1"); $page_showinmenu = get_site_preference('page_showinmenu', "1"); $page_extra1 = get_site_preference('page_extra1', ''); $page_extra2 = get_site_preference('page_extra2', ''); $page_extra3 = get_site_preference('page_extra3', ''); $page_searchable = get_site_preference('page_searchable', '1'); $page_cachable = get_site_preference('page_cachable', "1"); $page_metadata = get_site_preference('page_metadata', "<!-- " . lang('msg_defaultmetadata') . " -->"); $page_defaultcontent = get_site_preference("defaultpagecontent", "<!-- " . lang('msg_defaultcontent') . " -->"); $additional_editors = get_site_preference('additional_editors', ''); $message = ''; if (isset($_POST['submit'])) { // // Process Submit // $page_secure = isset($_POST['page_secure']) ? "1" : "0"; $page_active = isset($_POST['page_active']) ? "1" : "0"; $page_showinmenu = isset($_POST['page_showinmenu']) ? "1" : "0"; $page_cachable = isset($_POST['page_cachable']) ? "1" : "0"; $page_metadata = $_POST['page_metadata']; $page_defaultcontent = $_POST['page_defaultcontent']; if (isset($_POST['additional_editors']) && !empty($_POST['additional_editors'])) { $additional_editors = implode(',', $_POST['additional_editors']); } else { $additional_editors = '';
/** * DisplayHTMLHeader * This method outputs the HEAD section of the html page in the admin section. */ public function DisplayHTMLHeader($showielink = false, $addt = '') { $x = $this->breadcrumbs; // dummy function to trigger the navigation being built early. $config = cmsms()->GetConfig(); $urlext = CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; $title = get_site_preference('sitename') . ' - ' . $this->title; $str = "<head>\r\n"; $str .= <<<EOT \t<title>{$title}</title> \t<base href="{$config['admin_url']}/" /> \t<meta name="Generator" content="CMS Made Simple - Copyright (C) 2004-12 Ted Kulp. All rights reserved." /> \t<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \t<meta name="robots" content="noindex, nofollow" /> \t<link rel="stylesheet" type="text/css" href="style.php?{$urlext}" /> EOT; if ($showielink) { $str .= <<<EOT <!--[if IE]> <link rel="stylesheet" type="text/css" href="style.php?ie=1&{$urlext}" /> <![endif]--> EOT; } $str .= $this->OutputHeaderJavascript() . "\n"; $str .= "<!-- THIS IS WHERE HEADER STUFF SHOULD GO -->\n"; ob_start(); $tmp1 = $this->ThemeHeader(); $tmp2 = ob_get_contents(); ob_end_clean(); if ($tmp1) { // data is returned $str .= $tmp1; } else { // assume data is echoed $str .= $tmp2; } $str .= $addt . "\n"; $str .= "</head>\n"; // fix to correct and add the end header tag -- JLB echo $str; }
$dflt = $templateops->LoadDefaultTemplate(); if (isset($dflt)) { $contentobj->SetTemplateId($dflt->id); } // this stuff should be changed somehow. $contentobj->SetMetadata($metadata); $contentobj->SetPropertyValue('content_en', get_site_preference('defaultpagecontent')); // why? if ($parent_id != -1) { $contentobj->SetParentId($parent_id); } $contentobj->SetPropertyValue('searchable', get_site_preference('page_searchable', 1)); $contentobj->SetPropertyValue('extra1', get_site_preference('page_extra1', '')); $contentobj->SetPropertyValue('extra2', get_site_preference('page_extra2', '')); $contentobj->SetPropertyValue('extra3', get_site_preference('page_extra3', '')); $tmp = get_site_preference('additional_editors'); $tmp2 = array(); if (!empty($tmp)) { $tmp2 = explode(',', $tmp); } $contentobj->SetAdditionalEditors($tmp2); $xajax->processRequest(); if ($access && strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { try { if ($submit || $apply) { // Fill contentobj with parameters $contentobj->SetAddMode(); $contentobj->FillParams($_POST); $contentobj->SetOwner($userid); $error = $contentobj->ValidateData(); if ($error === FALSE) {
/** * Create a hierarchical ordered dropdown of all the content objects in the system for use * in the admin and various modules. If $current or $parent variables are passed, care is taken * to make sure that children which could cause a loop are hidden, in cases of when you're creating * a dropdown for changing a content object's parent. * * @param string $current The currently selected content object. If none is given, we show all items. * @param string $parent The parent of the currently selected content object. If none is given, we show all items. * @param string $name The html name of the dropdown * @param boolean $allowcurrent Overrides the logic if $current and/or $parent are passed. Defaults to false. * @param boolean $use_perms If true, checks authorship permissions on pages and only shows those the current * user has access to. * @param boolean $ignore_current Ignores the value of $current totally by not marking any items as invalid. * @param boolean $allow_all If true, show all items, even if the content object * doesn't have a valid link. Defaults to false. * @param boolean $use_name if true use Name() else use MenuText() Defaults to using the system preference. * @return string The html dropdown of the hierarchy */ function CreateHierarchyDropdown($current = '', $parent = '', $name = 'parent_id', $allowcurrent = 0, $use_perms = 0, $ignore_current = 0, $allow_all = false, $use_name = null) { $result = ''; $userid = -1; if (is_null($use_name)) { $use_name = get_site_preference('listcontent_showtitle', true); } $allcontent = $this->GetAllContent(false); if ($allcontent !== FALSE && count($allcontent) > 0) { if ($use_perms) { $userid = get_userid(); } if ($userid > 0 && check_permission($userid, 'Manage All Content') || $userid == -1 || $parent == -1) { $result .= '<option value="-1">' . lang('none') . '</option>'; } $curhierarchy = ''; foreach ($allcontent as $one) { if (!is_object($one)) { continue; } $value = $one->Id(); if ($value == $current) { // Grab hierarchy just in case we need to check children // (which will always be after) $curhierarchy = $one->Hierarchy(); if (!$allowcurrent) { // Then jump out. We don't want ourselves in the list. continue; } $value = -1; } // If it doesn't have a valid link... // don't include it. if (!$allow_all && !$one->HasUsableLink()) { continue; } // If it's a child of the current, we don't want to show it as it // could cause a deadlock. if (!$allowcurrent && $curhierarchy != '' && strstr($one->Hierarchy() . '.', $curhierarchy . '.') == $one->Hierarchy() . '.') { continue; } // If we have a valid userid... only include pages where this user // has write access... or is an admin user... or has appropriate permission. if ($userid > 0 && $one->Id() != $parent) { if (!check_permission($userid, 'Manage All Content') && !check_authorship($userid, $one->Id())) { continue; } } // Don't include content types that do not want children either... if (!$one->WantsChildren()) { continue; } $result .= '<option value="' . $value . '"'; // Select current parent if it exists if ($one->Id() == $parent) { $result .= ' selected="selected"'; } $txt = $use_name ? $one->Name() : $one->MenuText(); if ($value == -1 && $ignore_current == 0) { $result .= '>' . $one->Hierarchy() . '. - ' . $txt . ' (' . lang('invalid') . ')</option>'; } else { $result .= '>' . $one->Hierarchy() . '. - ' . $txt . '</option>'; } } } if (!empty($result)) { $result = '<select name="' . $name . '" id="' . $name . '">' . $result . '</select>'; } return $result; }
} else { //checkfor file size if ($newfile["size"] > $config["max_upload_size"] || $newfile["error"] == 1) { $this->smarty->assign('messagefail', $this->Lang("filetoobig")); } else { $ext = strtolower(substr($newfile["name"], strrpos($newfile["name"], "."))); //echo $ext;echo $type; $isimage = $ext == ".jpeg" || $ext == ".jpg" || $ext == ".gif" || $ext == ".png"; if ($type != "image" || $isimage) { $filename = $this->Slash($thisdir, $newfile["name"]); if ($this->GetPreference("makethumbnail", 1) == 1) { //echo "hi"; $thumbname = $this->Slash($thisdir, "thumb_" . $newfile["name"]); //echo $thumbname; $thumbnail_width = get_site_preference('thumbnail_width', 96); $thumbnail_height = get_site_preference('thumbnail_height', 96); $this->HandleFileResizing($newfile["tmp_name"], $thumbname, $thumbnail_width, $thumbnail_height); } //print_r($_POST); if (isset($params["resize_on"]) && (is_numeric($params["resize_x"]) || is_numeric($params["resize_y"]))) { if ($this->HandleFileResizing($newfile["tmp_name"], $filename, $params["resize_x"], $params["resize_y"])) { $this->smarty->assign('messagesuccess', $this->Lang("fileuploaded")); } else { $this->smarty->assign('messagefail', $this->Lang("uploadfailed")); } } else { if (cms_move_uploaded_file($newfile["tmp_name"], $filename)) { //echo $filename; $this->smarty->assign('messagesuccess', $this->Lang("fileuploaded")); } else { $this->smarty->assign('messagefail', $this->Lang("uploadfailed"));