function generatePDFReport($report, $results) { $types = self::get_report_column_types($report->getId()); eval('$managerInstance = ' . $report->getObjectType() . "::instance();"); $externalCols = $managerInstance->getExternalColumns(); $filename = str_replace(' ', '_', $report->getName()) . date('_YmdHis'); $pageLayout = $_POST['pdfPageLayout']; $fontSize = $_POST['pdfFontSize']; include_once LIBRARY_PATH . '/pdf/fpdf.php'; $pdf = new FPDF($pageLayout); $pdf->setTitle($report->getName()); $pdf->AddPage(); $pdf->SetFont('Arial', '', $fontSize); $pdf->Cell(80); $report_title = iconv(mb_internal_encoding(), "ISO-8859-1", html_entity_decode($report->getName(), ENT_COMPAT)); $pdf->Cell(30, 10, $report_title); $pdf->Ln(20); $colSizes = array(); $maxValue = array(); $fixed_col_sizes = array(); foreach ($results['rows'] as $row) { $i = 0; foreach ($row as $k => $value) { if (!isset($maxValue[$i])) { $maxValue[$i] = ''; } if (strlen(strip_tags($value)) > strlen($maxValue[$i])) { $maxValue[$i] = strip_tags($value); } $i++; } } $k = 0; foreach ($maxValue as $str) { $col_title_len = $pdf->GetStringWidth($results['columns'][$k]); $colMaxTextSize = max($pdf->GetStringWidth($str), $col_title_len); $db_col = $results['columns'][$k]; $colType = array_var($types, array_var($results['db_columns'], $db_col, ''), ''); if ($colType == DATA_TYPE_DATETIME && !($report->getObjectType() == 'ProjectEvents' && $results['db_columns'][$db_col] == 'start')) { $colMaxTextSize = $colMaxTextSize / 2; if ($colMaxTextSize < $col_title_len) { $colMaxTextSize = $col_title_len; } } $fixed_col_sizes[$k] = $colMaxTextSize; $k++; } $fixed_col_sizes = self::fix_column_widths($pageLayout == 'P' ? 172 : 260, $fixed_col_sizes); $max_char_len = array(); $i = 0; foreach ($results['columns'] as $col) { $colMaxTextSize = $fixed_col_sizes[$i]; $colFontSize = $colMaxTextSize + 5; $colSizes[$i] = $colFontSize; $col_name = iconv(mb_internal_encoding(), "ISO-8859-1", html_entity_decode($col, ENT_COMPAT)); $pdf->Cell($colFontSize, 7, $col_name); $max_char_len[$i] = self::get_max_length_from_pdfsize($pdf, $colFontSize); $i++; } $lastColX = $pdf->GetX(); $pdf->Ln(); $pdf->Line($pdf->GetX(), $pdf->GetY(), $lastColX, $pdf->GetY()); foreach ($results['rows'] as $row) { $i = 0; $more_lines = array(); $col_offsets = array(); foreach ($row as $k => $value) { if ($k == 'link') { $value = strip_tags($value); $cell = $value; } else { $cell = $this->format_value_to_print($k, $value, $types[$k], $report->getObjectType()); } $cell = iconv(mb_internal_encoding(), "ISO-8859-1", html_entity_decode($cell, ENT_COMPAT)); $splitted = self::split_column_value($cell, $max_char_len[$i]); $cell = $splitted[0]; if (count($splitted) > 1) { array_shift($splitted); $ml = 0; foreach ($splitted as $sp_val) { if (!isset($more_lines[$ml]) || !is_array($more_lines[$ml])) { $more_lines[$ml] = array(); } $more_lines[$ml][$i] = $sp_val; $ml++; } $col_offsets[$i] = $pdf->x; } $pdf->Cell($colSizes[$i], 7, $cell); $i++; } foreach ($more_lines as $ml_values) { $pdf->Ln(); foreach ($ml_values as $col_idx => $col_val) { $pdf->SetX($col_offsets[$col_idx]); $pdf->Cell($colSizes[$col_idx], 7, $col_val); } } $pdf->Ln(); $pdf->SetDrawColor(220, 220, 220); $pdf->Line($pdf->GetX(), $pdf->GetY(), $lastColX, $pdf->GetY()); $pdf->SetDrawColor(0, 0, 0); } $filename = ROOT . "/tmp/" . gen_id() . ".pdf"; $pdf->Output($filename, "F"); download_file($filename, "application/pdf", $report->getName(), true); unlink($filename); die; }
function render_single_member_selector(Dimension $dimension, $genid = null, $selected_member_ids = null, $options = array()) { if (is_null($genid)) $genid = gen_id(); $dimension_options = $dimension->getOptions(true); $dim_info = array( 'dimension_id' => $dimension->getId(), 'dimension_code' => $dimension->getCode(), 'dimension_options' => $dimension_options, 'is_manageable' => $dimension->getIsManageable(), 'is_required' => array_var($options, 'is_required'), 'is_multiple' => array_var($options, 'is_multiple'), ); if($dimension_options && isset($dimension_options->useLangs) && $dimension_options->useLangs ) { $dim_info['dimension_name'] = lang($dimension->getCode()); } $dimensions = array($dim_info); if (is_null($selected_member_ids)) $selected_member_ids = array(); // Set view variables $selected_members = count($selected_member_ids) > 0 ? Members::findAll(array('conditions' => 'id IN ('.implode(',', $selected_member_ids).')')) : array(); $selected_members_json = "[".implode(',', $selected_member_ids)."]"; $component_id = "$genid-member-selectors-panel-$content_object_type_id"; $listeners = array_var($options, 'listeners', array()); $allowed_member_type_ids = array_var($options, 'allowedMemberTypes', null); // Render view include get_template_path("components/multiple_dimension_selector", "dimension"); }
function nFileHandleUpload($file) { global $nFilePrefix, $filelimit; $name = $file['name']; $tmp_name = $file['tmp_name']; if ($file['size'] > $filelimit) { return 0; } $name = preg_replace("{/|\\s+}", "_", $name); $name = preg_replace("/^\\./", "0.", $name); $name = preg_replace("/^index/", "noindex", $name); $name = preg_replace("/^default/", "nodefault", $name); do { $pref = gen_id(); } while (is_file("{$nFilePrefix}/{$pref}/{$name}")); $name = "{$pref}/{$name}"; if (!is_dir("{$nFilePrefix}/{$pref}")) { mkdir_perms("{$nFilePrefix}/{$pref}", 0755); } if (!is_dir("{$nFilePrefix}/html/{$pref}")) { mkdir_perms("{$nFilePrefix}/html/{$pref}", 0755); } move_uploaded_file($tmp_name, "{$nFilePrefix}/{$name}"); chmod("{$nFilePrefix}/{$name}", 0755) or $fail = 1; if ($fail == 1) { return 0; } else { $_SESSION['own'][] = "{$nFilePrefix}/{$name}"; return $name; } }
function add_subscribers_list() { if (logged_user()->isGuest()) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } $genid = array_var($_GET, 'genid'); $obj_id = array_var($_GET, 'obj_id'); $object = Objects::findObject($obj_id); if (!isset($genid)) { $genid = gen_id(); } $subscriberIds = array(); if ($object->isNew()) { $subscriberIds[] = logged_user()->getId(); } else { foreach ($object->getSubscribers() as $u) { $subscriberIds[] = $u->getId(); } } tpl_assign('object', $object); tpl_assign('subscriberIds', $subscriberIds); tpl_assign('genid', $genid); }
function gen_id($query) { $g = rand(10000, 99999); while ($row = mysqli_fetch_assoc($query)) { if ($g == $row['id']) { gen_id($query); } } return $g; }
function render($control_name) { $genid = gen_id(); $object_types = ObjectTypes::getAvailableObjectTypes(); $value = $this->getValue(); $out = ''; foreach ($object_types as $ot) { $checked = array_search($ot->getId(), $value) !== false; $out .= '<div class="checkbox-config-option">'; $out .= label_tag(lang($ot->getName()), $genid . '_' . $control_name . '_' . $ot->getId(), false, array('style' => 'cursor:pointer;'), ''); $out .= checkbox_field($control_name . '[' . $ot->getId() . ']', $checked, array('id' => $genid . '_' . $control_name . '_' . $ot->getId())); $out .= '</div >'; } $out .= '<input type="hidden" name="' . $control_name . '[0]" value=" "><div class="clear"></div>'; return $out; }
function render($control_name) { $genid = gen_id(); $object_types = ObjectTypes::getAvailableObjectTypesWithDimensionObjects(" AND `name` IN ('task', 'project', 'sample')"); $value = $this->getValue(); $out = ''; foreach ($object_types as $ot) { $checked = array_search($ot->getId(), $value) !== false; $out .= '<div style="float:left; margin-right: 15px; min-width: 130px;">'; $out .= label_tag(lang($ot->getName()), $genid . '_' . $control_name . '_' . $ot->getId(), false, array('style' => 'cursor:pointer;'), ''); $out .= checkbox_field($control_name . '[' . $ot->getId() . ']', $checked, array('id' => $genid . '_' . $control_name . '_' . $ot->getId())); $out .= '</div >'; } $out .= '<input type="hidden" name="' . $control_name . '[0]" value=" "><div class="clear"></div>'; return $out; }
function render($control_name) { $genid = gen_id(); $groups = PermissionGroups::findAll(array('conditions' => "`type`='roles' AND `parent_id`>0")); $value = $this->getValue(); $out = ''; foreach ($groups as $group) { /* @var $dim Dimension */ $checked = array_search($group->getId(), $value) !== false; $out .= '<div class="checkbox-config-option">'; $out .= label_tag($group->getName(), $genid . '_' . $control_name . '_' . $group->getId(), false, array('style' => 'cursor:pointer;'), ''); $out .= checkbox_field($control_name . '[' . $group->getId() . ']', $checked, array('id' => $genid . '_' . $control_name . '_' . $group->getId())); $out .= '</div >'; } $out .= '<input type="hidden" name="' . $control_name . '[0]" value=" "><div class="clear"></div>'; return $out; }
function crud_batchType() { $oper = $this->input->post('oper'); $id_ = $this->input->post('id'); $array_edit = array('CODE' => $this->input->post('CODE'), 'IS_ACTIVE' => $this->input->post('IS_ACTIVE'), 'IS_BATCH_REPORT' => $this->input->post('IS_BATCH_REPORT'), 'UPDATE_DATE' => "SYSDATE", 'UPDATE_BY' => $this->session->userdata('d_user_name')); switch ($oper) { case 'add': $new_id = gen_id('P_BATCH_TYPE_ID', 'P_BATCH_TYPE'); $this->db->query("INSERT INTO P_BATCH_TYPE(P_BATCH_TYPE_ID,CODE,IS_ACTIVE,IS_BATCH_REPORT,CREATION_DATE,CREATED_BY,UPDATE_DATE,UPDATE_BY)\r\n VALUES({$new_id},\r\n '" . $this->input->post('CODE') . "',\r\n '" . $this->input->post('IS_ACTIVE') . "',\r\n '" . $this->input->post('IS_BATCH_REPORT') . "',\r\n SYSDATE,\r\n '" . $this->session->userdata('d_user_name') . "',\r\n SYSDATE,\r\n '" . $this->session->userdata('d_user_name') . "'\r\n )"); break; case 'edit': $this->db->query("UPDATE P_BATCH_TYPE SET\r\n CODE = '" . $this->input->post('CODE') . "',\r\n IS_ACTIVE = '" . $this->input->post('IS_ACTIVE') . "',\r\n IS_BATCH_REPORT = '" . $this->input->post('IS_BATCH_REPORT') . "',\r\n UPDATE_DATE = SYSDATE,\r\n UPDATE_BY = '" . $this->session->userdata('d_user_name') . "'\r\n WHERE\r\n P_BATCH_TYPE_ID = " . $id_); break; case 'del': $this->db->where('P_BATCH_TYPE_ID', $id_); $this->db->delete('P_BATCH_TYPE'); break; } }
function render_single_member_selector(Dimension $dimension, $genid = null, $selected_member_ids = null, $options = array(), $default_view = true) { if (is_null($genid)) { $genid = gen_id(); } $dim_info = array('dimension_id' => $dimension->getId(), 'dimension_code' => $dimension->getCode(), 'dimension_name' => $dimension->getName(), 'is_manageable' => $dimension->getIsManageable(), 'is_required' => array_var($options, 'is_required'), 'is_multiple' => array_var($options, 'is_multiple')); $dimensions = array($dim_info); if (!is_array($selected_member_ids)) { $selected_member_ids = array(); } foreach ($selected_member_ids as $k => &$v) { if (!is_numeric($v)) { unset($selected_member_ids[$k]); } } if (count($selected_member_ids) > 0) { $sql = "SELECT m.id FROM " . TABLE_PREFIX . "members m WHERE m.id IN (" . implode(',', $selected_member_ids) . ") AND m.dimension_id=" . $dimension->getId(); $clean_sel_member_ids = array_flat(DB::executeAll($sql)); $selected_member_ids = $clean_sel_member_ids; } $content_object_type_id = array_var($options, 'content_object_type_id'); $initial_selected_members = $selected_member_ids; if (is_null($selected_member_ids)) { $selected_member_ids = array(); } // Set view variables $selected_members = count($selected_member_ids) > 0 ? Members::findAll(array('conditions' => 'id IN (' . implode(',', $selected_member_ids) . ')')) : array(); $selected_members_json = "[" . implode(',', $selected_member_ids) . "]"; $component_id = "{$genid}-member-selectors-panel-{$content_object_type_id}"; $listeners = array_var($options, 'listeners', array()); $allowed_member_type_ids = array_var($options, 'allowedMemberTypes', null); $hide_label = array_var($options, 'hide_label', false); if (isset($options['label'])) { $label = $options['label']; } // Render view include get_template_path("components/multiple_dimension_selector", "dimension"); }
function add_subscribers_list() { if (logged_user()->isGuest()) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } $genid = array_var($_GET, 'genid'); $obj_id = array_var($_GET, 'obj_id'); $obj_manager = array_var($_GET, 'manager'); $object = get_object_by_manager_and_id($obj_id, $obj_manager); if (!isset($genid)) { $genid = gen_id(); } $subscriberIds = array(); if ($object->isNew()) { $subscriberIds[] = logged_user()->getId(); } else { foreach ($object->getSubscribers() as $u) { $subscriberIds[] = $u->getId(); } } if (!isset($workspaces)) { if ($object->isNew()) { $workspaces = array(active_or_personal_project()); } else { $workspaces = $object->getWorkspaces(); } } tpl_assign('object', $object); tpl_assign('type', get_class($object->manager())); tpl_assign('workspaces', $workspaces); tpl_assign('subscriberIds', $subscriberIds); tpl_assign('genid', $genid); //echo tpl_fetch(get_template_path('add_subscribers_list', 'object')); }
if (defined('SANDBOX_URL')) { $url = get_sandbox_url('feed', 'show_html_mail', array('pre' => $tpre, 'r' => gen_id(), 'id' => logged_user()->getId(), 'token' => $user_token)); } else { $url = get_url('mail', 'show_html_mail', array('pre' => $tpre, 'r' => gen_id())); } $content .= '<div style="position: relative; left:0; top: 0; width: 100%; height: 100px; background-color: white">'; $content .= '<iframe id="'.$genid.'ifr" name="'.$genid.'ifr" style="width:100%;height:100%" frameborder="0" src="'.$url.'" onload="javascipt:iframe=document.getElementById(\''.$genid.'ifr\'); iframe.parentNode.style.height = Math.min(600, iframe.contentWindow.document.body.scrollHeight + 30) + \'px\' ;"> </iframe>'; '<script>if (Ext.isIE) document.getElementById(\''.$genid.'ifr\').contentWindow.location.reload();</script>'; $content .= '<a class="ico-expand" style="display: block; width: 16px; height: 16px; cursor: pointer; position: absolute; right: 20px; top: 2px" title="' . lang('expand') . '" onclick="og.expandDocumentView.call(this)"></a> </div>'; if ($remove_quoted) { $content .= '<a id="'.$genid.'showQuotedText" style="font-family:verdana,arial,helvetica,sans-serif; font-size:11px; line-height:150%; cursor:pointer; color:#003562; padding-left:10px;" onclick="og.showQuotedHtml(\''.$pre.'\', \''.gen_id().'\', \''.$genid.'\', \''.$user_token.'\');"> :: '.lang('show quoted text').' ::</a>'; } $content .= ' <input type="hidden" id="'.$genid.'viewingImages" value="'.($remove_images?'no':'yes').'" /> <input type="hidden" id="'.$genid.'viewingQuoted" value="'.($remove_quoted?'no':'yes').'" /> '; } else { if ($email->getBodyPlain() != '') { $remove_quoted = MailUtilities::hasQuotedText($email->getBodyPlain()) && $hide_quoted_text_in_emails; $content = ""; if ($remove_quoted) { $content = MailUtilities::replaceQuotedText($email->getBodyPlain(), '-----'.lang('hidden quoted text').'-----'); $content = '<div id="'.$genid.'noQuoteMail">' . escape_html_whitespace(convert_to_links(clean($content))) . '</div>'; $content = str_replace('-----'.lang('hidden quoted text')."-----", '<span style="color: #777;font-style:italic;padding: 5px 20px"><'.lang('hidden quoted text').'></span>', $content); $content .= '<a class="internalLink" style="padding-left:10px;" id="'.$genid.'quotedLink" href="#" onclick="og.showQuotedText(\''.$genid.'\')">:: '.lang('show quoted text').' ::</a>';
if ($start_of_task && $end_of_task) { $tip_title = lang('task'); $img_url = image_url('/16x16/tasks.png'); $tip_pre = ''; } else { if ($end_of_task) { $tip_title = lang('end of task'); $img_url = image_url('/16x16/task_end.png'); $tip_pre = 'end_'; } else { $tip_title = lang('start of task'); $img_url = image_url('/16x16/task_start.png'); $tip_pre = 'st_'; } } $tip_pre .= gen_id() . "_"; $div_prefix = 'd_ta_div_' . $tip_pre; $subject = $event->getObjectName(); $divtype = '<span class="italic">' . $tip_title . '</span> - '; $tipBody = lang('assigned to') . ': ' . clean($event->getAssignedToName()) . (trim(clean($event->getText())) != '' ? '<br><br>' . html_to_text($event->getText()) : ''); } elseif ($event instanceof ProjectEvent) { $div_prefix = 'd_ev_div_'; $subject = clean($event->getObjectName()); $img_url = image_url('/16x16/calendar.png'); $divtype = '<span class="italic">' . lang('event') . '</span> - '; $tipBody = trim(clean($event->getDescription())) != '' ? '<br>' . clean($event->getDescription()) : ''; } elseif ($event instanceof Contact) { $div_prefix = 'd_bd_div_'; $objType = 'contact'; $subject = clean($event->getObjectName()); $img_url = image_url('/16x16/contacts.png');
<?php $container_id = gen_id(); ?> <div id="<?php echo $container_id; ?> "></div> <script> var tasks = [ <?php $first = true; foreach ($tasks as $task) { /*if ($task->getMilestoneId() != 0) { // don't show in tasks tasks that will also be listed under milestones. // if this is removed, tasks will appear twice. something needs to be done // so that updates on one of them reflects on the other. continue; }*/ if ($first) { $first = false; } else { echo ","; } $taskInfo = "id:" . $task->getId() . "," . "title:'" . str_replace("\n", " ", str_replace("'", "\\'", $task->getTitle())) . "'," . "parent:" . $task->getParentId() . "," . "milestone:" . $task->getMilestoneId() . "," . "subtasks:[]," . "assignedTo:'" . str_replace("'", "\\'", $task->getAssignedTo() == null ? '' : $task->getAssignedToName()) . "'," . "expanded:false," . "completed:" . ($task->isCompleted() ? "true" : "false") . "," . "completedBy:'" . str_replace("'", "\\'", $task->getCompletedByName()) . "'," . "isLate:" . ($task->isLate() ? "true" : "false") . "," . "daysLate:" . $task->getLateInDays() . "," . "priority:" . $task->getPriority() . "," . "duedate:" . ($task->getDueDate() ? $task->getDueDate()->getTimestamp() : '0') . "," . "percentCompleted:" . $task->getPercentCompleted() . "," . "order:" . $task->getOrder(); echo '{' . $taskInfo . '}'; } // foreach ?> ];
<?php require_javascript('og/modules/linkToObjectForm.js'); if (!$genid) $genid = gen_id(); ?> <a id="<?php echo $genid ?>before" href="#" onclick="App.modules.linkToObjectForm.pickObject(this)"><?php echo lang('link object') ?></a> <script> <?php if (is_array($objects)) { foreach ($objects as $o) { if (!$o instanceof ContentDataObject) continue; ?> App.modules.linkToObjectForm.addObject(document.getElementById('<?php echo $genid ?>before'), { 'object_id': <?php echo $o->getId() ?>, 'type': '<?php echo $o->getObjectTypeName() ?>', 'name': <?php echo json_encode($o->getObjectName()) ?> }); <?php } } ?> </script>
<?php $genid = gen_id() ?> <form style='height:100%;background-color:white' class="internalForm" action="<?php echo get_url('template', 'instantiate_parameters', array('id' => $id, 'back' => '1')) ?>" method="post"> <div class="template"> <div class="coInputHeader"> <div class="coInputHeaderUpperRow"> <div class="coInputTitle"><?php echo lang('template parameters')?></div> </div> </div> <div class="coInputMainBlock"> <div> <table><tbody> <?php foreach($parameters as $parameter) {?> <tr style='height:30px;'> <td style="padding:3px 10px 0 10px;"><b><?php echo $parameter['name']; ?></b></td> <td align="left"> <?php if($parameter['type'] == 'string'){ ?> <input id="parameterValues[<?php echo $parameter['name'] ?>]" name="parameterValues[<?php echo $parameter['name'] ?>]" /> <?php }else if($parameter['type'] == 'date'){ ?> <?php echo pick_date_widget2('parameterValues['.$parameter['name'].']')?> <?php }else{ ?> <select name="<?php echo 'parameterValues['.$parameter['name'].']'; ?>"> <?php $companies = allowed_users_to_assign(active_context()); foreach ($companies as $c) {?> <option value="<?php echo $c['id']; ?>"> <?php echo $c['name']; ?></option> <?php $users = $c['users'];
private static function getLogoAttachmentData($toemail) { $logo_info = array(); try { $content = FileRepository::getBackend()->getFileContent(owner_company()->getPictureFile()); if ($content != "") { $file_path = ROOT . "/tmp/logo_empresa.png"; $handle = fopen($file_path, 'wb'); if ($handle) { fwrite($handle, $content); fclose($handle); if (!$toemail) { $toemail = "recipient@"; } $logo_info = array('cid' => gen_id() . substr($toemail, strpos($toemail, '@')), 'path' => $file_path, 'type' => 'image/png', 'disposition' => 'inline', 'name' => 'logo_empresa.png'); } } } catch (FileNotInRepositoryError $e) { Logger::log("Could not find owner company picture file: " . $e->getMessage()); } $logo_info; }
$msg = str_replace("'", "'", trim($_POST['msg'])); if (!mb_check_encoding($subject, "Shift_JIS") || mb_strlen($subject, "Shift_JIS") > $maxsubchars || !mb_check_encoding($msg, "Shift_JIS") || mb_strlen($msg, "Shift_JIS") > $maxmsgchars || mb_substr_count($msg, "\n", "Shift_JIS") > $maxmsglines) { $error = "Illegal encoding or string too long"; } else { if (mb_strlen($subject, "Shift_JIS") < $minsubchars || mb_strlen($msg, "Shift_JIS") < $minmsgchars) { $error = "String too short"; } else { session_start(); if ($_SESSION['6_letters_code'] != $_POST['captcha']) { $error = "Wrong captcha answer"; } else { mysql_query("insert into threads(boardid, subject) values(" . $boardid . ", '" . $subject . "')"); $rs = mysql_query("select max(id) from threads where boardid=" . $boardid . " and subject='" . $subject . "'"); $row = mysql_fetch_row($rs); $threadid = $row[0]; mysql_query("insert into posts(threadid, boardid, author, msg, dat) values(" . $threadid . ", " . $boardid . ", '" . gen_id() . "', '" . $msg . "', NOW())"); header("Location: thread.php?b=" . $boardid . "&t=" . $threadid); } } } } } $rs = mysql_query("select name, notice from boards where id=" . $boardid); $row = mysql_fetch_row($rs); if (mysql_num_rows($rs) == 0) { header('Location: index.php'); } $boardname = $row[0]; $notice = $row[1]; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<?php require "settings.php"; require "functions.php"; // Split the variable into two, $domain & $port. list($domain, $port) = filter_domain($_GET["domain"]); // Check the site and get the response code. $data = get_response($domain, $port); // Caluate and format the time taken to connect. $time = round($data["time"], 3); $id = gen_id($data); $title = gen_title($id, $domain); $html = gen_html($id, $domain, $port, $time, $data["code"]); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title><?php echo $title . " // isitup.org"; // display the dynamic title ?> </title> <!-- Hi r/ProgrammerHumor :wave:! --> <!-- Meta Info --> <meta name="description" content="The availability results for <?php echo $domain; ?>
/** * Edit email * * @param void * @return null */ function edit_mail() { if (logged_user()->isGuest()) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } $this->setTemplate('add_mail'); if (array_var($_GET, 'id', '') == '') { flash_error('Invalid parameter.'); ajx_current("empty"); } $original_mail = MailContents::findById(get_id('id', $_GET)); if (!$original_mail) { flash_error('Invalid parameter.'); ajx_current("empty"); } $mail_accounts = MailAccounts::getMailAccountsByUser(logged_user()); if (count($mail_accounts) < 1) { flash_error(lang('no mail accounts set')); ajx_current("empty"); return; } $mail_data = array_var($_POST, 'mail', null); if (!is_array($mail_data)) { $body = $original_mail->getBodyHtml() == '' ? $original_mail->getBodyPlain() : $original_mail->getBodyHtml(); //Attachs $attachs = array(); if ($original_mail->getHasAttachments()) { $attachments = self::readAttachmentsFromFileSystem($original_mail, $att_version); foreach ($attachments as $att) { $fName = $att["name"]; $fileType = $att["type"]; $fid = gen_id(); $attachs[] = "FwdMailAttach:{$fName}:{$fileType}:{$fid}"; if ($att_version >= 2) { @copy($att['path'], ROOT . "/tmp/" . logged_user()->getId() . "_" . $original_mail->getAccountId() . "_FwdMailAttach_{$fid}"); } else { file_put_contents(ROOT . "/tmp/" . logged_user()->getId() . "_" . $original_mail->getAccountId() . "_FwdMailAttach_{$fid}", $att['data']); } } } $mail_data = array('to' => $original_mail->getTo(), 'cc' => $original_mail->getCc(), 'bcc' => $original_mail->getBcc(), 'subject' => $original_mail->getSubject(), 'body' => $body, 'type' => $original_mail->getBodyHtml() != '' ? 'html' : 'plain', 'account_id' => $original_mail->getAccountId(), 'conversation_id' => $original_mail->getConversationId(), 'in_reply_to_id' => $original_mail->getMessageId(), 'original_id' => $original_mail->getId(), 'last_mail_in_conversation' => MailContents::getLastMailIdInConversation($original_mail->getConversationId(), true), 'id' => $original_mail->getId(), 'draft_edit' => 1, 'attachs' => $attachs); // array } // if tpl_assign('mail', $original_mail); tpl_assign('mail_data', $mail_data); tpl_assign('mail_accounts', $mail_accounts); }
function linked_object_filters() { $genid = gen_id(); $listeners = array('on_selection_change' => "Ext.getCmp('dimFilter').fireEvent('memberselected', member_selector['{$genid}'].sel_context);"); $options = array('select_current_context' => true, 'listeners' => $listeners, 'width' => 195); render_member_selectors(ProjectMessages::instance()->getObjectTypeId(), $genid, null, $options, null, null, false); die; }
/** * Render and process forgot password form * * @param void * @return null */ function forgot_password() { if (isset($_GET['your_email'])) { $your_email = trim(array_var($_GET, 'your_email')); } else { $your_email = trim(array_var($_POST, 'your_email')); } tpl_assign('your_email', $your_email); if (array_var($_REQUEST, 'submited') == 'submited') { if (!is_valid_email($your_email)) { tpl_assign('error', new InvalidEmailAddressError($your_email, lang('invalid email address'))); $this->render(); } // if $user = Contacts::getByEmail($your_email); if (!($user instanceof Contact && $user->isUser()) || $user->getDisabled()) { flash_error(lang('email address not in use', $your_email)); $this->redirectTo('access', 'forgot_password'); } // if $token = sha1(gen_id() . (defined('SEED') ? SEED : '')); $timestamp = time() + 60 * 60 * 24; set_user_config_option('reset_password', $token . ";" . $timestamp, $user->getId()); try { DB::beginWork(); Notifier::forgotPassword($user, $token); flash_success(lang('success forgot password')); DB::commit(); } catch (Exception $e) { DB::rollback(); flash_error(lang('error forgot password')); } // try $this->redirectTo('access', 'forgot_password', array('instructions_sent' => 1)); } // if }
<?php $genid = gen_id(); ?> <form id='formClassify' name='formClassify' style='height:100%;background-color:white' class="internalForm" action="<?php echo get_url('mail','classify', array('id'=>$email->getId())) ?>" method="post"> <div class="classify"> <?php render_member_selectors(MailContents::instance()->getObjectTypeId(), $genid, $email->getMemberIds()); ?> </div> <input type="hidden" name="id" value="<?php echo $email->getId() ?>" /> <input type="hidden" name="submit" value="1" /> <?php echo submit_button(lang('classify'), 's', array('tabindex' => '50')) ?> </form>
private function upload_document_image($url, $filename, $img_num) { $file_dt = array(); $file_content = file_get_contents(html_entity_decode($url)); $extension = get_file_extension($url); if (strpos($extension, "c=files") !== FALSE) $extension = "jpg"; $name = $filename . "-img-$img_num.$extension"; $description = lang("this file is included in document", $filename); $tmp_name = ROOT . "/tmp/" . gen_id() . $extension; file_put_contents($tmp_name, $file_content); $file_dt['name'] = $name; $file_dt['size'] = strlen($file_content); $file_dt['type'] = Mime_Types::instance()->get_type($extension); $file_dt['tmp_name'] = $tmp_name; $file = ProjectFiles::getByFilename($name); if ($file) { $file->delete(); } $file = new ProjectFile(); $file->setIsVisible(true); $file->setFilename($name); $file->setDescription($description); $file->setArchivedById(logged_user()->getId()); $file->setArchivedOn(DateTimeValueLib::now()); $file->save(); $file->handleUploadedFile($file_dt, true, $description); //$FIXME file->addToWorkspace(active_or_personal_project()); ApplicationLogs::createLog($file, ApplicationLogs::ACTION_ADD); unlink($tmp_name); return $file->getId(); }
<?php if (!isset($genid)) $genid = gen_id(); if (!isset($allow_export)) $allow_export = true; /*add_page_action(lang('print view'), '#', "ico-print", "_blank", array('onclick' => 'this.form' . $genid . '.submit'));*/ ?> <form id="form<?php echo $genid ?>" name="form<?php echo $genid ?>" action="<?php echo get_url('reporting', $template_name . '_print') ?>" method="post" enctype="multipart/form-data" target="_download"> <input name="post" type="hidden" value="<?php echo str_replace('"',"'", json_encode($post))?>"/> <div class="report" style="padding:7px"> <table style="min-width:600px"> <tr> <td rowspan=2 colspan="2" class="coViewHeader" style="width:auto;"> <div id="iconDiv" class="coViewIconImage ico-large-report" style="float:left;"></div> <div class="coViewTitleContainer"> <div class="coViewTitle" style="margin-left:55px;"><?php echo $title ?></div> <input type="submit" name="print" value="<?php echo lang('print view') ?>" onclick="og.reports.printReport('<?php echo $genid?>','<?php echo $title ?>'); return false;" style="width:120px; margin-top:10px;"/> <input type="submit" name="exportCSV" value="<?php echo lang('export csv') ?>" onclick="document.getElementById('form<?php echo $genid ?>').target = '_download';" style="width:120px; margin-top:10px;"/> <?php if ($allow_export) { ?> <input type="button" name="exportPDFOptions" onclick="og.showPDFOptions();" value="<?php echo lang('export pdf') ?>" style="width:120px; margin-top:10px;"/> <?php } ?> <input name="parameters" type="hidden" value="<?php echo str_replace('"',"'", json_encode($post))?>"/> <input name="context" type="hidden" value="" id="<?php echo $genid?>_plain_context"/> </div> <div class="clear"></div> </td> <td class="coViewTopRight" width="10px"></td> </tr>
static function generateMessageId($email_address = null) { $id_right = null; if ($email_address) { // get a valid right-part id from the email address (domain name) $id_right = substr($email_address, strpos($email_address, '@')); if (strpos($id_right, ">") !== false) { $id_right = substr($id_right, 0, strpos($id_right, ">")); } $id_right = preg_replace('/[^a-zA-Z0-9\\.\\!\\#\\/\\$\\%\\&\'\\*\\+\\-\\=\\?\\^\\_\\`\\{\\|\\}\\~]/', '', $id_right); } $id_left = str_replace("_", ".", gen_id()); if (!$id_right) { $id_right = gen_id(); } return "<" . $id_left . "@" . $id_right . ">"; }
function crud($table, $key, $id, $arr) { $oper = $this->input->post('oper'); $id_ = $this->input->post('id'); $count = count($arr); // print_r($count); for ($i = 0; $i < $count; $i++) { $data[$arr[$i]] = $this->input->post($arr[$i]); } switch ($oper) { case 'add': $new_id = gen_id($key, $table); $this->db->set($key, $new_id); $this->db->insert($table, $data); break; case 'edit': $this->db->where($key, $id_); $this->db->update($table, $data); break; case 'del': $this->db->where($key, $id_); $this->db->delete($table); break; } }
array($file->isNew() ? lang('add presentation') : lang('edit presentation')) )); ?> <?php if (!$file->isNew()) { $url = str_replace("&", "&", get_url('files', 'save_presentation', array( 'id' => $file->getId()))); $filename = $file->getFilename(); $slimContent = escapeSLIM(remove_css_and_scripts($file->getFileContent())); } else { $url = str_replace("&", "&", get_url('files', 'save_presentation')); $filename = ''; $slimContent = escapeSLIM('<div class="slide"><div style="font-size: 200%; font-weight: bold; font-family: sans-serif; position: absolute; left: 5%; top: 0%; width: 90%; height: 10%; text-align: center;">'.lang("new presentation").'</div></div>'); } $id = gen_id(); ?> <div id="<?php echo $id ?>" style="width: 100%; height: 100%; overflow: hidden;"> </div> <script> var panel = Ext.getCmp(og.getParentContentPanel('<?php echo $id ?>').id); var <?php echo $id ?> = new Slimey({ container: "<?php echo $id ?>", rootDir: '<?php echo SLIMEY_PATH ?>', imagesDir: '<?php echo get_theme_url("slimey/images/") ?>', filename: <?php echo ($file->isNew()?"''":json_encode($file->getFilename())) ?>, fileId: <?php echo ($file->isNew()?0:$file->getId()) ?>, slimContent: '<?php echo $slimContent ?>', saveUrl: '<?php echo $url ?>'
<?php require_javascript('og/modules/memberListView.js'); if (!isset($genid)) { $genid = gen_id(); } if (!isset($actual_associations)) { $actual_associations = array(); } function order_members($members) { $tmp_array = array(); foreach ($members as $mem) { if (!isset($tmp_array[$mem->getDepth()])) { $tmp_array[$mem->getDepth()] = array(); } $tmp_array[$mem->getDepth()][$mem->getId()] = array('m' => $mem, 'sub' => array()); } $level = max(array_keys($tmp_array)); while ($level > 1) { foreach ($tmp_array[$level] as $mid => &$minfo) { $tmp_array[$level - 1][$minfo['m']->getParentMemberId()]['sub'][$mid] = $minfo; } $level--; } $ordered_members = array(); foreach (array_shift($tmp_array) as $id => $info) { $ordered_members[] = $info['m']; flatten_members_array($info['sub'], $ordered_members); } return $ordered_members;
private function generatePictureFile($source_file, $max_size, $tmp_filename = "") { if (!$tmp_filename) { $tmp_filename = CACHE_DIR . "/" . gen_id() . ".png"; } if (!is_file($source_file)) { return null; } if (!$max_size) { $max_size = 600; } Env::useLibrary('simplegd'); $image = new SimpleGdImage($source_file); if ($image->getWidth() > $max_size || $image->getHeight() > $max_size) { if ($image->getWidth() > $image->getHeight()) { $w = $max_size; $ratio = $image->getHeight() / $image->getWidth(); $h = $ratio * $w; } else { $h = $max_size; $ratio = $image->getWidth() / $image->getHeight(); $w = $ratio * $h; } $new_image = $image->resize($w, $h, false); $new_image->saveAs($tmp_filename); $repo_id = FileRepository::addFile($tmp_filename, array('type' => 'image/png', 'public' => true)); @unlink($tmp_filename); return $repo_id; } else { return null; } }