static function getGroupConfigAll($configType = NULL) { if (isset($configType)) { $result = DocUsergroupConfig::findBySQL('usergroup IS NOT NULL AND is_group_config = ' . $configType . ' ORDER BY usergroup'); } else { $result = DocUsergroupConfig::findBySQL('usergroup IS NOT NULL ORDER BY usergroup'); } $data = array(); foreach ($result as $group) { $bar['id'] = $group['id']; $bar['name'] = $group['usergroup']; if ($group['is_group_config'] == 0) { $user = new User($group['usergroup']); //User::findByDatafield('user_id', $group['usergroup']); $bar['name'] = $user->getFullName(); } $bar['upload_quota'] = $group['upload_quota']; $bar['upload_unit'] = $group['upload_unit']; $bar['quota'] = $group['quota']; $bar['quota_unit'] = $group['quota_unit']; $bar['forbidden'] = $group['upload_forbidden']; $bar['types'] = DocUsergroupConfig::getForbiddenTypesNameFromGroup($group['usergroup']); $bar['closed'] = $group['area_close']; $data[] = $bar; } return $data; }
/** * Modifies an Issue's Reporter. * * @param integer $issue_id The id of the issue. * @param string $fullname The id of the user. * @param boolean $add_history If this should be logged. * @return int */ public static function update($issue_id, $email, $add_history = true) { $email = strtolower(Mail_Helper::getEmailAddress($email)); $usr_id = User::getUserIDByEmail($email, true); // If no valid user found reset to system account if (!$usr_id) { $usr_id = APP_SYSTEM_USER_ID; } $sql = 'UPDATE {{%issue}} SET iss_usr_id = ? WHERE iss_id = ?'; try { DB_Helper::getInstance()->query($sql, array($usr_id, $issue_id)); } catch (DbException $e) { return -1; } if ($add_history) { // TRANSLATORS: %1: email, %2: full name $current_usr_id = Auth::getUserID(); History::add($issue_id, $current_usr_id, 'issue_updated', 'Reporter was changed to {email} by {user}', array('email' => $email, 'user' => User::getFullName($current_usr_id))); } // Add new user to notification list if ($usr_id > 0) { Notification::subscribeEmail($usr_id, $issue_id, $email, Notification::getDefaultActions()); } return 1; }
/** * eventAddFeed * This event is triggered when the note is added in the * contact.php page. * Its the last event and assume that the ContactNoteEditSave has * a primary key from the database table. * This event action prepare all the data so no additional query is needed * in the display table. * @param EventControler */ function eventAddFeed(EventControler $evtcl) { $this->note = $_SESSION['ContactNoteEditSave']->note; $this->iduser = $evtcl->iduser_for_feed; $this->idcontact = $_SESSION['ContactNoteEditSave']->idcontact; $this->idcontact_note = $_SESSION['ContactNoteEditSave']->idcontact_note; $user = new User(); $user->getId($this->iduser); $do_contact = new Contact(); $do_contact->getId($this->idcontact); if ($evtcl->added_by_cont == 'Yes') { $this->added_by = $do_contact->getContactFullName(); } else { $this->added_by = $user->getFullName(); } $this->contact_full_name = $do_contact->getContactFullName(); $this->contact_image_url = $do_contact->getContactPicture(); if (strlen($this->note) > 200) { $this->note = substr($this->note, 0, 200); $this->more = True; } else { $this->more = false; } $user_relation = new ContactSharing(); $user_array = $user_relation->getCoWorkerByContact($this->idcontact); @array_push($user_array, $this->iduser); if (!is_array($user_array) || $user_array === false) { $user_array = array($evtcl->iduser_for_feed); } //print_r($user_array);exit; $this->addFeed($user_array); }
function setUser(User $user) { if ($user) { $this->user_id = $user->id; $this->token = sha1($user->id . $user->getFullName() . time()); } }
function sendVehicleDeletedMessage() { $addedby = new User($this->vehicle->getAddedBy()); $subject = 'Vehicle Deleted with ' . WEB_FULL_NAME; $message = "Dear " . $this->admin->getFullName() . ",<br /><br />\n\n You have successfully removed vehicle with us.<br />\n\n\n Vehicle Added Under Company : {$this->company->getName()}<br /><br />\n\n Vehicle Added By : {$addedby->getFullName()}<br /><br />\n\n Vehicle Details :<br /><br />\n Vehicle Type : {$this->vehicle->getType()} <br />\n Vehicle Model : {$this->vehicle->getModel()} <br />\n Make Year: {$this->vehicle->getMakeYear()} <br /><br />\n Vehicle Number: {$this->vehicle->getVehicleNumber()} <br /><br />\n Description: {$this->vehicle->getType()} <br /><br />\n Adding Date : {$this->vehicle->getDateAdded()} <br /><br />\n\n Vehicle Activate Date : {$this->vehicle->getVehicleDepolyDate()} <br /><br />\n\n Vehicle Deactivate Date : {$this->vehicle->getVehicleDeActivatedDate()} <br /><br />"; $message = Mailer::makeMessage($message); return Mailer::SendMail($this->admin->getEmail(), $subject, $message); }
public static function add(User $user) { $insertUser = Db::pdoConnect()->prepare("INSERT INTO user SET full_name=:fullname, user_password=:user_password, user_email=:user_email"); $insertUser->bindValue(':fullname', $user->getFullName(), PDO::PARAM_STR); $insertUser->bindValue(':user_password', $user->getPassword(), PDO::PARAM_STR); $insertUser->bindValue(':user_email', $user->getUserEmail(), PDO::PARAM_STR); $insertUser->execute(); $lastId = Db::pdoConnect()->lastInsertId(); $user->setUserId($lastId); return $user; }
public function authenticate() { $user = new User(); if ($user->authenticate($this->username, $this->password)) { $this->_id = $user->userID; $this->setState('employeeID', $user->getEmployeeID()); $this->setState('fullName', $user->getFullName()); $this->errorCode = self::ERROR_NONE; } else { $this->errorCode = self::ERROR_UNKNOWN_IDENTITY; } return $this->errorCode == self::ERROR_NONE; }
/** * A custom method within the Plugin to generate the content * * @return string : HTML */ function generateTimesheetBlock() { $output = ''; $do_project_block = new Project(); $do_project_rel = new ProjectSharing(); $all_users = $do_project_rel->getAllUsersFromProjectRel(); $do_user_tab = new User(); $users_array = array(); if (is_array($all_users) && count($all_users) > 0) { foreach ($all_users as $users) { $users_array[] = $users["iduser"]; $users_array[] = $users["idcoworker"]; } $users_array = array_unique($users_array); //$users_array = array_pop($users_array,$_SESSION['do_User']->iduser); $do_prob_dis_tab = new TimesheetBlockProjectDiscuss(); $do_prob_dis_tab->getAllProjectHoursForCoWorker($users_array); if ($do_prob_dis_tab->getNumRows() > 0) { $tot_hr = 0; $used_project = array(); $result_array = array(); while ($do_prob_dis_tab->next()) { if (!in_array($do_prob_dis_tab->idproject, $used_project)) { $user_data_array = array(); $used_project[] = $do_prob_dis_tab->idproject; } //$data = array("project_name"=>$do_prob_dis_tab->name,"iduser"=>$do_prob_dis_tab->iduser,"hours"=>$do_prob_dis_tab->hours_work); $data = array("hours" => $do_prob_dis_tab->hours_work); //$result_array[$do_prob_dis_tab->idproject][$do_prob_dis_tab->name][$do_prob_dis_tab->iduser][] = $data ; $result_array[$do_prob_dis_tab->iduser][] = $data; } foreach ($result_array as $key => $value) { $output .= '<hr>'; $output .= '<b>' . $do_user_tab->getFullName($key) . '</b><br />'; $tot_hour = 0.0; foreach ($value as $hour) { $h = (double) $hour["hours"]; $tot_hour += $h; } $output .= $tot_hour . ' hrs <br />'; $tot_hour = 0.0; } $output .= '<hr>'; return $output; } else { $this->setIsActive(false); } } else { $this->setIsActive(false); } }
function eventAddFeed($coworkerid, $projectid) { $do_project = new Project(); $do_project->getId($projectid); $this->project_name = $do_project->getProjectName(); $user = array($coworkerid); $this->iduser = $_SESSION["do_User"]->iduser; $do_user = new User(); $do_user->getId($this->iduser); $this->user_full_name = $do_user->getFullName(); $this->idcontact = $coworkerid; $this->idproject = $projectid; $this->addFeed($user); }
/** * @return Zend_Mail * @throws Zend_Mail_Protocol_Exception */ public static function getMail(Exception $ex, User $user, $errors) { $exceptionClass = get_class($ex); $stack = $ex->getTraceAsString(); $stackDetail = print_r($errors, true); $currentUrl = Zend_OpenId::selfURL(); if ($user->role = ROLE_GUEST) { $userLabel = 'Anonymous'; } else { $userLabel = $user->getFullName() . '(' . $user->username . ')'; } $body = <<<EOD Dear Admin, An error has occured in your Community-ID installation. URL requested: {$currentUrl} By User: {$userLabel} Exception: {$exceptionClass} Call stack: {$stack} Call stack detail: {$stackDetail} EOD; // can't use $this-_config 'cause it's a static function $configEmail = Zend_Registry::get('config')->email; switch (strtolower($configEmail->transport)) { case 'smtp': Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp($configEmail->host, $configEmail->toArray())); break; case 'mock': Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Mock()); break; default: Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Sendmail()); } $mail = new Zend_Mail(); $mail->setBodyText($body); $mail->setFrom($this->_config->email->supportemail); $mail->addTo($configEmail->adminemail); $mail->setSubject('Community-ID error report'); return $mail; }
/** * Method used to remove a specific list of checkins * * @param int[] $items list to remove * @return integer 1 if the update worked, -1 otherwise */ public static function remove($items) { $itemlist = DB_Helper::buildList($items); $stmt = "SELECT\n isc_iss_id\n FROM\n {{%issue_checkin}}\n WHERE\n isc_id IN ({$itemlist})"; $issue_id = DB_Helper::getInstance()->getOne($stmt, $items); $stmt = "DELETE FROM\n {{%issue_checkin}}\n WHERE\n isc_id IN ({$itemlist})"; try { DB_Helper::getInstance()->query($stmt, $items); } catch (DbException $e) { return -1; } // need to mark this issue as updated Issue::markAsUpdated($issue_id); $usr_id = Auth::getUserID(); History::add($issue_id, $usr_id, 'scm_checkin_removed', 'SCM Checkins removed by {user}', array('user' => User::getFullName($usr_id))); return 1; }
/** * eventAddFeed * This event is triggered when the note is added in the * contact.php page. * Its the last event and assume that the ContactNoteEditSave has * a primary key from the database table. * This event action prepare all the data so no additional query is needed * in the display table. * @param EventControler */ function eventAddFeed(EventControler $evtcl) { $this->note = $_SESSION['ContactNoteEditSave']->note; $this->iduser = $_SESSION['ContactNoteEditSave']->iduser; $this->idcontact = $_SESSION['ContactNoteEditSave']->idcontact; $this->idcontact_note = $_SESSION['ContactNoteEditSave']->idcontact_note; $user = new User(); $user->getId($this->iduser); $this->user_full_name = $user->getFullName(); $do_contact = new Contact(); $do_contact->getId($this->idcontact); $this->contact_full_name = $do_contact->getContactFullName(); $this->contact_image_url = $do_contact->getContactPicture(); if (strlen($this->note) > 200) { $this->note = substr($this->note, 0, 200); $this->more = True; } else { $this->more = false; } $user_relation = new ContactSharing(); $this->addFeed($user_relation->getCoWorkerByContact($this->idcontact)); }
public function submitMailingList($message, $first = false) { global $PROJECT_MAILING_LIST; $projectUser = new User($this->getUserId()); $from = new DateTime($this->getFromDate()); $toEmail = $PROJECT_MAILING_LIST . '@googlegroups.com'; $subject = 'Storage Request #' . $this->getId() . ': ' . $this->getName() . ' by ' . htmlspecialchars($projectUser->getFullName()); $headers = 'From: no-reply@london.hackspace.org.uk' . "\r\n" . 'Reply-To: no-reply@london.hackspace.org.uk' . "\r\n" . 'Content-Type:text/html;charset=utf-8' . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n"; $id = '<storage-' . $this->getId() . '-' . $this->getUserId() . '-' . $from->format('YmdHis') . '@london.hackspace.org.uk>'; // if this is the 1st message about this project to the list give it a predictable message id if ($first) { $headers .= 'Message-Id: ' . $id . "\r\n"; } else { // then in later messages we can refer to that message id so we get better threading // (we don't need to bother with a message id for subsequent messages, our mta should add one). // $headers .= 'References: ' . $id . "\r\n"; } if (mail($toEmail, $subject, $message, $headers)) { // log the post $this->submitLog('Posted to the Mailing List', false); } }
@($issue_id = $HTTP_GET_VARS["issue_id"] ? $HTTP_GET_VARS["issue_id"] : $HTTP_POST_VARS["issue_id"]); $details = Issue::getDetails($issue_id); $tpl->assign("issue_id", $issue_id); $tpl->assign("issue", $details); if (!Issue::canAccess($issue_id, $usr_id)) { $tpl->setTemplate("permission_denied.tpl.html"); $tpl->displayTemplate(); exit; } if (@$HTTP_POST_VARS["cat"] == "post_note") { // change status if (!@empty($HTTP_POST_VARS['new_status'])) { $res = Issue::setStatus($issue_id, $HTTP_POST_VARS['new_status']); if ($res != -1) { $new_status = Status::getStatusTitle($HTTP_POST_VARS['new_status']); History::add($issue_id, $usr_id, History::getTypeID('status_changed'), "Status changed to '{$new_status}' by " . User::getFullName($usr_id)); } } $res = Note::insert($usr_id, $issue_id); $tpl->assign("post_result", $res); // enter the time tracking entry about this phone support entry if (!empty($HTTP_POST_VARS['time_spent'])) { $HTTP_POST_VARS['issue_id'] = $issue_id; $HTTP_POST_VARS['category'] = $HTTP_POST_VARS['time_category']; $HTTP_POST_VARS['summary'] = 'Time entry inserted when sending an internal note.'; Time_Tracking::insertEntry(); } } elseif (@$HTTP_GET_VARS["cat"] == "reply") { if (!@empty($HTTP_GET_VARS["id"])) { $note = Note::getDetails($HTTP_GET_VARS["id"]); $date = Misc::formatReplyDate($note["timestamp"]);
/** * Converts a note to a draft or an email * * @param int $note_id The id of the note * @param string $target What the note should be converted too (email, etc) * @param bool $authorize_sender If $authorize_sender If the sender should be added to authorized senders list. * @return int */ public static function convertNote($note_id, $target, $authorize_sender = false) { $issue_id = self::getIssueID($note_id); $email_account_id = Email_Account::getEmailAccount(); $blocked_message = self::getBlockedMessage($note_id); $unknown_user = self::getUnknownUser($note_id); $structure = Mime_Helper::decode($blocked_message, true, true); $body = $structure->body; $sender_email = strtolower(Mail_Helper::getEmailAddress($structure->headers['from'])); $current_usr_id = Auth::getUserID(); if ($target == 'email') { if (Mime_Helper::hasAttachments($structure)) { $has_attachments = 1; } else { $has_attachments = 0; } list($blocked_message, $headers) = Mail_Helper::rewriteThreadingHeaders($issue_id, $blocked_message, @$structure->headers); $t = array('issue_id' => $issue_id, 'ema_id' => $email_account_id, 'message_id' => @$structure->headers['message-id'], 'date' => Date_Helper::getCurrentDateGMT(), 'from' => @$structure->headers['from'], 'to' => @$structure->headers['to'], 'cc' => @$structure->headers['cc'], 'subject' => @$structure->headers['subject'], 'body' => @$body, 'full_email' => @$blocked_message, 'has_attachment' => $has_attachments, 'headers' => $headers); // need to check for a possible customer association if (!empty($structure->headers['from'])) { $details = Email_Account::getDetails($email_account_id); // check from the associated project if we need to lookup any customers by this email address if (CRM::hasCustomerIntegration($details['ema_prj_id'])) { $crm = CRM::getInstance($details['ema_prj_id']); // check for any customer contact association try { $contact = $crm->getContactByEmail($sender_email); $issue_contract = $crm->getContract(Issue::getContractID($issue_id)); if ($contact->canAccessContract($issue_contract)) { $t['customer_id'] = $issue_contract->getCustomerID(); } } catch (CRMException $e) { } } } if (empty($t['customer_id'])) { $update_type = 'staff response'; $t['customer_id'] = null; } else { $update_type = 'customer action'; } $res = Support::insertEmail($t, $structure, $sup_id); if ($res != -1) { Support::extractAttachments($issue_id, $structure); // notifications about new emails are always external $internal_only = false; // special case when emails are bounced back, so we don't want to notify the customer about those if (Notification::isBounceMessage($sender_email)) { $internal_only = true; } Notification::notifyNewEmail($current_usr_id, $issue_id, $t, $internal_only, false, '', $sup_id); Issue::markAsUpdated($issue_id, $update_type); self::remove($note_id, false); History::add($issue_id, $current_usr_id, 'note_converted_email', 'Note converted to e-mail (from: {from}) by {user}', array('from' => @$structure->headers['from'], 'user' => User::getFullName($current_usr_id))); // now add sender as an authorized replier if ($authorize_sender) { Authorized_Replier::manualInsert($issue_id, @$structure->headers['from']); } } return $res; } // save message as a draft $res = Draft::saveEmail($issue_id, $structure->headers['to'], $structure->headers['cc'], $structure->headers['subject'], $body, false, $unknown_user); // remove the note, if the draft was created successfully if ($res) { self::remove($note_id, false); $usr_id = $current_usr_id; History::add($issue_id, $usr_id, 'note_converted_draft', 'Note converted to draft (from: {from}) by {user}', array('from' => @$structure->headers['from'], 'user' => User::getFullName($current_usr_id))); } return $res; }
/** * Method used to remotely add an authorized replier to a given issue. * * @param integer $issue_id The issue ID * @param integer $usr_id The user ID of the person performing the change * @param boolean $replier The user ID of the authorized replier * @return integer The status ID */ public static function remoteAddAuthorizedReplier($issue_id, $usr_id, $replier) { $res = self::manualInsert($issue_id, $replier, false); if ($res != -1) { // save a history entry about this... History::add($issue_id, $usr_id, 'remote_replier_added', '{replier} remotely added to authorized repliers by {user}', array('replier' => $replier, 'user' => User::getFullName($usr_id))); } return $res; }
echo $location->getSeq(); ?> " /> <div class="form-group"> <label class="col-sm-2 control-label">Location</label> <div class="col-sm-10"> <?php echo DropDownUtils::getUserLocationsDropDown($seq, "l_DropDown", "", $locationSeq); ?> </div> </div> <div class="form-group"> <label class="col-lg-2 control-label">Full Name</label> <div class="col-lg-10"> <input type="text" name="fullName" placeholder="Full Name" required="required" value="<?php echo $user->getFullName(); ?> " class="form-control"> </div> </div> <div class="form-group"> <label class="col-lg-2 control-label">User Name</label> <div class="col-lg-10"> <input type="text" name="username" placeholder="User Name" required="required" value="<?php echo $user->getUserName(); ?> " class="form-control"> </div> </div> <div class="form-group"> <label class="col-lg-2 control-label">Password</label>
$marginRate = $pa != 0 ? -1 * (100 * $marge / $pa) : ''; $markRate = $pv != 0 ? -1 * (100 * $marge / $pv) : ''; } else { $marginRate = $pa != 0 ? 100 * $marge / $pa : ''; $markRate = $pv != 0 ? 100 * $marge / $pv : ''; } $var = !$var; print "<tr " . $bc[$var] . ">"; if ($agentid > 0) { $companystatic->id = $objp->socid; $companystatic->nom = $objp->nom; $companystatic->client = $objp->client; print "<td>" . $companystatic->getNomUrl(1, 'customer') . "</td>\n"; } else { $userstatic->fetch($objp->agent); print "<td>" . $userstatic->getFullName($langs, 0, 0, 0) . "</td>\n"; } print "<td align=\"right\">" . price($pv, null, null, null, null, $rounding) . "</td>\n"; print "<td align=\"right\">" . price($pa, null, null, null, null, $rounding) . "</td>\n"; print "<td align=\"right\">" . price($marge, null, null, null, null, $rounding) . "</td>\n"; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { print "<td align=\"right\">" . ($marginRate === '' ? 'n/a' : price($marginRate, null, null, null, null, $rounding) . "%") . "</td>\n"; } if (!empty($conf->global->DISPLAY_MARK_RATES)) { print "<td align=\"right\">" . ($markRate === '' ? 'n/a' : price($markRate, null, null, null, null, $rounding) . "%") . "</td>\n"; } print "</tr>\n"; $i++; } } print "</table>";
$head = prelevement_prepare_head($bon); dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), '', 'payment'); print '<table class="border" width="100%">'; print '<tr><td width="20%">' . $langs->trans("Ref") . '</td><td>' . $bon->getNomUrl(1) . '</td></tr>'; print '<tr><td width="20%">' . $langs->trans("Date") . '</td><td>' . dol_print_date($bon->datec, 'day') . '</td></tr>'; print '<tr><td width="20%">' . $langs->trans("Amount") . '</td><td>' . price($bon->amount) . '</td></tr>'; // Status print '<tr><td width="20%">' . $langs->trans('Status') . '</td>'; print '<td>' . $bon->getLibStatut(1) . '</td>'; print '</tr>'; if ($bon->date_trans != 0) { $muser = new User($db); $muser->fetch($bon->user_trans); print '<tr><td width="20%">' . $langs->trans("TransData") . '</td><td>'; print dol_print_date($bon->date_trans, 'day'); print ' ' . $langs->trans("By") . ' ' . $muser->getFullName($langs) . '</td></tr>'; print '<tr><td width="20%">' . $langs->trans("TransMetod") . '</td><td>'; print $bon->methodes_trans[$bon->method_trans]; print '</td></tr>'; } if ($bon->date_credit != 0) { print '<tr><td width="20%">' . $langs->trans('CreditDate') . '</td><td>'; print dol_print_date($bon->date_credit, 'day'); print '</td></tr>'; } print '</table>'; print '<br>'; print '<table class="border" width="100%"><tr><td width="20%">'; print $langs->trans("WithdrawalFile") . '</td><td>'; $relativepath = 'receipts/' . $bon->ref; print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?type=text/plain&modulepart=prelevement&file=' . urlencode($relativepath) . '">' . $relativepath . '</a>';
/** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ function _load_ldap_info() { global $conf, $langs; $info = array(); // Object classes $info["objectclass"] = explode(',', $conf->global->LDAP_GROUP_OBJECT_CLASS); // Champs if ($this->name && !empty($conf->global->LDAP_GROUP_FIELD_FULLNAME)) { $info[$conf->global->LDAP_GROUP_FIELD_FULLNAME] = $this->name; } //if ($this->name && ! empty($conf->global->LDAP_GROUP_FIELD_NAME)) $info[$conf->global->LDAP_GROUP_FIELD_NAME] = $this->name; if ($this->note && !empty($conf->global->LDAP_GROUP_FIELD_DESCRIPTION)) { $info[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION] = $this->note; } if (!empty($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)) { $valueofldapfield = array(); foreach ($this->members as $key => $val) { $muser = new User($this->db); $muser->fetch($val->id); if ($conf->global->LDAP_KEY_USERS == 'cn') { $ldapuserid = $muser->getFullName($langs); } elseif ($conf->global->LDAP_KEY_USERS == 'sn') { $ldapuserid = $muser->lastname; } elseif ($conf->global->LDAP_KEY_USERS == 'uid') { $ldapuserid = $muser->login; } $valueofldapfield[] = $conf->global->LDAP_KEY_USERS . '=' . $ldapuserid . ',' . $conf->global->LDAP_USER_DN; } $info[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] = !empty($valueofldapfield) ? $valueofldapfield : ''; } return $info; }
} ?> <p><?php echo nl2br(stripslashes($project->getDescription())); ?> </p> <br/> <hr/> <strong>Activity log</strong><br/><br/> <ul> <?php foreach ($projectslogs as $log) { $userURL = ''; if ($log->getUserId() != null) { $logUser = new User($log->getUserId()); $userURL = ' by <a href="/members/member.php?id=' . $log->getUserId() . '">' . htmlspecialchars($logUser->getFullName()) . '</a>'; } echo '<li><span class="light-color">' . date('g:ia jS M', $log->getTimestamp()) . '</span> | ' . str_replace('Mailing List', '<a target="_blank" href="' . $project->getMailingListURL() . '">Mailing List</a>', $log->getDetails()) . $userURL . '</li>'; } ?> </ul> <?php if ($user->getId() != $project->getUserId() || $user->isAdmin()) { ?> <hr/> <form class="form-inline" role="form" method="post"> <strong>Update Status</strong><br/> <p><small>Status changes are notified to the mailing list (except for archived).</small></p> <input type="hidden" name="token" value="<?php echo fRequest::generateCSRFToken(); ?>
<a href="<?php echo PluginEngine::getLink($plugin, array(), "market/profile/" . $user->getId()); ?> "> <?php echo htmlReady($user->name); ?> </a> <? else : ?> <? $user = new User($review['user_id']) ?> <a href="<?php echo URLHelper::getLink("dispatch.php/profile", array('username' => $user['username'])); ?> "> <?php echo htmlReady($user->getFullName()); ?> </a> <? endif ?> </strong> <span class="origin">(<?php echo htmlReady($review['host_id'] ? $review->host['name'] : $GLOBALS['UNI_NAME_CLEAN']); ?> )</span> <div class="review_text"> <?php echo formatReady($review['review']); ?> </div> <div class="stars"> <? $rating = round($review['rating'], 1) ?>
$query = "UPDATE {$GLOBALS['CONFIG']['db_prefix']}log set revision='" . intval(intval($lrevision_num) - 1) . "' WHERE id = '{$id}' and revision = 'current'"; mysql_query($query, $GLOBALS['connection']) or die("Error in query: {$query}. " . mysql_error()); $query = "INSERT INTO {$GLOBALS['CONFIG']['db_prefix']}log (id, modified_on, modified_by, note, revision) VALUES('{$id}', NOW(), '" . addslashes($username) . "', '" . addslashes($_POST['note']) . "', 'current')"; $result = mysql_query($query, $GLOBALS['connection']) or die("Error in query: {$query}. " . mysql_error()); // update file status $query = "UPDATE {$GLOBALS['CONFIG']['db_prefix']}data SET status = '0', publishable='{$lpublishable}', realname='{$filename}' WHERE id='{$id}'"; $result = mysql_query($query, $GLOBALS['connection']) or die("Error in query: {$query}. " . mysql_error()); // rename and save file $newFileName = $id . '.dat'; copy($_FILES['file']['tmp_name'], $GLOBALS['CONFIG']['dataDir'] . $newFileName); AccessLog::addLogEntry($id, 'I'); /** * Send out email notifications to reviewers */ $file_obj = new FileData($id, $GLOBALS['connection'], DB_NAME); $get_full_name = $user_obj->getFullName(); $full_name = $get_full_name[0] . ' ' . $get_full_name[1]; $department = $file_obj->getDepartment(); $reviewer_obj = new Reviewer($id, $GLOBALS['connection'], DB_NAME); $reviewer_list = $reviewer_obj->getReviewersForDepartment($department); $date = date('Y-m-d H:i:s T'); // Build email for general notices $mail_subject = msg('checkinpage_file_was_checked_in'); $mail_body2 = msg('checkinpage_file_was_checked_in') . "\n\n"; $mail_body2 .= msg('label_filename') . ': ' . $file_obj->getName() . "\n\n"; $mail_body2 .= msg('label_status') . ': ' . msg('addpage_new') . "\n\n"; $mail_body2 .= msg('date') . ': ' . $date . "\n\n"; $mail_body2 .= msg('addpage_uploader') . ': ' . $full_name . "\n\n"; $mail_body2 .= msg('email_thank_you') . ',' . "\n\n"; $mail_body2 .= msg('email_automated_document_messenger') . "\n\n"; $mail_body2 .= $GLOBALS['CONFIG']['base_url'] . "\n\n";
/** * Method used to update the values stored in the database. * * @return integer 1 if the update worked properly, any other value otherwise */ public static function updateValues() { $prj_id = Auth::getCurrentProject(); $issue_id = $_POST['issue_id']; $old_values = self::getValuesByIssue($prj_id, $issue_id); if (isset($_POST['custom_fields']) && count($_POST['custom_fields']) > 0) { $custom_fields = $_POST['custom_fields']; // get the types for all of the custom fields being submitted $cf = array_keys($custom_fields); $cf_list = DB_Helper::buildList($cf); $stmt = "SELECT\n fld_id,\n fld_type\n FROM\n {{%custom_field}}\n WHERE\n fld_id IN ({$cf_list})"; $field_types = DB_Helper::getInstance()->getPair($stmt, $cf); // get the titles for all of the custom fields being submitted $stmt = "SELECT\n fld_id,\n fld_title\n FROM\n {{%custom_field}}\n WHERE\n fld_id IN ({$cf_list})"; $field_titles = DB_Helper::getInstance()->getPair($stmt, $cf); $updated_fields = array(); foreach ($custom_fields as $fld_id => $value) { // security check $sql = 'SELECT fld_min_role FROM {{%custom_field}} WHERE fld_id = ?'; $min_role = DB_Helper::getInstance()->getOne($sql, array($fld_id)); if ($min_role > Auth::getCurrentRole()) { continue; } $option_types = array('multiple', 'combo', 'checkbox'); if (!in_array($field_types[$fld_id], $option_types)) { // check if this is a date field $fld_db_name = self::getDBValueFieldNameByType($field_types[$fld_id]); // first check if there is actually a record for this field for the issue $stmt = "SELECT\n icf_id,\n {$fld_db_name} as value\n FROM\n {{%issue_custom_field}}\n WHERE\n icf_iss_id=? AND\n icf_fld_id=?"; try { $res = DB_Helper::getInstance()->getRow($stmt, array($issue_id, $fld_id)); } catch (DbException $e) { return -1; } $icf_id = $res['icf_id']; $old_value = $res['value']; if ($old_value == $value) { continue; } if (empty($icf_id)) { // record doesn't exist, insert new record $stmt = "INSERT INTO\n {{%issue_custom_field}}\n (\n icf_iss_id,\n icf_fld_id,\n {$fld_db_name}\n ) VALUES (\n ?, ?, ?\n )"; $params = array($issue_id, $fld_id, $value); try { DB_Helper::getInstance()->query($stmt, $params); } catch (DbException $e) { return -1; } } else { // record exists, update it $stmt = "UPDATE\n {{%issue_custom_field}}\n SET\n {$fld_db_name}=?\n WHERE\n icf_id=?"; $params = array($value, $icf_id); try { DB_Helper::getInstance()->query($stmt, $params); } catch (DbException $e) { return -1; } } if ($field_types[$fld_id] == 'textarea') { $updated_fields[$field_titles[$fld_id]] = ''; } else { $updated_fields[$field_titles[$fld_id]] = History::formatChanges($old_value, $value); } } else { $old_value = self::getDisplayValue($issue_id, $fld_id, true); if (!is_array($old_value)) { $old_value = array($old_value); } if (!is_array($value)) { $value = array($value); } if (count(array_diff($old_value, $value)) > 0 || count(array_diff($value, $old_value)) > 0) { $old_display_value = self::getDisplayValue($issue_id, $fld_id); // need to remove all associated options from issue_custom_field and then // add the selected options coming from the form self::removeIssueAssociation($fld_id, $issue_id); if (@count($value) > 0) { self::associateIssue($issue_id, $fld_id, $value); } $new_display_value = self::getDisplayValue($issue_id, $fld_id); $updated_fields[$field_titles[$fld_id]] = History::formatChanges($old_display_value, $new_display_value); } } } Workflow::handleCustomFieldsUpdated($prj_id, $issue_id, $old_values, self::getValuesByIssue($prj_id, $issue_id)); Issue::markAsUpdated($issue_id); // need to save a history entry for this if (count($updated_fields) > 0) { // log the changes $changes = ''; $i = 0; foreach ($updated_fields as $key => $value) { if ($i > 0) { $changes .= '; '; } if (!empty($value)) { $changes .= "{$key}: {$value}"; } else { $changes .= "{$key}"; } $i++; } $usr_id = Auth::getUserID(); History::add($issue_id, $usr_id, 'custom_field_updated', 'Custom field updated ({changes}) by {user}', array('changes' => $changes, 'user' => User::getFullName($usr_id))); } } return 1; }
/** * Sets the assignees for the issue * * @param integer $issue_id * @param array $assignees * @return int 1 if success, -1 if error, 0 if no change was needed. */ public static function setAssignees($issue_id, $assignees) { if (!is_array($assignees)) { $assignees = array(); } // see if there is anything to change $old_assignees = self::getAssignedUserIDs($issue_id); if (count(array_diff($old_assignees, $assignees)) == 0 && count(array_diff($assignees, $old_assignees)) == 0) { return 0; } $old_assignee_names = self::getAssignedUsers($issue_id); Workflow::handleAssignmentChange(self::getProjectID($issue_id), $issue_id, Auth::getUserID(), self::getDetails($issue_id), $assignees, true); // clear up the assignments for this issue, and then assign it to the current user self::deleteUserAssociations($issue_id); $assignee_names = array(); foreach ($assignees as $assignee) { $res = self::addUserAssociation(Auth::getUserID(), $issue_id, $assignee, false); if ($res == -1) { return -1; } $assignee_names[] = User::getFullName($assignee); Notification::subscribeUser(Auth::getUserID(), $issue_id, $assignee, Notification::getDefaultActions($issue_id, User::getEmail($assignee), 'set_assignees'), false); } Notification::notifyNewAssignment($assignees, $issue_id); $usr_id = Auth::getUserID(); History::add($issue_id, $usr_id, 'user_associated', 'Issue assignment to changed ({changes}) by {user}', array('changes' => History::formatChanges(implode(', ', $old_assignee_names), implode(', ', $assignee_names)), 'user' => User::getFullName($usr_id))); return 1; }
require './header.php'; $cards = fRecordSet::build('Card', array('uid=' => $_GET['cardid'])); if ($cards->count() == 0) { fURL::redirect("/kiosk/addcard.php?cardid=" . $_GET['cardid']); } $card = $cards->getRecord(0); $user = new User($card->getUserId()); $user->load(); if (isset($_POST['print'])) { $project = new Project($_POST['print']); $project->load(); if ($project->getUserId() != $user->getId()) { print "Incorrect project ID"; exit; } $data = array('storage_id' => $project->getId(), 'name' => $project->getName(), 'ownername' => $user->getFullName(), 'more_info' => $project->getDescription(), 'completion_date' => $project->getToDate()->format('Y/m/d'), 'max_extention' => "14"); $data_string = json_encode($data); $ch = curl_init('http://kiosk.london.hackspace.org.uk:12345/print/dnh'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string))); $result = curl_exec($ch); curl_close($ch); echo "<p>Your sticker is being printed now.</p>"; } $projects = fRecordSet::build('Project', array('state_id!=' => array('6', '7'), 'user_id=' => $user->getId())); ?> <?php if ($projects->count() > 0) {
$cap_rsp = NULL; if (isset($_POST["recaptcha_response_field"])) { if ($_POST["recaptcha_response_field"] != '') { $rsp = recaptcha_check_answer($conf->RC_PrivKey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$rsp->is_valid) { $cap_rsp = $rsp->error; } } else { $cap_rsp = 'incorrect-captcha-sol'; } } if (isset($_POST['username']) && isset($_POST['password']) && $cap_rsp == NULL) { $session->login($_POST['username'], $_POST['password']); } $user = new User(); $smarty->assign("loggedinuser", preg_replace('/\\s/', ' ', $user->getFullName())); if ($user->getId() == 0) { login_page($smarty); } if (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) != 'index.php') { $smarty->assign("menu_current", $src . basename($_SERVER['PHP_SELF'])); } else { $smarty->assign("menu_current", $base); } if ($user->isAdmin()) { $smarty->assign("admin", "yes"); $smarty->assign("version", $conf->version); } else { $smarty->assign("admin", "no"); } /*
$destinataire = new User($db); $destinataire->fetch($object->fk_user_validator); $emailTo = $destinataire->email; // FROM $expediteur = new User($db); $expediteur->fetch($object->fk_user_author); $emailFrom = $expediteur->email; if ($emailTo && $emailFrom) { $filename = array(); $filedir = array(); $mimetype = array(); // SUBJECT $subject = $langs->trans("ExpenseReportWaitingForApproval"); // CONTENT $link = $urlwithroot . '/expensereport/card.php?id=' . $object->id; $message = $langs->trans("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut, $object->date_fin, '', $langs), $link); // Rebuild pdf /* $object->setDocModel($user,""); $resultPDF = expensereport_pdf_create($db,$id,'',"",$langs); if($resultPDF): // ATTACHMENT array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref).".pdf"); array_push($mimetype,"application/pdf"); */ // PREPARE SEND $mailfile = new CMailFile($subject, $emailTo, $emailFrom, $message, $filedir, $mimetype, $filename); if ($mailfile) { // SEND
print '<td>'.$langs->trans("Order").'</td><td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$commande->ref.'</a>'; print "</td></tr>\n"; print '<tr>'; if (!$conf->expedition_bon->enabled && $conf->stock->enabled) { print '<td>'.$langs->trans("Warehouse").'</td>'; print '<td>'; $ents = $entrepot->list_array(); print '<a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$_GET["entrepot_id"].'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$ents[$_GET["entrepot_id"]].'</a>'; print '</td>'; } print "<td>".$langs->trans("Author")."</td><td>".$author->getFullName($langs)."</td>\n"; if ($commande->note) { print '<tr><td colspan="3">Note : '.nl2br($commande->note)."</td></tr>"; } print "</table>"; /* * Lignes de commandes * */ print '<br><table class="noborder" width="100%">'; $lines = $commande->fetch_lines(1);
/** * Import papers (including metadata and files). */ function importPapers() { if ($this->hasOption('verbose')) { printf("Importing papers\n"); } import('classes.file.PaperFileManager'); import('classes.search.PaperSearchIndex'); $userDao =& DAORegistry::getDAO('UserDAO'); $roleDao =& DAORegistry::getDAO('RoleDAO'); $trackDao =& DAORegistry::getDAO('TrackDAO'); $paperDao =& DAORegistry::getDAO('PaperDAO'); $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO'); $unassignedTrackId = null; $result =& $this->importDao->retrieve('SELECT * FROM papers ORDER by id'); while (!$result->EOF) { $row =& $result->fields; $schedConf =& $this->schedConfMap[$row['cf']]; $schedConfId = $schedConf->getId(); // Bring in the primary user for this paper. $user = $userDao->getUserByUsername(Core::cleanVar($row['login'])); if (!$user) { unset($user); $user = new User(); $user->setUsername(Core::cleanVar($row['login'])); $user->setFirstName(Core::cleanVar($row['first_name'])); $user->setLastName(Core::cleanVar($row['surname'])); $user->setAffiliation(Core::cleanVar($row['affiliation']), Locale::getLocale()); $user->setEmail(Core::cleanVar($row['email'])); $user->setUrl(Core::cleanVar($row['url'])); $user->setBiography(Core::cleanVar($row['bio']), Locale::getLocale()); $user->setLocales(array()); $user->setDateRegistered($row['created']); $user->setDateLastLogin($row['created']); $user->setMustChangePassword(1); $password = Validation::generatePassword(); $user->setPassword(Validation::encryptCredentials($user->getUsername(), $password)); if ($this->hasOption('emailUsers')) { import('classes.mail.MailTemplate'); $mail = new MailTemplate('USER_REGISTER'); $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName')); $mail->assignParams(array('username' => $user->getUsername(), 'password' => $password, 'conferenceName' => $schedConf->getFullTitle())); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } $user->setDisabled(0); $otherUser =& $userDao->getUserByEmail(Core::cleanVar($row['email'])); if ($otherUser !== null) { // User exists with this email -- munge it to make unique $user->setEmail('ocs-' . Core::cleanVar($row['login']) . '+' . Core::cleanVar($row['email'])); $this->conflicts[] = array(&$otherUser, &$user); } unset($otherUser); $userDao->insertUser($user); // Make this user a author $role = new Role(); $role->setSchedConfId($schedConf->getId()); $role->setConferenceId($schedConf->getConferenceId()); $role->setUserId($user->getId()); $role->setRoleId(ROLE_ID_AUTHOR); $roleDao->insertRole($role); unset($role); } $userId = $user->getId(); // Bring in the basic entry for the paper $paper = new Paper(); $paper->setUserId($userId); $paper->setLocale(Locale::getPrimaryLocale()); $paper->setSchedConfId($schedConfId); $oldTrackId = $row['primary_track_id']; if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) { $oldTrackId = $row['secondary_track_id']; } if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) { if (!$unassignedTrackId) { // Create an "Unassigned" track to use for submissions // that didn't have a track in OCS 1.x. $track = new Track(); $track->setSchedConfId($schedConf->getId()); $track->setTitle('UNASSIGNED', Locale::getLocale()); $track->setSequence(REALLY_BIG_NUMBER); $track->setDirectorRestricted(1); $track->setMetaReviewed(1); $unassignedTrackId = $trackDao->insertTrack($track); } $newTrackId = $unassignedTrackId; } else { $newTrackId = $this->trackMap[$oldTrackId]; } $paper->setTrackId($newTrackId); $paper->setTitle(Core::cleanVar($row['title']), Locale::getLocale()); $paper->setAbstract(Core::cleanVar($row['abstract']), Locale::getLocale()); $paper->setDiscipline(Core::cleanVar($row['discipline']), Locale::getLocale()); $paper->setSponsor(Core::cleanVar($row['sponsor']), Locale::getLocale()); $paper->setSubject(Core::cleanVar($row['topic']), Locale::getLocale()); $paper->setLanguage(Core::cleanVar($row['language'])); $paper->setDateSubmitted($row['created']); $paper->setDateStatusModified($row['timestamp']); // $paper->setTypeConst($row['present_format'] == 'multiple' ? SUBMISSION_TYPE_PANEL : SUBMISSION_TYPE_SINGLE); FIXME $paper->setCurrentRound(REVIEW_ROUND_ABSTRACT); $paper->setSubmissionProgress(0); $paper->setPages(''); // Bring in authors $firstNames = split("\n", Core::cleanVar($row['first_name'] . "\n" . $row['add_first_names'])); $lastNames = split("\n", Core::cleanVar($row['surname'] . "\n" . $row['add_surnames'])); $emails = split("\n", Core::cleanVar($row['email'] . "\n" . $row['add_emails'])); $affiliations = split("\n", Core::cleanVar($row['affiliation'] . "\n" . $row['add_affiliations'])); $urls = split("\n", Core::cleanVar($row['url'] . "\n" . $row['add_urls'])); foreach ($emails as $key => $email) { if (empty($email)) { continue; } $author = new Author(); $author->setEmail($email); $author->setFirstName($firstNames[$key]); $author->setLastName($lastNames[$key]); $author->setAffiliation($affiliations[$key], Locale::getLocale()); @$author->setUrl($urls[$key]); // Suppress warnings from inconsistent OCS 1.x data $author->setPrimaryContact($key == 0 ? 1 : 0); $paper->addAuthor($author); unset($author); } switch ($row['accepted']) { case 'true': $paper->setStatus(STATUS_PUBLISHED); $paperId = $paperDao->insertPaper($paper); $publishedPaper = new PublishedPaper(); $publishedPaper->setPaperId($paperId); $publishedPaper->setSchedConfId($schedConfId); $publishedPaper->setDatePublished(Core::getCurrentDate()); $publishedPaper->setSeq(REALLY_BIG_NUMBER); $publishedPaper->setViews(0); $publishedPaperDao->insertPublishedPaper($publishedPaper); $publishedPaperDao->resequencePublishedPapers($paper->getTrackId(), $schedConfId); break; case 'reject': $paper->setStatus(STATUS_DECLINED); $paperId = $paperDao->insertPaper($paper); break; default: $paper->setStatus(STATUS_QUEUED); $paperId = $paperDao->insertPaper($paper); } $this->paperMap[$row['id']] =& $paper; $paperFileManager = new PaperFileManager($paperId); if (!empty($row['paper']) && $row['paper'] != 'PDF') { $format = 'text/html'; $extension = $paperFileManager->getDocumentExtension($format); $fileId = $paperFileManager->writeSubmissionFile('migratedFile' . $extension, $row['paper'], $format); $paper->setSubmissionFileId($fileId); $paperDao->updatePaper($paper); $fileId = $paperFileManager->writePublicFile('migratedGalley' . $extension, $row['paper'], $format); PaperSearchIndex::updateFileIndex($paperId, PAPER_SEARCH_GALLEY_FILE, $fileId); if (strstr($format, 'html')) { $galley = new PaperHTMLGalley(); $galley->setLabel('HTML'); } else { $galley = new PaperGalley(); switch ($format) { case 'application/pdf': $galley->setLabel('PDF'); break; case 'application/postscript': $galley->setLabel('PostScript'); break; case 'application/msword': $galley->setLabel('Word'); break; case 'text/xml': $galley->setLabel('XML'); break; case 'application/powerpoint': $galley->setLabel('Slideshow'); break; default: $galley->setLabel('Untitled'); break; } } $galley->setLocale(Locale::getLocale()); $galley->setPaperId($paperId); $galley->setFileId($fileId); $galleyDao->insertGalley($galley); unset($galley); } elseif ($row['paper'] == 'PDF') { $fileId = $paperFileManager->copySubmissionFile($this->importPath . '/papers/' . $row['pdf'], 'application/pdf'); $paper->setSubmissionFileId($fileId); $paperDao->updatePaper($paper); $fileId = $paperFileManager->copyPublicFile($this->importPath . '/papers/' . $row['pdf'], 'application/pdf'); PaperSearchIndex::updateFileIndex($paperId, PAPER_SEARCH_GALLEY_FILE, $fileId); $galley = new PaperGalley(); $galley->setLabel('PDF'); $galley->setLocale(Locale::getLocale()); $galley->setPaperId($paperId); $galley->setFileId($fileId); $galleyDao->insertGalley($galley); unset($galley); } // FIXME: The following fields from OCS 1.x are UNUSED: // program_insert approach coverage format relation appendix_names appendix_dates // appendix appendix_pdf secondary_track_id multiple_* restrict_access paper_email // delete_paper comment_email unset($user); unset($paper); unset($schedConf); unset($paperFileManager); $result->MoveNext(); } $result->Close(); }