/** * Render the Date field */ public function render() { global $icmsConfigPersona; $ele_name = $this->getName(); $ele_value = $this->getValue(false); $jstime = formatTimestamp($ele_value, _SHORTDATESTRING); include_once ICMS_ROOT_PATH . '/include/calendar' . ($icmsConfigPersona['use_jsjalali'] == true ? 'jalali' : '') . 'js.php'; $result = "<input type='text' name='" . $ele_name . "' id='" . $ele_name . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . date(_SHORTDATESTRING, $ele_value) . "'" . $this->getExtra() . " /> <img src='" . ICMS_URL . "/images/calendar.png' alt='" . _CALENDAR . "' title='" . _CALENDAR . "' onclick='return showCalendar(\"" . $ele_name . "\");'>"; if ($icmsConfigPersona['use_jsjalali']) { include_once ICMS_ROOT_PATH . '/include/jalali.php'; $result = "<input id='tmp_" . $ele_name . "' readonly='readonly' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . (_CALENDAR_TYPE == 'jalali' ? icms_conv_nr2local(jdate(_SHORTDATESTRING, $ele_value)) : date(_SHORTDATESTRING, $ele_value)) . "' /><input type='hidden' name='" . $ele_name . "' id='" . $ele_name . "' value='" . date(_SHORTDATESTRING, $ele_value) . "' " . $this->getExtra() . " /> <img src='" . ICMS_URL . "/images/calendar.png' alt='" . _CALENDAR . "' title='" . _CALENDAR . "' id='btn_" . $ele_name . "'><script type='text/javascript'>\n\t\t\t\tCalendar.setup({\n\t\t\t\t\tinputField : 'tmp_" . $ele_name . "',\n\t\t \t\tifFormat : '%Y-%m-%d',\n\t\t \t\tbutton : 'btn_" . $ele_name . "',\n \t\t\tlangNumbers : true,\n \t\t\tdateType\t: '" . _CALENDAR_TYPE . "',\n\t\t\t\t\tonUpdate\t: function(cal){document.getElementById('" . $ele_name . "').value = cal.date.print('%Y-%m-%d');}\n\t\t\t\t});\n\t\t\t</script>"; } return $result; }
for ($i = 0; $i < $tcount; $i++) { $tplsetname = $tplsets[$i]->getVar('tplset_name'); $installed_themes[] = $tplsetname; $class = $class == 'even' ? 'odd' : 'even'; echo '<tr class="' . $class . '" align="center"><td style="vertical-align: middle;" class="head">' . $tplsetname . '<br /><br /><span style="font-weight:normal;">' . $tplsets[$i]->getVar('tplset_desc') . '</span></td><td style="vertical-align: middle;">' . formatTimestamp($tplsets[$i]->getVar('tplset_created'), 's') . '</td><td align="' . _GLOBAL_LEFT . '"><ul>'; $tplstats = $tpltpl_handler->getModuleTplCount($tplsetname); if (count($tplstats) > 0) { $module_handler = icms::handler('icms_module'); echo '<ul>'; foreach ($tplstats as $moddir => $filecount) { $module =& $module_handler->getByDirname($moddir); if (is_object($module)) { if ($installed_mods[$moddir] > $filecount) { $filecount = '<span style="color:#ff0000;">' . $filecount . '</span>'; } echo '<li>' . $module->getVar('name') . ' [<a href="admin.php?fct=tplsets&op=listtpl&tplset=' . $tplsetname . '&moddir=' . $moddir . '">' . _LIST . '</a> (<strong>' . icms_conv_nr2local($filecount) . '</strong>)]</li>'; } unset($module); } $not_installed = array_diff(array_keys($installed_mods), array_keys($tplstats)); } else { $not_installed =& array_keys($installed_mods); } foreach ($not_installed as $ni) { $module =& $module_handler->getByDirname($ni); echo '<li>' . $module->getVar('name') . ' <a href="admin.php?fct=tplsets&op=listtpl&tplset=' . $tplsetname . '&moddir=' . $ni . '"><img src="' . ICMS_IMAGES_SET_URL . '/actions/view_choose.png" alt="' . _LIST . '" title="' . _LIST . '" /></a> (<span style="color:#ff0000; font-weight: bold;">0</span>)' . ' <a href="admin.php?fct=tplsets&op=generatemod&tplset=' . $tplsetname . '&moddir=' . $ni . '"><img src="' . ICMS_IMAGES_SET_URL . '/actions/filenew2.png" alt="' . _MD_GENERATE . '" title="' . _MD_GENERATE . '" /></a></li>'; } echo '</ul></td><td style="vertical-align: middle;">' . '<a href="admin.php?fct=tplsets&op=download&method=tar&tplset=' . $tplsetname . '"><img src="' . ICMS_IMAGES_SET_URL . '/actions/filesave2.png" alt="' . _MD_DOWNLOAD . '" title="' . _MD_DOWNLOAD . '" /></a> <a href="admin.php?fct=tplsets&op=clone&tplset=' . $tplsetname . '"><img src="' . ICMS_IMAGES_SET_URL . '/actions/editcopy.png" alt="' . _CLONE . '" title="' . _CLONE . '" /></a>'; if ($tplsetname != 'default' && $tplsetname != $icmsConfig['template_set']) { echo ' <a href="admin.php?fct=tplsets&op=delete&tplset=' . $tplsetname . '"><img src="' . ICMS_IMAGES_SET_URL . '/actions/editdelete.png" alt="' . _DELETE . '" title="' . _DELETE . '" /></a>'; }
/** * Shows the latest members that were added * * @param array $options The block options * @return array $block The newest members block array */ function b_system_newmembers_show($options) { global $icmsConfigUser; $block = array(); $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('level', 0, '>')); $limit = (!empty($options[0])) ? $options[0] : 10; $criteria->setOrder('DESC'); $criteria->setSort('user_regdate'); $criteria->setLimit($limit); $member_handler = icms::handler('icms_member'); $newmembers = $member_handler->getUsers($criteria); $count = count($newmembers); for ($i = 0; $i < $count; $i++) { if ($options[1] == 1) { if ($newmembers[$i]->getVar('user_avatar') && $newmembers[$i]->getVar('user_avatar') != 'blank.gif' && $newmembers[$i]->getVar('user_avatar') != '') { $block['users'][$i]['avatar'] = ICMS_UPLOAD_URL . '/' . $newmembers[$i]->getVar('user_avatar'); } elseif ($icmsConfigUser['avatar_allow_gravatar'] == 1) { $block['users'][$i]['avatar'] = $newmembers[$i]->gravatar('G', $icmsConfigUser['avatar_width']); } else { $block['users'][$i]['avatar'] = ''; } } else { $block['users'][$i]['avatar'] = ''; } $block['users'][$i]['id'] = $newmembers[$i]->getVar('uid'); $block['users'][$i]['name'] = $newmembers[$i]->getVar('uname'); $block['users'][$i]['joindate'] = formatTimestamp($newmembers[$i]->getVar('user_regdate'), 's'); $block['users'][$i]['login_name'] = $newmembers[$i]->getVar('login_name'); } if (!empty($options[2]) && $options[2] == 1) { $block['index_enabled'] = TRUE; $block['registered'] = icms_conv_nr2local($member_handler->getUserCount(new icms_db_criteria_Item('level'))); $block['inactive'] = icms_conv_nr2local($member_handler->getUserCount(new icms_db_criteria_Item('level', 0))); $block['active'] = icms_conv_nr2local($member_handler->getUserCount(new icms_db_criteria_Item('level', 0, '>'))); $block['lang_totalusers'] = _MB_SYSTEM_TOTAL_USERS; $block['lang_activeusers'] = _MB_SYSTEM_ACT_USERS; $block['lang_inactiveusers'] = _MB_SYSTEM_INACT_USERS; } return $block; }
/** * Converts size to human readable text * * @param int $size The size to convert * @return string The converted size * @todo Move to a static class method - String */ function icms_convert_size($size) { if ($size >= 1073741824) { $ret = round($size / 1024 / 1024 / 1024, 1) . ' ' . _CORE_GIGABYTES_SHORTEN; } elseif ($size >= 1048576 && $size < 1073741824) { $ret = round($size / 1024 / 1024, 1) . ' ' . _CORE_MEGABYTES_SHORTEN; } elseif ($size >= 1024 && $size < 1048576) { $ret = round($size / 1024, 1) . ' ' . _CORE_KILOBYTES_SHORTEN; } else { $ret = $size . ' ' . _CORE_BYTES; } return icms_conv_nr2local($ret); }
? trim(filter_input(INPUT_POST, 'op')) : 'list' ); if ($op == 'list') { icms_loadLanguageFile('system', 'preferences', TRUE); icms_cp_header(); echo '<div class="CPbigTitle" style="background-image: url(' . ICMS_URL . '/modules/system/admin/avatars/images/avatars_big.png)">' . _MD_AVATARMAN . '</div><br />'; $avt_handler = icms::handler('icms_data_avatar'); $savatar_count = $avt_handler->getCount(new icms_db_criteria_Item('avatar_type', 'S')); $cavatar_count = $avt_handler->getCount(new icms_db_criteria_Item('avatar_type', 'C')); echo '<ul><li>' . _MD_SYSAVATARS . ' (' . sprintf(_NUMIMAGES, '<strong>' . icms_conv_nr2local($savatar_count) . '</strong>') . ') [<a href="admin.php?fct=avatars&op=listavt&type=S">' . _LIST . '</a>]</li><li>' . _MD_CSTAVATARS . ' (' . sprintf(_NUMIMAGES, '<strong>' . icms_conv_nr2local($cavatar_count) . '</strong>') . ') [<a href="admin.php?fct=avatars&op=listavt&type=C">' . _LIST . '</a>]</li></ul>'; $form = new icms_form_Theme(_MD_ADDAVT, 'avatar_form', 'admin.php', "post", TRUE); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new icms_form_elements_Text(_IMAGENAME, 'avatar_name', 50, 255), TRUE); $form->addElement(new icms_form_elements_File(_IMAGEFILE, 'avatar_file', $icmsConfigUser['avatar_maxsize'])); $form->addElement(new icms_form_elements_Text(_IMGWEIGHT, 'avatar_weight', 3, 4, 0)); $form->addElement(new icms_form_elements_Radioyn(_IMGDISPLAY, 'avatar_display', 1, _YES, _NO)); $restrictions = _MD_AM_AVATARMAX . ": " . $icmsConfigUser['avatar_maxsize'] . "<br />"; $restrictions .= _MD_AM_AVATARW . ": " . $icmsConfigUser['avatar_width'] . "px<br />"; $restrictions .= _MD_AM_AVATARH . ": ". $icmsConfigUser['avatar_height']. "px"; $form->addElement(new icms_form_elements_Label(_MD_RESTRICTIONS, $restrictions)); $form->addElement(new icms_form_elements_Hidden('op', 'addfile')); $form->addElement(new icms_form_elements_Hidden('fct', 'avatars')); $form->addElement(new icms_form_elements_Button('', 'avt_button', _SUBMIT, 'submit'));
} } if (!empty($_GET)) { foreach ($_GET as $k => $v) { ${$k} = StopXSS($v); } } $op = isset($_GET['op']) ? trim(filter_input(INPUT_GET, 'op')) : (isset($_POST['op']) ? trim(filter_input(INPUT_POST, 'op')) : 'list'); if ($op == 'list') { icms_loadLanguageFile('system', 'preferences', TRUE); icms_cp_header(); echo '<div class="CPbigTitle" style="background-image: url(' . ICMS_URL . '/modules/system/admin/avatars/images/avatars_big.png)">' . _MD_AVATARMAN . '</div><br />'; $avt_handler = icms::handler('icms_data_avatar'); $savatar_count = $avt_handler->getCount(new icms_db_criteria_Item('avatar_type', 'S')); $cavatar_count = $avt_handler->getCount(new icms_db_criteria_Item('avatar_type', 'C')); echo '<ul><li>' . _MD_SYSAVATARS . ' (' . sprintf(_NUMIMAGES, '<strong>' . icms_conv_nr2local($savatar_count) . '</strong>') . ') [<a href="admin.php?fct=avatars&op=listavt&type=S">' . _LIST . '</a>]</li><li>' . _MD_CSTAVATARS . ' (' . sprintf(_NUMIMAGES, '<strong>' . icms_conv_nr2local($cavatar_count) . '</strong>') . ') [<a href="admin.php?fct=avatars&op=listavt&type=C">' . _LIST . '</a>]</li></ul>'; $form = new icms_form_Theme(_MD_ADDAVT, 'avatar_form', 'admin.php', "post", TRUE); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new icms_form_elements_Text(_IMAGENAME, 'avatar_name', 50, 255), TRUE); $form->addElement(new icms_form_elements_File(_IMAGEFILE, 'avatar_file', $icmsConfigUser['avatar_maxsize'])); $form->addElement(new icms_form_elements_Text(_IMGWEIGHT, 'avatar_weight', 3, 4, 0)); $form->addElement(new icms_form_elements_Radioyn(_IMGDISPLAY, 'avatar_display', 1, _YES, _NO)); $restrictions = _MD_AM_AVATARMAX . ": " . $icmsConfigUser['avatar_maxsize'] . "<br />"; $restrictions .= _MD_AM_AVATARW . ": " . $icmsConfigUser['avatar_width'] . "px<br />"; $restrictions .= _MD_AM_AVATARH . ": " . $icmsConfigUser['avatar_height'] . "px"; $form->addElement(new icms_form_elements_Label(_MD_RESTRICTIONS, $restrictions)); $form->addElement(new icms_form_elements_Hidden('op', 'addfile')); $form->addElement(new icms_form_elements_Hidden('fct', 'avatars')); $form->addElement(new icms_form_elements_Button('', 'avt_button', _SUBMIT, 'submit')); $form->display(); icms_cp_footer();
/** * 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); }
/** * Output buffering callback inserting logger dump in page output * Determines wheter output can be shown (based on permissions) * @param string $output * @return string $output */ public function render($output) { global $icmsModule; $this->addExtra('Included files', count(get_included_files()) . ' files'); $this->addExtra(_CORE_MEMORYUSAGE, icms_conv_nr2local(icms_convert_size(memory_get_usage()))); $groups = is_object(icms::$user) ? icms::$user->getGroups() : XOOPS_GROUP_ANONYMOUS; $moduleid = isset($icmsModule) && is_object($icmsModule) ? $icmsModule->getVar('mid') : 1; $gperm_handler = icms::handler('icms_member_groupperm'); if (!$this->renderingEnabled || !$this->activated || !$gperm_handler->checkRight('enable_debug', $moduleid, $groups)) { return $output; } $this->renderingEnabled = $this->activated = false; $log = $this->dump($this->usePopup ? 'popup' : ''); $pattern = '<!--{xo-logger-output}-->'; $pos = strpos($output, $pattern); if ($pos !== false) { return substr($output, 0, $pos) . $log . substr($output, $pos + strlen($pattern)); } else { return $output . $log; } }
/** * Render the Date field */ public function render() { global $icmsConfigPersona; $ele_name = $this->getName(); // ALTERED BY FREEFORM SOLUTIONS FOR THE DATE DEFAULT CHANGES IN FORMULIZE STANDALONE if ($icmsConfigPersona['use_jsjalali']) { include_once ICMS_ROOT_PATH . '/include/jalali.php'; } if ($this->getValue(false) !== _DATE_DEFAULT) { $ele_value = date(_SHORTDATESTRING, $this->getValue(false)); $jstime = formatTimestamp($this->getValue(false), _SHORTDATESTRING); if (_CALENDAR_TYPE == 'jalali') { $jalali_ele_value = icms_conv_nr2local(jdate(_SHORTDATESTRING, $ele_value)); } else { $jalali_ele_value = $ele_value; } } else { $ele_value = $this->getValue(false); $jstime = formatTimestamp(time(), _SHORTDATESTRING); $jalali_ele_value = $ele_value; } include_once ICMS_ROOT_PATH . '/include/calendar' . ($icmsConfigPersona['use_jsjalali'] == true ? 'jalali' : '') . 'js.php'; $result = "<input type='text' name='" . $ele_name . "' id='" . $ele_name . "' class=\"icms-date-box\" size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $ele_value . "'" . $this->getExtra() . " /> <img src='" . ICMS_URL . "/images/calendar.png' class='no-print' alt='" . _CALENDAR . "' title='" . _CALENDAR . "' id='btn_" . $ele_name . "' onclick='return showCalendar(\"" . $ele_name . "\");'>"; if (false and $icmsConfigPersona['use_jsjalali']) { $dateFormat = dateFormatToStrftime(_SHORTDATESTRING); $result = "<input name='" . $ele_name . "' id='" . $ele_name . "' class=\"icms-date-box\" size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $jalali_ele_value . "'" . $this->getExtra() . " /> <img src='" . ICMS_URL . "/images/calendar.png' class='no-print' alt='" . _CALENDAR . "' title='" . _CALENDAR . "' id='btn_" . $ele_name . "'><script type='text/javascript'>\n\t\t\t\tCalendar.setup({\n\t\t\t\t\tinputField : '" . $ele_name . "',\n\t\t\t\t\tifFormat : '{$dateFormat}',\n\t\t\t\t\tbutton : 'btn_" . $ele_name . "',\n\t\t\t\t\tlangNumbers : true,\n\t\t\t\t\tdateType : '" . _CALENDAR_TYPE . "',\n\t\t\t\t\tonUpdate : function(cal){document.getElementById('" . $ele_name . "').value = cal.date.print('{$dateFormat}');}\n\t\t\t\t});\n\t\t\t</script>"; } else { $result = "<input type='text' name='" . $ele_name . "' id='" . $ele_name . "' class=\"icms-date-box\" size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $ele_value . "'" . $this->getExtra() . " />"; static $output_datepicker_defaults = true; if ($output_datepicker_defaults) { $ICMS_URL = ICMS_URL; // the jQuery datepicker wants a date format such as yy-mm-dd, or yy-m-d. // yyyy-mm-dd gives a date like '20142014-10-11', so only yy, not yyyy. $dateFormat = dateFormatToStrftime(_SHORTDATESTRING); $dateFormat = str_replace(array("%y", "%m", "%d"), array("yy", "m", "d"), strtolower($dateFormat)); // note: datepicker_defaults is a var so it is available later for date elements with date limits $result .= <<<EOF <script> var datepicker_defaults = { dateFormat: "{$dateFormat}", changeMonth: true, changeYear: true, hideIfNoPrevNext: true, // do not show the prev/next links if they are disabled numberOfMonths: 1, yearRange: "c-20:c+20", showOn: "both", buttonImageOnly: true, buttonImage: "{$ICMS_URL}/images/calendar.png", buttonText: "Calendar" }; jQuery(document).ready(function() { jQuery.datepicker.setDefaults(datepicker_defaults); jQuery(function() { jQuery(".icms-date-box").datepicker(); }); }); </script> EOF; $output_datepicker_defaults = false; } } return $result; }
$abortUpdate = true; } /* New config options and values for mail settings */ $sql = 'UPDATE `' . icms::$xoopsDB->prefix('config') . '` SET `conf_order`=9 WHERE `conf_name`="sendmailpath"'; $result = icms::$xoopsDB->query($sql); $icmsDatabaseUpdater->insertConfig(ICMS_CONF_MAILER, 'smtpsecure', '_MD_AM_SMTPSECURE', 'ssl', '_MD_AM_SMTPSECUREDESC', 'select', 'text', 7); $config_id = icms::$xoopsDB->getInsertId(); $sql = "INSERT INTO " . icms::$xoopsDB->prefix('configoption') . " (confop_id, confop_name, confop_value, conf_id)" . " VALUES" . " (NULL, 'None', 'none', {$config_id}), " . " (NULL, 'SSL', 'ssl', {$config_id}), " . " (NULL, 'TLS', 'tls', {$config_id})"; if (!icms::$xoopsDB->queryF($sql)) { $abortUpdate = true; } $icmsDatabaseUpdater->insertConfig(ICMS_CONF_MAILER, 'smtpauthport', '_MD_AM_SMTPAUTHPORT', '465', '_MD_AM_SMTPAUTHPORTDESC', 'textbox', 'int', 8); $icmsDatabaseUpdater->updateModuleDBVersion($newDbVersion, 'system'); echo sprintf(_DATABASEUPDATER_UPDATE_OK, icms_conv_nr2local($newDbVersion)) . '<br />'; } /* 1.2.2 release */ if (!$abortUpdate) { $newDbVersion = 40; } if ($dbVersion < $newDbVersion) { $file = ICMS_PLUGINS_PATH . '/csstidy/css_optimiser.php'; if (file_exists($file)) { if (unlink($file)) { echo sprintf(_FILE_DELETED, $file) . '<br />'; } else { icms_core_Message::error(sprintf(_CSSTIDY_VULN, $file)); } } $icmsDatabaseUpdater->updateModuleDBVersion($newDbVersion, 'system'); echo sprintf(_DATABASEUPDATER_UPDATE_OK, icms_conv_nr2local($newDbVersion)) . '<br />'; }
/** * Edit the banner * @param int $bid banner id */ function BannerEdit($bid) { global $icmsConfig, $icmsModule; $bid = (int) $bid; icms_cp_header(); $result=icms::$xoopsDB->query("SELECT cid, imptotal, impmade, clicks, imageurl, clickurl, htmlbanner, htmlcode FROM " . icms::$xoopsDB->prefix("banner") . " where bid='". (int) $bid . "'"); list($cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $htmlbanner, $htmlcode) = icms::$xoopsDB->fetchRow($result); echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">"; echo"<h4>" . _AM_EDITBNR . "</h4>"; if ($htmlbanner) { echo icms_core_DataFilter::checkVar($htmlcode, 'html', 'output'); } else { if (strtolower(substr($imageurl, strrpos($imageurl, ".")))==".swf") { echo '<object type="application/x-shockwave-flash" data="' . $imageurl . '" width="468" height="60">'; echo '<param name="movie" value="' . $imageurl . '" />'; echo '<param name="quality" value="high" />'; echo '</object>'; } else { echo '<img src="' . $imageurl . '" alt="" />'; } } echo "<form action='admin.php' method='post'>" . _AM_CLINAMET . "<select name='cid'>\n"; $result = icms::$xoopsDB->query("SELECT cid, name FROM " . icms::$xoopsDB->prefix("bannerclient") . " where cid='". (int) $cid . "'"); list($cid, $name) = icms::$xoopsDB->fetchRow($result); $name = icms_core_DataFilter::htmlSpecialChars($name); echo "<option value='$cid' selected='selected'>$name</option>"; $result = icms::$xoopsDB->query("SELECT cid, name FROM " . icms::$xoopsDB->prefix("bannerclient")); while (list($ccid, $name) = icms::$xoopsDB->fetchRow($result)) { $name = icms_core_DataFilter::htmlSpecialChars($name); if ($cid != $ccid) { echo "<option value='$ccid'>$name</option>"; } } echo "</select><br />"; if ($imptotal == 0) { $impressions = "" . _AM_UNLIMIT . ""; } else { $impressions = $imptotal; } echo _AM_ADDIMPT . "<input type='text' name='impadded' size='12' maxlength='11' /> " . _AM_PURCHT . "<strong>$impressions</strong> " . _AM_MADET . "<strong>" . icms_conv_nr2local($impmade) . "</strong><br />" . _AM_IMGURLT . "<input type='text' name='imageurl' size='50' maxlength='200' value='" . htmlspecialchars($imageurl, ENT_QUOTES) . "' /><br />" . _AM_CLICKURLT . "<input type='text' name='clickurl' size='50' maxlength='200' value='" . htmlspecialchars($clickurl, ENT_QUOTES) . "' /><br />" . _AM_USEHTML; if ($htmlbanner) { echo " <input type='checkbox' name='htmlbanner' value='1' checked='checked' />"; echo "<br />" . _AM_CODEHTML . "<br /><textarea name='htmlcode' rows='6' cols='60'>" . icms_core_DataFilter::checkVar($htmlcode, 'html', 'edit') . "</textarea><br /><input type='hidden' name='bid' value='$bid' />" . "<input type='hidden' name='imptotal' value='$imptotal' />" . "<input type='hidden' name='fct' value='banners' />" . icms::$security->getTokenHTML() . "<input type='hidden' name='op' value='BannerChange' />" . "<input type='submit' value='" . _AM_CHGBNR . "' /></form>"; } else { echo " <input type='checkbox' name='htmlbanner' value='1' />"; echo "<br />" . _AM_CODEHTML . "<br /><textarea name='htmlcode' rows='6' cols='60'>" . icms_core_DataFilter::checkVar($htmlcode, 'text', 'output') . "</textarea><br /><input type='hidden' name='bid' value='$bid' />" . "<input type='hidden' name='imptotal' value='$imptotal' />" . "<input type='hidden' name='fct' value='banners' />" . icms::$security->getTokenHTML() . "<input type='hidden' name='op' value='BannerChange' />" . "<input type='submit' value='" . _AM_CHGBNR . "' /></form>"; } echo "</td></tr></table>"; icms_cp_footer(); }
/** * Logic for updating a module * * @todo add installation_notify(), only if the version of the module changes * * @param str $dirname * @return str Result messages from the module update */ function icms_module_update($dirname) { global $icmsConfig, $icmsAdminTpl; $msgs = array(); $dirname = trim($dirname); $module_handler = icms::handler('icms_module'); $module =& $module_handler->getByDirname($dirname); // Save current version for use in the update function $prev_version = $module->getVar('version'); $prev_dbversion = $module->getVar('dbversion'); /** * http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php * @todo PHP5.3.0 supports $icmsAdminTpl::template_clear_module_cache($module->getVar('mid')); */ $icmsAdminTpl->template_clear_module_cache($module->getVar('mid')); // we dont want to change the module name set by admin $temp_name = $module->getVar('name'); $module->loadInfoAsVar($dirname); $module->setVar('name', $temp_name); /* * ensure to only update those fields that are currently available in the database * this is required to allow structural updates for the module table */ $table = new icms_db_legacy_updater_Table("modules"); foreach (array_keys($module->vars) as $k) { if (!$table->fieldExists($k)) { unset($module->vars[$k]); } } if (!$module_handler->insert($module)) { $msgs[] = sprintf('<p>' . _MD_AM_UPDATE_FAIL . '</p>', $module->getVar('name')); } else { $newmid = $module->getVar('mid'); $msgs[] = _MD_AM_MOD_DATA_UPDATED; $tplfile_handler =& icms::handler('icms_view_template_file'); $deltpl =& $tplfile_handler->find('default', 'module', $module->getVar('mid')); $delng = array(); if (is_array($deltpl)) { $xoopsDelTpl = new icms_view_Tpl(); // clear cache files $xoopsDelTpl->clear_cache(NULL, 'mod_' . $dirname); // delete template file entry in db $dcount = count($deltpl); for ($i = 0; $i < $dcount; $i++) { if (!$tplfile_handler->delete($deltpl[$i])) { $delng[] = $deltpl[$i]->getVar('tpl_file'); } } } $templates = $module->getInfo('templates'); if ($templates !== FALSE) { $msgs[] = _MD_AM_MOD_UP_TEM; foreach ($templates as $tpl) { $tpl['file'] = trim($tpl['file']); if (!in_array($tpl['file'], $delng)) { $tpldata =& xoops_module_gettemplate($dirname, $tpl['file']); $tplfile =& $tplfile_handler->create(); $tplfile->setVar('tpl_refid', $newmid); $tplfile->setVar('tpl_lastimported', 0); $tplfile->setVar('tpl_lastmodified', time()); if (preg_match("/\.css$/i", $tpl['file'])) { $tplfile->setVar('tpl_type', 'css'); } else { $tplfile->setVar('tpl_type', 'module'); } $tplfile->setVar('tpl_source', $tpldata, TRUE); $tplfile->setVar('tpl_module', $dirname); $tplfile->setVar('tpl_tplset', 'default'); $tplfile->setVar('tpl_file', $tpl['file'], TRUE); $tplfile->setVar('tpl_desc', $tpl['description'], TRUE); if (!$tplfile_handler->insert($tplfile)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_INSERT_FAIL . '</span>', '<strong>' . $tpl['file'] . '</strong>'); } else { $newid = $tplfile->getVar('tpl_id'); $msgs[] = sprintf(' <span>' . _MD_AM_TEMPLATE_INSERTED . '</span>', '<strong>' . $tpl['file'] . '</strong>', '<strong>' . $newid . '</strong>'); if ($icmsConfig['template_set'] == 'default') { if (!$icmsAdminTpl->template_touch($newid)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_RECOMPILE_FAIL . '</span>', '<strong>' . $tpl['file'] . '</strong>'); } else { $msgs[] = sprintf(' <span>' . _MD_AM_TEMPLATE_RECOMPILED . '</span>', '<strong>' . $tpl['file'] . '</strong>'); } } } unset($tpldata); } else { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_DELETE_FAIL . '</span>', $tpl['file']); } } } $blocks = $module->getInfo('blocks'); $msgs[] = _MD_AM_MOD_REBUILD_BLOCKS; if ($blocks !== FALSE) { $count = count($blocks); $showfuncs = array(); $funcfiles = array(); for ($i = 1; $i <= $count; $i++) { if (isset($blocks[$i]['show_func']) && $blocks[$i]['show_func'] != '' && isset($blocks[$i]['file']) && $blocks[$i]['file'] != '') { $editfunc = isset($blocks[$i]['edit_func']) ? $blocks[$i]['edit_func'] : ''; $showfuncs[] = $blocks[$i]['show_func']; $funcfiles[] = $blocks[$i]['file']; $template = $content = ''; if ((isset($blocks[$i]['template']) && trim($blocks[$i]['template']) != '')) { $content =& xoops_module_gettemplate($dirname, $blocks[$i]['template'], TRUE); } if (!$content) { $content = ''; } else { $template = $blocks[$i]['template']; } $options = ''; if (!empty($blocks[$i]['options'])) { $options = $blocks[$i]['options']; } $sql = "SELECT bid, name FROM " . icms::$xoopsDB->prefix('newblocks') . " WHERE mid='" . (int) $module->getVar('mid') . "' AND func_num='". (int) $i . "' AND show_func='" . addslashes($blocks[$i]['show_func']) . "' AND func_file='" . addslashes($blocks[$i]['file']) . "'"; $fresult = icms::$xoopsDB->query($sql); $fcount = 0; while ($fblock = icms::$xoopsDB->fetchArray($fresult)) { $fcount++; $sql = "UPDATE " . icms::$xoopsDB->prefix("newblocks") . " SET name='" . addslashes($blocks[$i]['name']) . "', edit_func='" . addslashes($editfunc) . "', content='', template='" . $template . "', last_modified=" . time() . " WHERE bid='". (int) $fblock['bid'] . "'"; $result = icms::$xoopsDB->query($sql); if (!$result) { $msgs[] = sprintf(' ' . _MD_AM_UPDATE_FAIL, $fblock['name']); } else { $msgs[] = sprintf(' ' . _MD_AM_BLOCK_UPDATED, '<strong>' . $fblock['name'] . '</strong>', '<strong>' . icms_conv_nr2local($fblock['bid']) . '</strong>'); if ($template != '') { $tplfile =& $tplfile_handler->find('default', 'block', $fblock['bid']); if (count($tplfile) == 0) { $tplfile_new =& $tplfile_handler->create(); $tplfile_new->setVar('tpl_module', $dirname); $tplfile_new->setVar('tpl_refid', (int) $fblock['bid']); $tplfile_new->setVar('tpl_tplset', 'default'); $tplfile_new->setVar('tpl_file', $blocks[$i]['template'], TRUE); $tplfile_new->setVar('tpl_type', 'block'); } else { $tplfile_new = $tplfile[0]; } $tplfile_new->setVar('tpl_source', $content, TRUE); $tplfile_new->setVar('tpl_desc', $blocks[$i]['description'], TRUE); $tplfile_new->setVar('tpl_lastmodified', time()); $tplfile_new->setVar('tpl_lastimported', 0); if (!$tplfile_handler->insert($tplfile_new)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_UPDATE_FAIL . '</span>', '<strong>' . $blocks[$i]['template'] . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_TEMPLATE_UPDATED, '<strong>' . $blocks[$i]['template'] . '</strong>'); if ($icmsConfig['template_set'] == 'default') { if (!$icmsAdminTpl->template_touch($tplfile_new->getVar('tpl_id'))) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_RECOMPILE_FAIL . '</span>', '<strong>' . $blocks[$i]['template'] . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_TEMPLATE_RECOMPILED, '<strong>' . $blocks[$i]['template'] . '</strong>'); } } } } } } if ($fcount == 0) { $newbid = icms::$xoopsDB->genId(icms::$xoopsDB->prefix('newblocks') . '_bid_seq'); $block_name = addslashes($blocks[$i]['name']); /* @todo properly handle the block_type when updating the system module */ $sql = "INSERT INTO " . icms::$xoopsDB->prefix("newblocks") . " (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, c_type, isactive, dirname, func_file, show_func, edit_func, template, bcachetime, last_modified) VALUES ('" . (int) $newbid . "', '". (int) $module->getVar('mid') . "', '". (int) $i . "', '" . addslashes($options) . "', '" . $block_name . "', '" . $block_name . "', '', '1', '0', '0', 'M', 'H', '1', '" . addslashes($dirname) . "', '" . addslashes($blocks[$i]['file']) . "', '" . addslashes($blocks[$i]['show_func']) . "', '" . addslashes($editfunc) . "', '" . $template . "', '0', '" . time() . "')"; $result = icms::$xoopsDB->query($sql); if (!$result) { $msgs[] = sprintf(' ' . _MD_AM_CREATE_FAIL, $blocks[$i]['name']); echo $sql; } else { if (empty($newbid)) { $newbid = icms::$xoopsDB->getInsertId(); } $groups =& icms::$user->getGroups(); $gperm_handler = icms::handler('icms_member_groupperm'); foreach ($groups as $mygroup) { $bperm =& $gperm_handler->create(); $bperm->setVar('gperm_groupid', (int) $mygroup); $bperm->setVar('gperm_itemid', (int) $newbid); $bperm->setVar('gperm_name', 'block_read'); $bperm->setVar('gperm_modid', 1); if (!$gperm_handler->insert($bperm)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_BLOCK_ACCESS_FAIL . '</span>', '<strong>' . $newbid . '</strong>', '<strong>' . $mygroup . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_BLOCK_ACCESS_ADDED, '<strong>' . $newbid . '</strong>', '<strong>' . $mygroup . '</strong>'); } } if ($template != '') { $tplfile =& $tplfile_handler->create(); $tplfile->setVar('tpl_module', $dirname); $tplfile->setVar('tpl_refid', (int) $newbid); $tplfile->setVar('tpl_source', $content, TRUE); $tplfile->setVar('tpl_tplset', 'default'); $tplfile->setVar('tpl_file', $blocks[$i]['template'], TRUE); $tplfile->setVar('tpl_type', 'block'); $tplfile->setVar('tpl_lastimported', 0); $tplfile->setVar('tpl_lastmodified', time()); $tplfile->setVar('tpl_desc', $blocks[$i]['description'], TRUE); if (!$tplfile_handler->insert($tplfile)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_INSERT_FAIL . '</span>', '<strong>' . $blocks[$i]['template'] . '</strong>'); } else { $newid = $tplfile->getVar('tpl_id'); $msgs[] = sprintf(' ' . _MD_AM_TEMPLATE_INSERTED, '<strong>' . $blocks[$i]['template'] . '</strong>', '<strong>' . $newid . '</strong>'); if ($icmsConfig['template_set'] == 'default') { if (!$icmsAdminTpl->template_touch($newid)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_RECOMPILE_FAIL . '</span>', '<strong>' . $blocks[$i]['template'] . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_TEMPLATE_RECOMPILED, '<strong>' . $blocks[$i]['template'] . '</strong>'); } } } } $msgs[] = sprintf(' ' . _MD_AM_BLOCK_CREATED, '<strong>' . $blocks[$i]['name'] . '</strong>', '<strong>' . $newbid . '</strong>'); $sql = "INSERT INTO " . icms::$xoopsDB->prefix('block_module_link') . " (block_id, module_id, page_id) VALUES ('" . (int) $newbid . "', '0', '1')"; icms::$xoopsDB->query($sql); } } } } $icms_block_handler = icms::handler('icms_view_block'); $block_arr = $icms_block_handler->getByModule($module->getVar('mid')); foreach ($block_arr as $block) { if (!in_array($block->getVar('show_func'), $showfuncs) || !in_array($block->getVar('func_file'), $funcfiles)) { $sql = sprintf("DELETE FROM %s WHERE bid = '%u'", icms::$xoopsDB->prefix('newblocks'), (int) $block->getVar('bid')); if (!icms::$xoopsDB->query($sql)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_BLOCK_DELETE_FAIL . '</span>', '<strong>' . $block->getVar('name') . '</strong>', '<strong>' . $block->getVar('bid') . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_BLOCK_DELETED, '<strong>' . $block->getVar('name') . '</strong>', '<strong>' . $block->getVar('bid') . '</strong>'); if ($block->getVar('template') != '') { $tplfiles =& $tplfile_handler->find(NULL, 'block', $block->getVar('bid')); if (is_array($tplfiles)) { $btcount = count($tplfiles); for ($k = 0; $k < $btcount; $k++) { if (!$tplfile_handler->delete($tplfiles[$k])) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_BLOCK_TMPLT_DELETE_FAILED . '</span>', '<strong>' . $tplfiles[$k]->getVar('tpl_file') . '</strong>', '<strong>' . $tplfiles[$k]->getVar('tpl_id') . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_BLOCK_TMPLT_DELETED, '<strong>' . $tplfiles[$k]->getVar('tpl_file') . '</strong>', '<strong>' . $tplfiles[$k]->getVar('tpl_id') . '</strong>'); } } } } } } } } // first delete all config entries $config_handler = icms::handler('icms_config'); $configs =& $config_handler->getConfigs(new icms_db_criteria_Item('conf_modid', $module->getVar('mid'))); $confcount = count($configs); $config_delng = array(); if ($confcount > 0) { $msgs[] = _MD_AM_CONFIGOPTION_DELETED; for ($i = 0; $i < $confcount; $i++) { if (!$config_handler->deleteConfig($configs[$i])) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_CONFIGOPTION_DELETE_FAIL . '</span>', '<strong>' . $configs[$i]->getvar('conf_id') . '</strong>'); // save the name of config failed to delete for later use $config_delng[] = $configs[$i]->getvar('conf_name'); } else { $config_old[$configs[$i]->getvar('conf_name')]['value'] = $configs[$i]->getvar('conf_value', 'N'); $config_old[$configs[$i]->getvar('conf_name')]['formtype'] = $configs[$i]->getvar('conf_formtype'); $config_old[$configs[$i]->getvar('conf_name')]['valuetype'] = $configs[$i]->getvar('conf_valuetype'); $msgs[] = sprintf(' ' . _MD_AM_CONFIGOPTION_DELETED, '<strong>' . $configs[$i]->getVar('conf_id') . '</strong>'); } } } // now reinsert them with the new settings $configs = $module->getInfo('config'); if ($configs !== FALSE) { if ($module->getVar('hascomments') != 0) { include_once ICMS_INCLUDE_PATH . '/comment_constants.php' ; array_push($configs, array( 'name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array( '_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN) ) ); array_push($configs, array( 'name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 ) ); } } else { if ($module->getVar('hascomments') != 0) { include_once ICMS_INCLUDE_PATH . '/comment_constants.php' ; $configs[] = array( 'name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array( '_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN ) ); $configs[] = array( 'name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0 ); } } if ($module->getVar('hasnotification') != 0) { if (empty($configs)) { $configs = array(); } // Main notification options include_once ICMS_INCLUDE_PATH . '/notification_constants.php'; $options = array( '_NOT_CONFIG_DISABLE' => XOOPS_NOTIFICATION_DISABLE, '_NOT_CONFIG_ENABLEBLOCK' => XOOPS_NOTIFICATION_ENABLEBLOCK, '_NOT_CONFIG_ENABLEINLINE' => XOOPS_NOTIFICATION_ENABLEINLINE, '_NOT_CONFIG_ENABLEBOTH' => XOOPS_NOTIFICATION_ENABLEBOTH, ); $configs[] = array( 'name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options'=>$options ); // Event specific notification options // FIXME: for some reason the default doesn't come up properly // initially is ok, but not when 'update' module.. $options = array(); $notification_handler = icms::handler('icms_data_notification'); $categories =& $notification_handler->categoryInfo('', $module->getVar('mid')); foreach ($categories as $category) { $events =& $notification_handler->categoryEvents($category['name'], FALSE, $module->getVar('mid')); foreach ($events as $event) { if (!empty($event['invisible'])) { continue; } $option_name = $category['title'] . ' : ' . $event['title']; $option_value = $category['name'] . '-' . $event['name']; $options[$option_name] = $option_value; } } $configs[] = array( 'name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options ); } if ($configs !== FALSE) { $msgs[] = _MD_AM_CONFIG_ADDING; $config_handler = icms::handler('icms_config'); $order = 0; foreach ($configs as $config) { // only insert ones that have been deleted previously with success if (!in_array($config['name'], $config_delng)) { $confobj =& $config_handler->createConfig(); $confobj->setVar('conf_modid', (int) $newmid); $confobj->setVar('conf_catid', 0); $confobj->setVar('conf_name', $config['name']); $confobj->setVar('conf_title', $config['title'], TRUE); $confobj->setVar('conf_desc', $config['description'], TRUE); $confobj->setVar('conf_formtype', $config['formtype']); $confobj->setVar('conf_valuetype', $config['valuetype']); if (isset($config_old[$config['name']]['value']) && $config_old[$config['name']]['formtype'] == $config['formtype'] && $config_old[$config['name']]['valuetype'] == $config['valuetype'] ) { // preserve the old value if any // form type and value type must be the same // need to deal with arrays, because getInfo('config') doesn't convert arrays if (is_array($config_old[$config['name']]['value'])) { $confobj->setVar('conf_value', serialize($config_old[$config['name']]['value']), TRUE); } else { $confobj->setVar('conf_value', $config_old[$config['name']]['value'], TRUE); } } else { $confobj->setConfValueForInput($config['default'], TRUE); } $confobj->setVar('conf_order', $order); $confop_msgs = ''; if (isset($config['options']) && is_array($config['options'])) { foreach ($config['options'] as $key => $value) { $confop =& $config_handler->createConfigOption(); $confop->setVar('confop_name', $key, TRUE); $confop->setVar('confop_value', $value, TRUE); $confobj->setConfOptions($confop); $confop_msgs .= sprintf('<br /> ' . _MD_AM_CONFIGOPTION_ADDED, '<strong>' . $key . '</strong>', '<strong>' . $value . '</strong>'); unset($confop); } } $order++; if (FALSE !== $config_handler->insertConfig($confobj)) { $msgs[] = sprintf(' ' . _MD_AM_CONFIG_ADDED, '<strong>' . $config['name'] . '</strong>. ') . $confop_msgs; } else { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_CONFIG_ADD_FAIL . '</span>', '<strong>' . $config['name'] . '</strong>. '); } unset($confobj); } } unset($configs); } // add module specific tasks to system autotasks list $atasks = $module->getInfo('autotasks'); $atasks_handler = &icms_getModuleHandler('autotasks', 'system'); if (isset($atasks) && is_array($atasks) && (count($atasks) > 0)) { $msgs[] = _MD_AM_AUTOTASK_UPDATE; $criteria = new icms_db_criteria_Compo(); $criteria->add(new icms_db_criteria_Item('sat_type', 'addon/' . $module->getInfo('dirname'))); $items_atasks = $atasks_handler->getObjects($criteria, FALSE); foreach ($items_atasks as $task) { $taskID = (int) $task->getVar('sat_addon_id'); $atasks[$taskID]['enabled'] = $task->getVar('sat_enabled'); $atasks[$taskID]['repeat'] = $task->getVar('sat_repeat'); $atasks[$taskID]['interval'] = $task->getVar('sat_interval'); $atasks[$taskID]['name'] = $task->getVar('sat_name'); } $atasks_handler->deleteAll($criteria); if (is_array($atasks)) { foreach ($atasks as $taskID => $taskData) { if (!isset($taskData['code']) || trim($taskData['code']) == '') continue; $task = &$atasks_handler->create(); if (isset($taskData['enabled'])) $task->setVar('sat_enabled', $taskData['enabled']); if (isset($taskData['repeat'])) $task->setVar('sat_repeat', $taskData['repeat']); if (isset($taskData['interval'])) $task->setVar('sat_interval', $taskData['interval']); if (isset($taskData['onfinish'])) $task->setVar('sat_onfinish', $taskData['onfinish']); $task->setVar('sat_name', $taskData['name']); $task->setVar('sat_code', $taskData['code']); $task->setVar('sat_type', 'addon/' . $module->getInfo('dirname')); $task->setVar('sat_addon_id', (int) $taskID); if (!($atasks_handler->insert($task))) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_AUTOTASK_FAIL . '</span>', '<strong>' . $taskData['name'] . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_AUTOTASK_ADDED, '<strong>' . $taskData['name'] . '</strong>'); } } } unset($atasks, $atasks_handler, $task, $taskData, $criteria, $items, $taskID); } // execute module specific update script if any $update_script = $module->getInfo('onUpdate'); $ModName = ($module->getInfo('modname') != '') ? trim($module->getInfo('modname')) : $dirname; if (FALSE !== $update_script && trim($update_script) != '') { include_once ICMS_MODULES_PATH . '/' . $dirname . '/' . trim($update_script); $is_IPF = $module->getInfo('object_items'); if (!empty($is_IPF)) { $icmsDatabaseUpdater = icms_db_legacy_Factory::getDatabaseUpdater(); $icmsDatabaseUpdater->moduleUpgrade($module, TRUE); array_merge($msgs, $icmsDatabaseUpdater->_messages); } if (function_exists('xoops_module_update_' . $ModName)) { $func = 'xoops_module_update_' . $ModName; if (!$func($module, $prev_version, $prev_dbversion)) { $msgs[] = sprintf(_MD_AM_FAIL_EXEC, '<strong>' . $func . '</strong>'); } else { $msgs[] = $module->messages; $msgs[] = sprintf(_MD_AM_FUNCT_EXEC, '<strong>' . $func . '</strong>'); } } elseif (function_exists('icms_module_update_' . $ModName)) { $func = 'icms_module_update_' . $ModName; if (!$func($module, $prev_version, $prev_dbversion)) { $msgs[] = sprintf(_MD_AM_FAIL_EXEC, '<strong>' . $func . '</strong>'); } else { $msgs[] = $module->messages; $msgs[] = sprintf(_MD_AM_FUNCT_EXEC, '<strong>' . $func . '</strong>'); } } } $msgs[] = '</code><p>' . sprintf(_MD_AM_OKUPD, '<strong>' . $module->getVar('name') . '</strong>') . '</p>'; } $ret = '<code>' . implode('<br />', $msgs); return $ret; }
$com_rootid = $comment->getVar('com_rootid'); // get all comments posted later within the same thread $thread_comments =& $comment_handler->getThread($com_rootid, $com_id); // construct a comment tree $xot = new icms_ipf_Tree($thread_comments, 'com_id', 'com_pid', 'com_rootid'); $child_comments =& $xot->getAllChild($com_id); // add itself here $child_comments[$com_id] =& $comment; $msgs = array(); $deleted_num = array(); $member_handler = icms::handler('icms_member'); foreach (array_keys($child_comments) as $i) { if (!$comment_handler->delete($child_comments[$i])) { $msgs[] = _CM_COMDELETENG . ' (ID: ' . icms_conv_nr2local($child_comments[$i]->getVar('com_id')) . ')'; } else { $msgs[] = _CM_COMDELETED . ' (ID: ' . icms_conv_nr2local($child_comments[$i]->getVar('com_id')) . ')'; // store poster ID and deleted post number into array for later use $poster_id = $child_comments[$i]->getVar('com_uid'); if ($poster_id > 0) { $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : $deleted_num[$poster_id] + 1; } } } foreach ($deleted_num as $user_id => $post_num) { // update user posts $com_poster = $member_handler->getUser($user_id); if (is_object($com_poster)) { $member_handler->updateUserByField($com_poster, 'posts', $com_poster->getVar('posts') - $post_num); } } $com_itemid = $comment->getVar('com_itemid');
} } else { $thisUser = icms::handler('icms_member')->getUser($uid); if (!is_object($thisUser) || !$thisUser->isActive()) { redirect_header('index.php', 3, _US_SELECTNG); } $xoopsOption['template_main'] = 'system_userinfo.html'; include ICMS_ROOT_PATH . '/header.php'; $icmsTpl->assign('user_ownpage', FALSE); } if (is_object(icms::$user) && $isAdmin) { icms_makeSmarty(array('lang_editprofile' => _US_EDITPROFILE, 'lang_deleteaccount' => _US_DELACCOUNT, 'user_uid' => (int) $thisUser->getVar('uid'))); } $userrank = $thisUser->rank(); $date = $thisUser->getVar('last_login'); icms_makeSmarty(array('user_avatarurl' => $icmsConfigUser['avatar_allow_gravatar'] == TRUE ? $thisUser->gravatar('G', $icmsConfigUser['avatar_width']) : ICMS_UPLOAD_URL . '/' . $thisUser->getVar('user_avatar'), 'user_websiteurl' => $thisUser->getVar('url', 'E') == '' ? '' : '<a href="' . $thisUser->getVar('url', 'E') . '" rel="external">' . $thisUser->getVar('url') . '</a>', 'lang_website' => _US_WEBSITE, 'user_realname' => $thisUser->getVar('name'), 'lang_realname' => _US_REALNAME, 'lang_avatar' => _US_AVATAR, 'lang_allaboutuser' => sprintf(_US_ALLABOUT, $thisUser->getVar('uname')), 'user_alwopenid' => $icmsConfigAuth['auth_openid'], 'lang_openid', $icmsConfigAuth['auth_openid'] == TRUE ? _US_OPENID_FORM_CAPTION : '', 'lang_email' => _US_EMAIL, 'lang_privmsg' => _US_PM, 'lang_icq' => _US_ICQ, 'user_icq' => $thisUser->getVar('user_icq'), 'lang_aim' => _US_AIM, 'user_aim' => $thisUser->getVar('user_aim'), 'lang_yim' => _US_YIM, 'user_yim' => $thisUser->getVar('user_yim'), 'lang_msnm' => _US_MSNM, 'user_msnm' => $thisUser->getVar('user_msnm'), 'lang_location' => _US_LOCATION, 'user_location' => $thisUser->getVar('user_from'), 'lang_occupation' => _US_OCCUPATION, 'user_occupation' => $thisUser->getVar('user_occ'), 'lang_interest' => _US_INTEREST, 'user_interest' => $thisUser->getVar('user_intrest'), 'lang_extrainfo' => _US_EXTRAINFO, 'user_extrainfo' => icms_core_DataFilter::checkVar($thisUser->getVar('bio', 'N'), 'text', 'output'), 'lang_statistics' => _US_STATISTICS, 'lang_membersince' => _US_MEMBERSINCE, 'user_joindate' => formatTimestamp($thisUser->getVar('user_regdate'), 's'), 'lang_rank' => _US_RANK, 'lang_posts' => _US_POSTS, 'lang_basicInfo' => _US_BASICINFO, 'lang_more' => _US_MOREABOUT, 'lang_myinfo' => _US_MYINFO, 'user_posts' => icms_conv_nr2local($thisUser->getVar('posts')), 'lang_lastlogin' => _US_LASTLOGIN, 'lang_notregistered' => _US_NOTREGISTERED, 'user_pmlink' => is_object(icms::$user) ? "<a href=\"javascript:openWithSelfMain('" . ICMS_URL . "/pmlite.php?send2=1&to_userid=" . (int) $thisUser->getVar('uid') . "', 'pmlite', 800,680);\"><img src=\"" . ICMS_URL . "/images/icons/" . $icmsConfig['language'] . "/pm.gif\" alt=\"" . sprintf(_SENDPMTO, $thisUser->getVar('uname')) . "\" /></a>" : '', 'user_rankimage' => $userrank['image'] ? '<img src="' . $userrank['image'] . '" alt="' . $userrank['title'] . '" />' : '', 'user_ranktitle' => $userrank['title'], 'user_lastlogin' => !empty($date) ? formatTimestamp($thisUser->getVar('last_login'), 'm') : '', 'icms_pagetitle' => sprintf(_US_ALLABOUT, $thisUser->getVar('uname')), 'user_email' => $thisUser->getVar('user_viewemail') == TRUE || is_object(icms::$user) && (icms::$user->isAdmin() || icms::$user->getVar('uid') == $thisUser->getVar('uid')) ? $thisUser->getVar('email', 'E') : ' ', 'user_openid' => $icmsConfigAuth['auth_openid'] == TRUE && ($thisUser->getVar('user_viewoid') == TRUE || is_object(icms::$user) && (icms::$user->isAdmin() || icms::$user->getVar('uid') == $thisUser->getVar('uid'))) ? $thisUser->getVar('openid', 'E') : ' ')); if ($icmsConfigUser['allwshow_sig'] == TRUE && strlen(trim($thisUser->getVar('user_sig', 'N'))) > 0) { icms_makeSmarty(array('user_showsignature' => TRUE, 'lang_signature' => _US_SIGNATURE, 'user_signature' => icms_core_DataFilter::checkVar($thisUser->getVar('user_sig', 'N'), 'html', 'output'))); } $module_handler = icms::handler('icms_module'); $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('hassearch', 1)); $criteria->add(new icms_db_criteria_Item('isactive', 1)); $mids = array_keys($module_handler->getList($criteria)); foreach ($mids as $mid) { if ($gperm_handler->checkRight('module_read', $mid, $groups)) { $module = $module_handler->get($mid); $results = $module->search('', '', 5, 0, (int) $thisUser->getVar('uid')); $count = count($results); if (is_array($results) && $count > 0) { for ($i = 0; $i < $count; $i++) { if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
$icmsAdminTpl->assign('latest_url', $icmsVersionChecker->latest_url); if (ICMS_VERSION_STATUS == 10 && $icmsVersionChecker->latest_status < 10) { // I'm running a final release so make sure to notify the user that the update is not a final $icmsAdminTpl->assign('not_a_final_comment', TRUE); } } else { $checkerErrors = $icmsVersionChecker->getErrors(TRUE); if ($checkerErrors) { $icmsAdminTpl->assign('errors', $checkerErrors); } } $icmsAdminTpl->assign('your_version', $icmsVersionChecker->installed_version_name); $icmsAdminTpl->assign('lang_php_vesion', PHP_VERSION); $icmsAdminTpl->assign('lang_mysql_version', mysql_get_server_info()); $icmsAdminTpl->assign('lang_server_api', PHP_SAPI); $icmsAdminTpl->assign('lang_os_name', PHP_OS); $icmsAdminTpl->assign('safe_mode', ini_get('safe_mode') ? _CO_ICMS_ON : _CO_ICMS_OFF); $icmsAdminTpl->assign('register_globals', ini_get('register_globals') ? _CO_ICMS_ON : _CO_ICMS_OFF); $icmsAdminTpl->assign('magic_quotes_gpc', ini_get('magic_quotes_gpc') ? _CO_ICMS_ON : _CO_ICMS_OFF); $icmsAdminTpl->assign('allow_url_fopen', ini_get('allow_url_fopen') ? _CO_ICMS_ON : _CO_ICMS_OFF); $icmsAdminTpl->assign('fsockopen', function_exists('fsockopen') ? _CO_ICMS_ON : _CO_ICMS_OFF); $icmsAdminTpl->assign('allow_call_time_pass_reference', ini_get('allow_call_time_pass_reference') ? _CO_ICMS_ON : _CO_ICMS_OFF); $icmsAdminTpl->assign('post_max_size', icms_conv_nr2local(ini_get('post_max_size'))); $icmsAdminTpl->assign('max_input_time', icms_conv_nr2local(ini_get('max_input_time'))); $icmsAdminTpl->assign('output_buffering', icms_conv_nr2local(ini_get('output_buffering'))); $icmsAdminTpl->assign('max_execution_time', icms_conv_nr2local(ini_get('max_execution_time'))); $icmsAdminTpl->assign('memory_limit', icms_conv_nr2local(ini_get('memory_limit'))); $icmsAdminTpl->assign('file_uploads', ini_get('file_uploads') ? _CO_ICMS_ON : _CO_ICMS_OFF); $icmsAdminTpl->assign('upload_max_filesize', icms_conv_nr2local(ini_get('upload_max_filesize'))); $icmsAdminTpl->display(ICMS_MODULES_PATH . '/system/templates/admin/system_adm_version.html'); icms_cp_footer();
$count = count($this->logstart); $ret .= '<table id="xo-logger-timers" class="outer"><tr><th colspan="2">' . _TIMERS . ' (' . icms_conv_nr2local($count) . ') </th></tr>'; foreach ($this->logstart as $k => $v) { $ret .= '<tr><td class="' . $class . '"><strong>' . htmlspecialchars($k) . '</strong> ' . sprintf(_TOOKXLONG, '<span style="color:#ff0000;">' . icms_conv_nr2local(sprintf("%.03f", $this->dumpTime($k))) . '</span>') . '</td></tr>'; $class = $class == 'odd' ? 'even' : 'odd'; } $ret .= '</table>'; } /** * @author ImpressCMS * @since 1.3 */ if (empty($mode) || $mode == 'deprecated') { $class = 'even'; $count = count($this->deprecated); $ret .= '<table id="xo-logger-deprecated" class="outer"><tr><th colspan="2">' . _CORE_DEPRECATED . ' (' . icms_conv_nr2local($count) . ') </th></tr>'; foreach ($this->deprecated as $dep) { $ret .= '<tr><td class="' . $class . '">' . $dep . '</td></tr>'; $class = $class == 'odd' ? 'even' : 'odd'; } $ret .= '</table>'; } if (empty($mode)) { $ret .= <<<EOT </div> <script type="text/javascript"> \tfunction xoLogCreateCookie(name,value,days) { \t\tif (days) { \t\t\tvar date = new Date(); \t\t\tdate.setTime(date.getTime()+(days*24*60*60*1000)); \t\t\tvar expires = "; expires="+date.toGMTString();
$class = $class == 'odd' ? 'even' : 'odd'; $poster_uname = $icmsConfig['anonymous']; if ($comments[$i]->getVar('com_uid') > 0) { $poster =& $member_handler->getUser($comments[$i]->getVar('com_uid')); if (is_object($poster)) { $poster_uname = '<a href="' . ICMS_URL . '/userinfo.php?uid=' . $comments[$i]->getVar('com_uid') . '">' . $poster->getVar('uname') . '</a>'; } } $icon = $comments[$i]->getVar('com_icon'); $icon = empty($icon) ? '/images/icons/' . $GLOBALS["icmsConfig"]["language"] . '/no_posticon.gif' : '/images/subject/' . htmlspecialchars($icon, ENT_QUOTES); $icon = '<img src="' . ICMS_URL . $icon . '" alt="" />'; echo '<tr align="center"><td class="' . $class . '">' . $icon . '</td><td class="' . $class . '" align="' . _GLOBAL_LEFT . '"><a href="admin.php?fct=comments&op=jump&com_id=' . $i . '">' . $comments[$i]->getVar('com_title') . '</a></td><td class="' . $class . '">' . formatTimestamp($comments[$i]->getVar('com_created'), 'm') . '</td><td class="' . $class . '">' . $poster_uname . '</td><td class="' . $class . '">' . icms_conv_nr2local($comments[$i]->getVar('com_ip')) . '</td><td class="' . $class . '">' . $module_array[$comments[$i]->getVar('com_modid')] . '</td><td class="' . $class . '">' . $status_array2[$comments[$i]->getVar('com_status')] . '</td><td class="' . $class . '" align="' . _CENTER . '"><a href="admin/comments/comment_edit.php?com_id=' . $i . '"><img src="' . ICMS_IMAGES_SET_URL . '/actions/edit.png" alt="' . _EDIT . '" title="' . _EDIT . '" /></a> <a href="admin/comments/comment_delete.php?com_id=' . $i . '"><img src="' . ICMS_IMAGES_SET_URL . '/actions/editdelete.png" alt="' . _DELETE . '" title="' . _DELETE . '" /></a></td></tr>'; } echo '</table>'; echo '<table style="width: 100%; border: 0; margin: 3px; padding: 3px;"><tr><td>' . sprintf(_MD_AM_COMFOUND, '<b>' . icms_conv_nr2local($total) . '</b>'); if ($total > $limit) { $nav = new icms_view_PageNav($total, $limit, $start, 'start', 'fct=comments&op=list&limit=' . $limit . '&sort=' . $sort . '&order=' . $order . '&module=' . $module); echo '</td><td align="center">' . $nav->renderNav(); } echo '</td></tr></table>'; icms_cp_footer(); break; case 'jump': $com_id = isset($_GET['com_id']) ? (int) $_GET['com_id'] : 0; if ($com_id > 0) { $comment_handler = icms::handler('icms_data_comment'); $comment =& $comment_handler->get($com_id); if (is_object($comment)) { $module_handler = icms::handler('icms_module'); $module =& $module_handler->get($comment->getVar('com_modid'));
echo '<tr align="center"><td class="' . $class . '">' . $icon . '</td><td class="' . $class . '" align="' . _GLOBAL_LEFT . '"><a href="admin.php?fct=comments&op=jump&com_id=' . $i . '">' . $comments[$i]->getVar('com_title') . '</a></td><td class="' . $class . '">' . formatTimestamp($comments[$i]->getVar('com_created'), 'm') . '</td><td class="' . $class . '">' . $poster_uname . '</td><td class="' . $class . '">' . icms_conv_nr2local($comments[$i]->getVar('com_ip')) . '</td><td class="' . $class . '">' . $module_array[$comments[$i]->getVar('com_modid')] . '</td><td class="' . $class . '">' . $status_array2[$comments[$i]->getVar('com_status')] . '</td><td class="' . $class . '" align="' . _CENTER . '"><a href="admin/comments/comment_edit.php?com_id=' . $i . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/edit.png" alt="' . _EDIT . '" title="' . _EDIT . '" /></a> <a href="admin/comments/comment_delete.php?com_id=' . $i . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/editdelete.png" alt="' . _DELETE . '" title="' . _DELETE . '" /></a></td></tr>'; } echo '</table>'; echo '<table style="width: 100%; border: 0; margin: 3px; padding: 3px;"><tr><td>' . sprintf(_MD_AM_COMFOUND, '<b>' . icms_conv_nr2local($total) . '</b>'); if ($total > $limit) { $nav = new icms_view_PageNav($total, $limit, $start, 'start', 'fct=comments&op=list&limit=' . $limit . '&sort=' . $sort . '&order=' . $order . '&module=' . $module); echo '</td><td align="center">' . $nav->renderNav(); } echo '</td></tr></table>'; icms_cp_footer(); break; case 'jump': $com_id = (isset($_GET['com_id'])) ? (int) $_GET['com_id'] : 0; if ($com_id > 0) { $comment_handler = icms::handler('icms_data_comment'); $comment =& $comment_handler->get($com_id); if (is_object($comment)) { $module_handler = icms::handler('icms_module');
foreach ($temp_queries as $q) { $q = trim($q); if (strlen($q) >= $icmsConfigSearch['keyword_min']) { $queries[] = icms_core_DataFilter::addSlashes($q); } else { $ignored_queries[] = icms_core_DataFilter::addSlashes($q); } } if (count($queries) == 0) { redirect_header('search.php', 2, sprintf(_SR_KEYTOOSHORT, icms_conv_nr2local($icmsConfigSearch['keyword_min']))); exit; } } else { $query = trim($query); if (strlen($query) < $icmsConfigSearch['keyword_min']) { redirect_header('search.php', 2, sprintf(_SR_KEYTOOSHORT, icms_conv_nr2local($icmsConfigSearch['keyword_min']))); exit; } $queries = array(icms_core_DataFilter::addSlashes($query)); } } $xoopsTpl->assign("label_search_results", _SR_SEARCHRESULTS); // Keywords section. $xoopsTpl->assign("label_keywords", _SR_KEYWORDS . ':'); $keywords = array(); $ignored_keywords = array(); foreach ($queries as $q) { $keywords[] = htmlspecialchars(stripslashes($q), ENT_COMPAT, _CHARSET); } if (!empty($ignored_queries)) { $xoopsTpl->assign("label_ignored_keywords", sprintf(_SR_IGNOREDWORDS, $icmsConfigSearch['keyword_min']));
. formatTimestamp($tplsets[$i]->getVar('tplset_created'), 's') . '</td><td align="' . _GLOBAL_LEFT . '"><ul>'; $tplstats = $tpltpl_handler->getModuleTplCount($tplsetname); if (count($tplstats) > 0) { $module_handler = icms::handler('icms_module'); echo '<ul>'; foreach ($tplstats as $moddir => $filecount) { $module =& $module_handler->getByDirname($moddir); if (is_object($module)) { if ($installed_mods[$moddir] > $filecount) { $filecount = '<span style="color:#ff0000;">' . $filecount . '</span>'; } echo '<li>' . $module->getVar('name') . ' [<a href="admin.php?fct=tplsets&op=listtpl&tplset=' . $tplsetname . '&moddir=' . $moddir . '">' . _LIST . '</a> (<strong>' . icms_conv_nr2local($filecount) . '</strong>)]</li>'; } unset($module); } $not_installed = array_diff(array_keys($installed_mods), array_keys($tplstats)); } else { $not_installed =& array_keys($installed_mods); } foreach ($not_installed as $ni) { $module =& $module_handler->getByDirname($ni); echo '<li>' . $module->getVar('name') . ' <a href="admin.php?fct=tplsets&op=listtpl&tplset=' . $tplsetname . '&moddir=' . $ni . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/view_choose.png" alt="' . _LIST . '" title="' . _LIST . '" /></a> (<span style="color:#ff0000; font-weight: bold;">0</span>)' . ' <a href="admin.php?fct=tplsets&op=generatemod&tplset=' . $tplsetname . '&moddir=' . $ni . '"><img src="'. ICMS_IMAGES_SET_URL . '/actions/filenew2.png" alt="' . _MD_GENERATE . '" title="' . _MD_GENERATE . '" /></a></li>'; }
printf(_SENDPMTO, $foundusers[$j]->getVar("uname", "E")); echo "' /></a></td><td align='center'>"; if ($foundusers[$j]->getVar("url", "E") != "") { echo "<a href='" . $foundusers[$j]->getVar("url", "E") . "' target='_blank'><img src='" . ICMS_URL . "/images/icons/" . $GLOBALS["icmsConfig"]["language"] . "/www.gif' border='0' alt='" . _VISITWEBSITE . "' /></a>"; } else { echo " "; } echo "</td><td align='center'>" . formatTimeStamp($foundusers[$j]->getVar("user_regdate"), "s") . "</td><td align='center'>"; if ($foundusers[$j]->getVar("last_login") != 0) { echo formatTimeStamp($foundusers[$j]->getVar("last_login"), "m"); } else { echo " "; } echo "</td><td align='center'>" . icms_conv_nr2local($foundusers[$j]->getVar("posts")) . "</td>"; echo "<td align='center'><a href='" . ICMS_MODULES_URL . "/system/admin.php?fct=users&uid=" . $foundusers[$j]->getVar("uid") . "&op=modifyUser'><img src='". ICMS_IMAGES_SET_URL . "/actions/edit.png' alt=" . _EDIT . " title=" . _EDIT . " /></a></td></tr>\n"; } echo "<tr class='foot'><td><select name='fct'><option value='users'>" . _DELETE . "</option><option value='mailusers'>" . _AM_SENDMAIL . "</option>"; $group = !empty($group) ? (int) $group : 0; if ($group > 0) { $member_handler = icms::handler('icms_member'); $add2group =& $member_handler->getGroup($group); echo "<option value='groups' selected='selected'>" . sprintf(_AM_ADD2GROUP, $add2group->getVar('name')) . "</option>"; } echo "</select> "; if ($group > 0) { echo "<input type='hidden' name='groupid' value='" . $group . "' />"; } echo "</td><td colspan='12'>" . icms::$security->getTokenHTML() . "<input type='submit' value='" . _SUBMIT . "' /></td></tr></table></form>\n";
/** * */ public function getLimitsArray() { $ret = array(); $ret['all']['caption'] = _CO_ICMS_LIMIT_ALL; $ret['all']['selected'] = 'all' == $this->_limitsel ? "selected='selected'" : ""; $ret['5']['caption'] = icms_conv_nr2local('5'); $ret['5']['selected'] = '5' == $this->_limitsel ? "selected='selected'" : ""; $ret['10']['caption'] = icms_conv_nr2local('10'); $ret['10']['selected'] = '10' == $this->_limitsel ? "selected='selected'" : ""; $ret['15']['caption'] = icms_conv_nr2local('15'); $ret['15']['selected'] = '15' == $this->_limitsel ? "selected='selected'" : ""; $ret['20']['caption'] = icms_conv_nr2local('20'); $ret['20']['selected'] = '20' == $this->_limitsel ? "selected='selected'" : ""; $ret['25']['caption'] = icms_conv_nr2local('25'); $ret['25']['selected'] = '25' == $this->_limitsel ? "selected='selected'" : ""; $ret['30']['caption'] = icms_conv_nr2local('30'); $ret['30']['selected'] = '30' == $this->_limitsel ? "selected='selected'" : ""; $ret['35']['caption'] = icms_conv_nr2local('35'); $ret['35']['selected'] = '35' == $this->_limitsel ? "selected='selected'" : ""; $ret['40']['caption'] = icms_conv_nr2local('40'); $ret['40']['selected'] = '40' == $this->_limitsel ? "selected='selected'" : ""; return $ret; }
/** * Logic and rendering for modifying a member profile * * @param object $user */ function modifyUser($user) { global $icmsConfig, $icmsModule; icms_cp_header(); echo '<div class="CPbigTitle" style="background-image: url(' . ICMS_MODULES_URL . '/system/admin/users/images/users_big.png)">' . _MD_AM_USER . '</div><br />'; $member_handler = icms::handler('icms_member'); $user =& $member_handler->getUser($user); if (is_object($user)) { if (!$user->isActive()) { icms_core_Message::confirm(array('fct' => 'users', 'op' => 'reactivate', 'uid' => $user->getVar('uid')), 'admin.php', _AM_NOTACTIVE); icms_cp_footer(); exit(); } $uid_value = $user->getVar('uid'); $uname_value = $user->getVar('uname', 'E'); $login_name_value = $user->getVar('login_name', 'E'); $name_value = $user->getVar('name', 'E'); $email_value = $user->getVar('email', 'E'); $email_cbox_value = $user->getVar('user_viewemail') ? 1 : 0; $openid_value = $user->getVar('openid', 'E'); $openid_cbox_value = $user->getVar('user_viewoid') ? 1 : 0; $url_value = $user->getVar('url', 'E'); $temp = $user->getVar('theme'); $timezone_value = $user->getVar('timezone_offset'); $icq_value = $user->getVar('user_icq', 'E'); $aim_value = $user->getVar('user_aim', "E"); $yim_value = $user->getVar('user_yim', "E"); $msnm_value = $user->getVar('user_msnm', 'E'); $location_value = $user->getVar('user_from', 'E'); $occ_value = $user->getVar('user_occ', 'E'); $interest_value = $user->getVar('user_intrest', 'E'); $sig_value = $user->getVar('user_sig', 'E'); $sig_cbox_value = ($user->getVar('attachsig') == 1) ? 1 : 0; $umode_value = $user->getVar('umode'); $uorder_value = $user->getVar('uorder'); $notify_method_value = $user->getVar('notify_method'); $notify_mode_value = $user->getVar('notify_mode'); $bio_value = $user->getVar('bio', 'E'); $rank_value = $user->rank(FALSE); $mailok_value = $user->getVar('user_mailok', 'E'); $pass_expired_value = $user->getVar('pass_expired') ? 1 : 0; $op_value = 'updateUser'; $form_title = _AM_UPDATEUSER . ': ' . $user->getVar('uname'); $language_value = $user->getVar('language'); $form_isedit = TRUE; $groups = array_values($user->getGroups()); include ICMS_MODULES_PATH . '/system/admin/users/userform.php'; echo "<br /><strong>" . _AM_USERPOST . "</strong><br /><br />\n" . "<table>\n" . "<tr><td>" . _AM_COMMENTS . "</td><td>" . icms_conv_nr2local($user->getVar('posts')) . "</td></tr>\n" . "</table>\n" . "<br />" . _AM_PTBBTSDIYT . "<br />\n" . "<form action=\"admin.php\" method=\"post\">\n" . "<input type=\"hidden\" name=\"id\" value=\"" . $user->getVar('uid') . "\">" . "<input type=\"hidden\" name=\"type\" value=\"user\">\n" . "<input type=\"hidden\" name=\"fct\" value=\"users\">\n" . "<input type=\"hidden\" name=\"op\" value=\"synchronize\">\n" . icms::$security->getTokenHTML() . "\n" . "<input type=\"submit\" value=\"" . _AM_SYNCHRONIZE . "\">\n" . "</form>\n"; } else { echo "<h4 style='text-align:" . _GLOBAL_LEFT . ";'>" . _AM_USERDONEXIT . "</h4>"; } icms_cp_footer(); }
/** * Create a navigational dropdown list * * @param boolean $showbutton Show the "Go" button? * @return string */ public function renderSelect($showbutton = false) { if ($this->total < $this->perpage) { return; } $total_pages = ceil($this->total / $this->perpage); $ret = ''; if ($total_pages > 1) { $ret = '<form name="pagenavform">'; $ret .= '<select name="pagenavselect" onchange="location=this.options[this.options.selectedIndex].value;">'; $counter = 1; $current_page = (int) floor(($this->current + $this->perpage) / $this->perpage); while ($counter <= $total_pages) { if ($counter == $current_page) { $ret .= '<option value="' . $this->url . ($counter - 1) * $this->perpage . '" selected="selected">' . icms_conv_nr2local($counter) . '</option>'; } else { $ret .= '<option value="' . $this->url . ($counter - 1) * $this->perpage . '">' . icms_conv_nr2local($counter) . '</option>'; } $counter++; } $ret .= '</select>'; if ($showbutton) { $ret .= ' <input type="submit" value="' . _GO . '" />'; } $ret .= '</form>'; } return $ret; }
$ret .= '<tr class="foot"><td>' . _TOTAL . ' <span style="color:#ff0000;">' . icms_conv_nr2local(count($this->blocks)) . '</span> ' . _BLOCK . '</td></tr></table>'; } if (empty($mode) || $mode == 'extra') { $class = 'even'; $ret .= '<table id="xo-logger-extra" class="outer"><tr><th colspan="2">' . _EXTRA . '</th></tr>'; foreach ($this->extra as $ex) { $ret .= '<tr><td class="' . $class . '"><strong>' . htmlspecialchars($ex['name']) . ':</strong> ' . htmlspecialchars($ex['msg']) . '</td></tr>'; $class = $class == 'odd' ? 'even' : 'odd'; } $ret .= '</table>'; } if (empty($mode) || $mode == 'timers') { $class = 'even'; $ret .= '<table id="xo-logger-timers" class="outer"><tr><th colspan="2">' . _TIMERS . '</th></tr>'; foreach ($this->logstart as $k => $v) { $ret .= '<tr><td class="' . $class . '"><strong>' . htmlspecialchars($k) . '</strong> ' . sprintf(_TOOKXLONG, '<span style="color:#ff0000;">' . icms_conv_nr2local(sprintf("%.03f", $this->dumpTime($k))) . '</span>') . '</td></tr>'; $class = $class == 'odd' ? 'even' : 'odd'; } $ret .= '</table>'; } if (empty($mode) || $mode == 'deprecated') { $class = 'even'; $ret .= '<table id="xo-logger-deprecated" class="outer"><tr><th colspan="2">' . _CORE_DEPRECATED . '</th></tr>'; foreach ($this->deprecated as $dep) { $ret .= '<tr><td class="' . $class . '">' . $dep . '</td></tr>'; $class = $class == 'odd' ? 'even' : 'odd'; } $ret .= '</table>'; } if (empty($mode)) { $ret .= <<<EOT
function icms_module_update($dirname) { $dirname = trim($dirname); $db =& icms_db_Factory::instance(); $module_handler = icms::handler('icms_module'); $module =& $module_handler->getByDirname($dirname); // Save current version for use in the update function $prev_version = $module->getVar('version'); $prev_dbversion = $module->getVar('dbversion'); xoops_template_clear_module_cache($module->getVar('mid')); // we dont want to change the module name set by admin $temp_name = $module->getVar('name'); $module->loadInfoAsVar($dirname); $module->setVar('name', $temp_name); if (!$module_handler->insert($module)) { echo '<p>Could not update ' . $module->getVar('name') . '</p>'; echo "<br /><a href='admin.php?fct=modulesadmin'>" . _MD_AM_BTOMADMIN . "</a>"; } else { $newmid = $module->getVar('mid'); $msgs = array(); $msgs[] = _MD_AM_MOD_DATA_UPDATED; $tplfile_handler =& icms::handler('icms_view_template_file'); $deltpl =& $tplfile_handler->find('default', 'module', $module->getVar('mid')); $delng = array(); if (is_array($deltpl)) { $xoopsDelTpl = new icms_view_Tpl(); // clear cache files $xoopsDelTpl->clear_cache(null, 'mod_' . $dirname); // delete template file entry in db $dcount = count($deltpl); for ($i = 0; $i < $dcount; $i++) { if (!$tplfile_handler->delete($deltpl[$i])) { $delng[] = $deltpl[$i]->getVar('tpl_file'); } } } $templates = $module->getInfo('templates'); if ($templates != false) { $msgs[] = _MD_AM_MOD_UP_TEM; foreach ($templates as $tpl) { $tpl['file'] = trim($tpl['file']); if (!in_array($tpl['file'], $delng)) { $tpldata =& xoops_module_gettemplate($dirname, $tpl['file']); $tplfile =& $tplfile_handler->create(); $tplfile->setVar('tpl_refid', $newmid); $tplfile->setVar('tpl_lastimported', 0); $tplfile->setVar('tpl_lastmodified', time()); if (preg_match("/\\.css\$/i", $tpl['file'])) { $tplfile->setVar('tpl_type', 'css'); } else { $tplfile->setVar('tpl_type', 'module'); } $tplfile->setVar('tpl_source', $tpldata, true); $tplfile->setVar('tpl_module', $dirname); $tplfile->setVar('tpl_tplset', 'default'); $tplfile->setVar('tpl_file', $tpl['file'], true); $tplfile->setVar('tpl_desc', $tpl['description'], true); if (!$tplfile_handler->insert($tplfile)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_INSERT_FAIL . '</span>', '<strong>' . $tpl['file'] . '</strong>'); } else { $newid = $tplfile->getVar('tpl_id'); $msgs[] = sprintf(' <span>' . _MD_AM_TEMPLATE_INSERTED . '</span>', '<strong>' . $tpl['file'] . '</strong>', '<strong>' . $newid . '</strong>'); if ($icmsConfig['template_set'] == 'default') { if (!icms_view_Tpl::template_touch($newid)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_RECOMPILE_FAIL . '</span>', '<strong>' . $tpl['file'] . '</strong>'); } else { $msgs[] = sprintf(' <span>' . _MD_AM_TEMPLATE_RECOMPILED . '</span>', '<strong>' . $tpl['file'] . '</strong>'); } } } unset($tpldata); } else { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_DELETE_FAIL . '</span>', $tpl['file']); } } } $blocks = $module->getInfo('blocks'); $msgs[] = _MD_AM_MOD_REBUILD_BLOCKS; if ($blocks != false) { $count = count($blocks); $showfuncs = array(); $funcfiles = array(); for ($i = 1; $i <= $count; $i++) { if (isset($blocks[$i]['show_func']) && $blocks[$i]['show_func'] != '' && isset($blocks[$i]['file']) && $blocks[$i]['file'] != '') { $editfunc = isset($blocks[$i]['edit_func']) ? $blocks[$i]['edit_func'] : ''; $showfuncs[] = $blocks[$i]['show_func']; $funcfiles[] = $blocks[$i]['file']; $template = ''; if (isset($blocks[$i]['template']) && trim($blocks[$i]['template']) != '') { $content =& xoops_module_gettemplate($dirname, $blocks[$i]['template'], true); } if (!$content) { $content = ''; } else { $template = $blocks[$i]['template']; } $options = ''; if (!empty($blocks[$i]['options'])) { $options = $blocks[$i]['options']; } $sql = "SELECT bid, name FROM " . $db->prefix('newblocks') . " WHERE mid='" . (int) $module->getVar('mid') . "' AND func_num='" . (int) $i . "' AND show_func='" . addslashes($blocks[$i]['show_func']) . "' AND func_file='" . addslashes($blocks[$i]['file']) . "'"; $fresult = $db->query($sql); $fcount = 0; while ($fblock = $db->fetchArray($fresult)) { $fcount++; $sql = "UPDATE " . $db->prefix("newblocks") . " SET name='" . addslashes($blocks[$i]['name']) . "', edit_func='" . addslashes($editfunc) . "', content='', template='" . $template . "', last_modified=" . time() . " WHERE bid='" . (int) $fblock['bid'] . "'"; $result = $db->query($sql); if (!$result) { $msgs[] = sprintf(' ' . _MD_AM_UPDATE_FAIL, $fblock['name']); } else { $msgs[] = sprintf(' ' . _MD_AM_BLOCK_UPDATED, '<strong>' . $fblock['name'] . '</strong>', '<strong>' . icms_conv_nr2local($fblock['bid']) . '</strong>'); if ($template != '') { $tplfile =& $tplfile_handler->find('default', 'block', $fblock['bid']); if (count($tplfile) == 0) { $tplfile_new =& $tplfile_handler->create(); $tplfile_new->setVar('tpl_module', $dirname); $tplfile_new->setVar('tpl_refid', (int) $fblock['bid']); $tplfile_new->setVar('tpl_tplset', 'default'); $tplfile_new->setVar('tpl_file', $blocks[$i]['template'], true); $tplfile_new->setVar('tpl_type', 'block'); } else { $tplfile_new = $tplfile[0]; } $tplfile_new->setVar('tpl_source', $content, true); $tplfile_new->setVar('tpl_desc', $blocks[$i]['description'], true); $tplfile_new->setVar('tpl_lastmodified', time()); $tplfile_new->setVar('tpl_lastimported', 0); if (!$tplfile_handler->insert($tplfile_new)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_UPDATE_FAIL . '</span>', '<strong>' . $blocks[$i]['template'] . '</strong>'); } else { $msgs[] = ' Template <b>' . $blocks[$i]['template'] . '</b> updated.'; if ($icmsConfig['template_set'] == 'default') { if (!icms_view_Tpl::template_touch($tplfile_new->getVar('tpl_id'))) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_RECOMPILE_FAIL . '</span>', '<strong>' . $blocks[$i]['template'] . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_TEMPLATE_RECOMPILED, '<strong>' . $blocks[$i]['template'] . '</strong>'); } } } } } } if ($fcount == 0) { $newbid = $db->genId($db->prefix('newblocks') . '_bid_seq'); $block_name = addslashes($blocks[$i]['name']); $sql = "INSERT INTO " . $db->prefix("newblocks") . " (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, c_type, isactive, dirname, func_file, show_func, edit_func, template, bcachetime, last_modified) VALUES ('" . (int) $newbid . "', '" . (int) $module->getVar('mid') . "', '" . (int) $i . "','" . addslashes($options) . "','" . $block_name . "', '" . $block_name . "', '', '1', '0', '0', 'M', 'H', '1', '" . addslashes($dirname) . "', '" . addslashes($blocks[$i]['file']) . "', '" . addslashes($blocks[$i]['show_func']) . "', '" . addslashes($editfunc) . "', '" . $template . "', '0', '" . time() . "')"; $result = $db->query($sql); if (!$result) { $msgs[] = ' ERROR: Could not create ' . $blocks[$i]['name']; echo $sql; } else { if (empty($newbid)) { $newbid = $db->getInsertId(); } $groups =& icms::$user->getGroups(); $gperm_handler = icms::handler('icms_member_groupperm'); foreach ($groups as $mygroup) { $bperm =& $gperm_handler->create(); $bperm->setVar('gperm_groupid', (int) $mygroup); $bperm->setVar('gperm_itemid', (int) $newbid); $bperm->setVar('gperm_name', 'block_read'); $bperm->setVar('gperm_modid', 1); if (!$gperm_handler->insert($bperm)) { $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not add block access right. Block ID: <b>' . $newbid . '</b> Group ID: <b>' . $mygroup . '</b></span>'; } else { $msgs[] = ' Added block access right. Block ID: <b>' . $newbid . '</b> Group ID: <b>' . $mygroup . '</b>'; } } if ($template != '') { $tplfile =& $tplfile_handler->create(); $tplfile->setVar('tpl_module', $dirname); $tplfile->setVar('tpl_refid', (int) $newbid); $tplfile->setVar('tpl_source', $content, true); $tplfile->setVar('tpl_tplset', 'default'); $tplfile->setVar('tpl_file', $blocks[$i]['template'], true); $tplfile->setVar('tpl_type', 'block'); $tplfile->setVar('tpl_lastimported', 0); $tplfile->setVar('tpl_lastmodified', time()); $tplfile->setVar('tpl_desc', $blocks[$i]['description'], true); if (!$tplfile_handler->insert($tplfile)) { $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not insert template <b>' . $blocks[$i]['template'] . '</b> to the database.</span>'; } else { $newid = $tplfile->getVar('tpl_id'); $msgs[] = ' Template <b>' . $blocks[$i]['template'] . '</b> added to the database.'; if ($icmsConfig['template_set'] == 'default') { if (!icms_view_Tpl::template_touch($newid)) { $msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_TEMPLATE_RECOMPILE_FAIL . '</span>', '<strong>' . $blocks[$i]['template'] . '</strong>'); } else { $msgs[] = sprintf(' ' . _MD_AM_TEMPLATE_RECOMPILED, '<strong>' . $blocks[$i]['template'] . '</strong>'); } } } } $msgs[] = ' Block <b>' . $blocks[$i]['name'] . '</b> created. Block ID: <b>' . $newbid . '</b>'; $sql = "INSERT INTO " . $db->prefix('block_module_link') . " (block_id, module_id, page_id) VALUES ('" . (int) $newbid . "', '0', '1')"; $db->query($sql); } } } } $icms_block_handler = icms::handler('icms_view_block'); $block_arr = $icms_block_handler->getByModule($module->getVar('mid')); foreach ($block_arr as $block) { if (!in_array($block->getVar('show_func'), $showfuncs) || !in_array($block->getVar('func_file'), $funcfiles)) { $sql = sprintf("DELETE FROM %s WHERE bid = '%u'", $db->prefix('newblocks'), (int) $block->getVar('bid')); if (!$db->query($sql)) { $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not delete block <b>' . $block->getVar('name') . '</b>. Block ID: <b>' . $block->getVar('bid') . '</b></span>'; } else { $msgs[] = ' Block <b>' . $block->getVar('name') . ' deleted. Block ID: <b>' . $block->getVar('bid') . '</b>'; if ($block->getVar('template') != '') { $tplfiles =& $tplfile_handler->find(null, 'block', $block->getVar('bid')); if (is_array($tplfiles)) { $btcount = count($tplfiles); for ($k = 0; $k < $btcount; $k++) { if (!$tplfile_handler->delete($tplfiles[$k])) { $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not remove deprecated block template. (ID: <b>' . $tplfiles[$k]->getVar('tpl_id') . '</b>)</span>'; } else { $msgs[] = ' Block template <b>' . $tplfiles[$k]->getVar('tpl_file') . '</b> deprecated.'; } } } } } } } } // first delete all config entries $config_handler = icms::handler('icms_config'); $configs =& $config_handler->getConfigs(new icms_db_criteria_Item('conf_modid', $module->getVar('mid'))); $confcount = count($configs); $config_delng = array(); if ($confcount > 0) { $msgs[] = 'Deleting module config options...'; for ($i = 0; $i < $confcount; $i++) { if (!$config_handler->deleteConfig($configs[$i])) { $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not delete config data from the database. Config ID: <b>' . $configs[$i]->getvar('conf_id') . '</b></span>'; // save the name of config failed to delete for later use $config_delng[] = $configs[$i]->getvar('conf_name'); } else { $config_old[$configs[$i]->getvar('conf_name')]['value'] = $configs[$i]->getvar('conf_value', 'N'); $config_old[$configs[$i]->getvar('conf_name')]['formtype'] = $configs[$i]->getvar('conf_formtype'); $config_old[$configs[$i]->getvar('conf_name')]['valuetype'] = $configs[$i]->getvar('conf_valuetype'); $msgs[] = ' Config data deleted from the database. Config ID: <b>' . $configs[$i]->getVar('conf_id') . '</b>'; } } } // now reinsert them with the new settings $configs = $module->getInfo('config'); if ($configs != false) { if ($module->getVar('hascomments') != 0) { include_once ICMS_ROOT_PATH . '/include/comment_constants.php'; array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN))); array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0)); } } else { if ($module->getVar('hascomments') != 0) { $configs = array(); include_once ICMS_ROOT_PATH . '/include/comment_constants.php'; $configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)); $configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0); } } // RMV-NOTIFY if ($module->getVar('hasnotification') != 0) { if (empty($configs)) { $configs = array(); } // Main notification options include_once ICMS_ROOT_PATH . '/include/notification_constants.php'; include_once ICMS_ROOT_PATH . '/include/notification_functions.php'; $options = array(); $options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE; $options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK; $options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE; $options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH; //$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1); $configs[] = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options); // Event specific notification options // FIXME: for some reason the default doesn't come up properly // initially is ok, but not when 'update' module.. $options = array(); $categories =& icms_data_notification_Handler::categoryInfo('', $module->getVar('mid')); foreach ($categories as $category) { $events =& icms_data_notification_Handler::categoryEvents($category['name'], false, $module->getVar('mid')); foreach ($events as $event) { if (!empty($event['invisible'])) { continue; } $option_name = $category['title'] . ' : ' . $event['title']; $option_value = $category['name'] . '-' . $event['name']; $options[$option_name] = $option_value; //$configs[] = array ('name' => icms_data_notification_Handler::generateConfig($category,$event,'name'), 'title' => icms_data_notification_Handler::generateConfig($category,$event,'title_constant'), 'description' => icms_data_notification_Handler::generateConfig($category,$event,'description_constant'), 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1); } } $configs[] = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options); } if ($configs != false) { $msgs[] = 'Adding module config data...'; $config_handler = icms::handler('icms_config'); $order = 0; foreach ($configs as $config) { // only insert ones that have been deleted previously with success if (!in_array($config['name'], $config_delng)) { $confobj =& $config_handler->createConfig(); $confobj->setVar('conf_modid', (int) $newmid); $confobj->setVar('conf_catid', 0); $confobj->setVar('conf_name', $config['name']); $confobj->setVar('conf_title', $config['title'], true); $confobj->setVar('conf_desc', $config['description'], true); $confobj->setVar('conf_formtype', $config['formtype']); $confobj->setVar('conf_valuetype', $config['valuetype']); if (isset($config_old[$config['name']]['value']) && $config_old[$config['name']]['formtype'] == $config['formtype'] && $config_old[$config['name']]['valuetype'] == $config['valuetype']) { // preserver the old value if any // form type and value type must be the same $confobj->setVar('conf_value', $config_old[$config['name']]['value'], true); } else { $confobj->setConfValueForInput($config['default'], true); //$confobj->setVar('conf_value', $config['default'], true); } $confobj->setVar('conf_order', $order); $confop_msgs = ''; if (isset($config['options']) && is_array($config['options'])) { foreach ($config['options'] as $key => $value) { $confop =& $config_handler->createConfigOption(); $confop->setVar('confop_name', $key, true); $confop->setVar('confop_value', $value, true); $confobj->setConfOptions($confop); $confop_msgs .= '<br /> Config option added. Name: <b>' . $key . '</b> Value: <b>' . $value . '</b>'; unset($confop); } } $order++; if (false != $config_handler->insertConfig($confobj)) { $msgs[] = ' Config <b>' . $config['name'] . '</b> added to the database.' . $confop_msgs; } else { $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not insert config <b>' . $config['name'] . '</b> to the database.</span>'; } unset($confobj); } } unset($configs); } // add module specific tasks to system autotasks list $atasks = $module->getInfo('autotasks'); $atasks_handler =& icms_getModuleHandler('autotasks', 'system'); if (count($atasks) > 0) { $msgs[] = 'Updating autotasks...'; $criteria = new icms_db_criteria_Compo(); $criteria->add(new icms_db_criteria_Item('sat_type', 'addon/' . $module->getInfo('dirname'))); $items_atasks = $atasks_handler->getObjects($criteria, false); foreach ($items_atasks as $task) { $taskID = (int) $task->getVar('sat_addon_id'); $atasks[$taskID]['enabled'] = $task->getVar('sat_enabled'); $atasks[$taskID]['repeat'] = $task->getVar('sat_repeat'); $atasks[$taskID]['interval'] = $task->getVar('sat_interval'); $atasks[$taskID]['name'] = $task->getVar('sat_name'); } $atasks_handler->deleteAll($criteria); foreach ($atasks as $taskID => $taskData) { if (!isset($taskData['code']) || trim($taskData['code']) == '') { continue; } $task =& $atasks_handler->create(); if (isset($taskData['enabled'])) { $task->setVar('sat_enabled', $taskData['enabled']); } if (isset($taskData['repeat'])) { $task->setVar('sat_repeat', $taskData['repeat']); } if (isset($taskData['interval'])) { $task->setVar('sat_interval', $taskData['interval']); } if (isset($taskData['onfinish'])) { $task->setVar('sat_onfinish', $taskData['onfinish']); } $task->setVar('sat_name', $taskData['name']); $task->setVar('sat_code', sprintf("require ICMS_ROOT_PATH . \"/modules/%s/%s\";", $module->getInfo('dirname'), addslashes($taskData['code']))); $task->setVar('sat_type', 'addon/' . $module->getInfo('dirname')); $task->setVar('sat_addon_id', (int) $taskID); if (!$atasks_handler->insert($task)) { $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not insert autotask to db. Name: <b>' . $taskData['name'] . '</b></span>'; } else { $msgs[] = ' Updated task from autotasks list. Task Name: <b>' . $taskData['name'] . '</b>'; } } unset($atasks, $atasks_handler, $task, $taskData, $criteria, $items, $taskID); } // execute module specific update script if any $update_script = $module->getInfo('onUpdate'); $ModName = $module->getInfo('modname') != '' ? trim($module->getInfo('modname')) : $dirname; if (false != $update_script && trim($update_script) != '') { include_once ICMS_ROOT_PATH . '/modules/' . $dirname . '/' . trim($update_script); $is_IPF = $module->getInfo('object_items'); if (!empty($is_IPF)) { $icmsDatabaseUpdater = icms_db_legacy_Factory::getDatabaseUpdater(); $icmsDatabaseUpdater->moduleUpgrade($module, true); foreach ($icmsDatabaseUpdater->_messages as $msg) { $msgs[] = $msg; } } if (function_exists('xoops_module_update_' . $ModName)) { $func = 'xoops_module_update_' . $ModName; if (!$func($module, $prev_version, $prev_dbversion)) { $msgs[] = sprintf(_MD_AM_FAIL_EXEC, '<strong>' . $func . '</strong>'); } else { $msgs[] = sprintf(_MD_AM_FUNCT_EXEC, '<strong>' . $func . '</strong>'); } } elseif (function_exists('icms_module_update_' . $ModName)) { $func = 'icms_module_update_' . $ModName; if (!$func($module, $prev_version, $prev_dbversion)) { $msgs[] = sprintf(_MD_AM_FAIL_EXEC, '<strong>' . $func . '</strong>'); } else { $msgs[] = sprintf(_MD_AM_FUNCT_EXEC, '<strong>' . $func . '</strong>'); } } } $msgs[] = '</code><p>' . sprintf(_MD_AM_OKUPD, '<b>' . $module->getVar('name') . '</b>') . '</p>'; } $ret = '<code>'; foreach ($msgs as $msg) { $ret .= $msg . '<br />'; } return $ret; }
$form->addElement(new icms_form_elements_File(_US_SELFILE, 'avatarfile', icms_conv_nr2local($icmsConfigUser['avatar_maxsize'])), TRUE); $form->addElement(new icms_form_elements_Hidden('op', 'avatarupload')); $form->addElement(new icms_form_elements_Hidden('uid', (int) icms::$user->getVar('uid'))); $form->addElement(new icms_form_elements_Button('', 'submit', _SUBMIT, 'submit')); $form->display(); } $avatar_handler = icms::handler('icms_data_avatar'); $form2 = new icms_form_Theme(_US_CHOOSEAVT, 'uploadavatar', 'edituser.php', 'post', TRUE); $avatar_select = new icms_form_elements_Select('', 'user_avatar', icms::$user->getVar('user_avatar')); $avatar_select->addOptionArray($avatar_handler->getList('S')); $avatar_select->setExtra("onchange='showImgSelected(\"avatar\", \"user_avatar\", \"uploads\", \"\", \"" . ICMS_URL . "\")'"); $avatar_tray = new icms_form_elements_Tray(_US_AVATAR, ' '); $avatar_tray->addElement($avatar_select); $avatar_tray->addElement(new icms_form_elements_Label('', "<img src='" . ICMS_UPLOAD_URL . "/" . icms::$user->getVar("user_avatar", "E") . "' name='avatar' id='avatar' alt='' /> <a href=\"javascript:openWithSelfMain('" . ICMS_URL . "/misc.php?action=showpopups&type=avatars','avatars',600,400);\">" . _LIST . "</a>")); if ($icmsConfigUser['avatar_allow_upload'] == 1 && icms::$user->getVar('posts') < $icmsConfigUser['avatar_minposts']) { $form2->addElement(new icms_form_elements_Label(sprintf(_US_POSTSNOTENOUGH, icms_conv_nr2local($icmsConfigUser['avatar_minposts'])), _US_UNCHOOSEAVT)); } $form2->addElement($avatar_tray); $form2->addElement(new icms_form_elements_Hidden('uid', (int) icms::$user->getVar('uid'))); $form2->addElement(new icms_form_elements_Hidden('op', 'avatarchoose')); $form2->addElement(new icms_form_elements_Button('', 'submit2', _SUBMIT, 'submit')); $form2->display(); /** Include the footer file to complete page rendering */ include ICMS_ROOT_PATH . '/footer.php'; break; case 'avatarupload': if (!icms::$security->check()) { redirect_header('index.php', 3, _US_NOEDITRIGHT . "<br />" . implode('<br />', icms::$security->getErrors())); } $xoops_upload_file = array(); if (!empty($_POST['xoops_upload_file']) && is_array($_POST['xoops_upload_file'])) {
$type_select->addOptionArray(array("AND" => _SR_ALL, "OR" => _SR_ANY, "exact" => _SR_EXACT)); $search_form->addElement($type_select); if (!empty($mids)) { $mods_checkbox = new icms_form_elements_Checkbox(_SR_SEARCHIN, "mids[]", $mids); } else { $mods_checkbox = new icms_form_elements_Checkbox(_SR_SEARCHIN, "mids[]", $mid); } if (empty($modules)) { $criteria = new icms_db_criteria_Compo(); $criteria->add(new icms_db_criteria_Item('hassearch', 1)); $criteria->add(new icms_db_criteria_Item('isactive', 1)); if (!empty($available_modules)) { $criteria->add(new icms_db_criteria_Item('mid', "(" . implode(',', $available_modules) . ")", 'IN')); } $module_handler = icms::handler('icms_module'); $mods_checkbox->addOptionArray($module_handler->getList($criteria)); } else { unset($module); foreach (array_keys($modules) as $mid) { $module_array[$mid] = $modules[$mid]->getVar('name'); } $mods_checkbox->addOptionArray($module_array); } $search_form->addElement($mods_checkbox); if ($icmsConfigSearch['keyword_min'] > 0) { $search_form->addElement(new icms_form_elements_Label(_SR_SEARCHRULE, sprintf(_SR_KEYIGNORE, icms_conv_nr2local($icmsConfigSearch['keyword_min'])))); } $search_form->addElement(new icms_form_elements_Hidden("action", "results")); $search_form->addElement(new icms_form_elements_Hiddentoken('id')); $search_form->addElement(new icms_form_elements_Button("", "submit", _SR_SEARCH, "submit")); return $search_form->render();
'user_location' => $thisUser->getVar('user_from'), 'lang_occupation' => _US_OCCUPATION, 'user_occupation' => $thisUser->getVar('user_occ'), 'lang_interest' => _US_INTEREST, 'user_interest' => $thisUser->getVar('user_intrest'), 'lang_extrainfo' => _US_EXTRAINFO, 'user_extrainfo' => icms_core_DataFilter::checkVar($thisUser->getVar('bio', 'N'), 'text', 'output'), 'lang_statistics' => _US_STATISTICS, 'lang_membersince' => _US_MEMBERSINCE, 'user_joindate' => formatTimestamp($thisUser->getVar('user_regdate'), 's'), 'lang_rank' => _US_RANK, 'lang_posts' => _US_POSTS, 'lang_basicInfo' => _US_BASICINFO, 'lang_more' => _US_MOREABOUT, 'lang_myinfo' => _US_MYINFO, 'user_posts' => icms_conv_nr2local($thisUser->getVar('posts')), 'lang_lastlogin' => _US_LASTLOGIN, 'lang_notregistered' => _US_NOTREGISTERED, 'user_pmlink' => is_object(icms::$user) ? "<a href=\"javascript:openWithSelfMain('" . ICMS_URL . "/pmlite.php?send2=1&to_userid=" . (int) $thisUser->getVar('uid') . "', 'pmlite', 800,680);\"><img src=\"" . ICMS_URL . "/images/icons/" . $icmsConfig['language'] . "/pm.gif\" alt=\"" . sprintf(_SENDPMTO, $thisUser->getVar('uname')) . "\" /></a>" : '', 'user_rankimage' => $userrank['image'] ? '<img src="' . $userrank['image'] . '" alt="' . $userrank['title'] . '" />' : '', 'user_ranktitle' => $userrank['title'], 'user_lastlogin' => !empty($date) ? formatTimestamp($thisUser->getVar('last_login'), 'm') : '', 'icms_pagetitle' => sprintf(_US_ALLABOUT, $thisUser->getVar('uname')), 'user_email' => ($thisUser->getVar('user_viewemail') == TRUE || (is_object(icms::$user)