$nbAccount = CAppUI::conf("messagerie CronJob_nbMail"); $older = CAppUI::conf("messagerie CronJob_olderThan"); $limitMail = CValue::get("limit", CAppUI::conf("messagerie limit_external_mail") + 1); $account_id = CValue::get("account_id"); $import = CValue::get("import", 0); //source $source = new CSourcePOP(); $where = array(); $where["active"] = "= '1'"; $where["cron_update"] = "= '1'"; if ($account_id) { $where["source_pop_id"] = " = '{$account_id}'"; } $order = "'last_update' ASC"; $limit = "0, {$nbAccount}"; $sources = $source->loadList($where, $order, $limit); /** @var $sources CSourcePOP[] */ foreach ($sources as $_source) { $user = $_source->loadRefMetaObject(); //no user => next if (!$_source->user) { CAppUI::stepAjax("pas d'utilisateur pour cette source %s", UI_MSG_WARNING, $_source->_view); continue; } // when a mail is copied in mediboard, will it be marked as read on the server ? $markReadServer = 0; $prefs = CPreferences::get($_source->object_id); //for user_id $markReadServer = isset($prefs["markMailOnServerAsRead"]) ? $prefs["markMailOnServerAsRead"] : CAppUI::pref("markMailOnServerAsRead"); $archivedOnReception = isset($prefs["mailReadOnServerGoToArchived"]) ? $prefs["mailReadOnServerGoToArchived"] : CAppUI::pref("mailReadOnServerGoToArchived"); //last email uid from mediboard
$user->load($user_id); //CSourcePOP account $account = new CSourcePOP(); //getting the list of user with the good rights $listUsers = $user->loadListWithPerms(PERM_EDIT); $where = array(); $where["source_pop.is_private"] = "= '0'"; $where["source_pop.object_class"] = "= 'CMediusers'"; $where["users_mediboard.function_id"] = "= '{$user->function_id}'"; $where["users_mediboard.user_id"] = CSQLDataSource::prepareIn(array_keys($listUsers)); $ljoin = array(); $ljoin["users_mediboard"] = "source_pop.object_id = users_mediboard.user_id AND source_pop.object_class = 'CMediusers'"; //all accounts linked to a mediuser //all accounts from an unique mediuser are grouped, in order to have the mediusers list /** @var CSourcePOP[] $accounts_available */ $accounts_available = $account->loadList($where, null, null, null, $ljoin); //getting user list $users = array(); foreach ($accounts_available as $_account) { $userPop = $_account->loadRefMetaObject(); $users[$userPop->_id] = $userPop; } //all accounts to the selected user $where["source_pop.object_id"] = " = '{$user->_id}'"; //if user connected, show the private source pop if ($user_id == $user_connected->_id) { $where["source_pop.is_private"] = " IS NOT NULL"; } $accounts_user = $account->loadList($where, null, null, null, $ljoin); //if no account_id, selecting the first one if (!$account_id && count($accounts_available)) {
<?php /** * $Id$ * * @category Messagerie * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $source = new CSourcePOP(); /** @var CSourcePOP[] $sources */ $sources = $source->loadList(); foreach ($sources as $_source) { $_source->loadRefMetaObject(); $_source->countRefMails(); } //smarty $smarty = new CSmartyDP(); $smarty->assign("sources", $sources); $smarty->display("vw_list_accounts.tpl");