function sc_check_priv($prob_id, $opened, $user) { if (!function_exists('check_priv')) { require __DIR__ . '/privilege.php'; } if (isset($_SESSION['user'])) { if (strcmp($user, $_SESSION['user']) == 0 || check_priv(PRIV_SOURCE)) { return TRUE; } } require __DIR__ . '/../conf/database.php'; if (!defined('PROB_HAS_TEX')) { require __DIR__ . '/../lib/problem_flags.php'; } if ($opened) { $row = mysqli_fetch_row(mysqli_query($con, "select has_tex from problem where problem_id={$prob_id}")); if (!$row) { return _('There\'s no such problem'); } $prob_flag = $row[0]; if ($prob_flag & PROB_IS_HIDE && !check_priv(PRIV_INSIDER)) { return _('Looks like you can\'t access this page'); } if ($prob_flag & PROB_DISABLE_OPENSOURCE) { return _('This solution is not open-source'); } else { if ($prob_flag & PROB_SOLVED_OPENSOURCE) { if (isset($_SESSION['user'])) { $query = 'select min(result) from solution where user_id=\'' . $_SESSION['user'] . "' and problem_id={$prob_id} group by problem_id"; $user_status = mysqli_query($con, $query); $row = mysqli_fetch_row($user_status); if ($row && $row[0] == 0) { return TRUE; } } return _('You can\'t see me before solving it'); } else { if (isset($_SESSION['user'])) { $res = mysqli_query($con, "SELECT contest.contest_id,co.contest_id from contest\n RIGHT JOIN (select contest_id from contest_status where user_id='" . $_SESSION['user'] . "' and leave_time is NULL) as cs on (contest.contest_id=cs.contest_id)\n LEFT JOIN (select contest_id from contest_problem where problem_id={$prob_id}) as cp on (contest.contest_id=cp.contest_id)\n LEFT JOIN (select contest_id from contest_owner where user_id='" . $_SESSION['user'] . "') as co on (contest.contest_id=co.contest_id)\n where NOW()>start_time and NOW()<end_time and contest.hide_source_code"); $num = mysqli_num_rows($res); if ($num > 0) { $accessible = false; while ($row = mysqli_fetch_row($res)) { if (!is_null($row[1])) { $accessible = true; } } if ($accessible) { return TRUE; } else { return _('You can\'t see me before the contest ends'); } } return TRUE; } } } } return _('Looks like you can\'t access this page'); }
/** * Return the rendered information about the Horde_Mime_Part object. * * URL parameters used by this function: * - tgz_contents: (integer) If set, show contents of ZIP file. * * @return array See Horde_Mime_Viewer_Driver::render(). */ protected function _renderInfo() { global $injector; $vars = $injector->getInstance('Horde_Variables'); if (!$this->getConfigParam('show_contents') && !isset($vars->tgz_contents)) { $status = new IMP_Mime_Status($this->_mimepart, _("This is a compressed file.")); $status->addMimeAction('tgzViewContents', _("Click to display the file contents.")); $status->icon('mime/compressed.png'); return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=UTF-8')); } $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/mime')); $view->addHelper('Text'); $view->downloadclass = 'tgzdownload'; $view->files = array(); $view->tableclass = 'tgzcontents'; $tgzInfo = $this->_getTgzInfo(); foreach ($tgzInfo as $key => $val) { if (!strlen($val['data'])) { continue; } $file = new stdClass(); $file->download = ''; $file->name = $val['name']; $file->size = IMP::sizeFormat($val['size']); if (!empty($val['size'])) { $file->download = $this->getConfigParam('imp_contents')->linkView($this->_mimepart, 'download_render', '', array('class' => 'iconImg downloadAtc', 'jstext' => _("Download"), 'params' => array('tgz_attachment' => $key))); } $view->files[] = $file; } return array($this->_mimepart->getMimeId() => array('data' => $view->render('compressed'), 'type' => 'text/html; charset=UTF-8')); }
/** */ protected function _init() { global $injector, $notification, $page_output; $this->_assertCategory('Ingo_Rule_System_Whitelist', _("Whitelist")); $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create(); $whitelist = $ingo_storage->getSystemRule('Ingo_Rule_System_Whitelist'); /* Token checking & perform requested actions. */ switch ($this->_checkToken(array('rule_update'))) { case 'rule_update': try { $whitelist->addresses = $this->vars->whitelist; $ingo_storage->updateRule($whitelist); $notification->push(_("Changes saved."), 'horde.success'); $injector->getInstance('Ingo_Factory_Script')->activateAll(); } catch (Ingo_Exception $e) { $notification->push($e); } break; } /* Prepare the view. */ $view = new Horde_View(array('templatePath' => INGO_TEMPLATES . '/basic/whitelist')); $view->addHelper('Horde_Core_View_Helper_Help'); $view->addHelper('Horde_Core_View_Helper_Label'); $view->addHelper('Text'); $view->disabled = $whitelist->disable; $view->formurl = $this->_addToken(self::url()); $view->whitelist = implode("\n", $whitelist->addresses); $page_output->addScriptFile('whitelist.js'); $page_output->addInlineJsVars(array('IngoWhitelist.filtersurl' => strval(Ingo_Basic_Filters::url()->setRaw(true)))); $this->title = _("Whitelist Edit"); $this->output = $view->render('whitelist'); }
function translate($lang, $test = 0) { global $LOCALE_PATH; putenv("LANGUAGE={$lang}"); bindtextdomain("zarafa", "{$LOCALE_PATH}"); if (STORE_SUPPORTS_UNICODE == false) { bind_textdomain_codeset('zarafa', "windows-1252"); } else { bind_textdomain_codeset('zarafa', "utf-8"); } textdomain('zarafa'); setlocale(LC_ALL, $lang); $trans_array["Sent Items"] = _("Sent Items"); $trans_array["Outbox"] = _("Outbox"); $trans_array["Deleted Items"] = _("Deleted Items"); $trans_array["Inbox"] = _("Inbox"); $trans_array["Calendar"] = _("Calendar"); $trans_array["Contacts"] = _("Contacts"); $trans_array["Drafts"] = _("Drafts"); $trans_array["Journal"] = _("Journal"); $trans_array["Notes"] = _("Notes"); $trans_array["Tasks"] = _("Tasks"); $trans_array["Junk E-mail"] = _("Junk E-mail"); return $trans_array; }
/** * preprocess before forwarding. * * @access public */ function preforward() { $this->subtitle = _('Select language'); $config = $this->backend->getConfig(); $this->af->setApp('allow_language', $config->get('allow_language')); $this->af->setApp('cur_lang', current($this->backend->ctl->getLanguage())); }
/** * Show the menu * * @return void */ function show() { $cur = common_current_user(); $action = $this->action->trimmed('action'); $this->out->elementStart('ul', array('class' => 'nav')); if (Event::handle('StartSubGroupNav', array($this))) { $this->out->menuItem(common_local_url('showstream', array('nickname' => $this->user->nickname)), _m('MENU', 'Profile'), empty($profile) ? $this->user->nickname : $profile->getBestName(), $action == 'showstream', 'nav_profile'); $this->out->menuItem(common_local_url('subscriptions', array('nickname' => $this->user->nickname)), _m('MENU', 'Subscriptions'), sprintf(_('People %s subscribes to.'), $this->user->nickname), $action == 'subscriptions', 'nav_subscriptions'); $this->out->menuItem(common_local_url('subscribers', array('nickname' => $this->user->nickname)), _m('MENU', 'Subscribers'), sprintf(_('People subscribed to %s.'), $this->user->nickname), $action == 'subscribers', 'nav_subscribers'); if ($cur && $cur->id == $this->user->id) { // Possibly site admins should be able to get in here too $pending = $this->countPendingSubs(); if ($pending || $cur->subscribe_policy == User::SUBSCRIBE_POLICY_MODERATE) { $this->out->menuItem(common_local_url('subqueue', array('nickname' => $this->user->nickname)), sprintf(_m('MENU', 'Pending (%d)'), $pending), sprintf(_('Approve pending subscription requests.'), $this->user->nickname), $action == 'subqueueaction', 'nav_subscribers'); } } $this->out->menuItem(common_local_url('usergroups', array('nickname' => $this->user->nickname)), _m('MENU', 'Groups'), sprintf(_('Groups %s is a member of.'), $this->user->nickname), $action == 'usergroups', 'nav_usergroups'); $this->out->menuItem(common_local_url('peopletagsubscriptions', array('nickname' => $this->user->nickname)), _m('MENU', 'Lists'), sprintf(_('List subscriptions by %s.'), $this->user->nickname), in_array($action, array('peopletagsbyuser', 'peopletagsubscriptions', 'peopletagsforuser')), 'nav_timeline_peopletags'); if (common_config('invite', 'enabled') && !is_null($cur) && $this->user->id === $cur->id) { $this->out->menuItem(common_local_url('invite'), _m('MENU', 'Invite'), sprintf(_('Invite friends and colleagues to join you on %s.'), common_config('site', 'name')), $action == 'invite', 'nav_invite'); } Event::handle('EndSubGroupNav', array($this)); } $this->out->elementEnd('ul'); }
public function render(\Koch\Pagination\Pagination $pagination) { $lastPage = $pagination->getLastPage(); $numberOfPages = $pagination->getNumberOfPages(); $current_page = $pagination->getCurrentPage(); $url = 'URL'; $html = '<nav class="pagination">'; $html .= sprintf('<a href="%s">‹ %s</a>', str_replace('{page}', 1, $url), _('First')); if ($pagination->hasPreviousPage()) { $html .= sprintf('<a href="%s"><</a>', str_replace('{page}', $pagination->getPreviousPage(), $url)); } // render page range around the current page for ($i = 1; $i <= $numberOfPages; ++$i) { if ($i === $current_page) { $html .= sprintf('<li class="active">%s</li>', $i); } else { $html .= sprintf('<a href="%s">%s</a>', str_replace('{page}', $i, $url), $i); } } if ($pagination->hasNextPage()) { $html .= sprintf('<a href="%s">></a>', str_replace('{page}', $pagination->getNextPage(), $url)); } if ($lastPage) { $html .= sprintf('<a href="%s"> %s›</a>', str_replace('{page}', $lastPage, $url), _('Last')); } $html .= '</nav>'; return $html; }
function do_credits() { global $dblang, $globals; echo '<br style="clear: both;" />' . "\n"; echo '<div class="credits-strip">' . "\n"; echo '<span class="credits-strip-text">' . "\n"; // IMPORTANT: legal note only for our servers, CHANGE IT!! if (preg_match('/meneame.net$/', get_server_name())) { echo '<a href="http://bitassa.com/legal-meneame.php"><strong>' . _('información legal y condiciones de uso') . '</strong></a> | '; } // IMPORTANT: read above echo '<a href="' . $globals['base_url'] . 'faq-' . $dblang . '.php#we">' . _('quiénes somos') . '</a>'; echo '<br />'; echo '<a href="http://meneame.wikispaces.com/" title="wiki meneame">' . _('wiki') . '</a>' . "\n"; echo ' | ' . _('código: ') . ' <a href="' . $globals['base_url'] . 'COPYING">' . _('licencia') . '</a>, <a href="' . $globals['base_url'] . 'archives/meneame-src.tgz">' . _('descargar') . '</a>'; echo ' | <a href="http://creativecommons.org/licenses/by-sa/2.5/">' . _('licencia de los gráficos') . '</a>' . "\n"; echo '</span>' . "\n"; echo '<span class="credits-strip-buttons">' . "\n"; echo '<a href="http://validator.w3.org/check?uri=referer"><img src="' . $globals['base_url'] . 'img/common/valid-xhtml10.png" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>' . "\n"; echo ' ' . "\n"; echo '<a href="http://jigsaw.w3.org/css-validator/check/referer"><img style="border:0;width:88px;height:31px" src="' . $globals['base_url'] . 'img/common/vcss.png" alt="Valid CSS!" /></a> ' . "\n"; echo '<a href="http://feedvalidator.org/check.cgi?url=http://meneame.net/rss2.php"><img src="' . $globals['base_url'] . 'img/common/valid-rss.png" alt="[Valid RSS]" title="Validate my RSS feed" /></a>' . "\n"; echo '</span>' . "\n"; echo '</div>' . "\n"; echo "<!--ben-tmp-functions:do_credits-->\n"; }
function get_menu($params) { $out = ''; extract($params); $prefix = empty($prefix) ? '' : $prefix; $suffix = empty($suffix) ? '' : $suffix; $pre_tag = empty($pre_tag) ? '' : $pre_tag; $after_tag = empty($after_tag) ? '' : $after_tag; $out = ''; include_once LIB_ROOT . '/pages/page.class.php'; $out .= $prefix . '<a href="/" class=menu>' . _('Home') . '</a>' . $suffix; if (!AuthController::getInstance()->isAuthorized() && $show_signup) { $out .= $prefix . '<a href="/signup.php" class=menu>' . _('Sign Up') . '</a>' . $suffix; } if ($show_memberarea) { $out .= $prefix . '<a href="/user/account.php" class=menu>' . _('Member\'s area') . '</a>' . $suffix; } if (Project::getInstance()->getCurUser()->isAdmin()) { $out .= $prefix . '<small><a href="/includes/inlines/admin/page.php?position=0" target="blank" style="font-size:9px;">(add page here)</a></small>' . $suffix; } $result = sql_query(' SELECT * FROM pages WHERE lang="' . $_COOKIE['lang'] . '" AND home=0 AND show_in_menu=1 ORDER BY position, id DESC '); while ($menu_page = mysql_fetch_assoc($result)) { $out .= $prefix . '<a href="/index.php?page=' . $menu_page['id'] . '" class=menu>' . $menu_page['name'] . '</a>' . $suffix; if (Project::getInstance()->getCurUser()->isAdmin()) { $out .= $prefix . '<small><a href="/includes/inlines/admin/page.php?position=' . $menu_page['position'] . '" target="blank" style="font-size:9px;">(add page here)</a></small>' . $suffix; } } $out .= $exclude ? '' : $prefix . '<a href="/contactus.php" class=menu>' . _('Contact Us') . '</a>' . $suffix; return $pre_tag . $out . $after_tag; }
/** * Sets and shows an alert * * @param string $message * @param string $type = "Error" * @param boolean $URL = NULL * @return string value */ function getAlert($message, $type = "error", $URL = NULL) { if (!is_null($URL)) { $message = a(__(_($message)), encode($URL), TRUE); } if ($type === "error") { return '<div id="alert-message" class="alert alert-error"> <a class="close">×</a> ' . __(_($message)) . ' </div>'; } elseif ($type === "success") { unset($_POST); return '<div id="alert-message" class="alert alert-success"> <a class="close">×</a> ' . __(_($message)) . ' </div>'; } elseif ($type === "warning") { return '<div id="alert-message" class="alert alert-warning"> <a class="close">×</a> ' . __(_($message)) . ' </div>'; } elseif ($type === "notice") { return '<div id="alert-message" class="alert alert-info"> <a class="close">×</a> ' . __(_($message)) . ' </div>'; } }
/** * Purge old messages in the sent-mail mailbox. * * @return boolean Whether any messages were purged from the mailbox. */ public function execute() { global $prefs, $notification; /* Get the current UNIX timestamp minus the number of days specified * in 'purge_sentmail_keep'. If a message has a timestamp prior to * this value, it will be deleted. */ $del_time = new Horde_Date(time() - $prefs->getValue('purge_sentmail_keep') * 86400); foreach ($this->_getMboxes() as $mbox) { /* Open the sent-mail mailbox and get the list of messages older * than 'purge_sentmail_keep' days. */ $query = new Horde_Imap_Client_Search_Query(); $query->dateSearch($del_time, Horde_Imap_Client_Search_Query::DATE_BEFORE); $msg_ids = $mbox->runSearchQuery($query); /* Go through the message list and delete the messages. */ if ($msg_ids->delete(array('nuke' => true))) { $msgcount = count($msg_ids); if ($msgcount == 1) { $notification->push(sprintf(_("Purging 1 message from sent-mail mailbox %s."), $mbox->display), 'horde.message'); } else { $notification->push(sprintf(_("Purging %d messages from sent-mail mailbox."), $msgcount, $mbox->display), 'horde.message'); } } } return true; }
/** * Variables required in form input: * - imple_submit: vcard action. Contains import and source properties * - mime_id * - muid * * @return boolean True on success. */ protected function _handle(Horde_Variables $vars) { global $registry, $injector, $notification; $iCal = new Horde_Icalendar(); try { $contents = $injector->getInstance('IMP_Factory_Contents')->create(new IMP_Indices_Mailbox($vars)); if (!($mime_part = $contents->getMimePart($vars->mime_id))) { throw new IMP_Exception(_("Cannot retrieve vCard data from message.")); } elseif (!$iCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) { throw new IMP_Exception(_("Error reading the contact data.")); } $components = $iCal->getComponents(); } catch (Exception $e) { $notification->push($e, 'horde.error'); } $import = !empty($vars->imple_submit->import) ? $vars->imple_submit->import : false; $source = !empty($vars->imple_submit->source) ? $vars->imple_submit->source : false; if ($import && $source && $registry->hasMethod('contacts/import')) { $count = 0; foreach ($components as $c) { if ($c->getType() == 'vcard') { try { $registry->call('contacts/import', array($c, null, $source)); ++$count; } catch (Horde_Exception $e) { $notification->push(Horde_Core_Translation::t("There was an error importing the contact data:") . ' ' . $e->getMessage(), 'horde.error'); } } } $notification->push(sprintf(Horde_Core_Translation::ngettext("%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), $count), 'horde.success'); } }
/** * Add additional items to the sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { $perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms'); if (Sesha::isAdmin(Horde_Perms::READ) || $perms->hasPermission('sesha:addStock', $GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { $sidebar->addNewButton(_("_Add Stock"), Horde::url('stock.php')->add('actionId', 'add_stock')); } }
public function __construct() { $this->Name = "agent_readmeoss"; $this->Title = _("ReadMeOSS generation"); $this->AgentName = "readmeoss"; parent::__construct(); }
public function html() { global $registry; $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->addTemplatePath(ANSEL_TEMPLATES . '/widgets'); $view->owner = $this->_view->gallery->get('owner'); $view->userfeedurl = Ansel::getUrlFor('rss_user', array('owner' => $view->owner)); $view->slug = $this->_view->gallery->get('slug'); $view->galleryname = $this->_view->gallery->get('name'); $view->galleryfeedurl = Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $view->slug)); $view->title = _("Links"); /* Embed html */ if (empty($this->_view->_params['image_id'])) { /* Gallery view */ $params = array('count' => 10); if (!empty($slug)) { $params['gallery_slug'] = $slug; } else { $params['gallery_id'] = $this->_view->gallery->id; } } else { // This is an image view $params = array('thumbsize' => 'screen', 'images' => $this->_view->_params['image_id'], 'count' => 10); } $view->embed = Ansel::embedCode($params); return $view->render('links'); }
function authorize() { global $globals, $db; if (empty($_GET['code'])) { do_error(_('acceso denegado'), false, false); } try { $this->client->setAccessToken($this->client->authenticate()); if (!($access_token = $this->client->getAccessToken())) { do_error(_('acceso denegado'), false, false); } $response = $this->gplus->people->get('me'); $this->uid = $response['id']; $this->username = User::get_valid_username($response['displayName']); } catch (Exception $e) { do_error(_('error de conexión a') . " {$this->service} (authorize2)", false, false); } $db->transaction(); if (!$this->user_exists()) { $this->url = $response['url']; $this->names = $response['displayName']; $this->avatar = $response['image']['url']; $this->store_user(); } $this->store_auth(); $db->commit(); $this->user_login(); }
/** * Abort with a fatal error, displaying debug information to the * user. * * @access public * * @param integer $error Error number which is assigned to a text in errors.php. * @param integer $file The file in which the error occured. * @param integer $line The line on which the error occured. * @param optional boolean $log Log this message via Horde::logMesage()? */ function fatalError($error, $file, $line, $log = true) { $errortext = _("<b>A fatal error has occurred:</b>") . "<br /><br />\n"; $errortext .= Basic::getErrorMessage($error) . "<br /><br />\n"; $errortext .= sprintf(_("[line %s of %s]"), $line, $file); /*if ($log) { $errortext .= "<br /><br />\n"; $errortext .= _("Details have been logged for the administrator."); }*/ // Hardcode a small stylesheet so that this doesn't depend on // anything else. echo <<<HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Application Framework :: Fatal Error</title> <style type="text/css"> <!-- body { font-family: Geneva,Arial,Helvetica,sans-serif; font-size: 12px; background-color: #013069; color: #ffffff; } .header { color: #000000; background-color: #ffffff; font-family: Verdana,Helvetica,sans-serif; font-size: 12px; } --> </style> </head> <body> <table border="0" align="center" width="500" cellpadding="2" cellspacing="0"> <tr><td class="header" align="center">{$errortext}</td></tr> </table> </body> </html> HTML; exit; }
function activate_group($group_id) { global $feedback; $group =& group_get_object($group_id); if (!$group || !is_object($group)) { $feedback .= _('Error creating group object') . '<br />'; return false; } else { if ($group->isError()) { $feedback .= $group->getErrorMessage() . '<br />'; return false; } } $feedback .= sprintf(_('Approving Group: %1$s'), $group->getUnixName()) . '<br />'; if (!$group->approve(session_get_user())) { $feedback .= $group->getErrorMessage() . '<br />'; return false; } $hook_params = array(); $hook_params['group_id'] = $group_id; plugin_hook("group_approved", $hook_params); //plugin webcalendar //create webcal group plugin_hook('add_cal_group', $group_id); return true; }
protected function doAction() { $sortField = $this->getInput('sort', CProfile::get('web.media_types.php.sort', 'description')); $sortOrder = $this->getInput('sortorder', CProfile::get('web.media_types.php.sortorder', ZBX_SORT_UP)); CProfile::update('web.media_type.php.sort', $sortField, PROFILE_TYPE_STR); CProfile::update('web.media_types.php.sortorder', $sortOrder, PROFILE_TYPE_STR); $config = select_config(); $data = ['uncheck' => $this->hasInput('uncheck'), 'sort' => $sortField, 'sortorder' => $sortOrder]; // get media types $data['mediatypes'] = API::Mediatype()->get(['output' => ['mediatypeid', 'description', 'type', 'smtp_server', 'smtp_helo', 'smtp_email', 'exec_path', 'gsm_modem', 'username', 'status'], 'limit' => $config['search_limit'] + 1, 'editable' => true, 'preservekeys' => true]); if ($data['mediatypes']) { // get media types used in actions $actions = API::Action()->get(['output' => ['actionid', 'name'], 'selectOperations' => ['operationtype', 'opmessage'], 'mediatypeids' => array_keys($data['mediatypes'])]); foreach ($data['mediatypes'] as &$mediaType) { $mediaType['typeid'] = $mediaType['type']; $mediaType['type'] = media_type2str($mediaType['type']); $mediaType['listOfActions'] = []; foreach ($actions as $action) { foreach ($action['operations'] as $operation) { if ($operation['operationtype'] == OPERATION_TYPE_MESSAGE && $operation['opmessage']['mediatypeid'] == $mediaType['mediatypeid']) { $mediaType['listOfActions'][$action['actionid']] = ['actionid' => $action['actionid'], 'name' => $action['name']]; } } } order_result($mediaType['listOfActions'], 'name'); } unset($mediaType); order_result($data['mediatypes'], $sortField, $sortOrder); } $url = (new CUrl('zabbix.php'))->setArgument('action', 'mediatype.list'); $data['paging'] = getPagingLine($data['mediatypes'], $sortOrder, $url); $response = new CControllerResponseData($data); $response->setTitle(_('Configuration of media types')); $this->setResponse($response); }
/** * Tries to login a user and populates self::$data on success. * * @param string $login user login * @param string $password user password * * @throws Exception if user cannot be logged in * * @return bool */ public static function login($login, $password) { try { self::setDefault(); self::$data = API::User()->login(array('user' => $login, 'password' => $password, 'userData' => true)); if (!self::$data) { throw new Exception(); } if (self::$data['gui_access'] == GROUP_GUI_ACCESS_DISABLED) { error(_('GUI access disabled.')); throw new Exception(); } if (empty(self::$data['url'])) { self::$data['url'] = CProfile::get('web.menu.view.last', 'index.php'); } $result = (bool) self::$data; if (isset(self::$data['attempt_failed']) && self::$data['attempt_failed']) { CProfile::init(); CProfile::update('web.login.attempt.failed', self::$data['attempt_failed'], PROFILE_TYPE_INT); CProfile::update('web.login.attempt.ip', self::$data['attempt_ip'], PROFILE_TYPE_STR); CProfile::update('web.login.attempt.clock', self::$data['attempt_clock'], PROFILE_TYPE_INT); $result &= CProfile::flush(); } // remove guest session after successful login $result &= DBexecute('DELETE FROM sessions WHERE sessionid=' . zbx_dbstr(get_cookie('zbx_sessionid'))); if ($result) { self::setSessionCookie(self::$data['sessionid']); add_audit_ext(AUDIT_ACTION_LOGIN, AUDIT_RESOURCE_USER, self::$data['userid'], '', null, null, null); } return $result; } catch (Exception $e) { self::setDefault(); return false; } }
function GetTldInfo($params = null) { $ret = parent::GetTldInfo($params); $registry = $this->registry_factory->GetRegistryByExtension($params["tld"]); $manifest = $registry->GetManifest(); $contacts = new stdClass(); // Get contact type groups from module manifest $groups = array(); $XmlGroups = $manifest->GetSectionConfig()->xpath('contact_groups/group'); foreach ($XmlGroups as $XmlGroup) { $group = new stdClass(); $group->name = "{$XmlGroup->attributes()->name}"; $group->title = _($XmlGroup->attributes()->title); $group->fields = new stdClass(); $this->ExportDataFormFields($XmlGroup->fields->field, $group->fields); $this->ExportDataFormFields($XmlGroup->extra_fields->field, $group->fields); $groups[] = $group; } $types = array(); foreach ($manifest->GetContactTypes() as $contact_type) { $config = $manifest->GetContactConfig($contact_type); $type = new stdClass(); $type->name = "{$config->attributes()->type}"; $type->group = "{$config->attributes()->group}"; $type->required = "{$config->attributes()->required}"; $types[] = $type; } $contacts->groups = new stdClass(); $contacts->groups->group = $groups; $contacts->types = new stdClass(); $contacts->types->type = $types; $ret->contacts = $contacts; return $ret; }
function toStringEdit ($post_vars = "", $faulty_values = "", $edit_form = "", $anker = "") { if ($faulty_values == '') $faulty_values = array(); $out = ''; $tag_headline = ''; $table = ''; if ($edit_form == '') $edit_form = new ExternEditHtml($this->config, $post_vars, $faulty_values, $anker); $edit_form->setElementName($this->getName()); $element_headline = $this->getEditFormHeadline($edit_form); $headline = $edit_form->editHeadline(_("Allgemeine Angaben")); $title = _("Link-Text:"); $info = _("Geben Sie den Text ein, der auf die übergeordnete Ebene verweist (Link zurück)."); $content = $edit_form->editTextfieldGeneric("linktext", $title, $info, 25, 60); $title = _("Link-Bild (URL):"); $info = _("Geben Sie die URL eines Bildes ein, das als Link auf die übergeordnete Ebene verweist (z.B. Back-Button)."); $content .= $edit_form->editTextfieldGeneric("image", $title, $info, 40, 200); $content_table = $edit_form->editContentTable($headline, $content); $content_table .= $edit_form->editBlankContent(); $out = $content_table . $edit_form->getEditFormContent($this->attributes); $submit = $edit_form->editSubmit($this->config->getName(), $this->config->getId(), $this->getName()); $out = $edit_form->editContent($out, $submit); $out .= $edit_form->editBlank(); return $element_headline . $out; }
/** * @brief Show the folder where user have access. * @param p_type string - A for all dossiers - R for accessible folders - X forbidden folders * @param p_login is the user name * @param p_text is a part of the name where are looking for * @return nothing * */ static function show_dossier($p_type, $p_login = "", $p_text = "", $limit = 0) { $cn = new Database(); $str_limit = $limit == 0 ? '' : ' limit ' . $limit; if ($p_type == "A") { $l_sql = "select *, 'W' as priv_priv from ac_dossier where dos_name ~* \$2 or dos_description ~* \$2 ORDER BY dos_name {$str_limit} "; $a_row = $cn->get_array($l_sql, $p_text); return $a_row; } else { if ($p_type == "R") { $l_sql = "select * from jnt_use_dos\n natural join ac_dossier\n natural join ac_users\n where\n use_login=\$1\n and ( dos_name ~* \$2 or dos_description ~* \$2)\n \n order by dos_name \n {$str_limit}\n "; $a_row = $cn->get_array($l_sql, array($p_login, $p_text)); return $a_row; } else { if ($p_type == 'X') { $l_sql = ' select * from ac_dossier where dos_id not in (select dos_id from jnt_use_dos where use_id=$1) and ( dos_name ~* $2 or dos_description ~* $2) order by dos_name ' . $str_limit; $a_row = $cn->get_array($l_sql, array($p_login, $p_text)); return $a_row; } else { throw new Exception(_("Erreur paramètre")); } } } }
function __construct() { parent::__construct(); $this->description = 'Thüringer Universitäts- und Landesbibliothek Jena'; $this->z_host = "sru.gbv.de/opac-de-27"; $this->z_profile = array('1016' => _("Basisindex [ALL]"), '4' => _("Titelstichwörter [TIT]"), '5' => _("Serienstichwörter [SER]"), '21' => _("alle Klassifikationen [SYS]"), '54' => _("Signatur [SGN]"), '1004' => _("Person, Author [PER]"), '1005' => _("Körperschaften [KOR]"), '1006' => _("Kongresse [KON]"), '1007' => _("alle Nummern [NUM]"), '5040' => _("Schlagwörter [SLW]"), '8062' => _("alle Titelanfänge [TAF]"), '8580' => _("Verlagsort, Verlag [PUB]")); }
/** * Import constructor. * * @param ContactService $contactService * @param SelectionService $selectionService */ public function __construct(ContactService $contactService, SelectionService $selectionService) { parent::__construct(); $this->setAttribute('method', 'post'); $this->setAttribute('action', ''); $this->setAttribute('class', 'form-horizontal'); $selections = []; foreach ($selectionService->findAll('selection') as $selection) { /** @var $selection Selection */ if (is_null($selection->getSql())) { $selections[$selection->getId()] = $selection->getSelection(); } } asort($selections); $this->add(['type' => '\\Zend\\Form\\Element\\Select', 'name' => 'selection_id', 'options' => ["value_options" => $selections, 'empty_option' => '-- Append to existing selection', "label" => "txt-append-to-selection", "help-block" => _("txt-contact-import-append-to-selection-name-help-block")]]); $optins = []; foreach ($contactService->findAll('optIn') as $optin) { /** @var $optin OptIn */ $optins[$optin->getId()] = $optin->getOptIn(); } asort($optins); $this->add(['type' => '\\Zend\\Form\\Element\\MultiCheckbox', 'name' => 'optIn', 'options' => ["value_options" => $optins, "label" => "txt-select-opt-in", "help-block" => _("txt-contact-import-select-opt-in-help-block")]]); $this->add(['type' => '\\Zend\\Form\\Element\\Text', 'name' => 'selection', 'options' => ["label" => "txt-selection", "help-block" => _("txt-contact-import-selection-name-help-block")]]); $this->add(['type' => '\\Zend\\Form\\Element\\File', 'name' => 'file', 'options' => ["label" => "txt-file", "help-block" => _("txt-contact-import-file-requirements")]]); $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'upload', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-verify-data")]]); $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'import', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-import")]]); }
function pla_rdelete($server, $dn) { # We delete all children, not only the visible children in the tree $children = $server->getContainerContents($dn, null, 0, '(objectClass=*)', LDAP_DEREF_NEVER); if (!is_array($children) || count($children) == 0) { printf('<span style="white-space: nowrap;">%s %s...', _('Deleting'), $dn); if ($server->delete($dn)) { printf(' <span style="color:green">%s</span></span><br />', _('Success')); return true; } else { system_message(array('title' => _('Could not delete the entry.') . sprintf(' (%s)', pretty_print_dn($dn)), 'body' => ldap_error_msg($server->getErrorMessage(null), $server->getErrorNum(null)), 'type' => 'error')); } } else { foreach ($children as $child_dn) { pla_rdelete($server, $child_dn); } printf('<span style="white-space: nowrap;">%s %s...', _('Deleting'), $dn); if ($server->delete($dn)) { printf(' <span style="color:green">%s</span></span><br />', _('Success')); return true; } else { system_message(array('title' => _('Could not delete the entry.') . sprintf(' (%s)', pretty_print_dn($dn)), 'body' => ldap_error_msg($server->getErrorMessage(null), $server->getErrorNum(null)), 'type' => 'error')); } } }
/** * Constructor * * @param User $user the user for the feed * @param User $cur the current authenticated user, if any * @param boolean $indent flag to turn indenting on or off * * @return void */ function __construct($user, $cur = null, $indent = true) { parent::__construct($cur, $indent); $this->user = $user; if (!empty($user)) { $profile = $user->getProfile(); $ao = ActivityObject::fromProfile($profile); array_push($ao->extra, $profile->profileInfo($cur)); // XXX: For users, we generate an author _AND_ an <activity:subject> // This is for backward compatibility with clients (especially // StatusNet's clients) that assume the Atom will conform to an // older version of the Activity Streams API. Subject should be // removed in future versions of StatusNet. $this->addAuthorRaw($ao->asString('author')); $depMsg = 'Deprecation warning: activity:subject is present ' . 'only for backward compatibility. It will be ' . 'removed in the next version of StatusNet.'; $this->addAuthorRaw("<!--{$depMsg}-->\n" . $ao->asString('activity:subject')); } // TRANS: Title in atom user notice feed. %s is a user name. $title = sprintf(_("%s timeline"), $user->nickname); $this->setTitle($title); $sitename = common_config('site', 'name'); $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename); $this->setSubtitle($subtitle); $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); $logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE); $this->setLogo($logo); $this->setUpdated('now'); $this->addLink(common_local_url('showstream', array('nickname' => $user->nickname))); $self = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom')); $this->setId($self); $this->setSelfLink($self); $this->addLink(common_local_url('sup', null, null, $user->id), array('rel' => 'http://api.friendfeed.com/2008/03#sup', 'type' => 'application/json')); }
public function globalSearch() { $modules = \FreePBX::Modules()->getActiveModules(); // If I'm in device and user mode, don't display Extensions, and vice-versa. $mode = \FreePBX::Config()->get('AMPEXTENSIONS'); $retarr = array(); foreach ($modules as $rawname => $m) { if (isset($m['items'])) { foreach ($m['items'] as $k => $v) { if ($mode == "deviceanduser" && $v['name'] == "Extensions") { continue; } elseif ($mode == "extensions" && ($v['name'] == "Devices" || $v['name'] == "Users")) { continue; } \modgettext::push_textdomain(strtolower($m['rawname'])); $retarr[] = array("rawname" => $rawname, "rawtext" => $v['name'], "text" => _($v['name']), "type" => "get", "dest" => !empty($v['href']) ? $v['href'] : "?display={$k}"); \modgettext::pop_textdomain(); } } } $hooks = $this->FreePBX->Hooks->returnHooks(); foreach ($hooks as $hook) { $mod = $hook['module']; $hook = $hook['method']; $out = \FreePBX::$mod()->{$hook}($retarr); if (!empty($out)) { $retarr = $out; } } return $retarr; }
/** * Constructor. */ public function __construct() { $ob = new Horde_Script_File_JsDir('imp.js', 'imp'); $ob->jsvars = array('IMP_JS.unblock_image_text' => _("Click to always show images from this sender.")); $this->_files[] = $ob; $GLOBALS['page_output']->ajax = true; }
/** * @param EntityManager $entityManager */ public function __construct(EntityManager $entityManager) { parent::__construct('doa'); $doa = new Entity\Doa(); $doctrineHydrator = new DoctrineHydrator($entityManager, 'Affiliation\\Entity\\Doa'); $this->setHydrator($doctrineHydrator)->setObject($doa); $builder = new AnnotationBuilder(); /** * Go over the different form elements and add them to the form */ foreach ($builder->createForm($doa)->getElements() as $element) { /** * Go over each element to add the objectManager to the EntitySelect */ if ($element instanceof EntitySelect) { $element->setOptions(['object_manager' => $entityManager]); } //Add only when a type is provided if (array_key_exists('type', $element->getAttributes())) { $this->add($element); } } $this->add(['type' => '\\Zend\\Form\\Element\\Select', 'name' => 'contact', 'options' => ["label" => "txt-signer"]]); $this->add(['type' => '\\Zend\\Form\\Element\\File', 'name' => 'file', 'options' => ["label" => "txt-source-file", "help-block" => _("txt-attachment-requirements")]]); }