/** * Execute specific controller action * * @access public * @param string $action * @return InvalidControllerActionError if action name is not valid or true */ function execute($action) { // Prepare action name $action = trim(strtolower($action)); // If we have valid action execute and done... Else throw exception if($this->validAction($action)) { $this->setAction($action); $ret = true; Hook::fire('before_action', array( 'controller' => $this, 'action' => $action ), $ret); if ($ret) { TimeIt::start("Action"); $this->$action(); TimeIt::stop(); Hook::fire('after_action', array( 'controller' => $this, 'action' => $action ), $ret); } return true; } else { throw new InvalidControllerActionError($this->getControllerName(), $action); } // if } // execute
public function text() { $text = nl2br($this->entity->text); //turn links to clickable $text = app('App\\Repositories\\PostRepository')->turnLinks($text); return \Hook::fire('post-text', $text); }
/** * Render user box * * @param User $user * @return null */ function render_user_box(Contact $user) { tpl_assign('_userbox_user', $user); $crumbs = array(); $crumbs[] = array( 'url' => get_url('help','help_options', array('current' => 'help')), 'text' => lang('help'), ); $crumbs[] = array( 'url' => logged_user()->getAccountUrl(), 'target' => 'account', 'text' => lang('account'), ); if (logged_user()->isExecutiveGroup()) { $crumbs[] = array( 'url' => get_url('administration', 'index'), 'target' => 'administration', 'text' => lang('administration'), ); } Hook::fire('render_userbox_crumbs', null, $crumbs); $crumbs = array_reverse($crumbs); tpl_assign('_userbox_crumbs', $crumbs); return tpl_fetch(get_template_path('user_box', 'application')); } // render_user_box
/** * Create page * * @param array $val * @return \App\Models\Page */ public function create($val) { $expected = ['title', 'description', 'website', 'url' => '', 'category']; /** * @var $title * @var $description * @var $website * @var $category * @var $url */ extract(array_merge($expected, $val)); if (!empty($title) and !empty($category)) { $page = $this->model->newInstance(); $page->title = sanitizeText($title, 130); $page->slug = sanitizeText($url); $page->user_id = \Auth::user()->id; $page->description = \Hook::fire('filter-text', sanitizeText($description)); $page->category_id = sanitizeText($category); $page->website = sanitizeText($website); $page->save(); $page->save(); $this->event->fire('page.add', [$page]); return $page; } return false; }
/** * Delete * * Removing an object is done with the delete method. Pass an id with the * request and the object should be removed. * @param int $id */ public function delete($id) { /* * Return not found by defaut, just in case you don't override it when * extending it. */ Hook::fire(Hook::EVENT_RESPONSE_NOT_FOUND); }
/** * Render user box * * @param User $user * @return null */ function render_user_box(Contact $user) { tpl_assign('_userbox_user', $user); $crumbs = array(); $crumbs[] = array('url' => get_url('help', 'help_options', array('current' => 'help')), 'text' => lang('help')); $crumbs[] = array('url' => logged_user()->getAccountUrl(), 'target' => 'account', 'text' => lang('account')); if (logged_user()->isExecutiveGroup()) { $crumbs[] = array('id' => "userbox-settings", 'url' => '#', 'text' => lang('settings'), 'onclick' => "og.openLink(og.getUrl('more','index',{more_settings_expanded:1})); return false;"); } Hook::fire('render_userbox_crumbs', null, $crumbs); $crumbs = array_reverse($crumbs); tpl_assign('_userbox_crumbs', $crumbs); return tpl_fetch(get_template_path('user_box', 'application')); }
function contactCanReadObjectTypeinMember($permission_group_ids, $member_id, $object_type_id, $can_write = false, $can_delete = false, $user = null) { if ($user instanceof Contact && $user->isAdministrator()) { return true; } $can_write_cond = $can_write ? " AND `can_write` = 1" : ""; $can_delete_cond = $can_delete ? " AND `can_delete` = 1" : ""; $ret = false; Hook::fire('can_read_ot_in_member', array('pgs' => $permission_group_ids, 'ot' => $object_type_id, 'can_write' => $can_write_cond, 'can_delete' => $can_delete_cond), $ret); if ($ret) { return $ret; } $res = DB::execute("SELECT permission_group_id FROM " . TABLE_PREFIX . "contact_member_permissions WHERE `member_id` = '{$member_id}' AND `object_type_id` = '{$object_type_id}' AND \r\n\t \t\t\t\t\t\t\t`permission_group_id` IN ( {$permission_group_ids} ) {$can_write_cond} {$can_delete_cond} limit 1"); return $res->numRows() > 0; }
/** * Render user box * * @param User $user * @return null */ function render_user_box(User $user) { tpl_assign('_userbox_user', $user); tpl_assign('_userbox_projects', $user->getActiveProjects()); $crumbs = array(); $crumbs[] = array('url' => get_url('help', 'help_options', array('current' => 'help')), 'text' => lang('help')); $crumbs[] = array('url' => logged_user()->getAccountUrl(), 'target' => 'account', 'text' => lang('account')); if (logged_user()->isMemberOfOwnerCompany() && logged_user()->isAdministrator()) { $crumbs[] = array('url' => get_url('administration', 'index'), 'target' => 'administration', 'text' => lang('administration')); } Hook::fire('render_userbox_crumbs', null, $crumbs); $crumbs = array_reverse($crumbs); tpl_assign('_userbox_crumbs', $crumbs); return tpl_fetch(get_template_path('user_box', 'application')); }
function send_reminders() { _log("Sending reminders..."); Env::useHelper('permissions'); $sent = 0; $ors = ObjectReminders::getDueReminders(); foreach ($ors as $or) { $function = $or->getType(); try { $ret = 0; Hook::fire($function, $or, $ret); $sent += $ret; } catch (Exception $ex) { _log("Error sending reminder: " . $ex->getMessage()); } } _log("$sent reminders sent."); }
/** * Method to add a report * * @param array $val * @return boolean */ public function add($val) { $expected = ['type' => '', 'url' => '', 'reason' => '']; /** * @var $type * @var $url * @var $reason */ extract($val = array_merge($expected, $val)); if (empty($reason)) { return false; } $report = $this->model->newInstance(); $report->url = sanitizeText($url); $report->user_id = \Auth::user()->id; $report->type = sanitizeText($type, 50); $report->reason = \Hook::fire('filter-text', sanitizeText($reason)); $report->save(); return true; }
/** * Method to send message to a user * * @param int $userid * @param string $text * @param string $image * @param int $fromUserid * @return bool */ public function send($userid, $text, $image = null, $fromUserid = null) { $fromUserid = $fromUserid ? $fromUserid : \Auth::user()->id; if (!$this->canSendEachOther($userid, $fromUserid)) { return false; } $conversation = $this->conversationRepository->ensureConnection($userid, $fromUserid); $photo = ''; if ($image) { $photo = $this->photoRepository->upload($image, ['path' => 'users/' . $fromUserid, 'slug' => 'messages', 'userid' => $fromUserid]); } $message = $this->model->newInstance(); $message->text = \Hook::fire('filter-text', sanitizeText($text)); $message->sender = sanitizeText($fromUserid); $message->receiver = sanitizeText($userid); $message->image = $photo; $message->conversation_id = $conversation->id; $message->save(); $this->event->fire('message.send', [$message]); $this->realTimeRepository->add($userid, 'message'); return $message; }
/** * Construct * * @return BaseProjectFileRevisions */ function __construct() { Hook::fire('object_definition', 'ProjectFileRevision', self::$columns); parent::__construct('ProjectFileRevision', 'project_file_revisions', true); }
/** * Returns a list of emails according to the requested parameters * * @param string $tag * @param array $attributes * @param Project $project * @return array */ function getEmails($account_id = null, $state = null, $read_filter = "", $classif_filter = "", $context = null, $start = null, $limit = null, $order_by = 'received_date', $dir = 'ASC', $join_params = null, $archived = false, $conversation_list = null, $only_count_result = false) { $mailTablePrefix = "e"; if (!$limit) { $limit = user_config_option('mails_per_page') ? user_config_option('mails_per_page') : config_option('files_per_page'); } $accountConditions = ""; // Check for accounts $accountConditions = ''; if (isset($account_id) && $account_id > 0) { //Single account $accountConditions = " AND {$mailTablePrefix}.account_id = " . DB::escape($account_id); } else { // show mails for all visible accounts and classified mails where logged_user has permissions so we don't filter by account_id /*// show emails from other accounts $macs = MailAccountContacts::instance()->getByContact(logged_user()); $acc_ids = array(0); foreach ($macs as $mac) $acc_ids[] = $mac->getAccountId(); // permission conditions $pgs = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId()); if (trim($pgs == '')) $pgs = '0'; $perm_sql = "(SELECT count(*) FROM ".TABLE_PREFIX."sharing_table st WHERE st.object_id = $mailTablePrefix.object_id AND st.group_id IN ($pgs)) > 0"; // show mails for all visible accounts and classified mails where logged_user has permissions $accountConditions = " AND ($mailTablePrefix.account_id IN (" . implode(",", $acc_ids) . ") OR $perm_sql)";*/ } // Check for unclassified emails $classified = ''; if ($classif_filter != '' && $classif_filter != 'all') { $persons_dim = Dimensions::findByCode('feng_persons'); $persons_dim_id = $persons_dim instanceof Dimension ? $persons_dim->getId() : "0"; $classified = "AND " . ($classif_filter == 'unclassified' ? "NOT " : ""); $classified .= "o.id IN (SELECT om.object_id FROM " . TABLE_PREFIX . "object_members om INNER JOIN " . TABLE_PREFIX . "members m ON m.id=om.member_id WHERE m.dimension_id<>{$persons_dim_id})"; } // if not filtering by account or classification then check that emails are classified or from one of my accounts if ($classified == '' && $accountConditions == '') { $macs = MailAccountContacts::instance()->getByContact(logged_user()); $acc_ids = array(0); foreach ($macs as $mac) { $acc_ids[] = $mac->getAccountId(); } $accountConditions = " AND ({$mailTablePrefix}.account_id IN (" . implode(',', $acc_ids) . ") OR EXISTS (\r\n\t\t\t\t\tSELECT om1.object_id FROM " . TABLE_PREFIX . "object_members om1 \r\n\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "members m1 ON m1.id=om1.member_id \r\n\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "dimensions d1 ON d1.id=m1.dimension_id \r\n\t\t\t\t\tWHERE om1.object_id={$mailTablePrefix}.object_id AND d1.is_manageable=1) ) "; } // Check for draft, junk, etc. emails if ($state == "draft") { $stateConditions = " {$mailTablePrefix}.state = '2'"; } else { if ($state == "sent") { $stateConditions = " {$mailTablePrefix}.state IN ('1','3','5')"; } else { if ($state == "received") { $stateConditions = " {$mailTablePrefix}.state IN ('0','5')"; } else { if ($state == "junk") { $stateConditions = " {$mailTablePrefix}.state = '4'"; } else { if ($state == "outbox") { $stateConditions = " {$mailTablePrefix}.state >= 200"; } else { $stateConditions = ""; } } } } } // Check read emails if ($read_filter != "" && $read_filter != "all") { if ($read_filter == "unread") { $read = "AND NOT "; $subread = "AND NOT mc."; } else { $read = "AND "; $subread = "AND mc."; } $read2 = "id IN (SELECT rel_object_id FROM " . TABLE_PREFIX . "read_objects t WHERE contact_id = " . logged_user()->getId() . " AND id = t.rel_object_id AND t.is_read = '1')"; $read .= $read2; $subread .= $read2; } else { $read = ""; $subread = ""; } $conversation_cond = ""; $box_cond = "AND {$stateConditions}"; if (isset($conversation_list) && $conversation_list > 0) { $conversation_cond = "AND e.conversation_last = 1"; } $extra_conditions = "{$accountConditions} {$classified} {$read} {$conversation_cond} {$box_cond}"; Hook::fire("listing_extra_conditions", null, $extra_conditions); return self::instance()->listing(array('limit' => $limit, 'start' => $start, 'order' => $order_by, 'order_dir' => $dir, 'extra_conditions' => $extra_conditions, 'count_results' => false, 'only_count_results' => $only_count_result, 'join_params' => $join_params)); }
/** * Construct * * @return BaseObjectHandins */ function __construct() { Hook::fire('object_definition', 'ObjectHandin', self::$columns); parent::__construct('ObjectHandin', 'object_handins', true); }
/** * Construct * * @return BaseUsers */ function __construct() { Hook::fire('object_definition', 'User', self::$columns); parent::__construct('User', 'users', true); }
function get_member_custom_property_value_for_listing($cp, $member_id, $cp_vals = null) { if (is_null($cp_vals)) { $cp_vals = MemberCustomPropertyValues::getMemberCustomPropertyValues($member_id, $cp->getId()); } $val_to_show = ""; foreach ($cp_vals as $cp_val) { if (in_array($cp->getType(), array('contact', 'user')) && $cp_val instanceof MemberCustomPropertyValue) { $cp_contact = Contacts::findById($cp_val->getValue()); if ($cp_contact instanceof Contact) { $cp_val->setValue($cp_contact->getObjectName()); } else { $cp_val->setValue(""); } } if ($cp->getType() == 'date' && $cp_val instanceof MemberCustomPropertyValue) { $format = user_config_option('date_format'); Hook::fire("custom_property_date_format", null, $format); $tmp_date = DateTimeValueLib::dateFromFormatAndString(DATE_MYSQL, $cp_val->getValue()); if (str_starts_with($cp_val->getValue(), EMPTY_DATE)) { $formatted = ""; } else { if (str_ends_with($cp_val->getValue(), "00:00:00")) { $formatted = $tmp_date->format(user_config_option('date_format')); } else { $formatted = $tmp_date->format($format); } } $cp_val->setValue($formatted); } if ($cp->getType() == 'address' && $cp_val instanceof MemberCustomPropertyValue) { $values = str_replace("\\|", "%%_PIPE_%%", $cp_val->getValue()); $exploded = explode("|", $values); foreach ($exploded as &$v) { $v = str_replace("%%_PIPE_%%", "|", $v); $v = str_replace("'", "\\'", $v); } if (count($exploded) > 0) { $address_type = array_var($exploded, 0, ''); $street = array_var($exploded, 1, ''); $city = array_var($exploded, 2, ''); $state = array_var($exploded, 3, ''); $country = array_var($exploded, 4, ''); $zip_code = array_var($exploded, 5, ''); $country_name = CountryCodes::getCountryNameByCode($country); $tmp = array(); if ($street != '') { $tmp[] = $street; } if ($city != '') { $tmp[] = $city; } if ($state != '') { $tmp[] = $state; } if ($zip_code != '') { $tmp[] = $zip_code; } if ($country_name != '') { $tmp[] = $country_name; } $cp_val->setValue(implode(' - ', $tmp)); } } $val_to_show .= ($val_to_show == "" ? "" : ", ") . ($cp_val instanceof MemberCustomPropertyValue ? $cp_val->getValue() : ""); } $val_to_show = html_to_text($val_to_show); return $val_to_show; }
echo lang('default name'); ?> </th><th><?php echo lang('custom name'); ?> </th></tr> <?php $isAlt = true; foreach ($custom_dimension_names as $dimension_id => $custom_dimension_name) { $isAlt = !$isAlt; $dimension = Dimensions::getDimensionById($dimension_id); if (!$dimension instanceof Dimension || !$dimension->getIsManageable()) { continue; } $default_name = lang($dimension->getCode()); Hook::fire("edit_dimension_name", array('dimension' => $dimension), $default_name); ?> <tr class="<?php echo $isAlt ? 'altRow ' : ''; ?> "> <td><?php echo $default_name; ?> </td> <td><?php echo text_field('custom_names[' . $dimension_id . ']', $custom_dimension_name, array('class' => 'long')); ?> </td>
?> </td></tr></table></div> </div> <div> <?php echo label_tag(lang('display name'), 'profileFormDisplayName'); ?> <?php echo text_field('user[display_name]', array_var($user_data, 'display_name'), array('id' => 'profileFormDisplayName', 'tabindex' => '1000', 'class' => 'title')); ?> </div> <?php $categories = array(); Hook::fire('object_edit_categories', $object, $categories); ?> <?php $cps = CustomProperties::countHiddenCustomPropertiesByObjectType('Users'); ?> <div style="padding-top:5px"> <?php if (logged_user()->isAdministrator()) { ?> <a href="#" class="option" tabindex=1010 onclick="og.toggleAndBolden('<?php echo $genid; ?> update_profile_administrator_options',this)"><?php echo lang('administrator options'); ?>
/** * Construct * * @return BaseProjectChartParams */ function __construct() { Hook::fire('object_definition', 'ProjectChartParam', self::$columns); parent::__construct('ProjectChartParam', 'project_chart_params', true); }
function __construct() { Hook::fire ( 'object_definition', 'Widget', self::$columns ); parent::__construct ( 'Widget', 'widgets', true ); } // __construct
/** * Construct * * @return BaseContacts */ function __construct() { Hook::fire('object_definition', 'Contact', self::$columns); parent::__construct('Contact', 'contacts', true); }
/** * Construct * * @return BaseObjectProperties */ function __construct() { Hook::fire('object_definition', 'ObjectProperty', self::$columns); parent::__construct('ObjectProperty', 'object_properties', true); } // __construct
/** * @author Ignacio Vazquez <elpepe.uy at gmail dot com> * Handle quick add submit */ function quick_add() { if (array_var($_GET, 'current') == 'overview-panel') { ajx_current("reload"); }else { ajx_current("empty"); } //---------- REQUEST PARAMS -------------- // $_POST = Array ( // [member] => Array ( // [name] => pepe 333 // [dimension_id] => 1 // [parent_member_id] => 0 // [dimension_id] => 19 // ) // [contact] => Array ( // [email] => slkdjflksjdflksdf@kldsjflkdf.com // [user] => Array ( // [create-user]=>on // [type] => 25 // [first_name] => // [surname] => // ) //---------------------------------------- // Init variables $max_users = config_option('max_users'); if ($max_users && (Contacts::count() >= $max_users)) { flash_error(lang('maximum number of users reached error')); ajx_current("empty"); return; } if (!can_manage_security(logged_user())) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } $email = trim(array_var(array_var($_POST, 'contact'),'email')) ; $member = array_var($_POST, 'member'); $name = array_var($member, 'name'); $firstName = trim(array_var(array_var($_POST, 'contact'),'first_name')); $surname = trim(array_var(array_var($_POST, 'contact'),'surname')); $parentMemberId = array_var($member, 'parent_member_id'); $objectType = ObjectTypes::findById(array_var($member, 'object_type_id'))->getName(); // 'person', 'company' $dimensionId = array_var($member, 'dimension_id'); $company = array_var(array_var(array_var($_POST, 'contact'),'user'),'company_id'); // Create new instance of Contact and set the basic fields $contact = new Contact(); $contact->setObjectName($name); if ($firstName) { $contact->setFirstName($firstName); }else{ $contact->setFirstName($name); } if ($surname) { $contact->setSurname($surname); } $contact->setCompanyId($company); $contact->setIsCompany($objectType == "company"); if ($parentMemberId){ if ( $companyId = Members::findById($parentMemberId)->getObjectId()) { $contact->setCompanyId($companyId); } } // Save Contact try { DB::beginWork(); $contact->save(); if ($email && is_valid_email($email)) { if (!Contacts::validateUniqueEmail($email)) { DB::rollback(); flash_error(lang("email address must be unique")); return false; }else{ if (!array_var (array_var(array_var($_POST, 'contact'),'user'), 'create-user')) { $contact->addEmail($email, 'personal', true); } flash_success(lang("success add contact", $contact->getObjectName())); } } // User settings $user = array_var(array_var($_POST, 'contact'),'user'); $user['username'] = str_replace(" ","",strtolower($name)) ; $this->createUserFromContactForm($user, $contact->getId(), $email); // Reload contact again due to 'createUserFromContactForm' changes Hook::fire("after_contact_quick_add", Contacts::instance()->findById($contact->getId()), $ret); DB::commit(); }catch (Exception $e){ DB::rollback(); flash_error($e->getMessage()); } // Reload evt_add("reload dimension tree", array('dim_id' => $dimensionId)); }
enterMode: CKEDITOR.ENTER_DIV, shiftEnterMode: CKEDITOR.ENTER_BR, disableNativeSpellChecker: false, language: '<?php echo $loc ?>', customConfig: '', toolbar: [ ['Font','FontSize','-','Bold','Italic','Underline', 'Strike', '-', 'Blockquote', 'SpellChecker', 'Scayt','-', 'TextColor','BGColor','RemoveFormat','-', 'Link','Unlink','-', 'NumberedList','BulletedList','-', 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'] ], on: { instanceReady: function(ev) { og.adjustCkEditorArea('<?php echo $genid ?>',id); editor.resetDirty(); } }, entities_additional : '#39,#336,#337,#368,#369' }); } </script> <?php // to include additional templates in the tasks list $more_content_templates = array(); Hook::fire("include_tasks_template", null, $more_content_templates); foreach ($more_content_templates as $ct) { $this->includeTemplate(get_template_path(array_var($ct, 'template'), array_var($ct, 'controller'), array_var($ct, 'plugin'))); }
/** * Construct * * @return BaseApplicationReadLogs */ function __construct() { Hook::fire('object_definition', 'ApplicationReadLog', self::$columns); parent::__construct('ApplicationReadLog', 'application_read_logs', true); }
/** * Construct * * @return BaseConfigOptions */ function __construct() { Hook::fire('object_definition', 'UserWsConfigOptionValue', self::$columns); parent::__construct('UserWsConfigOptionValue', 'user_ws_config_option_values', true); }
/** * Construct * * @return BaseCronEvents */ function __construct() { Hook::fire('object_definition', 'CronEvent', self::$columns); parent::__construct('CronEvent', 'cron_events', true); }
/** * Construct * * @return BaseWorkspaceBillings */ function __construct() { Hook::fire('object_definition', 'WorkspaceBilling', self::$columns); parent::__construct('WorkspaceBilling', 'workspace_billings', true); }
<?php set_page_title(lang('forgot password')); add_javascript_to_page('jquery/jquery.js'); $css = array(); Hook::fire('overwrite_login_css', null, $css); foreach ($css as $c) { echo stylesheet_tag($c); } ?> <!--[if IE 7]> <?php echo stylesheet_tag("og/ie7.css"); ?> <![endif]--> <!--[if IE 8]> <?php echo stylesheet_tag("og/ie8.css"); ?> <![endif]--> <div class="header-container"> <div class="header"> <?php if (Plugins::instance()->isActivePlugin('custom_login')) { echo_custom_logo_url(); } else { ?> <a class="logo" href="http://www.fengoffice.com"></a> <?php } ?>
/** * Construct * * @return BaseExternalCalendarUsers */ function __construct() { Hook::fire('object_definition', 'ExternalCalendarUser', self::$columns); parent::__construct('ExternalCalendarUser', 'external_calendar_users', true); }