/** * Function to be triggered at the end of the core boot process * * @return void */ function eventStartOutputInit() { global $xoopsTpl; if (is_object(icms::$user)) { foreach (icms::$user->vars as $key => $value) { $user[$key] = $value; } foreach ($user as $key => $value) { foreach ($user [$key] as $key1 => $value1) { if ($key1 == 'value') { if ($key == 'last_login') { $value1 = formatTimestamp( isset($_SESSION['xoopsUserLastLogin']) ? $_SESSION['xoopsUserLastLogin'] : time(), _DATESTRING ); } $user [$key] = $value1; } } } $pm_handler = icms::handler('icms_data_privmessage'); $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('read_msg', 0)); $criteria->add(new icms_db_criteria_Item('to_userid', icms::$user->getVar('uid'))); $user['new_messages'] = $pm_handler->getCount($criteria); $xoopsTpl->assign('user', $user); } }
/** * Constructor * * @param string $caption Caption * @param string $name "name" attribute * @param string $value Initial text * @param int $rows Number of rows * @param int $cols Number of columns * @param string $hiddentext Hidden Text */ public function __construct($caption, $name, $value, $rows = 5, $cols = 50, $hiddentext = "xoopsHiddenText", $options = array()) { parent::__construct($caption, $name, $value, $rows, $cols); $this->_hiddenText = $hiddentext; global $icmsConfig, $icmsModule; $groups = is_object(icms::$user) ? icms::$user->getGroups() : ICMS_GROUP_ANONYMOUS; $moduleid = is_object($icmsModule) && $name != 'com_text' ? $icmsModule->getVar('mid') : 1; if (isset($options['editor']) && $options['editor'] != '' && $options['editor'] != $icmsConfig['editor_default']) { $editor_default = $options['editor']; } else { $editor_default = $icmsConfig['editor_default']; } $gperm_handler = icms::handler('icms_member_groupperm'); if (file_exists(ICMS_EDITOR_PATH . "/" . $editor_default . "/xoops_version.php") && $gperm_handler->checkRight('use_wysiwygeditor', $moduleid, $groups, 1, FALSE)) { include ICMS_EDITOR_PATH . "/" . $editor_default . "/xoops_version.php"; $this->htmlEditor = array($editorversion['class'], ICMS_EDITOR_PATH . "/" . $editorversion['dirname'] . "/" . $editorversion['file']); } if (!empty($this->htmlEditor)) { $options['name'] = $this->_name; $options['value'] = $this->_value; list($class, $path) = $this->htmlEditor; include_once $path; if (class_exists($class)) { $this->htmlEditor = new $class($options); } else { $this->htmlEditor = FALSE; } } }
/** * Constructor * @param icms_ipf_Object $object target object * @param string $key the key */ public function __construct($object, $key) { parent::__construct($object->vars[$key]['form_caption'], " "); $fileObj = $object->getFileObj($key); $module_handler = icms::handler("icms_module"); $module = $module_handler->getByDirname($object->handler->_moduleName); if ($fileObj->getVar("url") != "") { $this->addElement(new icms_form_elements_Label("", _CO_ICMS_CURRENT_FILE . $fileObj->render() . "<br /><br />")); } if ($fileObj->isNew()) { $this->addElement(new icms_ipf_form_elements_Fileupload($fileObj, $key)); $this->addElement(new icms_form_elements_Label("", "<br /><br /><small>" . _CO_ICMS_URL_FILE_DSC . "</small>")); $this->addElement(new icms_form_elements_Label("", "<br />" . _CO_ICMS_URL_FILE)); $this->addElement(new icms_ipf_form_elements_Text($fileObj, "url_" . $key)); } $this->addElement(new icms_form_elements_Hidden("mid_" . $key, $module->getVar("mid"))); $this->addElement(new icms_form_elements_Label("", "<br />" . _CO_ICMS_CAPTION)); $this->addElement(new icms_ipf_form_elements_Text($fileObj, "caption_" . $key)); $this->addElement(new icms_form_elements_Label("", "<br />" . _CO_ICMS_DESC)); $this->addElement(new icms_ipf_form_elements_Text($fileObj, "desc_" . $key)); if (!$fileObj->isNew()) { $this->addElement(new icms_form_elements_Label("", "<br />" . _CO_ICMS_CHANGE_FILE)); $this->addElement(new icms_ipf_form_elements_Fileupload($fileObj, $key)); $this->addElement(new icms_form_elements_Label("", "<br /><br /><small>" . _CO_ICMS_URL_FILE_DSC . "</small>")); $this->addElement(new icms_form_elements_Label("", "<br />" . _CO_ICMS_URL_FILE)); $this->addElement(new icms_ipf_form_elements_Text($fileObj, "url_" . $key)); } }
/** * Constructor * * @param object &$tpl * @param boolean $use_icons * @param boolean $do_iconcheck */ private function __construct(&$tpl, $use_icons = TRUE, $do_iconcheck = FALSE) { $this->_tpl =& $tpl; $this->_useIcons = $use_icons; $this->_doIconCheck = $do_iconcheck; $this->_memberHandler = icms::handler('icms_member'); $this->_statusText = array(XOOPS_COMMENT_PENDING => '<span style="text-decoration: none; font-weight: bold; color: #00ff00;">' . _CM_PENDING . '</span>', XOOPS_COMMENT_ACTIVE => '<span style="text-decoration: none; font-weight: bold; color: #ff0000;">' . _CM_ACTIVE . '</span>', XOOPS_COMMENT_HIDDEN => '<span style="text-decoration: none; font-weight: bold; color: #0000ff;">' . _CM_HIDDEN . '</span>'); }
/** * get video to display * * @param bool $main true if video is main video * @return str html code to display video */ public function getVideoToDisplay($main = false) { $module = icms::handler("icms_module")->getByDirname(basename(dirname(dirname(__FILE__))), TRUE); $width = $main ? $module->config['width_maintube'] : $module->config['width_tube']; $height = $main ? $module->config['height_maintube'] : $module->config['height_tube']; $ret = '<embed src="http://www.youtube.com/v/' . $this->getVar('youtube_code') . '&fs=1&hl=' . _LANGCODE . '" type="application/x-shockwave-flash" allowfullscreen="true" width="' . $width . '" height="' . $height . '"></embed>'; return $ret; }
/** * Constructor * * @param string $caption * @param string $name * @param bool $include_anon Include group "anonymous"? * @param mixed $value Pre-selected value (or array of them). * @param int $size Number or rows. "1" makes a drop-down-list. * @param bool $multiple Allow multiple selections? */ public function __construct($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false) { parent::__construct($caption, $name, $value, $size, $multiple); $member_handler = icms::handler('icms_member'); if (!$include_anon) { $this->addOptionArray($member_handler->getGroupList(new icms_db_criteria_Item('groupid', ICMS_GROUP_ANONYMOUS, '!='))); } else { $this->addOptionArray($member_handler->getGroupList()); } }
function protector_notify_base($mydirname, $category, $item_id) { include_once dirname(__FILE__) . '/include/common_functions.php'; $db =& icms_db_Factory::instance(); $module_handler = icms::handler('icms_module'); $module =& $module_handler->getByDirname($mydirname); if ($category == 'global') { $item['name'] = ''; $item['url'] = ''; return $item; } }
/** * Authenticate user * @param string $uname * @param string $pwd * @return object {@link icms_member_user_Object} icms_member_user_Object object */ public function authenticate($uname, $pwd = null) { $member_handler = icms::handler('icms_member'); $user = $member_handler->loginUser($uname, $pwd); icms::$session->enableRegenerateId = true; icms::$session->sessionOpen(); if ($user == false) { icms::$session->destroy(session_id()); $this->setErrors(1, _US_INCORRECTLOGIN); } return $user; }
function b_profile_usermenu_show($options) { global $icmsConfigUser; if (!is_object(icms::$user)) { return; } icms_loadLanguageFile(basename(dirname(dirname(__FILE__))), 'modinfo'); $block = array(); $dirname = basename(dirname(dirname(__FILE__))); $config_handler = icms::handler('icms_config'); $privmessage_handler = icms::handler('icms_data_privmessage'); $module = icms::handler('icms_module')->getByDirname($dirname, TRUE); $criteria = new icms_db_criteria_Compo(); $criteria->add(new icms_db_criteria_Item('read_msg', 0)); $criteria->add(new icms_db_criteria_Item('to_userid', icms::$user->getVar('uid'))); $newmsg = $privmessage_handler->getCount($criteria); $i = 0; if (icms::$user->isAdmin()) { $block[++$i]['name'] = _MB_SYSTEM_ADMENU; $block[$i]['url'] = ICMS_URL . "/admin.php"; } $block[++$i]['name'] = _MB_SYSTEM_VACNT; $block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/" . ($module->config['profile_social'] ? "index.php?uid=" . icms::$user->getVar('uid') : "userinfo.php?uid=" . icms::$user->getVar('uid')); $block[++$i]['name'] = _MB_SYSTEM_INBOX; $block[$i]['url'] = ICMS_URL . "/viewpmsg.php"; $block[$i]['extra'] = $newmsg; $block[++$i]['name'] = _MB_SYSTEM_NOTIF; $block[$i]['url'] = ICMS_URL . "/notifications.php"; if ($module->config['profile_social']) { $block[++$i]['name'] = _MI_PROFILE_SEARCH; $block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/search.php"; } $block[++$i]['name'] = _MI_PROFILE_EDITACCOUNT; $block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/edituser.php"; $block[++$i]['name'] = _MI_PROFILE_CHANGEPASS; $block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/changepass.php"; if ($icmsConfigUser['allow_chgmail']) { $block[++$i]['name'] = _MI_PROFILE_CHANGEMAIL; $block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/changemail.php"; } if ($icmsConfigUser['self_delete']) { $block[++$i]['name'] = _MI_PROFILE_DELETEACCOUNT; $block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/edituser.php?op=delete"; } if ($module->config['profile_social']) { $block[++$i]['name'] = _MI_PROFILE_MYCONFIGS; $block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/configs.php"; } $block[++$i]['name'] = _MB_SYSTEM_LOUT; $block[$i]['url'] = ICMS_URL . "/user.php?op=logout"; return $block; }
/** * get avatar of the tribeuser * * @global array $icmsConfigUser user configuration * @return string tribeuser avatar */ public function getTribeuserAvatar() { global $icmsConfigUser; $tribeUserId = $this->getVar('user_id', 'e'); $thisUser = icms::handler('icms_member')->getUser($tribeUserId); if (!is_object($thisUser)) { return; } $avatar = $thisUser->gravatar(); if (!$icmsConfigUser['avatar_allow_gravatar'] && strpos($avatar, 'http://www.gravatar.com/avatar/') !== false) { return false; } return '<img src="' . $thisUser->gravatar() . '" />'; }
function _checkUser($username, $password) { if (isset($this->user)) { return true; } $member_handler = icms::handler('icms_member'); $this->user =& $member_handler->loginUser(addslashes($username), addslashes($password)); if (!is_object($this->user)) { unset($this->user); return false; } $moduleperm_handler = icms::handler('icms_member_groupperm'); if (!$moduleperm_handler->checkRight('module_read', $this->module->getVar('mid'), $this->user->getGroups())) { unset($this->user); return false; } return true; }
/** * Constructor * @param object $object reference to targetobject (@link icms_ipf_Object) * @param string $key the form name */ public function __construct($object, $key) { $var = $object->vars[$key]; $control = $object->getControl($key); if (isset($control['delimeter'])) { $this->_delimeter = $control['delimeter']; } parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'), $this->_delimeter); // Adding the options inside this Radio element // If the custom method is not from a module, than it's from the core if (isset($control['options'])) { $this->addOptionArray($control['options']); } else { // let's find out if the method we need to call comes from an already defined object if (isset($control['object'])) { if (method_exists($control['object'], $control['method'])) { if ($option_array = $control['object']->{$control}['method']()) { // Adding the options array to the Radio element $this->addOptionArray($option_array); } } } else { // finding the itemHandler; if none, let's take the itemHandler of the $object if (isset($control['itemHandler'])) { if (!$control['module']) { // Creating the specified core object handler $control_handler = icms::handler($control['itemHandler']); } else { $control_handler =& icms_getModuleHandler($control['itemHandler'], $control['module']); } } else { $control_handler =& $object->handler; } // Checking if the specified method exists if (method_exists($control_handler, $control['method'])) { // TODO : How could I pass the parameters in the following call ... if ($option_array = $control_handler->{$control}['method']()) { // Adding the options array to the Radio element $this->addOptionArray($option_array); } } } } }
/** * Constructor * @param object $object reference to targetobject (@link icms_ipf_Object) * @param string $key the form name */ public function __construct($object, $key) { $var = $object->vars[$key]; $size = isset($var['size']) ? $var['size'] : ($this->_multiple ? 5 : 1); // Adding the options inside this SelectBox // If the custom method is not from a module, than it's from the core $control = $object->getControl($key); $value = isset($control['value']) ? $control['value'] : $object->getVar($key, 'e'); parent::__construct($var['form_caption'], $key, $value, $size, $this->_multiple); if (isset($control['options'])) { $this->addOptionArray($control['options']); } else { // let's find if the method we need to call comes from an already defined object if (isset($control['object'])) { if (method_exists($control['object'], $control['method'])) { if ($option_array = $control['object']->{$control}['method']()) { // Adding the options array to the select element $this->addOptionArray($option_array); } } } else { // finding the itemHandler; if none, let's take the itemHandler of the $object if (isset($control['itemHandler'])) { if (!isset($control['module'])) { // Creating the specified core object handler $control_handler = icms::handler($control['itemHandler']); } else { $control_handler =& icms_getModuleHandler($control['itemHandler'], $control['module']); } } else { $control_handler =& $object->handler; } // Checking if the specified method exists if (method_exists($control_handler, $control['method'])) { $option_array = call_user_func_array(array($control_handler, $control['method']), isset($control['params']) ? $control['params'] : array()); if (is_array($option_array) && count($option_array) > 0) { // Adding the options array to the select element $this->addOptionArray($option_array); } } } } }
/** * Constructor * @param icms_ipf_Object $object target object * @param string $key the key */ public function __construct($object, $key) { parent::__construct($object->vars[$key]['form_caption'], " "); $urllinkObj = $object->getUrlLinkObj($key); $module_handler = icms::handler("icms_module"); $module = $module_handler->getByDirname($object->handler->_moduleName); $this->addElement(new icms_form_elements_Label("", _CO_ICMS_URLLINK_URL)); $this->addElement(new icms_ipf_form_elements_Text($urllinkObj, "url_" . $key)); $this->addElement(new icms_form_elements_Label("", "<br/>" . _CO_ICMS_CAPTION)); $this->addElement(new icms_ipf_form_elements_Text($urllinkObj, "caption_" . $key)); $this->addElement(new icms_form_elements_Label("", "<br/>" . _CO_ICMS_DESC)); $this->addElement(new icms_ipf_form_elements_Text($urllinkObj, "desc_" . $key)); $this->addElement(new icms_form_elements_Label("", "<br/>" . _CO_ICMS_URLLINK_TARGET)); $this->addElement(new icms_form_elements_Hidden("mid_" . $key, $module->getVar("mid"))); $targ_val = $urllinkObj->getVar("target"); $targetRadio = new icms_form_elements_Radio("", "target_" . $key, $targ_val != "" ? $targ_val : "_blank"); $control = $urllinkObj->getControl("target"); $targetRadio->addOptionArray($control["options"]); $this->addElement($targetRadio); }
/** * Initialize the config handler. * @param $db */ public static function service() { if (isset(self::$instance)) { return self::$instance; } $instance = icms::handler('icms_config'); $configs = $instance->getConfigsByCat(array(ICMS_CONF, ICMS_CONF_USER, ICMS_CONF_METAFOOTER, ICMS_CONF_MAILER, ICMS_CONF_AUTH, ICMS_CONF_MULILANGUAGE, ICMS_CONF_PERSONA, ICMS_CONF_PLUGINS, ICMS_CONF_CAPTCHA, ICMS_CONF_SEARCH)); $GLOBALS['icmsConfig'] = $configs[ICMS_CONF]; $GLOBALS['xoopsConfig'] =& $GLOBALS['icmsConfig']; $GLOBALS['icmsConfigUser'] = $configs[ICMS_CONF_USER]; $GLOBALS['icmsConfigMetaFooter'] = $configs[ICMS_CONF_METAFOOTER]; $GLOBALS['icmsConfigMailer'] = $configs[ICMS_CONF_MAILER]; $GLOBALS['icmsConfigAuth'] = $configs[ICMS_CONF_AUTH]; $GLOBALS['icmsConfigMultilang'] = $configs[ICMS_CONF_MULILANGUAGE]; $GLOBALS['icmsConfigPersona'] = $configs[ICMS_CONF_PERSONA]; $GLOBALS['icmsConfigPlugins'] = $configs[ICMS_CONF_PLUGINS]; $GLOBALS['icmsConfigCaptcha'] = $configs[ICMS_CONF_CAPTCHA]; $GLOBALS['icmsConfigSearch'] = $configs[ICMS_CONF_SEARCH]; return self::$instance = $instance; }
/** * Constructor * @param object $object reference to targetobject (@link icms_ipf_Object) * @param string $key the form name */ public function __construct($object, $key) { $control = $object->getControl($key); if (isset($control['delimeter'])) { $this->_delimeter = $control['delimeter']; } parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key), $this->_delimeter); if (isset($control['options'])) { $this->addOptionArray($control['options']); } else { // let's find if the method we need to call comes from an already defined object if (isset($control['object'])) { if (method_exists($control['object'], $control['method'])) { if ($option_array = $control['object']->{$control}['method']()) { // Adding the options array to the select element $this->addOptionArray($option_array); } } } else { // finding the itemHandler; if none, let's take the itemHandler of the $object if (isset($control['itemHandler'])) { if (!isset($control['module'])) { // Creating the specified core object handler $control_handler = icms::handler($control['itemHandler']); } else { $control_handler =& icms_getModuleHandler($control['itemHandler'], $control['module']); } } else { $control_handler =& $object->handler; } // Checking if the specified method exists if (method_exists($control_handler, $control['method'])) { $option_array = call_user_func_array(array($control_handler, $control['method']), isset($control['params']) ? $control['params'] : array()); if (is_array($option_array) && count($option_array) > 0) { // Adding the options array to the select element $this->addOptionArray($option_array); } } } } }
/** * Get an array of plugins * @param string $path * @return multitype: */ public function getPluginsArray($path) { $module_handler = icms::handler('icms_module'); $criteria = new icms_db_criteria_Compo(); $criteria->add(new icms_db_criteria_Item('isactive', 1)); $tempModulesObj = $module_handler->getObjects($criteria); $modulesObj = array(); foreach ($tempModulesObj as $moduleObj) { $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; } $aFiles = str_replace('.php', '', icms_core_Filesystem::getFileList(ICMS_ROOT_PATH . '/plugins/' . $path . '/', '', array('php'))); $ret = array(); foreach ($aFiles as $pluginName) { $module_xoops_version_file = ICMS_ROOT_PATH . "/modules/{$pluginName}/xoops_version.php"; $module_icms_version_file = ICMS_ROOT_PATH . "/modules/{$pluginName}/icms_version.php"; if ((file_exists($module_xoops_version_file) || file_exists($module_icms_version_file)) && isset($modulesObj[$pluginName])) { $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); } } return $ret; }
/** * Constructor * * @param string $caption * @param string $name * @param mixed $value Pre-selected value (or array of them). * For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item * @param bool $include_anon Include user "anonymous"? * @param int $size Number or rows. "1" makes a drop-down-list. * @param bool $multiple Allow multiple selections? */ public function __construct($caption, $name, $include_anon = FALSE, $value = NULL, $size = 1, $multiple = FALSE, $showremovedusers = FALSE, $justremovedusers = FALSE) { $limit = 200; $select_element = new icms_form_elements_Select('', $name, $value, $size, $multiple); if ($include_anon) { $select_element->addOption(0, $GLOBALS['icmsConfig']['anonymous']); } $member_handler = icms::handler('icms_member'); $user_count = $member_handler->getUserCount(); $value = is_array($value) ? $value : (empty($value) ? array() : array($value)); if ($user_count > $limit && count($value) > 0) { $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item("uid", "(" . implode(",", $value) . ")", "IN")); } else { $criteria = new icms_db_criteria_Compo(); $criteria->setLimit($limit); } $criteria->setSort('uname'); if (!$showremovedusers) { $criteria->add(new icms_db_criteria_Item('level', '-1', '!=')); } elseif ($showremovedusers && $justremovedusers) { $criteria->add(new icms_db_criteria_Item('level', '-1')); } $criteria->setOrder('ASC'); $users = $member_handler->getUserList($criteria); $select_element->addOptionArray($users); if ($user_count <= $limit) { parent::__construct($caption, "", $name); $this->addElement($select_element); return; } icms_loadLanguageFile('core', 'findusers'); $js_addusers = "<script type=\"text/javascript\">\r\n\t\t\t\t\tfunction addusers(opts){\r\n\t\t\t\t\t\tvar num = opts.substring(0, opts.indexOf(\":\"));\r\n\t\t\t\t\t\topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n\t\t\t\t\t\tvar sel = xoopsGetElementById(\"" . $name . ($multiple ? "[]" : "") . "\");\r\n\t\t\t\t\t\tvar arr = new Array(num);\r\n\t\t\t\t\t\tfor (var n=0; n < num; n++) {\r\n\t\t\t\t\t\t\tvar nm = opts.substring(0, opts.indexOf(\":\"));\r\n\t\t\t\t\t\t\topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n\t\t\t\t\t\t\tvar val = opts.substring(0, opts.indexOf(\":\"));\r\n\t\t\t\t\t\t\topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n\t\t\t\t\t\t\tvar txt = opts.substring(0, nm - val.length);\r\n\t\t\t\t\t\t\topts = opts.substring(nm - val.length, opts.length);\r\n\t\t\t\t\t\t\tvar added = false;\r\n\t\t\t\t\t\t\tfor (var k = 0; k < sel.options.length; k++) {\r\n\t\t\t\t\t\t\t\tif (sel.options[k].value == val){\r\n\t\t\t\t\t\t\t\t\tadded = true;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (added == false) {\r\n\t\t\t\t\t\t\t\tsel.options[k] = new Option(txt, val);\r\n\t\t\t\t\t\t\t\tsel.options[k].selected = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t</script>"; $token = icms::$security->createToken(); $action_tray = new icms_form_elements_Tray("", " | "); $action_tray->addElement(new icms_form_elements_Label('', "<a href='#' onclick='var sel = xoopsGetElementById(\"" . $name . ($multiple ? "[]" : "") . "\");for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;'>" . _MA_USER_REMOVE . "</a>")); $action_tray->addElement(new icms_form_elements_Label('', "<a href='#' onclick='openWithSelfMain(\"" . ICMS_URL . "/include/findusers.php?target={$name}&multiple={$multiple}&token={$token}\", \"userselect\", 800, 600, null); return false;' >" . _MA_USER_MORE . "</a>" . $js_addusers)); parent::__construct($caption, '<br /><br />', $name); $this->addElement($select_element); $this->addElement($action_tray); }
/** * Return search results and show images on userinfo page * * @param array $queryarray the terms to look * @param text $andor the conector between the terms to be looked * @param int $limit The number of maximum results * @param int $offset from wich register start * @param int $userid from which user to look * @return array $ret with all results */ function profile_search($queryarray, $andor, $limit, $offset, $userid) { global $icmsConfigUser; $ret = array(); $i = 0; $dirname = basename(dirname(dirname(__FILE__))); // check if anonymous users can access profiles if (!is_object(icms::$user) && !$icmsConfigUser['allow_annon_view_prof']) { return $ret; } // check if tribes are activated in module configuration $module = icms::handler('icms_module')->getByDirname($dirname, TRUE); if (!$module->config['enable_tribes']) { return $ret; } $profile_tribes_handler = icms_getModuleHandler('tribes', basename(dirname(dirname(__FILE__))), 'profile'); $criteria = new icms_db_criteria_Compo(); // if those two lines are uncommented, "all search results" isn't showing in the search results //if ($offset) $criteria->setStart($offset); //if ($limit) $criteria->setLimit((int)$limit); $criteria->setSort('title'); if ($userid) { $criteria->add(new icms_db_criteria_Item('uid_owner', $userid)); } if (is_array($queryarray) && count($queryarray) > 0) { foreach ($queryarray as $query) { $criteria_query = new icms_db_criteria_Compo(); $criteria_query->add(new icms_db_criteria_Item('title', '%' . $query . '%', 'LIKE')); $criteria_query->add(new icms_db_criteria_Item('tribe_desc', '%' . $query . '%', 'LIKE'), 'OR'); $criteria->add($criteria_query, $andor); unset($criteria_query); } } $tribes = $profile_tribes_handler->getObjects($criteria, false, false); foreach ($tribes as $tribe) { $ret[$i++] = array("image" => 'images/tribes.gif', "link" => $tribe['itemUrl'], "title" => $tribe['title'], "time" => strtotime($tribe['creation_time']), "uid" => $tribe['uid_owner']); } return $ret; }
function smarty_function_xoInboxCount($params, &$smarty) { if (!isset(icms::$user) || !is_object(icms::$user)) { return; } $time = time(); if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) { $count = (int) $_SESSION['xoops_inbox_count']; } else { $pm_handler = icms::handler('icms_data_privmessage'); $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('read_msg', 0)); $criteria->add(new icms_db_criteria_Item('to_userid', icms::$user->getVar('uid'))); $count = (int) $pm_handler->getCount($criteria); $_SESSION['xoops_inbox_count'] = $count; $_SESSION['xoops_inbox_count_expire'] = $time + 60; } if (!@empty($params['assign'])) { $smarty->assign($params['assign'], $count); } else { echo $count; } }
function smarty_resource_db_tplinfo($tpl_name) { global $icmsConfig; static $cache = array(); if (isset($cache[$tpl_name])) { return $cache[$tpl_name]; } $tplset = $icmsConfig['template_set']; $theme = isset($icmsConfig['theme_set']) ? $icmsConfig['theme_set'] : 'default'; $tplfile_handler = icms::handler('icms_view_template_file'); // If we're not using the "default" template set, then get the templates from the DB if ($tplset != "default") { $tplobj = $tplfile_handler->getPrefetchedBlock($tplset, $tpl_name); if (count($tplobj)) { return $cache[$tpl_name] = $tplobj[0]; } } // If we'using the default tplset, get the template from the filesystem $tplobj = $tplfile_handler->getPrefetchedBlock("default", $tpl_name); if (!count($tplobj)) { return $cache[$tpl_name] = false; } $tplobj = $tplobj[0]; $module = $tplobj->getVar('tpl_module', 'n'); $type = $tplobj->getVar('tpl_type', 'n'); $blockpath = $type == 'block' ? 'blocks/' : ''; // First, check for an overloaded version within the theme folder $filepath = ICMS_THEME_PATH . "/{$theme}/modules/{$module}/{$blockpath}{$tpl_name}"; if (!file_exists($filepath)) { // If no custom version exists, get the tpl from its default location $filepath = ICMS_ROOT_PATH . "/modules/{$module}/templates/{$blockpath}{$tpl_name}"; if (!file_exists($filepath)) { return $cache[$tpl_name] = $tplobj; } } return $cache[$tpl_name] = $filepath; }
function profile_iteminfo($category, $item_id) { $item = array('name' => '', 'url' => ''); switch ($category) { case 'pictures': case 'videos': case 'audio': $thisUser = icms::handler('icms_member')->getUser($item_id); if ($thisUser === false) { break; } $item['name'] = $thisUser->getVar('uname'); $item['url'] = ICMS_URL . '/modules/' . basename(dirname(dirname(__FILE__))) . '/' . $category . '.php?uid=' . $item_id; break; case 'tribetopic': $profile_tribes_handler = icms_getModuleHandler('tribes', basename(dirname(dirname(__FILE__))), 'profile'); $tribesObj = $profile_tribes_handler->get($item_id); if ($tribesObj->isNew()) { break; } $item['name'] = $tribesObj->getVar('title'); $item['url'] = $tribesObj->getItemLink(true); break; case 'tribepost': $profile_tribetopic_handler = icms_getModuleHandler('tribetopic', basename(dirname(dirname(__FILE__))), 'profile'); $tribetopicObj = $profile_tribetopic_handler->get($item_id); if ($tribetopicObj->isNew()) { break; } $tribetopic = $tribetopicObj->toArray(); $item['name'] = $tribetopic['title']; $item['url'] = $tribetopic['itemUrl']; break; } return $item; }
/** * Overridding IcmsPersistable::toArray() method to add a few info * * @global array $icmsConfigUser user configuration * @return array of tribetopic info */ public function toArray() { global $icmsConfigUser; $ret = parent::toArray(); $ret['post_time'] = formatTimestamp($this->getVar('post_time', 'e'), 'm'); $ret['poster_uname'] = icms_member_user_Handler::getUserLink($this->getVar('poster_uid')); $ret['userCanEditAndDelete'] = $this->userCanEditAndDelete(); $thisUser = icms::handler('icms_member')->getUser($this->getVar('poster_uid')); if (is_object($thisUser)) { // get poster avatar $avatar = $thisUser->gravatar(); if ($icmsConfigUser['avatar_allow_gravatar'] || strpos($avatar, 'http://www.gravatar.com/avatar/') === false) { $ret['poster_avatar'] = '<img src="' . $thisUser->gravatar() . '" />'; } // get poster signature if (trim($thisUser->getVar('user_sig')) && $this->getVar('attachsig')) { $ret['poster_signature'] = icms_core_DataFilter::checkVar($thisUser->getVar('user_sig', 'N'), 'html', 'output'); } } // rewrite edit and delete item links to work with tribes.php $ret['editItemLink'] = str_replace($this->handler->_itemname . '.php?op=mod', 'tribes.php?tribes_id=' . $this->getVar('tribes_id') . '&topic_id=' . $this->getVar('topic_id') . '&op=edittribepost', $this->getEditItemLink(false, true, true)); $ret['deleteItemLink'] = str_replace($this->handler->_itemname . '.php?op=del', 'tribes.php?tribes_id=' . $this->getVar('tribes_id') . '&topic_id=' . $this->getVar('topic_id') . '&op=deltribepost', $this->getDeleteItemLink(false, true, true)); return $ret; }
public function setToGroups($group) { if (!is_array($group)) { if (get_class($group) == "icms_member_group_Object") { $member_handler = icms::handler('icms_member'); $this->setToUsers($member_handler->getUsersByGroup($group->getVar('groupid'), true)); } } else { foreach ($group as $g) { $this->setToGroups($g); } } }
/** * is the user currently logged in? * @return bool */ public function isOnline() { if (!isset($this->_isOnline)) { $onlinehandler = icms::handler('icms_core_Online'); $this->_isOnline = $onlinehandler->getCount(new icms_db_criteria_Item('online_uid', $this->getVar('uid'))) > 0 ? true : false; } return $this->_isOnline; }
/** * build options string * * @param mixed $value module-page combination * @return string html */ private function getPageSelOptions($value = NULL) { $icms_page_handler = icms::handler('icms_data_page'); if (!is_array($value)) { $value = array($value); } $module_handler = icms::handler('icms_module'); $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('hasmain', 1)); $criteria->add(new icms_db_criteria_Item('isactive', 1)); $module_list = $module_handler->getObjects($criteria); $mods = ''; foreach ($module_list as $module) { $mods .= '<optgroup label="' . $module->getVar('name') . '">'; $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_moduleid', $module->getVar('mid'))); $criteria->add(new icms_db_criteria_Item('page_status', 1)); $pages = $icms_page_handler->getObjects($criteria); $sel = ''; if (in_array($module->getVar('mid') . '-0', $value)) { $sel = ' selected=selected'; } $mods .= '<option value="' . $module->getVar('mid') . '-0"' . $sel . '>' . _AM_ALLPAGES . '</option>'; foreach ($pages as $page) { $sel = ''; if (in_array($module->getVar('mid') . '-' . $page->getVar('page_id'), $value)) { $sel = ' selected=selected'; } $mods .= '<option value="' . $module->getVar('mid') . '-' . $page->getVar('page_id') . '"' . $sel . '>'; $mods .= $page->getVar('page_title') . '</option>'; } $mods .= '</optgroup>'; } $module = $module_handler->get(1); $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_moduleid', 1)); $criteria->add(new icms_db_criteria_Item('page_status', 1)); $pages = $icms_page_handler->getObjects($criteria); $cont = ''; if (count($pages) > 0) { $cont = '<optgroup label="' . $module->getVar('name') . '">'; $sel = ''; if (in_array($module->getVar('mid') . '-0', $value)) { $sel = ' selected=selected'; } $cont .= '<option value="' . $module->getVar('mid') . '-0"' . $sel . '>' . _AM_ALLPAGES . '</option>'; foreach ($pages as $page) { $sel = ''; if (in_array($module->getVar('mid') . '-' . $page->getVar('page_id'), $value)) { $sel = ' selected=selected'; } $cont .= '<option value="' . $module->getVar('mid') . '-' . $page->getVar('page_id') . '"' . $sel . '>'; $cont .= $page->getVar('page_title') . '</option>'; } $cont .= '</optgroup>'; } $sel = $sel1 = ''; if (in_array('0-1', $value)) { $sel = ' selected=selected'; } if (in_array('0-0', $value)) { $sel1 = ' selected=selected'; } $ret = '<option value="0-1"' . $sel . '>' . _AM_TOPPAGE . '</option>'; $ret .= '<option value="0-0"' . $sel1 . '>' . _AM_ALLPAGES . '</option>'; $ret .= $cont . $mods; return $ret; }
/** * generate the modid (combination of current module and page) and store it in a static var * isStart is only needed for this class (used in function retrieveBlocks()). * * @global array $icmsConfig ImpressCMS configuration array * @global icms_module_Object $icmsModule current module * @return void */ public static function getPage() { global $icmsConfig, $icmsModule; if (is_array(self::$modid)) { return self::$modid; } // getting the start module and page configured in the admin panel if (is_array($icmsConfig['startpage'])) { $member_handler = icms::handler('icms_member'); $group = $member_handler->getUserBestGroup(is_object(icms::$user) ? icms::$user->getVar('uid') : 0); $icmsConfig['startpage'] = $icmsConfig['startpage'][$group]; } $startMod = $icmsConfig['startpage'] == '--' ? 'system' : $icmsConfig['startpage']; // setting the full and relative url of the actual page $clean_request = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); $fullurl = icms::$urls['http'] . icms::$urls['httphost'] . $clean_request; $url = substr(str_replace(ICMS_URL, '', $fullurl), 1); $icms_page_handler = icms::handler('icms_data_page'); $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_url', $fullurl)); if (!empty($url)) { $criteria->add(new icms_db_criteria_Item('page_url', $url), 'OR'); } $pages = $icms_page_handler->getCount($criteria); if ($pages > 0) { // we have a sym-link defined for this page $pages = $icms_page_handler->getObjects($criteria); $page = $pages[0]; $purl = filter_var($page->getVar('page_url'), FILTER_SANITIZE_URL); $mid = (int) $page->getVar('page_moduleid'); $pid = $page->getVar('page_id'); $module_handler = icms::handler('icms_module'); $module = $module_handler->get($mid); $dirname = $module->getVar('dirname'); $isStart = $startMod == $mid . '-' . $pid; } else { // we don't have a sym-link for this page if (is_object($icmsModule)) { $mid = (int) $icmsModule->getVar('mid'); $dirname = $icmsModule->getVar('dirname'); $isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $startMod == $dirname; } else { $mid = 1; $dirname = 'system'; $isStart = !empty($GLOBALS['xoopsOption']['show_cblock']); } $pid = 0; } /* determine the visitor's start page and update the request based on that? */ if ($isStart) { self::$modid = array('module' => 0, 'page' => 1, 'isStart' => $isStart); } else { $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_status', 1)); $pages = $icms_page_handler->getObjects($criteria); $pid = 0; foreach ($pages as $page) { $purl = filter_var($page->getVar('page_url'), FILTER_SANITIZE_URL); if (substr($purl, -1) == '*') { $purl = substr($purl, 0, -1); if (substr($url, 0, strlen($purl)) == $purl || substr($fullurl, 0, strlen($purl)) == $purl) { $pid = $page->getVar('page_id'); break; } } else { if ($purl == $url || $purl == $fullurl) { $pid = $page->getVar('page_id'); break; } } } self::$modid = array('module' => $mid, 'page' => $pid, 'isStart' => $isStart); } return self::$modid; }
*/ define('XOOPS_XMLRPC', 1); include './mainfile.php'; error_reporting(0); include_once ICMS_LIBRARIES_PATH . '/xml/rpc/xmlrpctag.php'; include_once ICMS_LIBRARIES_PATH . '/xml/rpc/xmlrpcparser.php'; icms::$logger->disableLogger(); $response = new XoopsXmlRpcResponse(); $parser = new XoopsXmlRpcParser(rawurlencode($GLOBALS['HTTP_RAW_POST_DATA'])); if (!$parser->parse()) { $response->add(new XoopsXmlRpcFault(102)); } else { $module_handler = icms::handler('icms_module'); $module =& $module_handler->getByDirname('news'); if (!is_object($module)) { $response->add(new XoopsXmlRpcFault(110)); } else { $methods = explode('.', $parser->getMethodName()); switch($methods[0]) { case 'blogger': include_once ICMS_LIBRARIES_PATH. ' /xml/rpc/bloggerapi.php'; $rpc_api = new BloggerApi($parser->getParam(), $response, $module); break; case 'metaWeblog': include_once ICMS_LIBRARIES_PATH . '/xml/rpc/metaweblogapi.php'; $rpc_api = new MetaWeblogApi($parser->getParam(), $response, $module);
break; case 'delete': if (!icms::$user || $icmsConfigUser['self_delete'] != 1) { redirect_header('index.php',5,_US_NOPERMISS); } else { $groups = icms::$user->getGroups(); if (in_array(XOOPS_GROUP_ADMIN, $groups)) { redirect_header('user.php', 5, _US_ADMINNO); } $ok = !isset($_POST['ok']) ? 0 : (int) $_POST['ok']; if ($ok != 1) { include 'header.php'; icms_core_Message::confirm(array('op' => 'delete', 'ok' => 1), 'user.php', _US_SURETODEL . '<br/>' . _US_REMOVEINFO); include 'footer.php'; } else { $del_uid = (int) icms::$user->getVar('uid'); $member_handler = icms::handler('icms_member'); if (FALSE != $member_handler->deleteUser(icms::$user)) { $online_handler = icms::handler('icms_core_Online'); $online_handler->destroy($del_uid); xoops_notification_deletebyuser($del_uid); redirect_header('index.php', 5, _US_BEENDELED); } redirect_header('index.php',5,_US_NOPERMISS); } exit(); } break; }
/** * Creates a multidimensional array with items of the dropdown menus of the admin panel. * This array will be saved, by the function xoops_module_write_admin_menu, in a cache file * to preserve resources of the server and to maintain compatibility with some modules Xoops. * * @author TheRplima * * @return array (content of admin panel dropdown menus) */ function impresscms_get_adminmenu() { $admin_menu = array(); $modules_menu = array(); $systemadm = false; ######################################################################### # Control Panel Home menu ######################################################################### $menu[0] = array('link' => ICMS_URL . '/admin.php', 'title' => _CPHOME, 'absolute' => 1, 'small' => ICMS_URL . '/modules/system/images/mini_cp.png'); $menu[] = array('link' => ICMS_URL, 'title' => _YOURHOME, 'absolute' => 1, 'small' => ICMS_URL . '/modules/system/images/home.png'); $menu[] = array('link' => ICMS_URL . '/user.php?op=logout', 'title' => _LOGOUT, 'absolute' => 1, 'small' => ICMS_URL . '/modules/system/images/logout.png'); $admin_menu[0] = array('id' => 'cphome', 'text' => _CPHOME, 'link' => '#', 'menu' => $menu); ######################################################################### # end ######################################################################### ######################################################################### # System Preferences menu ######################################################################### $module_handler = icms::handler('icms_module'); $mod =& $module_handler->getByDirname('system'); $menu = array(); foreach ($mod->getAdminMenu() as $lkn) { $lkn['dir'] = 'system'; $menu[] = $lkn; } $admin_menu[] = array('id' => 'opsystem', 'text' => _SYSTEM, 'link' => ICMS_URL . '/modules/system/admin.php', 'menu' => $menu); ######################################################################### # end ######################################################################### ######################################################################### # Modules menu ######################################################################### $module_handler = icms::handler('icms_module'); $criteria = new icms_db_criteria_Compo(); $criteria->add(new icms_db_criteria_Item('hasadmin', 1)); $criteria->add(new icms_db_criteria_Item('isactive', 1)); $modules = $module_handler->getObjects($criteria); usort($modules, 'impresscms_sort_adminmenu_modules'); foreach ($modules as $module) { $rtn = array(); $inf =& $module->getInfo(); $rtn['link'] = ICMS_URL . '/modules/' . $module->getVar('dirname') . '/' . (isset($inf['adminindex']) ? $inf['adminindex'] : ''); $rtn['title'] = $module->getVar('name'); $rtn['dir'] = $module->getVar('dirname'); if (isset($inf['iconsmall']) && $inf['iconsmall'] != '') { $rtn['small'] = ICMS_URL . '/modules/' . $module->getVar('dirname') . '/' . $inf['iconsmall']; } if (isset($inf['iconbig']) && $inf['iconbig'] != '') { $rtn['iconbig'] = ICMS_URL . '/modules/' . $module->getVar('dirname') . '/' . $inf['iconbig']; } $rtn['absolute'] = 1; $rtn['subs'] = array(); $module->loadAdminMenu(); if (is_array($module->adminmenu) && count($module->adminmenu) > 0) { foreach ($module->adminmenu as $item) { $item['link'] = ICMS_URL . '/modules/' . $module->getVar('dirname') . '/' . $item['link']; $rtn['subs'][] = $item; } } $hasconfig = $module->getVar('hasconfig'); $hascomments = $module->getVar('hascomments'); if (isset($hasconfig) && $hasconfig == 1 || isset($hascomments) && $hascomments == 1) { $subs = array('title' => _PREFERENCES, 'link' => ICMS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $module->getVar('mid')); $rtn['subs'][] = $subs; } $rtn['hassubs'] = count($rtn['subs']) > 0 ? 1 : 0; if ($rtn['hassubs'] == 0) { unset($rtn['subs']); } if ($module->getVar('dirname') == 'system') { $systemadm = true; } $modules_menu[] = $rtn; } $admin_menu[] = array('id' => 'modules', 'text' => _MODULES, 'link' => ICMS_URL . '/modules/system/admin.php?fct=modulesadmin', 'menu' => $modules_menu); ######################################################################### # end ######################################################################### ######################################################################### # ImpressCMS News Feed menu ######################################################################### $menu = array(); $menu[] = array('link' => 'http://www.impresscms.org', 'title' => _IMPRESSCMS_HOME, 'absolute' => 1); if (_LANGCODE != 'en') { $menu[] = array('link' => _IMPRESSCMS_LOCAL_SUPPORT, 'title' => _IMPRESSCMS_LOCAL_SUPPORT_TITLE, 'absolute' => 1); } $menu[] = array('link' => 'http://community.impresscms.org', 'title' => _IMPRESSCMS_COMMUNITY, 'absolute' => 1); $menu[] = array('link' => 'http://addons.impresscms.org', 'title' => _IMPRESSCMS_ADDONS, 'absolute' => 1); $menu[] = array('link' => 'http://wiki.impresscms.org', 'title' => _IMPRESSCMS_WIKI, 'absolute' => 1); $menu[] = array('link' => 'http://blog.impresscms.org', 'title' => _IMPRESSCMS_BLOG, 'absolute' => 1); $menu[] = array('link' => 'https://impresscmsdev.assembla.com/spaces/impresscms/new_dashboard', 'title' => _IMPRESSCMS_PROJECT, 'absolute' => 1); /* $menu[] = array( 'link' => 'http://www.impresscms.org/donations/', 'title' => _IMPRESSCMS_DONATE, 'absolute' => 1, //'small' = ICMS_URL . '/images/impresscms.png', ); */ $menu[] = array('link' => ICMS_URL . '/admin.php?rssnews=1', 'title' => _IMPRESSCMS_NEWS, 'absolute' => 1); $admin_menu[] = array('id' => 'news', 'text' => _ABOUT, 'link' => '#', 'menu' => $menu); ######################################################################### # end ######################################################################### return $admin_menu; }