Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @return	void
  */
 public function __construct()
 {
     $librariesArray = icms_core_Filesystem::getDirList(ICMS_LIBRARIES_PATH);
     foreach ($librariesArray as $library) {
         $library_boot_file = $this->getLibraryBootFilePath($library);
         if (file_exists($library_boot_file)) {
             include_once $library_boot_file;
             $this->_librariesArray[] = $library;
         }
     }
 }
Exemplo n.º 2
0
	/**
	 * Initializes the multilanguage process
	 * 
	 */
	static public function initMultilang() {
		global $icmsConfigMultilang, $icmsConfig;
		if ($icmsConfigMultilang['ml_enable']) {
			require_once ICMS_INCLUDE_PATH . '/im_multilanguage.php' ;
			$easiestml_langs = explode(',', $icmsConfigMultilang['ml_tags']);

			$easiestml_langpaths = icms_core_Filesystem::getDirList(ICMS_ROOT_PATH . "/language/");
			$langs = array_combine($easiestml_langs, explode(',', $icmsConfigMultilang['ml_names']));

			if ($icmsConfigMultilang['ml_autoselect_enabled']
				&& isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])
				&& $_SERVER['HTTP_ACCEPT_LANGUAGE'] != ""
			) {
				$autolang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2);
				if (in_array($autolang, $easiestml_langs)) {
					$icmsConfig['language'] = $langs[$autolang];
				}
			}

			if (isset($_GET['lang']) && isset($_COOKIE['lang'])) {
				if (in_array($_GET['lang'], $easiestml_langs)) {
					$icmsConfig['language'] = $langs[$_GET['lang']];
					if (isset($_SESSION['UserLanguage'])) {
						$_SESSION['UserLanguage'] = $langs[$_GET['lang']];
					}
				}
			} elseif (isset($_COOKIE['lang']) && isset($_SESSION['UserLanguage'])) {
				if ($_COOKIE['lang'] != $_SESSION['UserLanguage']) {
					if (in_array($_SESSION['UserLanguage'], $langs)) {
						$icmsConfig['language'] = $_SESSION['UserLanguage'];
					}
				} else {
					if (in_array($_COOKIE['lang'], $easiestml_langs)) {
						$icmsConfig['language'] = $langs[$_COOKIE['lang']];
					}
				}
			} elseif (isset($_COOKIE['lang'])) {
				if (in_array($_COOKIE['lang'], $easiestml_langs)) {
					$icmsConfig['language'] = $langs[$_COOKIE['lang']];
					if (isset( $_SESSION['UserLanguage'] )) {
						$_SESSION['UserLanguage'] = $langs[$_GET['lang']];
					}
				}
			} elseif (isset($_GET['lang'])) {
				if (in_array($_GET['lang'], $easiestml_langs)) {
					$icmsConfig['language'] = $langs[$_GET['lang']];
				}
			}
		}
	}
Exemplo n.º 3
0
 /**
  * Constructor
  *
  * @return	void
  */
 public function __construct()
 {
     $preloadFilesArray = str_replace('.php', '', icms_core_Filesystem::getFileList(ICMS_PRELOAD_PATH, '', array('php')));
     foreach ($preloadFilesArray as $filename) {
         // exclude index.html
         if (!in_array($this->getClassName($filename), get_declared_classes())) {
             $this->_preloadFilesArray[] = $filename;
             $this->addPreloadEvents($filename);
         }
     }
     // add ondemand preload
     global $icmsOnDemandPreload;
     if (isset($icmsOnDemandPreload) && count($icmsOnDemandPreload) > 0) {
         foreach ($icmsOnDemandPreload as $onDemandPreload) {
             $this->_preloadFilesArray[] = $onDemandPreload['filename'];
             $this->addPreloadEvents($onDemandPreload['filename'], $onDemandPreload['module']);
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Get an array of plugins
  * @param string $path
  * @return multitype:
  */
 public function getPluginsArray($path)
 {
     $module_handler = icms::handler('icms_module');
     $criteria = new icms_db_criteria_Compo();
     $criteria->add(new icms_db_criteria_Item('isactive', 1));
     $tempModulesObj = $module_handler->getObjects($criteria);
     $modulesObj = array();
     foreach ($tempModulesObj as $moduleObj) {
         $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj;
     }
     $aFiles = str_replace('.php', '', icms_core_Filesystem::getFileList(ICMS_ROOT_PATH . '/plugins/' . $path . '/', '', array('php')));
     $ret = array();
     foreach ($aFiles as $pluginName) {
         $module_xoops_version_file = ICMS_ROOT_PATH . "/modules/{$pluginName}/xoops_version.php";
         $module_icms_version_file = ICMS_ROOT_PATH . "/modules/{$pluginName}/icms_version.php";
         if ((file_exists($module_xoops_version_file) || file_exists($module_icms_version_file)) && isset($modulesObj[$pluginName])) {
             $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name');
         }
     }
     return $ret;
 }
Exemplo n.º 5
0
icms_core_Filesystem::chmod("../mainfile.php", 0444);
if (defined('XOOPS_TRUST_PATH') && XOOPS_TRUST_PATH != '') {
    icms_core_Filesystem::chmod(XOOPS_TRUST_PATH, 0777);
    icms_core_Filesystem::chmod(XOOPS_ROOT_PATH . '/modules', 0777);
    icms_core_Filesystem::chmod("/modules/protector/root/modules/protector", 0777);
    icms_core_Filesystem::chmod("/modules/protector/trust_path/modules", 0777);
    if (!is_dir(XOOPS_ROOT_PATH . '/modules/protector')) {
        icms_core_Filesystem::copyRecursive(XOOPS_ROOT_PATH . '/install/modules/protector/root/modules/protector', XOOPS_ROOT_PATH . '/modules/protector');
    }
    if (!is_dir(XOOPS_TRUST_PATH . '/modules')) {
        icms_core_Filesystem::copyRecursive(XOOPS_ROOT_PATH . '/install/modules/protector/trust_path/modules', XOOPS_TRUST_PATH . '/modules');
    }
    if (!is_dir(XOOPS_TRUST_PATH . '/modules/protector')) {
        icms_core_Filesystem::copyRecursive(XOOPS_ROOT_PATH . '/install/modules/protector/trust_path/modules/protector', XOOPS_TRUST_PATH . '/modules/protector');
    }
    icms_core_Filesystem::chmod(XOOPS_ROOT_PATH . '/modules', 0755);
}
$wizard->setPage('tablescreate');
$pageHasForm = true;
$pageHasHelp = false;
$vars =& $_SESSION['settings'];
include_once "../mainfile.php";
include_once './class/dbmanager.php';
$dbm = new db_manager();
if (!$dbm->isConnectable()) {
    $wizard->redirectToPage('-3');
    exit;
}
$process = '';
if (!$dbm->tableExists('users')) {
    $process = 'create';
Exemplo n.º 6
0
				echo '</td><td style="vertical-align: middle;">'
					. '<a href="admin.php?fct=tplsets&amp;op=edittpl&amp;id=' . $btemplates[$j]->getVar('tpl_id') . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/edit.png" alt="' . _EDIT . '" title="' . _EDIT . '" /></a>'
					. ' <a href="admin.php?fct=tplsets&amp;op=downloadtpl&amp;id=' . $btemplates[$j]->getVar('tpl_id') . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/filesave2.png" alt="' . _MD_DOWNLOAD . '" title="' . _MD_DOWNLOAD . '" /></a>' 
					. ' <a href="admin.php?fct=tplsets&amp;op=deletetpl&amp;id=' . $btemplates[$j]->getVar('tpl_id') . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/editdelete.png" alt="' . _DELETE . '" title="' . _DELETE . '" /></a>' 
					. '</td><td style="vertical-align: middle;" align="' . _GLOBAL_RIGHT . '"><input type="file" name="' . $filename . '" id="' . $filename . '" />'
					. '<input type="hidden" name="xoops_upload_file[]" id="xoops_upload_file[]" value="' . $filename . '" />'
					. '<input type="hidden" name="old_template[' . $filename . ']" value="' . $btemplates[$j]->getVar('tpl_id') . '" /></td>';
			} else {
				echo '<td><a href="admin.php?fct=tplsets&amp;op=edittpl&amp;id=' . $btemplates[$j]->getVar('tpl_id') . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/viewmag.png" alt="' . _MD_VIEW . '" title="' . _MD_VIEW . '" /></a>&nbsp;
				<a href="admin.php?fct=tplsets&amp;op=downloadtpl&amp;id=' . $btemplates[$j]->getVar('tpl_id') . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/filesave2.png" alt="' . _MD_DOWNLOAD . '" title="' . _MD_DOWNLOAD . '" /></a></td>';
			}
			echo '</tr>' . "\n";
			$binst_files[] = $filename;
		}
		if ($tplset != 'default') {
			$bnotinst_files = array_diff(icms_core_Filesystem::getFileList(ICMS_MODULES_PATH . '/' . $moddir . '/templates/blocks/'), $binst_files);
			foreach ($bnotinst_files as $nfile) {
				if ($nfile != 'index.html') {
					echo  '<tr style="background-color:#FFFF99;"><td style="background-color:#FFFF99;">' . $nfile 
						. '</td><td style="background-color:#FFFF99;">&nbsp;</td><td style="background-color:#FFFF99;">';
					$physical_file = ICMS_THEME_PATH . '/' . $tplset . '/templates/' . $moddir . '/blocks/' . $nfile;
					if (file_exists($physical_file)) {
						echo '[<a href="admin.php?fct=tplsets&amp;moddir=' . $moddir . '&amp;tplset=' . $tplset . '&amp;op=importtpl&amp;file=' . urlencode($nfile) . '">' . _MD_IMPORT . '</a>]';
					} else {
						echo '&nbsp;';
					}
					echo '</td><td style="background-color:#FFFF99;"><a href="admin.php?fct=tplsets&amp;moddir=' 
						. $moddir . '&amp;tplset=' . $tplset . '&amp;op=generatetpl&amp;type=block&amp;file=' . urlencode($nfile) . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/filenew2.png" alt="' . _MD_GENERATE . '" title="' . _MD_GENERATE . '" /></a></td>
						<td style="background-color:#FFFF99; vertical-align: middle; text-align: ' . _GLOBAL_RIGHT . '">' 
						. '<input type="file" name="' . $nfile . '" id="' . $nfile . '" />' 
						. '<input type="hidden" name="xoops_upload_file[]" id="xoops_upload_file[]" value="' . $nfile . '" />' 
Exemplo n.º 7
0
 /**
  * Returns an array of all available modules, based on folders in the modules directory
  *
  * The getList method cannot be used for this, because uninstalled modules are not listed
  * in the database
  *
  * @since	1.3
  * @return	array	List of folder names in the modules directory
  */
 public static function getAvailable()
 {
     $dirtyList = $cleanList = array();
     $dirtyList = icms_core_Filesystem::getDirList(ICMS_MODULES_PATH . '/');
     foreach ($dirtyList as $item) {
         if (file_exists(ICMS_MODULES_PATH . '/' . $item . '/icms_version.php')) {
             $cleanList[$item] = $item;
         } elseif (file_exists(ICMS_MODULES_PATH . '/' . $item . '/xoops_version.php')) {
             $cleanList[$item] = $item;
         }
     }
     return $cleanList;
 }
Exemplo n.º 8
0
         $sig_cbox_value = icms::$user->getVar('attachsig') ? 1 : 0;
         $sig_cbox = new icms_form_elements_Checkbox('', 'attachsig', $sig_cbox_value);
         $sig_cbox->addOption(1, _US_SHOWSIG);
         $sig_tray->addElement($sig_cbox);
     }
 }
 $umode_select = new icms_form_elements_Select(_US_CDISPLAYMODE, 'umode', icms::$user->getVar('umode'));
 $umode_select->addOptionArray(array('nest' => _NESTED, 'flat' => _FLAT, 'thread' => _THREADED));
 $uorder_select = new icms_form_elements_Select(_US_CSORTORDER, 'uorder', icms::$user->getVar('uorder'));
 $uorder_select->addOptionArray(array(XOOPS_COMMENT_OLD1ST => _OLDESTFIRST, XOOPS_COMMENT_NEW1ST => _NEWESTFIRST));
 $selected_theme = new icms_form_elements_Select(_US_SELECT_THEME, 'theme_selected', icms::$user->getVar('theme'));
 foreach ($icmsConfig['theme_set_allowed'] as $theme) {
     $selected_theme->addOption($theme, $theme);
 }
 $selected_language = new icms_form_elements_Select(_US_SELECT_LANG, 'language_selected', icms::$user->getVar('language'));
 foreach (icms_core_Filesystem::getDirList(ICMS_ROOT_PATH . "/language/") as $language) {
     $selected_language->addOption($language, $language);
 }
 // TODO: add this to admin user-edit functions...
 icms_loadLanguageFile('core', 'notification');
 include_once ICMS_INCLUDE_PATH . '/notification_constants.php';
 $notify_method_select = new icms_form_elements_Select(_NOT_NOTIFYMETHOD, 'notify_method', icms::$user->getVar('notify_method'));
 $notify_method_select->addOptionArray(array(XOOPS_NOTIFICATION_METHOD_DISABLE => _NOT_METHOD_DISABLE, XOOPS_NOTIFICATION_METHOD_PM => _NOT_METHOD_PM, XOOPS_NOTIFICATION_METHOD_EMAIL => _NOT_METHOD_EMAIL));
 $notify_mode_select = new icms_form_elements_Select(_NOT_NOTIFYMODE, 'notify_mode', icms::$user->getVar('notify_mode'));
 $notify_mode_select->addOptionArray(array(XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS, XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE, XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN));
 $bio_tarea = new icms_form_elements_Textarea(_US_EXTRAINFO, 'bio', icms::$user->getVar('bio', 'E'));
 $cookie_radio_value = empty($_COOKIE[$icmsConfig['usercookie']]) ? 0 : 1;
 $cookie_radio = new icms_form_elements_Radioyn(_US_USECOOKIE, 'usecookie', $cookie_radio_value, _YES, _NO);
 $pwd_text = new icms_form_elements_Password('', 'password', 10, 255, "", FALSE, $icmsConfigUser['pass_level'] ? 'password_adv' : '');
 $pwd_text2 = new icms_form_elements_Password('', 'vpass', 10, 255);
 $pwd_tray = new icms_form_elements_Tray(_US_PASSWORD . '<br />' . _US_TYPEPASSTWICE);
Exemplo n.º 9
0
/**
 * This Method starts the parsing of the specified RDF File. The File can be a local or a remote File.
 *
 * @access
 * @author
 * @param
 * @return
 * @see
 */
function imanager_addcat() {
	if (!empty($_POST)) foreach ($_POST as $k => $v) ${$k} = StopXSS($v);
	if (!icms::$security->check()) {
		redirect_header($_SERVER['SCRIPT_NAME'] . '?op=list&target=' . $target . '&type=' . $type, 3, implode('<br />', icms::$security->getErrors()));
	}
	$imgcat_handler = icms::handler('icms_image_category');
	$imagecategory =& $imgcat_handler->create();
	$imagecategory->setVar('imgcat_pid', $imgcat_pid);
	$imagecategory->setVar('imgcat_name', $imgcat_name);
	$imagecategory->setVar('imgcat_maxsize', $imgcat_maxsize);
	$imagecategory->setVar('imgcat_maxwidth', $imgcat_maxwidth);
	$imagecategory->setVar('imgcat_maxheight', $imgcat_maxheight);
	$imgcat_display = empty($imgcat_display) ? 0 : 1;
	$imagecategory->setVar('imgcat_display', $imgcat_display);
	$imagecategory->setVar('imgcat_weight', $imgcat_weight);
	$imagecategory->setVar('imgcat_storetype', $imgcat_storetype);
	if ($imgcat_storetype == 'file') {
		$imagecategory->setVar('imgcat_foldername', $imgcat_foldername);
		$categ_path = $imgcat_handler->getCategFolder($imagecategory);
	}
	$imagecategory->setVar('imgcat_type', 'C');

	if (!file_exists($categ_path)) {
		if (!icms_core_Filesystem::mkdir($categ_path)) {
			redirect_header($_SERVER['SCRIPT_NAME'] . '?op=list&target=' . $target . '&type=' . $type, 1, _MD_FAILADDCAT);
		}
	}

	if (!$imgcat_handler->insert($imagecategory)) {
		redirect_header($_SERVER['SCRIPT_NAME'] . '?op=list&target=' . $target . '&type=' . $type, 1, _MD_FAILADDCAT);
	}
	$newid = $imagecategory->getVar('imgcat_id');
	$imagecategoryperm_handler = icms::handler('icms_member_groupperm');
	if (!isset($readgroup)) {
		$readgroup = array();
	}
	if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) {
		array_push($readgroup, XOOPS_GROUP_ADMIN);
	}
	foreach ($readgroup as $rgroup) {
		$imagecategoryperm =& $imagecategoryperm_handler->create();
		$imagecategoryperm->setVar('gperm_groupid', $rgroup);
		$imagecategoryperm->setVar('gperm_itemid', $newid);
		$imagecategoryperm->setVar('gperm_name', 'imgcat_read');
		$imagecategoryperm->setVar('gperm_modid', 1);
		$imagecategoryperm_handler->insert($imagecategoryperm);
		unset($imagecategoryperm);
	}
	if (!isset($writegroup)) {
		$writegroup = array();
	}
	if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) {
		array_push($writegroup, XOOPS_GROUP_ADMIN);
	}
	foreach ($writegroup as $wgroup) {
		$imagecategoryperm =& $imagecategoryperm_handler->create();
		$imagecategoryperm->setVar('gperm_groupid', $wgroup);
		$imagecategoryperm->setVar('gperm_itemid', $newid);
		$imagecategoryperm->setVar('gperm_name', 'imgcat_write');
		$imagecategoryperm->setVar('gperm_modid', 1);
		$imagecategoryperm_handler->insert($imagecategoryperm);
		unset($imagecategoryperm);
	}
	redirect_header($_SERVER['SCRIPT_NAME'] . '?op=list&target=' . $target . '&type=' . $type, 2, _ICMS_DBUPDATED);
}
Exemplo n.º 10
0
 /**
  * Gets list of language folders inside default language directory - can't find anywhere in the core
  * @deprecated	Use icms_core_Filesystem::getDirList, instead
  * @todo		Remove in 1.4
  * @return  array	 $lang_list   list of language files in the directory
  */
 public static function getLangList()
 {
     icms_core_Debug::setDeprecated('icms_core_Filesystem::getDirList{ICMS_ROOT_PATH . "/language/")', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
     return icms_core_Filesystem::getDirList(ICMS_ROOT_PATH . "/language/");
 }
Exemplo n.º 11
0
 function getDBList()
 {
     $dirname = '../class/database/drivers';
     $list = icms_core_Filesystem::getDirList($dirname);
     // TODO: Add any verification of compatibility between the database drivers and the system.
     return $list;
 }
Exemplo n.º 12
0
 function createTrustPath()
 {
     if (@icms_core_Filesystem::mkdir($this->xoopsTrustPath, 0777, '', array('[', '?', '"', '<', '>', '|', ' '))) {
         if (@is_dir($this->xoopsTrustPath) && @is_readable($this->xoopsTrustPath)) {
             $_SESSION['settings']['TRUST_PATH'] = $this->xoopsTrustPath;
             return $this->validTrustPath = true;
         }
     }
     return $this->validTrustPath = false;
 }
Exemplo n.º 13
0
 * Installer introduction page
 *
 * See the enclosed file license.txt for licensing information.
 * If you did not receive this file, get it at http://www.fsf.org/copyleft/gpl.html
 *
 * @copyright    The XOOPS project http://www.xoops.org/
 * @license      http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL)
 * @package		installer
 * @since        Xoops 2.3.0
 * @author		Haruki Setoyama  <*****@*****.**>
 * @author 		Kazumi Ono <*****@*****.**>
 * @author		Skalpa Keo <*****@*****.**>
 * @version		$Id: page_start.php 20098 2010-09-07 16:19:19Z skenow $
 */
/**
 *
 */
require_once 'common.inc.php';
if (!defined('XOOPS_INSTALL')) {
    exit;
}
icms_core_Filesystem::chmod("../modules", 0777);
icms_core_Filesystem::chmod("../mainfile.php", 0777);
icms_core_Filesystem::chmod("../uploads", 0777);
icms_core_Filesystem::chmod("../templates_c", 0777);
icms_core_Filesystem::chmod("../cache", 0777);
$wizard->setPage('start');
$pageHasForm = false;
$content = "";
include "./language/{$wizard->language}/welcome.php";
include 'install_tpl.php';
Exemplo n.º 14
0
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $lang = $_REQUEST['lang'];
    $languages = icms_core_Filesystem::getDirList("./language/");
    if (!in_array($lang, $languages)) {
        $lang = 'english';
    }
    setcookie('xo_install_lang', $lang, null, null, null);
    $wizard->redirectToPage('+1');
    exit;
}
$_SESSION = array();
$pageHasForm = true;
$pageHasHelp = true;
$title = LANGUAGE_SELECTION;
$content = "";
$languages = icms_core_Filesystem::getDirList("./language/");
foreach ($languages as $lang) {
    $sel = $lang == $wizard->language ? ' checked="checked"' : '';
    $content .= "<div class=\"langselect\" style=\"text-decoration: none;\"><a href=\"javascript:void(0);\" style=\"text-decoration: none;\"><img src=\"../images/flags/{$lang}.gif\" alt=\"{$lang}\" /><br />{$lang}<br /> <input type=\"radio\" name=\"lang\" value=\"{$lang}\"{$sel} /></a></div>";
}
$content .= '<fieldset style="text-align: center;">';
$content .= '<legend>Select an Alternative Language Pack to Download</legend>';
$content .= '<div class="xoform-help">Languages may or may not be available if this is a development release.</div>';
$content .= '<div class="langselect" style="text-decoration: none;"><a href="http://addons.impresscms.org/modules/wfdownloads/viewcat.php?cid=241" target="_blank" style="text-decoration: none;"><img src="../images/flags/portuguesebr.gif" alt="Portuguese/BR Language Pack" /><br />Portug.<br />&lt;BRAZIL&gt;<br /></a></div>';
$content .= '<div class="langselect" style="text-decoration: none;"><a href="http://addons.impresscms.org/modules/wfdownloads/viewcat.php?cid=243" target="_blank" style="text-decoration: none;"><img src="../images/flags/nederlands.gif" alt="Dutch Language Pack" /><br />Dutch<br /></a></div>';
$content .= '<div class="langselect" style="text-decoration: none;"><a href="http://addons.impresscms.org/modules/wfdownloads/viewcat.php?cid=236" target="_blank" style="text-decoration: none;"><img src="../images/flags/french.gif" alt="French Language Pack" /><br />French<br /></a></div>';
$content .= '<div class="langselect" style="text-decoration: none;"><a href="http://addons.impresscms.org/modules/wfdownloads/viewcat.php?cid=239" target="_blank" style="text-decoration: none;"><img src="../images/flags/german.gif" alt="German Language Pack" /><br />German<br /></a></div>';
$content .= '<div class="langselect" style="text-decoration: none;"><a href="http://addons.impresscms.org/modules/wfdownloads/viewcat.php?cid=247" target="_blank" style="text-decoration: none;"><img src="../images/flags/italian.gif" alt="Italian Language Pack" /><br />Italian<br /></a></div>';
$content .= '<div class="langselect" style="text-decoration: none;"><a href="http://addons.impresscms.org/modules/wfdownloads/viewcat.php?cid=237" target="_blank" style="text-decoration: none;"><img src="../images/flags/persian.gif" alt="Persian Language Pack" /><br />Persian<br /></a></div>';
$content .= '<div class="langselect" style="text-decoration: none;"><a href="http://addons.impresscms.org/modules/wfdownloads/viewcat.php?cid=240" target="_blank" style="text-decoration: none;"><img src="../images/flags/spanish.gif" alt="Spanish Language Pack" /><br />Spanish<br /></a></div>';
$content .= '<div style="text-align: center; margin-top: 5px;"><a href="http://addons.impresscms.org/modules/wfdownloads/viewcat.php?cid=11" target="_blank">Select another language not listed here.</a></div>';
Exemplo n.º 15
0
/**
 * Logic and rendering for adding an image category
 */
function imanager_addcat() {
	if (isset($_POST)) {
		foreach ($_POST as $k => $v) {
			${$k} = $v;
		}
	}
	$imgcat_foldername = preg_replace('/[?".<>\|\s]/', '_', $imgcat_foldername);

	if (!icms::$security->check()) {
		redirect_header('admin.php?fct=images', 3, implode('<br />', icms::$security->getErrors()));
	}
	$imgcat_handler = icms::handler('icms_image_category');
	$imagecategory =& $imgcat_handler->create();
	$imagecategory->setVar('imgcat_pid', $imgcat_pid);
	$imagecategory->setVar('imgcat_name', $imgcat_name);
	$imagecategory->setVar('imgcat_maxsize', $imgcat_maxsize);
	$imagecategory->setVar('imgcat_maxwidth', $imgcat_maxwidth);
	$imagecategory->setVar('imgcat_maxheight', $imgcat_maxheight);
	$imgcat_display = empty($imgcat_display) ? 0 : 1;
	$imagecategory->setVar('imgcat_display', $imgcat_display);
	$imagecategory->setVar('imgcat_weight', $imgcat_weight);
	$imagecategory->setVar('imgcat_storetype', $imgcat_storetype);
	if ($imgcat_storetype == 'file') {
		$imagecategory->setVar('imgcat_foldername', $imgcat_foldername);
		$categ_path = $imgcat_handler->getCategFolder($imagecategory);
	}

	$imagecategory->setVar('imgcat_type', 'C');

	if ($imgcat_storetype == 'file') {
		if (!file_exists($categ_path)) {
			if (!icms_core_Filesystem::mkdir($categ_path)) {
				redirect_header('admin.php?fct=images', 1, _MD_FAILADDCAT);
			} else {
				if ($fh = @fopen($categ_path . '/index.html', 'w'))
				fwrite($fh, '<script>history.go(-1);</script>');
				@fclose($fh);
			}
		}
	}

	if (!$imgcat_handler->insert($imagecategory)) {
		redirect_header('admin.php?fct=images', 1, _MD_FAILADDCAT);
	}

	$newid = $imagecategory->getVar('imgcat_id');
	$imagecategoryperm_handler = icms::handler('icms_member_groupperm');
	if (!isset($readgroup)) {
		$readgroup = array();
	}

	if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) {
		array_push($readgroup, XOOPS_GROUP_ADMIN);
	}

	foreach ($readgroup as $rgroup) {
		$imagecategoryperm =& $imagecategoryperm_handler->create();
		$imagecategoryperm->setVar('gperm_groupid', $rgroup);
		$imagecategoryperm->setVar('gperm_itemid', $newid);
		$imagecategoryperm->setVar('gperm_name', 'imgcat_read');
		$imagecategoryperm->setVar('gperm_modid', 1);
		$imagecategoryperm_handler->insert($imagecategoryperm);
		unset($imagecategoryperm);
	}

	if (!isset($writegroup)) {
		$writegroup = array();
	}

	if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) {
		array_push($writegroup, XOOPS_GROUP_ADMIN);
	}

	foreach ($writegroup as $wgroup) {
		$imagecategoryperm =& $imagecategoryperm_handler->create();
		$imagecategoryperm->setVar('gperm_groupid', $wgroup);
		$imagecategoryperm->setVar('gperm_itemid', $newid);
		$imagecategoryperm->setVar('gperm_name', 'imgcat_write');
		$imagecategoryperm->setVar('gperm_modid', 1);
		$imagecategoryperm_handler->insert($imagecategoryperm);
		unset($imagecategoryperm);
	}
	redirect_header('admin.php?fct=images', 2, _MD_AM_DBUPDATED);
}
Exemplo n.º 16
0
function profile_db_upgrade_2()
{
    // Initialization
    $profile_field_handler = icms_getModuleHandler('field', basename(dirname(dirname(__FILE__))), 'profile');
    // add new fields
    $fieldid = addField('email', _US_EMAIL, '', 2, 'email', 1, 5, 0, array(), 1, 255, 1);
    addVisibility($fieldid, array(ICMS_GROUP_ADMIN, ICMS_GROUP_USERS), 0);
    // Copy images
    icms_core_Filesystem::copyRecursive(ICMS_ROOT_PATH . '/modules/' . basename(dirname(dirname(__FILE__))) . '/images/field', ICMS_UPLOAD_PATH . '/' . basename(dirname(dirname(__FILE__))) . '/field');
    // Assign Images to fields
    $profile_field_handler->updateAll('url', 'aim.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_aim')));
    $profile_field_handler->updateAll('url', 'bio.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'bio')));
    $profile_field_handler->updateAll('url', 'birthday.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_regdate')));
    $profile_field_handler->updateAll('url', 'clock.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'last_login')));
    $profile_field_handler->updateAll('url', 'comments.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'posts')));
    $profile_field_handler->updateAll('url', 'email.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'email')));
    $profile_field_handler->updateAll('url', 'house.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_from')));
    $profile_field_handler->updateAll('url', 'icq.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_icq')));
    $profile_field_handler->updateAll('url', 'interests.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_intrest')));
    $profile_field_handler->updateAll('url', 'msnm.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_msnm')));
    $profile_field_handler->updateAll('url', 'occ.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_occ')));
    $profile_field_handler->updateAll('url', 'openid.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'openid')));
    $profile_field_handler->updateAll('url', 'rank.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'rank')));
    $profile_field_handler->updateAll('url', 'signature.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_sig')));
    $profile_field_handler->updateAll('url', 'url.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'url')));
    $profile_field_handler->updateAll('url', 'username.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'name')));
    $profile_field_handler->updateAll('url', 'ym.gif', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_yim')));
    // update existing fields
    $profile_field_handler->updateAll('field_type', 'url', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'url')));
    $profile_field_handler->updateAll('field_type', 'location', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'user_from')));
    $profile_field_handler->updateAll('field_type', 'openid', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', 'openid')));
    $profile_field_handler->updateAll('field_edit', '0', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', '("posts", "openid", "user_viewoid")', 'IN')));
    $profile_field_handler->updateAll('system', '1', new icms_db_criteria_Compo(new icms_db_criteria_Item('field_name', '("' . implode('", "', $profile_field_handler->getUserVars()) . '")', 'IN')));
}
Exemplo n.º 17
0
 function protector_oninstall_base($module, $mydirname)
 {
     // transations on module install
     global $ret;
     // TODO :-D
     // for Cube 2.1
     if (defined('XOOPS_CUBE_LEGACY')) {
         $root =& XCube_Root::getSingleton();
         $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Success', 'protector_message_append_oninstall');
         $ret = array();
     } else {
         if (!is_array($ret)) {
             $ret = array();
         }
     }
     $db =& icms_db_Factory::instance();
     $mid = $module->getVar('mid');
     // TABLES (loading mysql.sql)
     $sql_file_path = dirname(__FILE__) . '/sql/mysql.sql';
     $prefix_mod = $db->prefix() . '_' . $mydirname;
     if (file_exists($sql_file_path)) {
         $ret[] = "SQL file found at <b>" . htmlspecialchars($sql_file_path) . "</b>.<br /> Creating tables...";
         $sqlutil = new icms_db_legacy_mysql_Utility();
         $sql_query = trim(file_get_contents($sql_file_path));
         $sqlutil->splitMySqlFile($pieces, $sql_query);
         $created_tables = array();
         foreach ($pieces as $piece) {
             $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod);
             if (!$prefixed_query) {
                 $ret[] = "Invalid SQL <b>" . htmlspecialchars($piece) . "</b><br />";
                 return false;
             }
             if (!$db->query($prefixed_query[0])) {
                 $ret[] = '<b>' . htmlspecialchars($db->error()) . '</b><br />';
                 //var_dump( $db->error() ) ;
                 return false;
             } else {
                 if (!in_array($prefixed_query[4], $created_tables)) {
                     $ret[] = 'Table <b>' . htmlspecialchars($prefix_mod . '_' . $prefixed_query[4]) . '</b> created.<br />';
                     $created_tables[] = $prefixed_query[4];
                 } else {
                     $ret[] = 'Data inserted to table <b>' . htmlspecialchars($prefix_mod . '_' . $prefixed_query[4]) . '</b>.</br />';
                 }
             }
         }
     }
     // TEMPLATES
     $tplfile_handler =& new icms_view_template_file_Handler(icms::$xoopsDB);
     $tpl_path = dirname(__FILE__) . '/templates';
     if ($handler = @opendir($tpl_path . '/')) {
         while (($file = readdir($handler)) !== false) {
             if (substr($file, 0, 1) == '.') {
                 continue;
             }
             $file_path = $tpl_path . '/' . $file;
             if (is_file($file_path) && in_array(strrchr($file, '.'), array('.html', '.css', '.js'))) {
                 $mtime = intval(@filemtime($file_path));
                 $tplfile =& $tplfile_handler->create();
                 $tplfile->setVar('tpl_source', file_get_contents($file_path), true);
                 $tplfile->setVar('tpl_refid', $mid);
                 $tplfile->setVar('tpl_tplset', 'default');
                 $tplfile->setVar('tpl_file', $mydirname . '_' . $file);
                 $tplfile->setVar('tpl_desc', '', true);
                 $tplfile->setVar('tpl_module', $mydirname);
                 $tplfile->setVar('tpl_lastmodified', $mtime);
                 $tplfile->setVar('tpl_lastimported', 0);
                 $tplfile->setVar('tpl_type', 'module');
                 if (!$tplfile_handler->insert($tplfile)) {
                     $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> to the database.</span><br />';
                 } else {
                     $tplid = $tplfile->getVar('tpl_id');
                     $ret[] = 'Template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> added to the database. (ID: <b>' . $tplid . '</b>)<br />';
                     // generate compiled file
                     if (!icms_view_Tpl::template_touch($tplid)) {
                         $ret[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b>.</span><br />';
                     } else {
                         $ret[] = 'Template <b>' . htmlspecialchars($mydirname . '_' . $file) . '</b> compiled.</span><br />';
                     }
                 }
             }
         }
         closedir($handler);
     }
     /*
     Fixes Bug #619 : parse Error
     */
     if (defined('ICMS_PRELOAD_PATH') && !file_exists(ICMS_PRELOAD_PATH . '/protector.php') && (!defined('PROTECTOR_POSTCHECK_INCLUDED') || !defined('PROTECTOR_PRECHECK_INCLUDED'))) {
         if (icms_core_Filesystem::copyRecursive(ICMS_TRUST_PATH . '/modules/protector/patches/ImpressCMS1.1/preload_protector.php', ICMS_PRELOAD_PATH . '/protector.php')) {
             $ret[] = 'Successfully moved protector preload<br />';
         } else {
             $ret[] = icms_core_Message::error("Failed to move protector preload - your site is not protected.", "", FALSE);
         }
     }
     icms_view_Tpl::template_clear_module_cache($mid);
     return true;
 }
/**
 * New Admin Control Panel Block, with grouping of items
 *
 * @since ImpressCMS 1.3
 * @return array
 */
function b_system_admin_cp_new_show()
{
    global $icmsTpl, $icmsConfig;
    $block['lang_cp'] = _CPHOME;
    // Loading System Configuration Links
    if (is_object(icms::$user)) {
        $groups = icms::$user->getGroups();
    } else {
        $groups = array();
    }
    $all_ok = FALSE;
    if (!in_array(ICMS_GROUP_ADMIN, $groups)) {
        $sysperm_handler = icms::handler('icms_member_groupperm');
        $ok_syscats =& $sysperm_handler->getItemIds('system_admin', $groups);
    } else {
        $all_ok = TRUE;
    }
    require_once ICMS_MODULES_PATH . '/system/constants.php';
    $admin_dir = ICMS_MODULES_PATH . '/system/admin';
    $dirlist = icms_core_Filesystem::getDirList($admin_dir);
    icms_loadLanguageFile('system', 'admin');
    asort($dirlist);
    $block = array();
    foreach ($dirlist as $file) {
        $mod_version_file = 'xoops_version.php';
        if (file_exists($admin_dir . '/' . $file . '/icms_version.php')) {
            $mod_version_file = 'icms_version.php';
        }
        include $admin_dir . '/' . $file . '/' . $mod_version_file;
        if ($modversion['hasAdmin']) {
            $category = isset($modversion['category']) ? (int) $modversion['category'] : 0;
            if (FALSE != $all_ok || in_array($modversion['category'], $ok_syscats)) {
                $block[$modversion['group']][] = array('title' => $modversion['name'], 'link' => ICMS_MODULES_URL . '/system/admin.php?fct=' . $file, 'image' => ICMS_MODULES_URL . '/system/admin/' . $file . '/images/' . $file . '_big.png');
            }
        }
        unset($modversion);
    }
    if (count($block) > 0) {
        ksort($block);
        return $block;
    }
}
Exemplo n.º 19
0
 /**
  *
  */
 public function getImagePath()
 {
     $dir = $this->_uploadPath . $this->_itemname;
     if (!file_exists($dir)) {
         icms_core_Filesystem::mkdir($dir);
     }
     return $dir . "/";
 }
Exemplo n.º 20
0
 * @author		Haruki Setoyama  <*****@*****.**>
 * @author 		Kazumi Ono <*****@*****.**>
 * @author		Skalpa Keo <*****@*****.**>
 * @version		$Id: page_end.php 20098 2010-09-07 16:19:19Z skenow $
 */
/**
 *
 */
require_once 'common.inc.php';
if (!defined('XOOPS_INSTALL')) {
    exit;
}
$success = isset($_GET['success']) ? trim($_GET['success']) : false;
if ($success) {
    if (is_dir(ICMS_ROOT_PATH . '/install')) {
        icms_core_Filesystem::deleteRecursive(ICMS_ROOT_PATH . '/install', true);
        header('Location: ' . ICMS_URL . '/index.php');
    }
    $_SESSION = array();
}
$wizard->setPage('end');
$pageHasForm = false;
$content = "";
include "./language/{$wizard->language}/finish.php";
// destroy all the installation session
unset($_SESSION);
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time() - 60);
}
session_unset();
session_destroy();
Exemplo n.º 21
0
 * @license	LICENSE.txt
 * @package		Administration
 * @subpackage	Comments
 * @since	XOOPS
 * @author	http://www.xoops.org The XOOPS Project
 * @author	modified by UnderDog <*****@*****.**>
 * @version		SVN: $Id: commentform.inc.php 20768 2011-02-06 00:02:25Z skenow $
 */
defined("ICMS_ROOT_PATH") || die("ImpressCMS root path not defined");
$cform = new icms_form_Theme(_CM_POSTCOMMENT, "commentform", "postcomment.php", "post", true);
if (!preg_match("/^re:/i", $subject)) {
    $subject = "Re: " . icms_core_DataFilter::icms_substr($subject, 0, 56);
}
$cform->addElement(new icms_form_elements_Text(_CM_TITLE, 'subject', 50, 255, $subject), true);
$icons_radio = new icms_form_elements_Radio(_MESSAGEICON, 'icon', $icon);
$subject_icons = icms_core_Filesystem::getFileList(ICMS_ROOT_PATH . "/images/subject/", '', array('gif', 'jpg', 'png'));
foreach ($subject_icons as $iconfile) {
    $icons_radio->addOption($iconfile, '<img src="' . ICMS_IMAGES_URL . '/subject/' . $iconfile . '" alt="" />');
}
$cform->addElement($icons_radio);
$cform->addElement(new icms_form_elements_Dhtmltextarea(_CM_MESSAGE, 'message', $message, 10, 50), true);
$option_tray = new icms_form_elements_Tray(_OPTIONS, '<br />');
if (icms::$user) {
    if ($icmsConfig['anonpost'] == true) {
        $noname_checkbox = new icms_form_elements_Checkbox('', 'noname', $noname);
        $noname_checkbox->addOption(1, _POSTANON);
        $option_tray->addElement($noname_checkbox);
    }
    if (icms::$user->isAdmin($icmsModule->getVar('mid'))) {
        $nohtml_checkbox = new icms_form_elements_Checkbox('', 'nohtml', $nohtml);
        $nohtml_checkbox->addOption(1, _DISABLEHTML);
Exemplo n.º 22
0
	$groups = icms::$user->getGroups();
} else {
	$groups = array();
}
$all_ok = FALSE;
if (!in_array(ICMS_GROUP_ADMIN, $groups)) {
	$sysperm_handler = icms::handler('icms_member_groupperm');
	$ok_syscats =& $sysperm_handler->getItemIds('system_admin', $groups);
} else {
	$all_ok = TRUE;
}

require_once ICMS_ROOT_PATH . '/modules/system/constants.php';

$admin_dir = ICMS_ROOT_PATH . '/modules/system/admin';
$dirlist = icms_core_Filesystem::getDirList($admin_dir);

icms_loadLanguageFile('system', 'admin');
asort($dirlist);
$adminmenu = array();
foreach ($dirlist as $file) {
	$mod_version_file = 'xoops_version.php';
	if (file_exists($admin_dir . '/' . $file . '/icms_version.php')) {
		$mod_version_file = 'icms_version.php';
	}
	include $admin_dir . '/' . $file . '/' . $mod_version_file;
	if ($modversion['hasAdmin']) {
		$category = isset($modversion['category']) ? (int) ($modversion['category']) : 0;
		if (FALSE != $all_ok || in_array($modversion['category'], $ok_syscats)) {
			$adminmenu[$modversion['group']]['title']		= $modversion['group'];
			$adminmenu[$modversion['group']]['link']		= "#";
Exemplo n.º 23
0
 /**
  * Constructor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	mixed	$value	Pre-selected value (or array of them).
  * 							Legal is any name of a ICMS_ROOT_PATH."/language/" subdirectory.
  * @param	int		$size	Number of rows. "1" makes a drop-down-list.
  */
 public function __construct($caption, $name, $value = null, $size = 1)
 {
     parent::__construct($caption, $name, $value, $size);
     $this->addOptionArray(icms_core_Filesystem::getDirList(ICMS_ROOT_PATH . "/language/"));
 }
Exemplo n.º 24
0
/**
 * Copy a file, or a folder and its contents from a website to your host
 *
 * @author	Sina Asghari <*****@*****.**>
 * @author	nensa at zeec dot biz
 * @param	string	$src	The source
 * @param	string  $dest	  The destination
 * @return   bool	Returns stream_copy_to_stream($src, $dest) on success, false on failure
 * @deprecated	Use icms_core_Filesystem::copyStream
 * @todo		Remove in version 1.4 - all instances have been removed from the core
 */
function icms_stream_copy($src, $dest)
{
    icms_core_Debug::setDeprecated('icms_core_Filesystem::copyStream', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
    return icms_core_Filesystem::copyStream($src, $dest);
}
Exemplo n.º 25
0
 /**
  * Gets list of all avatar image files inside default avatars directory
  *
  * @return  mixed	 $avatars|false  list of avatar files in the directory or false if no avatars
  */
 public static function getAllFromDir()
 {
     $avatars = array();
     $dirlist = array();
     $dirlist = icms_core_Filesystem::getDirList(ICMS_ROOT_PATH . "/images/avatar/");
     if (count($dirlist) > 0) {
         foreach ($dirlist as $dir) {
             $avatars[$dir] =& icms_core_Filesystem::getFileList(ICMS_ROOT_PATH . "/images/avatar/" . $dir . "/", $dir . "/", array('gif', 'jpg', 'png'));
         }
     } else {
         return false;
     }
     return $avatars;
 }
Exemplo n.º 26
0
 /**
  * Gets list of Captcha items (Internal Function)
  * @param   string $name directory name to look in
  * @param   string $extension extension of the files to look for
  * @return  array  array of Captcha items
  */
 public function _getList($name, $extension = "")
 {
     $items = array();
     $file_path = "{$name}";
     $files = icms_core_Filesystem::getFileList($file_path);
     foreach ($files as $item) {
         if (empty($extension) || preg_match("/(\\.{$extension})\$/i", $item)) {
             $items[] = $item;
         }
     }
     if (function_exists("mod_createCacheFile")) {
         mod_createCacheFile($items, "captcha_{$name}", "captcha");
     }
     return $items;
 }
Exemplo n.º 27
0
/**
 * Writes index file
 * @param string  $path  path to the file to write
 * @return bool
 * @todo use language constants for error messages
 * @todo Move to static class Filesystem
 */
function xoops_write_index_file($path = '')
{
    icms_core_Debug::setDeprecated('icms_core_Filesystem::writeIndexFile', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
    return icms_core_Filesystem::writeIndexFile($path);
}
Exemplo n.º 28
0
				case 'select_paginati' :
					if (file_exists(ICMS_LIBRARIES_PATH . '/paginationstyles/paginationstyles.php')) {
						include ICMS_LIBRARIES_PATH . '/paginationstyles/paginationstyles.php';
						$st = & $styles;
						$arr = array();
						foreach ($st as $style) {
							$arr[$style['fcss']] = $style['name'];
						}
						$ele = new icms_form_elements_Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
						$ele->addOptionArray($arr);
					}
					break;
						
				case 'select_geshi' :
					$ele = new icms_form_elements_Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
					$dirlist = str_replace('.php', '', icms_core_Filesystem::getFileList(ICMS_LIBRARIES_PATH . '/geshi/geshi/', '', array('php')));
					if (! empty($dirlist)) {
						asort($dirlist);
						$ele->addOptionArray($dirlist);
					}
					break;
						
				case 'textbox' :
				default :
					$ele = new icms_form_elements_Text($title, $config[$i]->getVar('conf_name'), 50, 255, icms_core_DataFilter::htmlSpecialChars($config[$i]->getConfValueForOutput()));
					break;
			}
			$hidden = new icms_form_elements_Hidden('conf_ids[]', $config[$i]->getVar('conf_id'));
			$form->addElement($ele);
			$form->addElement($hidden);
			unset($ele, $hidden);
Exemplo n.º 29
0
/**
 * Automatic update of the system module
 *
 * @param object $module reference to the module object
 * @param int $oldversion The old version of the database
 * @param int $dbVersion The database version
 * @return mixed
 */
function xoops_module_update_system(&$module, $oldversion = NULL, $dbVersion = NULL)
{
    global $icmsConfig, $xoTheme;
    $from_112 = $abortUpdate = FALSE;
    $oldversion = $module->getVar('version');
    if ($oldversion < 120) {
        $result = icms::$xoopsDB->query("SELECT t1.tpl_id FROM " . icms::$xoopsDB->prefix('tplfile') . " t1, " . icms::$xoopsDB->prefix('tplfile') . " t2 WHERE t1.tpl_module = t2.tpl_module AND t1.tpl_tplset=t2.tpl_tplset AND t1.tpl_file = t2.tpl_file AND t1.tpl_id > t2.tpl_id");
        $tplids = array();
        while (list($tplid) = icms::$xoopsDB->fetchRow($result)) {
            $tplids[] = $tplid;
        }
        if (count($tplids) > 0) {
            $tplfile_handler = icms::handler('icms_view_template_file');
            $duplicate_files = $tplfile_handler->getObjects(new icms_db_criteria_Item('tpl_id', "(" . implode(',', $tplids) . ")", "IN"));
            if (count($duplicate_files) > 0) {
                foreach (array_keys($duplicate_files) as $i) {
                    $tplfile_handler->delete($duplicate_files[$i]);
                }
            }
        }
    }
    $icmsDatabaseUpdater = icms_db_legacy_Factory::getDatabaseUpdater();
    //$dbVersion  = $module->getDBVersion();
    //$oldversion  = $module->getVar('version');
    ob_start();
    $dbVersion = $module->getDBVersion();
    echo sprintf(_DATABASEUPDATER_CURRENTVER, icms_conv_nr2local($dbVersion)) . '<br />';
    echo "<code>" . sprintf(_DATABASEUPDATER_UPDATE_TO, icms_conv_nr2local(ICMS_SYSTEM_DBVERSION)) . "<br />";
    /*
     * DEVELOPER, PLEASE NOTE !!!
     *
     * Everytime we add a new upgrade block here, the dbversion of the System Module will get
     * incremented. It is very important to modify the ICMS_SYSTEM_DBVERSION accordingly
     * in htdocs/include/version.php
     *
     * When we start a new major release, move all the previous version's upgrade scripts to
     * a separate file, to minimize file size and memory usage
     */
    $CleanWritingFolders = FALSE;
    if ($dbVersion < 40) {
        include 'update-112-to-122.php';
    }
    /*  Begin upgrade to version 1.3 */
    if (!$abortUpdate) {
        $newDbVersion = 41;
    }
    if ($dbVersion < $newDbVersion) {
        /* Add new tables and data for the help suggestions and quick search */
        $table = new icms_db_legacy_updater_Table('autosearch_cat');
        if (!$table->exists()) {
            $table->setStructure("`cid` int(11) NOT NULL auto_increment,\n\t\t\t\t `cat_name` varchar(255) NOT NULL,\n\t\t\t\t `cat_url` text NOT NULL,\n\t\t\t\t PRIMARY KEY (`cid`)");
            if (!$table->createTable()) {
                $abortUpdate = TRUE;
                $newDbVersion = 40;
            }
            if (!$abortUpdate) {
                icms_loadLanguageFile('system', 'admin');
                $search_cats = array("NULL, '" . _MD_AM_ADSENSES . "', '/modules/system/admin.php?fct=adsense'", "NULL, '" . _MD_AM_AUTOTASKS . "', '/modules/system/admin.php?fct=autotasks'", "NULL, '" . _MD_AM_AVATARS . "', '/modules/system/admin.php?fct=avatars'", "NULL, '" . _MD_AM_BANS . "', '/modules/system/admin.php?fct=banners'", "NULL, '" . _MD_AM_BKPOSAD . "', '/modules/system/admin.php?fct=blockspadmin'", "NULL, '" . _MD_AM_BKAD . "', '/modules/system/admin.php?fct=blocksadmin'", "NULL, '" . _MD_AM_COMMENTS . "', '/modules/system/admin.php?fct=comments'", "NULL, '" . _MD_AM_CUSTOMTAGS . "', '/modules/system/admin.php?fct=customtag'", "NULL, '" . _MD_AM_USER . "', '/modules/system/admin.php?fct=users'", "NULL, '" . _MD_AM_FINDUSER . "', '/modules/system/admin.php?fct=finduser'", "NULL, '" . _MD_AM_ADGS . "', '/modules/system/admin.php?fct=groups'", "NULL, '" . _MD_AM_IMAGES . "', '/modules/system/admin.php?fct=images'", "NULL, '" . _MD_AM_MLUS . "', '/modules/system/admin.php?fct=mailusers'", "NULL, '" . _MD_AM_MIMETYPES . "', '/modules/system/admin.php?fct=mimetype'", "NULL, '" . _MD_AM_MDAD . "', '/modules/system/admin.php?fct=modulesadmin'", "NULL, '" . _MD_AM_PREF . "', '/modules/system/admin.php?fct=preferences'", "NULL, '" . _MD_AM_RATINGS . "', '/modules/system/admin.php?fct=rating'", "NULL, '" . _MD_AM_SMLS . "', '/modules/system/admin.php?fct=smilies'", "NULL, '" . _MD_AM_PAGES . "', '/modules/system/admin.php?fct=pages'", "NULL, '" . _MD_AM_TPLSETS . "', '/modules/system/admin.php?fct=tplsets'", "NULL, '" . _MD_AM_RANK . "', '/modules/system/admin.php?fct=userrank'", "NULL, '" . _MD_AM_VERSION . "', '/modules/system/admin.php?fct=version'");
                foreach ($search_cats as $cat) {
                    $table->setData($cat);
                }
                $table->addData();
            }
            unset($table);
        }
        $table = new icms_db_legacy_updater_Table('autosearch_list');
        if (!$table->exists() && !$abortUpdate) {
            $table->setStructure("`id` int(11) NOT NULL auto_increment,\n\t\t\t\t `cat_id` int(11) NOT NULL,\n\t\t\t\t `name` varchar(255) NOT NULL,\n\t\t\t\t `img` varchar(255) NOT NULL,\n\t\t\t\t `desc` text NOT NULL,\n\t\t\t\t `url` text NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`)");
            if (!$table->createTable()) {
                $abortUpdate = TRUE;
                $newDbVersion = 40;
            }
            if (!$abortUpdate) {
                icms_loadLanguageFile('system', 'admin');
                icms_loadLanguageFile('system', 'preferences', TRUE);
                $search_items = array("NULL, 1, '" . _MD_AM_ADSENSES . "', '/modules/system/admin/adsense/images/adsense_small.png', '" . _MD_AM_ADSENSES_DSC . "', '/modules/system/admin.php?fct=adsense'", "NULL, 2, '" . _MD_AM_AUTOTASKS . "', '/modules/system/admin/autotasks/images/autotasks_small.png', '" . _MD_AM_AUTOTASKS_DSC . "', '/modules/system/admin.php?fct=autotasks'", "NULL, 3, '" . _MD_AM_AVATARS . "', '/modules/system/admin/avatars/images/avatars_small.png', '" . _MD_AM_AVATARS_DSC . "', '/modules/system/admin.php?fct=avatars'", "NULL, 4, '" . _MD_AM_BANS . "', '/modules/system/admin/banners/images/banners_small.png', '" . _MD_AM_BANS_DSC . "', '/modules/system/admin.php?fct=banners'", "NULL, 5, '" . _MD_AM_BKPOSAD . "', '/modules/system/admin/blockspadmin/images/blockspadmin_small.png', '" . _MD_AM_BKPOSAD_DSC . "', '/modules/system/admin.php?fct=blockspadmin'", "NULL, 6, '" . _MD_AM_BKAD . "', '/modules/system/admin/blocksadmin/images/blocksadmin_small.png', '" . _MD_AM_BKAD_DSC . "', '/modules/system/admin.php?fct=blocksadmin'", "NULL, 7, '" . _MD_AM_COMMENTS . "', '/modules/system/admin/comments/images/comments_small.png', '" . _MD_AM_COMMENTS_DSC . "', '/modules/system/admin.php?fct=comments'", "NULL, 8, '" . _MD_AM_CUSTOMTAGS . "', '/modules/system/admin/customtag/images/customtag_small.png', '" . _MD_AM_CUSTOMTAGS_DSC . "', '/modules/system/admin.php?fct=customtag'", "NULL, 9, '" . _MD_AM_USER . "', '/modules/system/admin/users/images/users_small.png', '" . _MD_AM_USER_DSC . "', '/modules/system/admin.php?fct=users'", "NULL, 10, '" . _MD_AM_FINDUSER . "', '/modules/system/admin/findusers/images/findusers_small.png', '" . _MD_AM_FINDUSER_DSC . "', '/modules/system/admin.php?fct=findusers'", "NULL, 11, '" . _MD_AM_ADGS . "', '/modules/system/admin/groups/images/groups_small.png', '" . _MD_AM_ADGS_DSC . "', '/modules/system/admin.php?fct=groups'", "NULL, 12, '" . _MD_AM_IMAGES . "', '/modules/system/admin/images/images/images_small.png', '" . _MD_AM_IMAGES_DSC . "', '/modules/system/admin.php?fct=images'", "NULL, 13, '" . _MD_AM_MLUS . "', '/modules/system/admin/mailusers/images/mailusers_small.png', '" . _MD_AM_MLUS_DSC . "', '/modules/system/admin.php?fct=mailusers'", "NULL, 14, '" . _MD_AM_MIMETYPES . "', '/modules/system/admin/mimetype/images/mimetype_small.png', '" . _MD_AM_MIMETYPES_DSC . "', '/modules/system/admin.php?fct=mimetype'", "NULL, 15, '" . _MD_AM_MDAD . "', '/modules/system/admin/modulesadmin/images/modulesadmin_small.png', '" . _MD_AM_MDAD_DSC . "', '/modules/system/admin.php?fct=modulesadmin'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_AUTHENTICATION . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_AUTHENTICATION_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=7'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_AUTOTASKS . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_AUTOTASKS_PREF_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=13'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_CAPTCHA . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_CAPTCHA_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=11'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_GENERAL . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_GENERAL_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=1'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_PURIFIER . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_PURIFIER_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=14'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_MAILER . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_MAILER_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=6'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_METAFOOTER . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_METAFOOTER_DSC . "', '/modules/system/admin/preferences/images/preferences_small.png'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_MULTILANGUAGE . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_MULTILANGUAGE_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=8'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_PERSON . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_PERSON_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=10'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_PLUGINS . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_PLUGINS_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=12'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_SEARCH . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_SEARCH_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=5'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_USERSETTINGS . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_USERSETTINGS_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=2'", "NULL, 16, '" . _MD_AM_PREF . " - " . _MD_AM_CENSOR . "', '/modules/system/admin/preferences/images/preferences_small.png', '" . _MD_AM_CENSOR_DSC . "', '/modules/system/admin.php?fct=preferences&op=show&confcat_id=4'", "NULL, 17, '" . _MD_AM_RATINGS . "', '/modules/system/admin/rating/images/rating_small.png', '" . _MD_AM_RATINGS_DSC . "', '/modules/system/admin.php?fct=rating'", "NULL, 18, '" . _MD_AM_SMLS . "', '/modules/system/admin/smilies/images/smilies_small.png', '" . _MD_AM_SMLS_DSC . "', '/modules/system/admin.php?fct=smilies'", "NULL, 19, '" . _MD_AM_PAGES . "', '/modules/system/admin/pages/images/pages_small.png', '" . _MD_AM_PAGES_DSC . "', '/modules/system/admin.php?fct=pages'", "NULL, 20, '" . _MD_AM_TPLSETS . "', '/modules/system/admin/tplsets/images/tplsets_small.png', '" . _MD_AM_TPLSETS_DSC . "', '/modules/system/admin.php?fct=tplsets'", "NULL, 21, '" . _MD_AM_RANK . "', '/modules/system/admin/userrank/images/userrank_small.png', '" . _MD_AM_RANK_DSC . "', '/modules/system/admin.php?fct=userrank'", "NULL, 22, '" . _MD_AM_VRSN . "', '/modules/system/admin/version/images/version_small.png', '" . _MD_AM_VRSN_DSC . "', '/modules/system/admin.php?fct=version'");
                foreach ($search_items as $item) {
                    $table->setData($item);
                }
                $table->addData();
            }
            unset($table);
        }
        /* Optimize old tables and fix data structures */
        $table = new icms_db_legacy_updater_Table('config');
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` DROP INDEX conf_mod_cat_id, ADD INDEX mod_cat_order(conf_modid, conf_catid, conf_order)", 'Successfully altered the indexes on table config', '');
        unset($table);
        $table = new icms_db_legacy_updater_Table('group_permission');
        $table->addAlteredField('gperm_modid', "SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0'", 'gperm_modid');
        $table->alterTable();
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` DROP INDEX itemid, DROP INDEX groupid, DROP INDEX gperm_modid", 'Successfully dropped the indexes on table group_permission', '');
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` ADD INDEX name_mod_group (gperm_name(10), gperm_modid, gperm_groupid)", 'Successfully added the indexes on table group_permission', '');
        unset($table);
        $table = new icms_db_legacy_updater_Table('modules');
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` DROP INDEX hasmain, DROP INDEX hasadmin, DROP INDEX hassearch, DROP INDEX hasnotification, DROP INDEX name, DROP INDEX dirname", 'Successfully dropped the indexes on table modules', '');
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` ADD INDEX dirname (dirname(5)), ADD INDEX active_main_weight (isactive, hasmain, weight)", 'Successfully added the indexes on table modules', '');
        unset($table);
        $table = new icms_db_legacy_updater_Table('users');
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` DROP INDEX email, DROP INDEX uiduname, DROP INDEX unamepass", 'Successfully dropped the indexes on table users', '');
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` DROP INDEX login_name, ADD UNIQUE INDEX login_name (login_name)", 'Successfully added the indexes on table users', '');
        unset($table);
        $table = new icms_db_legacy_updater_Table('priv_msgs');
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` DROP INDEX to_userid", 'Successfully dropped the indexes on table priv_msgs', '');
        unset($table);
        $table = new icms_db_legacy_updater_Table('ranks');
        $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` DROP INDEX rank_min", 'Successfully dropped the indexes on table ranks', '');
        unset($table);
        /* Corrects an error from db version 4 */
        $table = new icms_db_legacy_updater_Table('users');
        if ($table->fieldExists('pass')) {
            $table->addAlteredField('pass', "varchar(255) NOT NULL default ''", 'pass');
            $table->alterTable();
        }
        unset($table);
        /* change IP address to varchar(64) in session to accomodate IPv6 addresses */
        $table = new icms_db_legacy_updater_Table('session');
        if ($table->fieldExists('sess_ip')) {
            $table->addAlteredField('sess_ip', "varchar(64) NOT NULL default ''", 'sess_ip');
            $table->alterTable();
        }
        unset($table);
        /* add modname and ipf to modules table */
        $table = new icms_db_legacy_updater_Table("modules");
        $alter = FALSE;
        if (!$table->fieldExists("modname")) {
            $table->addNewField("modname", "varchar(25) NOT NULL default ''");
            $alter = TRUE;
        }
        if (!$table->fieldExists("ipf")) {
            $table->addNewField("ipf", "tinyint(1) unsigned NOT NULL default '0'");
            $alter = TRUE;
        }
        if ($alter) {
            $table->addNewFields();
        }
        unset($table, $alter);
        $module_handler = icms::handler('icms_module');
        $modules = $module_handler->getObjects();
        foreach ($modules as $module) {
            if ($module->getInfo("modname") !== FALSE) {
                $module->setVar("modname", $module->getInfo("modname"));
            }
            if ($module->getInfo("object_items") !== FALSE) {
                $module->setVar("ipf", 1);
            }
            $module_handler->insert($module);
        }
        unset($module_handler, $modules);
        /* add slot for adsense and rename fields */
        $table = new icms_db_legacy_updater_Table('system_adsense');
        if (!$table->fieldExists("slot")) {
            $table->addNewField("slot", "varchar(12) NOT NULL default ''");
            $table->addNewFields();
        }
        if ($table->fieldExists("border_color")) {
            $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` CHANGE border_color color_border varchar(6) NOT NULL default ''");
        }
        if ($table->fieldExists("background_color")) {
            $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` CHANGE background_color color_background varchar(6) NOT NULL default ''");
        }
        if ($table->fieldExists("link_color")) {
            $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` CHANGE link_color color_link varchar(6) NOT NULL default ''");
        }
        if ($table->fieldExists("url_color")) {
            $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` CHANGE url_color color_url varchar(6) NOT NULL default ''");
        }
        if ($table->fieldExists("text_color")) {
            $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` CHANGE text_color color_text varchar(6) NOT NULL default ''");
        }
        unset($table);
        /* rename content field for customtag */
        $table = new icms_db_legacy_updater_Table("system_customtag");
        if ($table->fieldExists("content")) {
            $icmsDatabaseUpdater->runQuery("ALTER TABLE `" . $table->name() . "` CHANGE content customtag_content text NOT NULL");
        }
        unset($table);
        /* rename gperm_name from view to view_customtag for system module */
        $table = new icms_db_legacy_updater_Table("group_permission");
        $icmsDatabaseUpdater->runQuery("UPDATE `" . $table->name() . "` SET gperm_name = 'view_customtag' WHERE gperm_name = 'view' AND gperm_modid = 1", "", "");
        unset($table);
        /* reset default source editor if jsvi is used */
        $configs = icms::$config->getConfigs(icms_buildCriteria(array("conf_name" => "sourceeditor_default")));
        if (count($configs) == 1 && $configs[0]->getVar("conf_value") == "jsvi") {
            $configs[0]->setVar("conf_value", "editarea");
            icms::$config->insertConfig($configs[0]);
        }
        unset($configs);
        /* New HTML Purifier options -
         * purifier_HTML_FlashAllowFullScreen, after purifier_HTML_AttrNameUseCDATA
         * purifier_Output_FlashCompat, after purifier_HTML_FlashAllowFullScreen
         * purifier_Filter_AllowCustom, after purifier_Filter_YouTube
         * purifier_Core_NormalizeNewlines, after purifier_Core_RemoveInvalidImg
         */
        $table = new icms_db_legacy_updater_Table("config");
        // retrieve the value of the position before the config to be inserted.
        $configs = icms::$config->getConfigs(icms_buildCriteria(array("conf_name" => "purifier_HTML_AttrNameUseCDATA")));
        $p = $configs[0]->getVar('conf_order') + 1;
        //move all the other options down
        $icmsDatabaseUpdater->runQuery("UPDATE `" . $table->name() . "` SET conf_order = conf_order + 2 WHERE conf_order >= " . $p . " AND conf_catid = " . ICMS_CONF_PURIFIER, "", "");
        $icmsDatabaseUpdater->insertConfig(ICMS_CONF_PURIFIER, 'purifier_HTML_FlashAllowFullScreen', '_MD_AM_PURIFIER_HTML_FLASHFULLSCRN', '0', '_MD_AM_PURIFIER_HTML_FLASHFULLSCRNDSC', 'yesno', 'int', $p);
        $icmsDatabaseUpdater->insertConfig(ICMS_CONF_PURIFIER, 'purifier_Output_FlashCompat', '_MD_AM_PURIFIER_OUTPUT_FLASHCOMPAT', '0', '_MD_AM_PURIFIER_OUTPUT_FLASHCOMPATDSC', 'yesno', 'int', $p++);
        // retrieve the value of the position before the config to be inserted.
        $configs = icms::$config->getConfigs(icms_buildCriteria(array("conf_name" => "purifier_Filter_YouTube")));
        $p = $configs[0]->getVar('conf_order') + 1;
        //move all the other options down
        $icmsDatabaseUpdater->runQuery("UPDATE `" . $table->name() . "` SET conf_order = conf_order + 1 WHERE conf_order >= " . $p . " AND conf_catid = " . ICMS_CONF_PURIFIER, "", "");
        $icmsDatabaseUpdater->insertConfig(ICMS_CONF_PURIFIER, 'purifier_Filter_AllowCustom', '_MD_AM_PURIFIER_FILTER_ALLOWCUSTOM', '0', '_MD_AM_PURIFIER_FILTER_ALLOWCUSTOMDSC', 'yesno', 'int', $p);
        // retrieve the value of the position before the config to be inserted.
        $configs = icms::$config->getConfigs(icms_buildCriteria(array("conf_name" => "purifier_Core_RemoveInvalidImg")));
        $p = $configs[0]->getVar('conf_order') + 1;
        //move all the other options down
        $icmsDatabaseUpdater->runQuery("UPDATE `" . $table->name() . "` SET conf_order = conf_order + 1 WHERE conf_order >= " . $p . " AND conf_catid = " . ICMS_CONF_PURIFIER, "", "");
        $icmsDatabaseUpdater->insertConfig(ICMS_CONF_PURIFIER, 'purifier_Core_NormalizeNewlines', '_MD_AM_PURIFIER_CORE_NORMALNEWLINES', '1', '_MD_AM_PURIFIER_CORE_NORMALNEWLINESDSC', 'yesno', 'int', $p);
        unset($table);
        /* Finish up this portion of the db update */
        if (!$abortUpdate) {
            $icmsDatabaseUpdater->updateModuleDBVersion($newDbVersion, 'system');
            echo sprintf(_DATABASEUPDATER_UPDATE_OK, icms_conv_nr2local($newDbVersion)) . '<br />';
        }
    }
    /*  1.3 beta|rc|final release  */
    /*
     * This portion of the upgrade must remain as the last section of code to execute
     * Place all release upgrade steps above this point
     */
    echo "</code>";
    if ($abortUpdate) {
        icms_core_Message::error(sprintf(_DATABASEUPDATER_UPDATE_ERR, icms_conv_nr2local($newDbVersion)), _DATABASEUPDATER_UPDATE_DB, TRUE);
    }
    if ($from_112 && !$abortUpdate) {
        /**
         * @todo create a language constant for this text
         */
        echo _DATABASEUPDATER_MSG_FROM_112;
        echo '<script>setTimeout("window.location.href=\'' . ICMS_MODULES_URL . '/system/admin.php?fct=modulesadmin&op=install&module=content&from_112=1\'",20000);</script>';
    }
    $feedback = ob_get_clean();
    if (method_exists($module, "setMessage")) {
        $module->messages = $module->setMessage($feedback);
    } else {
        echo $feedback;
    }
    $icmsDatabaseUpdater->updateModuleDBVersion($newDbVersion, 'system');
    return icms_core_Filesystem::cleanFolders(array('templates_c' => ICMS_COMPILE_PATH . "/", 'cache' => ICMS_CACHE_PATH . "/"), $CleanWritingFolders);
}
Exemplo n.º 30
0
 private function getCustomFilterList()
 {
     $dirPath = ICMS_LIBRARIES_PATH . '/htmlpurifier/standalone/HTMLPurifier/Filter/';
     $icmsConfigPurifier = icms::$config->getConfigsByCat(ICMS_CONF_PURIFIER);
     if ($icmsConfigPurifier['purifier_Filter_AllowCustom'] !== 0) {
         $filterList = array();
         $fileList = icms_core_Filesystem::getFileList($dirPath, '', array('php'), true);
         unset($fileList['ExtractStyleBlocks.php'], $fileList['YouTube.php']);
         $fileList = array_values($fileList);
         foreach ($fileList as &$val) {
             $val = "HTMLPurifier_Filter_" . substr($val, 0, strrpos($val, '.'));
             $newObject = new $val();
             $filterList[] = $newObject;
         }
     } else {
         $filterList = '';
     }
     return $filterList;
 }