/** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author trabis <*****@*****.**> * @version $Id: $ */ function xoops_module_pre_install_myinviter($module) { if (!xoops_isActiveModule('xmf')) { $module->setErrors('<b>Please install or reactivate XMF module</b>'); return false; } return true; }
/** * Get an instance to a module helper for a module directory * * @param string $dirname module direcory * * @return bool|Xoops\Module\Helper\HelperAbstract */ public static function getHelper($dirname = 'system') { // if this is a 2.6 system turn everything over to the core if (class_exists('Xoops', false)) { return \Xoops\Module\Helper::getHelper($dirname); } // otherwise get a GenericHelper instance for dirname $dirname = strtolower($dirname); if (xoops_isActiveModule($dirname)) { return GenericHelper::getInstance($dirname); } // not an active installed module return false; }
/** * Get an instance of a module helper for the module identified by $dirname * * @param string $dirname module directory * * @return \Xmf\Module\Helper|\Xoops\Module\Helper|false a Helper object of false on error */ public static function getHelper($dirname = 'system') { static $instance = array(); $dirname = strtolower($dirname); if (!isset($instance[$dirname])) { $instance[$dirname] = false; // if this is a 2.6 system turn everything over to the core if (class_exists('Xoops', false)) { $instance[$dirname] = \Xoops\Module\Helper::getHelper($dirname); } else { // otherwise get a GenericHelper instance for dirname if (xoops_isActiveModule($dirname)) { $instance[$dirname] = new static($dirname); } } } return $instance[$dirname]; }
/** * delete an item from the database * * @param object $item reference to the ITEM to delete * @param bool $force * * @return bool FALSE if failed. */ public function delete(&$item, $force = false) { // Deleting the files if (!$this->publisher->getHandler('file')->deleteItemFiles($item)) { $item->setErrors('An error while deleting a file.'); } if (!parent::delete($item, $force)) { $item->setErrors('An error while deleting.'); return false; } // Removing tags information if (xoops_isActiveModule('tag')) { $tag_handler = xoops_getmodulehandler('tag', 'tag'); $tag_handler->updateByItem('', $item->getVar('itemid'), PUBLISHER_DIRNAME, 0); } return true; }
* @author Skalpa Keo <*****@*****.**> * @author Taiwen Jiang <*****@*****.**> */ if (file_exists(__DIR__ . '/mainfile.php')) { include __DIR__ . '/mainfile.php'; } if (!defined('XOOPS_MAINFILE_INCLUDED')) { if (file_exists(__DIR__ . '/install/index.php')) { header('Location: install/index.php'); exit; } } $xoopsPreload = XoopsPreload::getInstance(); $xoopsPreload->triggerEvent('core.index.start'); //check if start page is defined if (isset($xoopsConfig['startpage']) && $xoopsConfig['startpage'] != '' && $xoopsConfig['startpage'] != '--' && xoops_isActiveModule($xoopsConfig['startpage'])) { // Temporary solution for start page redirection define('XOOPS_STARTPAGE_REDIRECTED', 1); global $xoopsModuleConfig; $module_handler = xoops_getHandler('module'); $xoopsModule = $module_handler->getByDirname($xoopsConfig['startpage']); if (!$xoopsModule || !$xoopsModule->getVar('isactive')) { include_once $GLOBALS['xoops']->path('header.php'); echo '<h4>' . _MODULENOEXIST . '</h4>'; include_once $GLOBALS['xoops']->path('footer.php'); exit; } $moduleperm_handler = xoops_getHandler('groupperm'); if ($xoopsUser) { if (!$moduleperm_handler->checkRight('module_read', $xoopsModule->getVar('mid'), $xoopsUser->getGroups())) { redirect_header(XOOPS_URL, 1, _NOPERM, false);
$item['embeded_files'] = $embededFiles; unset($file, $embededFiles, $filesObj, $fileObj); // Language constants $xoopsTpl->assign('mail_link', 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $itemObj->getItemUrl()); $xoopsTpl->assign('itemid', $itemObj->itemId()); $xoopsTpl->assign('sectionname', $publisher->getModule()->getVar('name')); $xoopsTpl->assign('module_dirname', $publisher->getModule()->getVar('dirname')); $xoopsTpl->assign('module_home', publisherModuleHome($publisher->getConfig('format_linked_path'))); $xoopsTpl->assign('categoryPath', $item['categoryPath'] . ' > ' . $item['title']); $xoopsTpl->assign('commentatarticlelevel', $publisher->getConfig('perm_com_art_level')); $xoopsTpl->assign('com_rule', $publisher->getConfig('com_rule')); $xoopsTpl->assign('other_items', $publisher->getConfig('item_other_items_type')); $xoopsTpl->assign('itemfooter', $myts->displayTarea($publisher->getConfig('item_footer'), 1)); $xoopsTpl->assign('perm_author_items', $publisher->getConfig('perm_author_items')); // tags support if (xoops_isActiveModule('tag')) { include_once $GLOBALS['xoops']->path('modules/tag/include/tagbar.php'); $xoopsTpl->assign('tagbar', tagbar($itemId, $catid = 0)); } /** * Generating meta information for this page */ $publisherMetagen = new PublisherMetagen($itemObj->getVar('title'), $itemObj->getVar('meta_keywords', 'n'), $itemObj->getVar('meta_description', 'n'), $itemObj->getCategoryPath()); $publisherMetagen->createMetaTags(); // Include the comments if the selected ITEM supports comments if ($publisher->getConfig('com_rule') != 0 && ($itemObj->cancomment() == 1 || !$publisher->getConfig('perm_com_art_level'))) { include_once $GLOBALS['xoops']->path('include/comment_view.php'); // Problem with url_rewrite and posting comments : $xoopsTpl->assign(array('editcomment_link' => PUBLISHER_URL . '/comment_edit.php?com_itemid=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode . $link_extra, 'deletecomment_link' => PUBLISHER_URL . '/comment_delete.php?com_itemid=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode . $link_extra, 'replycomment_link' => PUBLISHER_URL . '/comment_reply.php?com_itemid=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode . $link_extra)); $xoopsTpl->_tpl_vars['commentsnav'] = str_replace("self.location.href='", "self.location.href='" . PUBLISHER_URL . '/', $xoopsTpl->_tpl_vars['commentsnav']); }
/** * @return array */ function b_system_waiting_show() { global $xoopsUser; $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); $module_handler = xoops_getHandler('module'); $block = array(); // waiting content for news if (xoops_isActiveModule('news') && $module_handler->getCount(new Criteria('dirname', 'news'))) { $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('stories') . ' WHERE published=0'); if ($result) { $block['modules'][0]['adminlink'] = XOOPS_URL . '/modules/news/admin/index.php?op=newarticle'; list($block['modules'][0]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][0]['lang_linkname'] = _MB_SYSTEM_SUBMS; } } // waiting content for mylinks if (xoops_isActiveModule('mylinks') && $module_handler->getCount(new Criteria('dirname', 'mylinks'))) { $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_links') . ' WHERE status=0'); if ($result) { $block['modules'][1]['adminlink'] = XOOPS_URL . '/modules/mylinks/admin/index.php?op=listNewLinks'; list($block['modules'][1]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][1]['lang_linkname'] = _MB_SYSTEM_WLNKS; } $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_broken')); if ($result) { $block['modules'][2]['adminlink'] = XOOPS_URL . '/modules/mylinks/admin/index.php?op=listBrokenLinks'; list($block['modules'][2]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][2]['lang_linkname'] = _MB_SYSTEM_BLNK; } $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_mod')); if ($result) { $block['modules'][3]['adminlink'] = XOOPS_URL . '/modules/mylinks/admin/index.php?op=listModReq'; list($block['modules'][3]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][3]['lang_linkname'] = _MB_SYSTEM_MLNKS; } } // waiting content for mydownloads if (xoops_isActiveModule('mydownloads') && $module_handler->getCount(new Criteria('dirname', 'mydownloads'))) { $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mydownloads_downloads') . ' WHERE status=0'); if ($result) { $block['modules'][4]['adminlink'] = XOOPS_URL . '/modules/mydownloads/admin/index.php?op=listNewDownloads'; list($block['modules'][4]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][4]['lang_linkname'] = _MB_SYSTEM_WDLS; } $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mydownloads_broken') . ''); if ($result) { $block['modules'][5]['adminlink'] = XOOPS_URL . '/modules/mydownloads/admin/index.php?op=listBrokenDownloads'; list($block['modules'][5]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][5]['lang_linkname'] = _MB_SYSTEM_BFLS; } $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mydownloads_mod') . ''); if ($result) { $block['modules'][6]['adminlink'] = XOOPS_URL . '/modules/mydownloads/admin/index.php?op=listModReq'; list($block['modules'][6]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][6]['lang_linkname'] = _MB_SYSTEM_MFLS; } } // waiting content for xoops comments $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xoopscomments') . ' WHERE com_status=1'); if ($result) { $block['modules'][7]['adminlink'] = XOOPS_URL . '/modules/system/admin.php?module=0&status=1&fct=comments'; list($block['modules'][7]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][7]['lang_linkname'] = _MB_SYSTEM_COMPEND; } // waiting content for TDMDownloads if (xoops_isActiveModule('TDMdownloads') && $module_handler->getCount(new Criteria('dirname', 'TDMDownloads'))) { $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tdmdownloads_downloads') . ' WHERE status=0'); if ($result) { $block['modules'][8]['adminlink'] = XOOPS_URL . '/modules/TDMDownloads/admin/downloads.php?op=list&statut_display=0'; list($block['modules'][8]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][8]['lang_linkname'] = _MB_SYSTEM_TDMDOWNLOADS; } } // waiting content for extgallery if (xoops_isActiveModule('extgallery') && $module_handler->getCount(new Criteria('dirname', 'extgallery'))) { $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('extgallery_publicphoto') . ' WHERE photo_approved=0'); if ($result) { $block['modules'][9]['adminlink'] = XOOPS_URL . '/modules/extgallery/admin/photo.php#pending-photo'; list($block['modules'][9]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][9]['lang_linkname'] = _MB_SYSTEM_EXTGALLERY; } } // waiting content for smartsection if (xoops_isActiveModule('smartsection') && $module_handler->getCount(new Criteria('dirname', 'smartsection'))) { $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('smartsection_items') . ' WHERE status=1'); if ($result) { $block['modules'][10]['adminlink'] = XOOPS_URL . '/modules/smartsection/admin/item.php'; list($block['modules'][10]['pendingnum']) = $xoopsDB->fetchRow($result); $block['modules'][10]['lang_linkname'] = _MB_SYSTEM_SMARTSECTION; } } return $block; }
/** * @param $options * * @return array */ function publisher_latest_news_show($options) { $block = array(); xoops_loadLanguage('main', 'publisher'); $publisher =& PublisherPublisher::getInstance(); $start = $options[0]; // You can show articles from specified range $limit = $options[1]; $columnCount = $options[2]; $letters = $options[3]; $selectedStories = $options[4]; $sort = $options[9]; $order = publisherGetOrderBy($sort); $imgWidth = $options[11]; $imgHeight = $options[12]; $border = $options[13]; $bordercolor = $options[14]; $block['spec']['columnwidth'] = (int) (1 / $columnCount * 100); $allcats = false; if (!isset($options[29])) { $allcats = true; } elseif (in_array(0, explode(',', $options[29]))) { $allcats = true; } // creating the ITEM objects that belong to the selected category if ($allcats) { $criteria = null; } else { $criteria = new CriteriaCompo(); $criteria->add(new Criteria('categoryid', '(' . $options[29] . ')', 'IN')); } // Use specific ITEMS if ($selectedStories != 0) { unset($criteria); //removes category option $criteria = new CriteriaCompo(); $criteria->add(new Criteria('itemid', '(' . $selectedStories . ')', 'IN')); } $itemsObj =& $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, 'itemid'); $scount = count($itemsObj); if ($scount == 0) { return false; } $k = 0; $columns = array(); foreach ($itemsObj as $itemid => $itemObj) { $item = array(); $item['itemurl'] = $itemObj->getItemUrl(); $item['title'] = $itemObj->getItemLink(); $item['alt'] = strip_tags($itemObj->getItemLink()); $mainImage = $itemObj->getMainImage(); // check to see if GD function exist if (!function_exists('imagecreatetruecolor')) { $item['item_image'] = $mainImage['image_path']; } else { $item['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '&w=' . $imgWidth; // No $imgHeight for autoheight option } $item['text'] = $itemObj->getBlockSummary($letters); $item = $itemObj->getMainImage($item); //returns an array $lsHeight = ''; if ($options[12] != 0) { $lsHeight = 'height="' . $imgHeight . '" '; } // set height = 0 in block option for auto height if ($options[15] === 'LEFT') { $imgPosition = 'float: left'; $lsMargin = '-right'; } if ($options[15] === 'CENTER') { $imgPosition = 'text-align:center'; $lsMargin = ''; } if ($options[15] === 'RIGHT') { $imgPosition = 'float: right'; $lsMargin = '-left'; } //Image if ($options[10] == 1 && $item['image_path'] != '') { $startdiv = '<div style="' . $imgPosition . '"><a href="' . $item['itemurl'] . '">'; $style = 'style="margin' . $lsMargin . ': 10px; padding: 2px; border: ' . $border . 'px solid #' . $bordercolor . '"'; $enddiv = 'width="' . $imgWidth . '" ' . $lsHeight . '/></a></div>'; $image = $startdiv . '<img ' . $style . ' src="' . $item['item_image'] . '" alt="' . $item['image_name'] . '" ' . $enddiv; $item['image'] = $image; } if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin(-1)) { $item['admin'] = "<a href='" . PUBLISHER_URL . '/submit.php?itemid=' . $itemObj->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif'" . " title='" . _CO_PUBLISHER_EDIT . "' alt='" . _CO_PUBLISHER_EDIT . "' /></a> "; $item['admin'] .= "<a href='" . PUBLISHER_URL . '/admin/item.php?op=del&itemid=' . $itemObj->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png'" . " title='" . _CO_PUBLISHER_DELETE . "' alt='" . _CO_PUBLISHER_DELETE . "' /></a>"; } else { $item['admin'] = ''; } $block['topiclink'] = ''; /* if ($options[16] == 1) { $block['topiclink'] = '| <a href="'.XOOPS_URL.'/modules/news/topics_directory.php">'._AM_NEWS_TOPICS_DIRECTORY.'</a> '; } */ $block['archivelink'] = ''; if ($options[17] == 1) { $block['archivelink'] = '| <a href="' . PUBLISHER_URL . '/archive.php">' . _MB_PUBLISHER_ARCHIVE . '</a> '; } //TODO: Should we not show link to Anonymous? $block['submitlink'] = ''; if ($options[18] == 1 && $GLOBALS['xoopsUser']) { $block['submitlink'] = '| <a href="' . PUBLISHER_URL . '/submit.php">' . _MB_PUBLISHER_SUBMITNEWS . '</a> '; } $item['poster'] = ''; if ($options[19] == 1) { $item['poster'] = _MB_PUBLISHER_POSTER . ' ' . $itemObj->posterName(); } $item['posttime'] = ''; if ($options[20] == 1) { $item['posttime'] = _ON . ' ' . $itemObj->getDatesub(); } $item['topic_title'] = ''; if ($options[21] == 1) { $item['topic_title'] = $itemObj->getCategoryLink() . _MB_PUBLISHER_SP; } $item['read'] = ''; if ($options[22] == 1) { $item['read'] = ' (' . $itemObj->counter() . ' ' . _READS . ')'; } $item['more'] = ''; if ($itemObj->body() != '' || $itemObj->comments() > 0) { $item['more'] = '<a class="publisher_spotlight_readmore" href="' . $itemObj->getItemUrl() . '">' . _MB_PUBLISHER_READMORE . '</a>'; } $comments = $itemObj->comments(); if ($options[23] == 1) { if ($comments > 0) { //shows 1 comment instead of 1 comm. if comments ==1 //langugage file modified accordingly if ($comments == 1) { $item['comment'] = ' ' . _MB_PUBLISHER_ONECOMMENT . ' '; } else { $item['comment'] = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' '; } } else { $item['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' '; } } $item['print'] = ''; if ($options[24] == 1) { $item['print'] = '<a href="' . PublisherSeo::generateUrl('print', $itemObj->itemid(), $itemObj->short_url()) . '" rel="nofollow"><img src="' . PUBLISHER_URL . '/assets/images/links/print.gif" title="' . _CO_PUBLISHER_PRINT . '" alt="' . _CO_PUBLISHER_PRINT . '" /></a> '; } $item['pdf'] = ''; if ($publisher->getConfig('display_pdf')) { if ($options[25] == 1) { $item['pdf'] = "<a href='" . PUBLISHER_URL . '/makepdf.php?itemid=' . $itemObj->itemid() . "' rel='nofollow'><img src='" . PUBLISHER_URL . "/assets/images/links/pdf.gif' title='" . _CO_PUBLISHER_PDF . "' alt='" . _CO_PUBLISHER_PDF . "' /></a> "; } } $item['email'] = ''; if ($options[26] == 1 && xoops_isActiveModule('tellafriend')) { $subject = sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']); $subject = $itemObj->convertForJapanese($subject); $maillink = publisherTellAFriend($subject); $item['email'] = '<a href="' . $maillink . '"><img src="' . PUBLISHER_URL . '/assets/images/links/friend.gif" title="' . _CO_PUBLISHER_MAIL . '" alt="' . _CO_PUBLISHER_MAIL . '" /></a> '; } $block['morelink'] = ''; if ($options[27] == 1) { $block['morelink'] = '<a href="' . PUBLISHER_URL . '/index.php">' . _MB_PUBLISHER_MORE_ITEMS . '</a> '; } $block['latestnews_scroll'] = false; if ($options[5] == 1) { $block['latestnews_scroll'] = true; } $block['scrollheight'] = $options[6]; $block['scrollspeed'] = $options[7]; $block['scrolldir'] = $options[8]; $block['template'] = $options[28]; $block['imgwidth'] = $options[11]; $block['imgheight'] = $options[12]; $block['letters'] = $letters; $columns[$k][] = $item; ++$k; if ($k == $columnCount) { $k = 0; } } unset($item); $block['columns'] = $columns; return $block; }
/** * @param $obj * * @return $this */ public function createElements($obj) { $publisher =& PublisherPublisher::getInstance(); $allowedEditors = publisherGetEditors($publisher->getHandler('permission')->getGrantedItems('editors')); if (!is_object($GLOBALS['xoopsUser'])) { $group = array(XOOPS_GROUP_ANONYMOUS); } else { $group = $GLOBALS['xoopsUser']->getGroups(); } $this->setExtra('enctype="multipart/form-data"'); $this->startTab(_CO_PUBLISHER_TAB_MAIN); // Category $categoryFormSelect = new XoopsFormSelect(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e')); $categoryFormSelect->setDescription(_CO_PUBLISHER_CATEGORY_DSC); $categoryFormSelect->addOptionArray($publisher->getHandler('category')->getCategoriesForSubmit()); $this->addElement($categoryFormSelect); // ITEM TITLE $this->addElement(new XoopsFormText(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true); // SUBTITLE if ($this->isGranted(PublisherConstants::PUBLISHER_SUBTITLE)) { $this->addElement(new XoopsFormText(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e'))); } // SHORT URL if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_SHORT_URL)) { $textShortUrl = new XoopsFormText(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->short_url('e')); $textShortUrl->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC); $this->addElement($textShortUrl); } // TAGS if (xoops_isActiveModule('tag') && $this->isGranted(PublisherConstants::PUBLISHER_ITEM_TAG)) { include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php'); $textTags = new XoopsFormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0); $this->addElement($textTags); } // SELECT EDITOR $nohtml = !$obj->dohtml(); if (count($allowedEditors) === 1) { $editor = $allowedEditors[0]; } elseif (count($allowedEditors) > 0) { $editor = XoopsRequest::getString('editor', '', 'POST'); if (!empty($editor)) { publisherSetCookieVar('publisher_editor', $editor); } else { $editor = publisherGetCookieVar('publisher_editor'); if (empty($editor) && is_object($GLOBALS['xoopsUser'])) { // $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile $editor = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : ''; // Need set through user profile } } $editor = empty($editor) || !in_array($editor, $allowedEditors) ? $publisher->getConfig('submit_editor') : $editor; $formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors); $this->addElement($formEditor); } else { $editor = $publisher->getConfig('submit_editor'); } $editorConfigs = array(); $editorConfigs['rows'] = !$publisher->getConfig('submit_editor_rows') ? 35 : $publisher->getConfig('submit_editor_rows'); $editorConfigs['cols'] = !$publisher->getConfig('submit_editor_cols') ? 60 : $publisher->getConfig('submit_editor_cols'); $editorConfigs['width'] = !$publisher->getConfig('submit_editor_width') ? '100%' : $publisher->getConfig('submit_editor_width'); $editorConfigs['height'] = !$publisher->getConfig('submit_editor_height') ? '400px' : $publisher->getConfig('submit_editor_height'); // SUMMARY if ($this->isGranted(PublisherConstants::PUBLISHER_SUMMARY)) { // Description //$summaryText = new XoopsFormTextArea(_CO_PUBLISHER_SUMMARY, 'summary', $obj->getVar('summary', 'e'), 7, 60); $editorConfigs['name'] = 'summary'; $editorConfigs['value'] = $obj->getVar('summary', 'e'); $summaryText = new XoopsFormEditor(_CO_PUBLISHER_SUMMARY, $editor, $editorConfigs, $nohtml, $onfailure = null); $summaryText->setDescription(_CO_PUBLISHER_SUMMARY_DSC); $this->addElement($summaryText); } // BODY $editorConfigs['name'] = 'body'; $editorConfigs['value'] = $obj->getVar('body', 'e'); $bodyText = new XoopsFormEditor(_CO_PUBLISHER_BODY, $editor, $editorConfigs, $nohtml, $onfailure = null); $bodyText->setDescription(_CO_PUBLISHER_BODY_DSC); $this->addElement($bodyText); // VARIOUS OPTIONS if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML) || $this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY) || $this->isGranted(PublisherConstants::PUBLISHER_DOXCODE) || $this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE) || $this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) { if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML)) { $html_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO); $this->addElement($html_radio); } if ($this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY)) { $smiley_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO); $this->addElement($smiley_radio); } if ($this->isGranted(PublisherConstants::PUBLISHER_DOXCODE)) { $xcode_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->doxcode(), _YES, _NO); $this->addElement($xcode_radio); } if ($this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE)) { $image_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->doimage(), _YES, _NO); $this->addElement($image_radio); } if ($this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) { $linebreak_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->dobr(), _YES, _NO); $this->addElement($linebreak_radio); } } // Available pages to wrap if ($this->isGranted(PublisherConstants::PUBLISHER_AVAILABLE_PAGE_WRAP)) { $wrapPages = XoopsLists::getHtmlListAsArray(publisherGetUploadDir(true, 'content')); $availableWrapPagesText = array(); foreach ($wrapPages as $page) { $availableWrapPagesText[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>"; } $availableWrapPages = new XoopsFormLabel(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $availableWrapPagesText)); $availableWrapPages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC); $this->addElement($availableWrapPages); } // Uid /* We need to retreive the users manually because for some reason, on the frxoops.org server, the method users::getobjects encounters a memory error */ // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL if ($this->isGranted(PublisherConstants::PUBLISHER_UID)) { $uidSelect = new XoopsFormSelect(_CO_PUBLISHER_UID, 'uid', $obj->uid(), 1, false); $uidSelect->setDescription(_CO_PUBLISHER_UID_DSC); $sql = 'SELECT uid, uname FROM ' . $obj->db->prefix('users') . ' ORDER BY uname ASC'; $result = $obj->db->query($sql); $usersArray = array(); $usersArray[0] = $GLOBALS['xoopsConfig']['anonymous']; while (($myrow = $obj->db->fetchArray($result)) !== false) { $usersArray[$myrow['uid']] = $myrow['uname']; } $uidSelect->addOptionArray($usersArray); $this->addElement($uidSelect); } /* else { $hidden = new XoopsFormHidden('uid', $obj->uid()); $this->addElement($hidden); unset($hidden); }*/ // Author ALias if ($this->isGranted(PublisherConstants::PUBLISHER_AUTHOR_ALIAS)) { $element = new XoopsFormText(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e')); $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC); $this->addElement($element); unset($element); } // STATUS if ($this->isGranted(PublisherConstants::PUBLISHER_STATUS)) { $options = array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, PublisherConstants::PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, PublisherConstants::PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, PublisherConstants::PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED); $statusSelect = new XoopsFormSelect(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status')); $statusSelect->addOptionArray($options); $statusSelect->setDescription(_CO_PUBLISHER_STATUS_DSC); $this->addElement($statusSelect); unset($statusSelect); } // Datesub if ($this->isGranted(PublisherConstants::PUBLISHER_DATESUB)) { if ($obj->isNew()) { $datesub = time(); } else { $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub'); } $datesub_datetime = new PublisherFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true); // $datesub_datetime = new XoopsFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true); $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC); $this->addElement($datesub_datetime); } // NOTIFY ON PUBLISH if ($this->isGranted(PublisherConstants::PUBLISHER_NOTIFY)) { $notify_radio = new XoopsFormRadioYN(_CO_PUBLISHER_NOTIFY, 'notify', $obj->notifypub(), _YES, _NO); $this->addElement($notify_radio); } if ($this->hasTab(_CO_PUBLISHER_TAB_IMAGES)) { $this->startTab(_CO_PUBLISHER_TAB_IMAGES); } // IMAGE if ($this->isGranted(PublisherConstants::PUBLISHER_IMAGE_ITEM)) { $objimages = $obj->getImages(); $mainarray = is_object($objimages['main']) ? array($objimages['main']) : array(); $mergedimages = array_merge($mainarray, $objimages['others']); $objimage_array = array(); foreach ($mergedimages as $imageObj) { $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename'); } $imgcatHandler =& xoops_getHandler('imagecategory'); if (method_exists($imgcatHandler, 'getListByPermission')) { $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1); } else { $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1); } $catids = array_keys($catlist); $imageObjs = array(); if (!empty($catids)) { $imageHandler =& xoops_getHandler('image'); $criteria = new CriteriaCompo(new Criteria('imgcat_id', '(' . implode(',', $catids) . ')', 'IN')); $criteria->add(new Criteria('image_display', 1)); $criteria->setSort('image_nicename'); $criteria->setOrder('ASC'); $imageObjs = $imageHandler->getObjects($criteria, true); unset($criteria); } $image_array = array(); foreach ($imageObjs as $imageObj) { $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename'); } $image_array = array_diff($image_array, $objimage_array); $imageSelect = new XoopsFormSelect('', 'image_notused', '', 5); $imageSelect->addOptionArray($image_array); $imageSelect->setExtra("onchange='showImgSelected(\"image_display\", \"image_notused\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'"); //$imageSelect->setExtra( "onchange='appendMySelectOption(\"image_notused\", \"image_item\")'"); unset($image_array); $imageSelect2 = new XoopsFormSelect('', 'image_item', '', 5, true); $imageSelect2->addOptionArray($objimage_array); $imageSelect2->setExtra("onchange='publisher_updateSelectOption(\"image_item\", \"image_featured\"), showImgSelected(\"image_display\", \"image_item\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'"); $buttonadd = new XoopsFormButton('', 'buttonadd', _CO_PUBLISHER_ADD); $buttonadd->setExtra("onclick='publisher_appendSelectOption(\"image_notused\", \"image_item\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'"); $buttonremove = new XoopsFormButton('', 'buttonremove', _CO_PUBLISHER_REMOVE); $buttonremove->setExtra("onclick='publisher_appendSelectOption(\"image_item\", \"image_notused\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'"); $opentable = new XoopsFormLabel('', '<table><tr><td>'); $addcol = new XoopsFormLabel('', '</td><td>'); $addbreak = new XoopsFormLabel('', '<br />'); $closetable = new XoopsFormLabel('', '</td></tr></table>'); $GLOBALS['xoTheme']->addScript(PUBLISHER_URL . '/assets/js/ajaxupload.3.9.js'); $js_data = new XoopsFormLabel('', ' <script type= "text/javascript">/*<![CDATA[*/ $publisher(document).ready(function () { var button = $publisher("#publisher_upload_button"), interval; new AjaxUpload(button,{ action: "' . PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons responseType: "text/html", name: "publisher_upload_file", onSubmit : function (file, ext) { // change button text, when user selects file $publisher("#publisher_upload_message").html(" "); button.html("<img src=\'' . PUBLISHER_URL . '/assets/images/loadingbar.gif\'/>"); this.setData({ "image_nicename": $publisher("#image_nicename").val(), "imgcat_id" : $publisher("#imgcat_id").val() }); // If you want to allow uploading only 1 file at time, // you can disable upload button this.disable(); interval = window.setInterval(function () { }, 200); }, onComplete: function (file, response) { button.text("' . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '"); window.clearInterval(interval); // enable upload button this.enable(); // add file to the list var result = eval(response); if ("success" == result[0]) { $publisher("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>"); publisher_updateSelectOption(\'image_item\', \'image_featured\'); showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . XOOPS_URL . '\') } else { $publisher("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>"); } } }); }); /*]]>*/</script> '); $messages = new XoopsFormLabel('', "<div id='publisher_upload_message'></div>"); $button = new XoopsFormLabel('', "<div id='publisher_upload_button'>" . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '</div>'); $nicename = new XoopsFormText('', 'image_nicename', 30, 30, _CO_PUBLISHER_IMAGE_NICENAME); $imgcatHandler =& xoops_getHandler('imagecategory'); if (method_exists($imgcatHandler, 'getListByPermission')) { $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1); } else { $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1); } $imagecat = new XoopsFormSelect('', 'imgcat_id', '', 1); $imagecat->addOptionArray($catlist); $imageUploadTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_UPLOAD, ''); $imageUploadTray->addElement($js_data); $imageUploadTray->addElement($messages); $imageUploadTray->addElement($opentable); $imageUploadTray->addElement($imagecat); $imageUploadTray->addElement($addbreak); $imageUploadTray->addElement($nicename); $imageUploadTray->addElement($addbreak); $imageUploadTray->addElement($button); $imageUploadTray->addElement($closetable); $this->addElement($imageUploadTray); $imageTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_ITEMS, ''); $imageTray->addElement($opentable); $imageTray->addElement($imageSelect); $imageTray->addElement($addbreak); $imageTray->addElement($buttonadd); $imageTray->addElement($addcol); $imageTray->addElement($imageSelect2); $imageTray->addElement($addbreak); $imageTray->addElement($buttonremove); $imageTray->addElement($closetable); $imageTray->setDescription(_CO_PUBLISHER_IMAGE_ITEMS_DSC); $this->addElement($imageTray); $imagename = is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : ''; $imageforpath = $imagename != '' ? $imagename : 'blank.gif'; $imageSelect3 = new XoopsFormSelect(_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1); $imageSelect3->addOptionArray($objimage_array); $imageSelect3->setExtra("onchange='showImgSelected(\"image_display\", \"image_featured\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'"); $imageSelect3->setDescription(_CO_PUBLISHER_IMAGE_ITEM_DSC); $this->addElement($imageSelect3); $image_preview = new XoopsFormLabel(_CO_PUBLISHER_IMAGE_PREVIEW, "<img src='" . XOOPS_URL . '/uploads/' . $imageforpath . "' name='image_display' id='image_display' alt='' />"); $this->addElement($image_preview); } if ($this->hasTab(_CO_PUBLISHER_TAB_FILES)) { $this->startTab(_CO_PUBLISHER_TAB_FILES); } // File upload UPLOAD if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_UPLOAD_FILE)) { // NAME $nameText = new XoopsFormText(_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, ''); $nameText->setDescription(_CO_PUBLISHER_FILE_NAME_DSC); $this->addElement($nameText); unset($nameText); // DESCRIPTION $descriptionText = new XoopsFormTextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', ''); $descriptionText->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC); $this->addElement($descriptionText); unset($descriptionText); $statusSelect = new XoopsFormRadioYN(_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1); //1 - active $statusSelect->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC); $this->addElement($statusSelect); unset($statusSelect); $fileBox = new XoopsFormFile(_CO_PUBLISHER_ITEM_UPLOAD_FILE, 'item_upload_file', 0); $fileBox->setDescription(_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC); $fileBox->setExtra("size ='50'"); $this->addElement($fileBox); unset($fileBox); if (!$obj->isNew()) { $filesObj =& $publisher->getHandler('file')->getAllFiles($obj->itemid()); if (count($filesObj) > 0) { $table = ''; $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; $table .= '<tr>'; $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>"; $table .= "<td width='150' class='bg3' align='left'><strong>" . _AM_PUBLISHER_FILENAME . '</strong></td>'; $table .= "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_DESCRIPTION . '</strong></td>'; $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . '</strong></td>'; $table .= "<td width='100' class='bg3' align='center'><strong>" . _AM_PUBLISHER_UPLOADED_DATE . '</strong></td>'; $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>'; $table .= '</tr>'; foreach ($filesObj as $fileObj) { $modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "' /></a>"; $delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'/></a>"; if ($fileObj->status() == 0) { $not_visible = "<img src='" . PUBLISHER_URL . "/assets/images/no.gif'/>"; } else { $not_visible = ''; } $table .= '<tr>'; $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . '</td>'; $table .= "<td class='odd' align='left'>" . $not_visible . $fileObj->getFileLink() . '</td>'; $table .= "<td class='even' align='left'>" . $fileObj->description() . '</td>'; $table .= "<td class='even' align='center'>" . $fileObj->counter() . ''; $table .= "<td class='even' align='center'>" . $fileObj->getDatesub() . '</td>'; $table .= "<td class='even' align='center'> {$modify} {$delete} </td>"; $table .= '</tr>'; } $table .= '</table>'; $files_box = new XoopsFormLabel(_CO_PUBLISHER_FILES_LINKED, $table); $this->addElement($files_box); unset($files_box, $filesObj, $fileObj); } } } if ($this->hasTab(_CO_PUBLISHER_TAB_OTHERS)) { $this->startTab(_CO_PUBLISHER_TAB_OTHERS); } //$this->startTab(_CO_PUBLISHER_TAB_META); // Meta Keywords if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_KEYWORDS)) { $text_meta_keywords = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->meta_keywords('e'), 7, 60); $text_meta_keywords->setDescription(_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC); $this->addElement($text_meta_keywords); } // Meta Description if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_DESCRIPTION)) { $text_meta_description = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->meta_description('e'), 7, 60); $text_meta_description->setDescription(_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC); $this->addElement($text_meta_description); } //$this->startTab(_CO_PUBLISHER_TAB_PERMISSIONS); // COMMENTS if ($this->isGranted(PublisherConstants::PUBLISHER_ALLOWCOMMENTS)) { $addcomments_radio = new XoopsFormRadioYN(_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->cancomment(), _YES, _NO); $this->addElement($addcomments_radio); } // WEIGHT if ($this->isGranted(PublisherConstants::PUBLISHER_WEIGHT)) { $this->addElement(new XoopsFormText(_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->weight())); } $this->endTabs(); //COMMON TO ALL TABS $button_tray = new XoopsFormElementTray('', ''); if (!$obj->isNew()) { $button_tray->addElement(new XoopsFormButton('', 'additem', _SUBMIT, 'submit')); //orclone } else { $button_tray->addElement(new XoopsFormButton('', 'additem', _CO_PUBLISHER_CREATE, 'submit')); $button_tray->addElement(new XoopsFormButton('', '', _CO_PUBLISHER_CLEAR, 'reset')); } $button_tray->addElement(new XoopsFormButton('', 'preview', _CO_PUBLISHER_PREVIEW, 'submit')); $butt_cancel = new XoopsFormButton('', '', _CO_PUBLISHER_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $this->addElement($button_tray); $hidden = new XoopsFormHidden('itemid', $obj->itemid()); $this->addElement($hidden); unset($hidden); return $this; }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @package Include * @since 1.1 * @author trabis <*****@*****.**> * @version $Id: common.php 0 2009-06-11 18:47:04Z trabis $ */ defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); //XMF inclusion if (!xoops_isActiveModule('xmf')) { if (file_exists($file = dirname(dirname(dirname(__FILE__))) . '/xmf/include/bootstrap.php')) { include_once $file; echo 'Please install or reactivate XMF module'; } else { redirect_header(XOOPS_URL, 5, 'Please install XMF module'); } } define("MYINVITER_DIRNAME", basename(dirname(dirname(__FILE__)))); define("MYINVITER_URL", XOOPS_URL . '/modules/' . MYINVITER_DIRNAME); define("MYINVITER_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . MYINVITER_DIRNAME); define('MYINVITER_STATUS_WAITING', 0); define('MYINVITER_STATUS_BLACKLIST', 1); define('MYINVITER_STATUS_ERROR', 2); define('MYINVITER_STATUS_NOTSENT', 3); define('MYINVITER_STATUS_SENT', 4);
function myinviter_sendEmails($id = null, $force = false) { global $xoopsConfig; $errors = array(); $sent = 0; $emailsperpack = intval($GLOBALS['myinviter']->getConfig('emailsperpack')); if ($emailsperpack == 0 && $id == null) { $errors[] = 'No id or no pack number'; return $errors; } $timebpacks = intval($GLOBALS['myinviter']->getConfig('timebpacks')); $now = time(); $last = myinviter_getLastTime(); if ($now - $last <= $timebpacks && !$force) { $errors[] = 'Not enough time'; return $errors; } $from = $GLOBALS['myinviter']->getConfig('from'); //custom, system, user $html = $GLOBALS['myinviter']->getConfig('html'); $sandbox = $GLOBALS['myinviter']->getConfig('sandbox'); $sandboxemail = trim($GLOBALS['myinviter']->getConfig('sandboxemail')); $defaultuid = intval($GLOBALS['myinviter']->getConfig('defaultuid')); if (empty($sandboxemail)) { $sandboxemail = $xoopsConfig['adminmail']; } if ($from == 'custom') { $fromname = trim($GLOBALS['myinviter']->getConfig('fromname')); $fromemail = trim($GLOBALS['myinviter']->getConfig('fromemail')); if (empty($fromname) || empty($fromemail)) { $from = 'system'; } } if ($from == 'system') { $fromname = $xoopsConfig['sitename']; $fromemail = $xoopsConfig['adminmail']; } $this_handler = $GLOBALS['myinviter']->getHandler('item'); $objs = $this_handler->getWaitingObjects($id, 0, $emailsperpack); if (count($objs) == 0) { myinviter_setLastTime($now); $errors[] = 'No waiting emails'; return $errors; } $member_handler = xoops_gethandler('member'); foreach ($objs as $obj) { $thisUser = $member_handler->getUser($obj->getVar('userid')); //Was this user removed? Then get the default one! if (!is_object($thisUser)) { $thisUser = $member_handler->getUser($defaultuid); } if (!is_object($thisUser)) { $errors[] = 'No default user'; return $errors; } $xoopsMailer = xoops_getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/myinviter/language/'); if ($html == 1) { $xoopsMailer->multimailer->ContentType = "text/html"; $xoopsMailer->setTemplate('myinviter_invitation_html.tpl'); $avatar = $thisUser->getVar('user_avatar'); if ($avatar == 'blank.gif' || $avatar == '') { $avatar = XOOPS_URL . '/modules/myinviter/images/noavatar.gif'; } else { $avatar = XOOPS_URL . '/uploads/' . $avatar; } $xoopsMailer->assign("USER_AVATAR", $avatar); } else { $xoopsMailer->setTemplate('myinviter_invitation.tpl'); } if ($sandbox == 1) { $xoopsMailer->setToEmails(array($sandboxemail)); } else { $xoopsMailer->setToEmails(array($obj->getVar('email', 'n'))); } if ($from == 'user') { $fromname = $thisUser->getVar('uname', 'n'); $fromemail = $thisUser->getVar('email', 'n'); } $xoopsMailer->setFromEmail($fromemail); $xoopsMailer->setFromName($fromname); xoops_loadLanguage('main', 'myinviter'); $xoopsMailer->setSubject(sprintf($GLOBALS['myinviter']->getConfig('subject'), $thisUser->getVar('uname'))); $xoopsMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']); $xoopsMailer->assign("USER_UNAME", $thisUser->getVar('uname')); $xoopsMailer->assign("USER_UID", $thisUser->getVar('uid')); $xoopsMailer->assign("INVITED_NAME", $obj->getVar('name')); $key = md5($obj->getVar('email') . XOOPS_ROOT_PATH); $xoopsMailer->assign("BLACKLIST_URL", MYINVITER_URL . '/blacklist.php?email=' . $obj->getVar('email') . '&key=' . $key); if (!$xoopsMailer->send(true)) { $errors[] = $xoopsMailer->getErrors(false); // do not use html in error message $this_handler->insertError($obj); } else { $this_handler->insertSent($obj); $sent++; //All Ok? Set log /* $log_handler =& xoops_getmodulehandler('log', 'myinviter'); $log = $log_handler->create(); $log->setVar('log_userid',$thisUser->getVar('uid')); $log->setVar('log_date', time()); $log_handler->insert($log); */ } unset($xoopsMailer); } myinviter_setLastTime($now); $lastcount = myinviter_getEmailsSent(); myinviter_setEmailsSent($lastcount + $sent); if (xoops_isActiveModule('log')) { Xmf_Module_Helper::getInstance('log')->getHandler('item')->addItem('myinviter', 'emailssent', $sent); } return $errors; }
/** * Add config line * * @param array|string $value message to include in config box * @param string $type type of line to add * minimal set of acceptable types and value expectation * 'default' - value is message displayed directly (also used for unknown types) * 'folder' - value is directory name, will display accept if exists, error if not * 'chmod' - value is array(directory, permission) accept if exists with permission, * else error * 'module' - value is string module name, or array(module name, errortype) * If module is active, an accept line displays, otherwise, a warning * (if value is array(module, "warning") or an error displays. * * @return bool */ public function addConfigBoxLine($value = '', $type = 'default') { if ($type === 'module') { $mod = is_array($value) ? $value[0] : $value; if (xoops_isActiveModule($mod)) { return $this->addConfigAccept(sprintf(_AM_XMF_MODULE_INSTALLED, $mod)); } else { $nomod = is_array($value) ? $value[1] : 'error'; $line = sprintf(_AM_XMF_MODULE_NOT_INSTALLED, $mod); if ($nomod === 'warning') { return $this->addConfigWarning($line); } else { return $this->addConfigError($line); } } } return static::$ModuleAdmin->addConfigBoxLine($value, $type); }
* @author Taiwen Jiang <*****@*****.**> * @version $Id: index.php 12380 2014-03-16 03:03:00Z rgriffith $ */ if (file_exists(dirname(__FILE__) . '/mainfile.php')) { include dirname(__FILE__) . '/mainfile.php'; } if (!defined('XOOPS_MAINFILE_INCLUDED')) { if (file_exists(dirname(__FILE__) . '/install/index.php')) { header('Location: install/index.php'); exit; } } $xoopsPreload =& XoopsPreload::getInstance(); $xoopsPreload->triggerEvent('core.index.start'); //check if start page is defined if (isset($xoopsConfig['startpage']) && $xoopsConfig['startpage'] != "" && $xoopsConfig['startpage'] != "--" && xoops_isActiveModule($xoopsConfig['startpage'])) { // Temporary solution for start page redirection define("XOOPS_STARTPAGE_REDIRECTED", 1); global $xoopsModuleConfig; $module_handler =& xoops_gethandler('module'); $xoopsModule =& $module_handler->getByDirname($xoopsConfig['startpage']); if (!$xoopsModule || !$xoopsModule->getVar('isactive')) { include_once $GLOBALS['xoops']->path('header.php'); echo "<h4>" . _MODULENOEXIST . "</h4>"; include_once $GLOBALS['xoops']->path('footer.php'); exit; } $moduleperm_handler =& xoops_gethandler('groupperm'); if ($xoopsUser) { if (!$moduleperm_handler->checkRight('module_read', $xoopsModule->getVar('mid'), $xoopsUser->getGroups())) { redirect_header(XOOPS_URL, 1, _NOPERM, false);