/** * Flushes the rendered content to browser. * * @return void */ public function flush() { $content = $this->doc->moduleBody($this->pageRecord, $this->getDocHeaderButtons(), $this->getTemplateMarkers()); // Renders the module page $content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $content); $this->content = null; $this->doc = null; echo $content; }
/** * Smarty {fileuploadcontrol} function plugin * * Type: function<br> * Name: fileuploadcontrol<br> * Purpose: display a file upload control * * @param $params * @param \Smarty $smarty */ function smarty_function_fileuploadcontrol($params, &$smarty) { global $db; $files = $db->selectObjects('file', 'item_id="' . $params['id'] . '" AND item_type="' . $params['type'] . '"'); $template = new template('cermi', '_main'); $template->assign('files', $files); $template->assign('item_type', $params['type']); $template->assign('item_id', $params['id']); $html = $template->render(); echo $html; }
public static function show($name = null) { $queues = expSession::get('flash'); if (empty($name)) { $template = new template('common', '_msg_queue'); $template->assign('queues', $queues); $html = $template->render(); self::flushAllQueues(); } elseif (!empty($queues[$name])) { $template = new template('common', '_msg_queue'); $template->assign('queues', array($name => $queues[$name])); $html = $template->render(); self::flushQueue($name); } return $html; }
/** * Main function, starting the rendering of the list. * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH, $CLIENT; // Start document template object: $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('templates/db_list.html'); // Loading current page record and checking access: $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; // Apply predefined values for hidden checkboxes // Set predefined value for DisplayBigControlPanel: if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') { $this->MOD_SETTINGS['bigControlPanel'] = TRUE; } elseif ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'deactivated') { $this->MOD_SETTINGS['bigControlPanel'] = FALSE; } // Set predefined value for Clipboard: if ($this->modTSconfig['properties']['enableClipBoard'] === 'activated') { $this->MOD_SETTINGS['clipBoard'] = TRUE; } elseif ($this->modTSconfig['properties']['enableClipBoard'] === 'deactivated') { $this->MOD_SETTINGS['clipBoard'] = FALSE; } // Set predefined value for LocalizationView: if ($this->modTSconfig['properties']['enableLocalizationView'] === 'activated') { $this->MOD_SETTINGS['localization'] = TRUE; } elseif ($this->modTSconfig['properties']['enableLocalizationView'] === 'deactivated') { $this->MOD_SETTINGS['localization'] = FALSE; } // Initialize the dblist object: $dblist = t3lib_div::makeInstance('localRecordList'); $dblist->backPath = $BACK_PATH; $dblist->script = t3lib_BEfunc::getModuleUrl('web_list', array(), ''); $dblist->calcPerms = $BE_USER->calcPerms($this->pageinfo); $dblist->thumbs = $BE_USER->uc['thumbnailsByDefault']; $dblist->returnUrl = $this->returnUrl; $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0; $dblist->localizationView = $this->MOD_SETTINGS['localization']; $dblist->showClipboard = 1; $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView']; $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView']; $dblist->hideTables = $this->modTSconfig['properties']['hideTables']; $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.']; $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode']; $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0; $dblist->allowedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], 1); $dblist->deniedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], 1); $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0; $dblist->pageRow = $this->pageinfo; $dblist->counter++; $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => ''); $dblist->modTSconfig = $this->modTSconfig; // Clipboard is initialized: $dblist->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard $dblist->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session // Clipboard actions are handled: $CB = t3lib_div::_GET('CB'); // CB is the clipboard command array if ($this->cmd == 'setCB') { // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. By merging we get a full array of checked/unchecked elements // This is set to the 'el' array of the CB after being parsed so only the table in question is registered. $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge((array) t3lib_div::_POST('CBH'), (array) t3lib_div::_POST('CBC')), $this->cmd_table); } if (!$this->MOD_SETTINGS['clipBoard']) { $CB['setP'] = 'normal'; } // If the clipboard is NOT shown, set the pad to 'normal'. $dblist->clipObj->setCmd($CB); // Execute commands. $dblist->clipObj->cleanCurrent(); // Clean up pad $dblist->clipObj->endClipboard(); // Save the clipboard content // This flag will prevent the clipboard panel in being shown. // It is set, if the clickmenu-layer is active AND the extended view is not enabled. $dblist->dontShowClipControlPanels = $CLIENT['FORMSTYLE'] && !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$BE_USER->uc['disableCMlayers'] && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers']; // If there is access to the page, then render the list contents and set up the document template object: if ($access) { // Deleting records...: // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table. if ($this->cmd == 'delete') { $items = $dblist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), $this->cmd_table, 1); if (count($items)) { $cmd = array(); foreach ($items as $iK => $value) { $iKParts = explode('|', $iK); $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1; } $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $tce->start(array(), $cmd); $tce->process_cmdmap(); if (isset($cmd['pages'])) { t3lib_BEfunc::setUpdateSignal('updatePageTree'); } $tce->printLogErrorMessages(t3lib_div::getIndpEnv('REQUEST_URI')); } } // Initialize the listing object, dblist, for rendering the list: $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000); $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit); $dblist->setDispFields(); // Render versioning selector: if (t3lib_extMgm::isLoaded('version')) { $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id); } // Render the list of tables: $dblist->generateList(); // Write the bottom of the page: $dblist->writeBottom(); $listUrl = substr($dblist->listURL(), strlen($GLOBALS['BACK_PATH'])); // Add JavaScript functions to the page: $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpToUrl(URL) { // window.location.href = URL; return false; } function jumpExt(URL,anchor) { // var anc = anchor?anchor:""; window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc; return false; } function jumpSelf(URL) { // window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:""); return false; } function setHighlight(id) { // top.fsMod.recentIds["web"]=id; top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); } } ' . $this->doc->redirectUrls($listUrl) . ' ' . $dblist->CBfunctions() . ' function editRecords(table,idList,addParams,CBflag) { // window.location.href="' . $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams; } function editList(table,idList) { // var list=""; // Checking how many is checked, how many is not var pointer=0; var pos = idList.indexOf(","); while (pos!=-1) { if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) { list+=idList.substr(pointer,pos-pointer)+","; } pointer=pos+1; pos = idList.indexOf(",",pointer); } if (cbValue(table+"|"+idList.substr(pointer))) { list+=idList.substr(pointer)+","; } return list ? list : idList; } if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); } // access // Begin to compile the whole page, starting out with page header: $this->body = ''; $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">'; $this->body .= $dblist->HTMLcode; $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>'; // If a listing was produced, create the page footer with search form etc: if ($dblist->HTMLcode) { // Making field select box (when extended view for a single table is enabled): if ($dblist->table) { $this->body .= $dblist->fieldSelectBox($dblist->table); } // Adding checkbox options for extended listing and clipboard display: $this->body .= ' <!-- Listing options for extended view, clipboard and localization view --> <div id="typo3-listOptions"> <form action="" method="post">'; // Add "display bigControlPanel" checkbox: if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') { $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"'); $this->body .= '<label for="checkLargeControl">' . t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('largeControl', TRUE)) . '</label><br />'; } // Add "clipboard" checkbox: if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable') { if ($dblist->showClipboard) { $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"'); $this->body .= '<label for="checkShowClipBoard">' . t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('showClipBoard', TRUE)) . '</label><br />'; } } // Add "localization view" checkbox: if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') { $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"'); $this->body .= '<label for="checkLocalization">' . t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('localization', TRUE)) . '</label><br />'; } $this->body .= ' </form> </div>'; // Printing clipboard if enabled: if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard) { $this->body .= $dblist->clipObj->printClipboard(); } // Search box: $sectionTitle = t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE)); $this->body .= $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE); // Display sys-notes, if any are found: $this->body .= $dblist->showSysNotesForPage(); } // Setting up the buttons and markers for docheader $docHeaderButtons = $dblist->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body); // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render('DB list', $this->content); }
/** * Main function, creating the content for the access editing forms/listings * * @return void */ public function main() { global $BE_USER, $LANG; // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo); // Checking access: if ($this->id && $access || $BE_USER->isAdmin() && !$this->id) { if ($BE_USER->isAdmin() && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } // This decides if the editform can and will be drawn: $this->editingAllowed = $this->pageinfo['perms_userid'] == $BE_USER->user['uid'] || $BE_USER->isAdmin(); $this->edit = $this->edit && $this->editingAllowed; // If $this->edit then these functions are called in the end of the page... if ($this->edit) { $this->doc->postCode .= $this->doc->wrapScriptTags(' setCheck("check[perms_user]","data[pages][' . $this->id . '][perms_user]"); setCheck("check[perms_group]","data[pages][' . $this->id . '][perms_group]"); setCheck("check[perms_everybody]","data[pages][' . $this->id . '][perms_everybody]"); '); } // Draw the HTML page header. $this->content .= $this->doc->header($LANG->getLL('permissions') . ($this->edit ? ': ' . $LANG->getLL('Edit') : '')); $this->content .= $this->doc->spacer(5); $vContent = $this->doc->getVersionSelector($this->id, 1); if ($vContent) { $this->content .= $this->doc->section('', $vContent); } // Main function, branching out: if (!$this->edit) { $this->notEdit(); } else { $this->doEdit(); } $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $this->docHeaderButtons['csh']; $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); } else { // If no access or if ID == zero $this->content = $this->doc->header($LANG->getLL('permissions')); } // Renders the module page $this->content = $this->doc->render($LANG->getLL('permissions'), $this->content); }
function render() { //debug $debug = $_REQUEST['debug']; // array //get the variables $domain_uuid = $this->domain_uuid; $device_template = $this->device_template; $template_dir = $this->template_dir; $mac = $this->mac; $file = $this->file; //get the device template if (strlen($_REQUEST['template']) > 0) { $device_template = $_REQUEST['template']; $search = array('..', '/./'); $device_template = str_replace($search, "", $device_template); $device_template = str_replace('//', '/', $device_template); } //remove ../ and slashes in the file name $search = array('..', '/', '\\', '/./', '//'); $file = str_replace($search, "", $file); //get the domain_name if (strlen($domain_name) == 0) { $sql = "SELECT domain_name FROM v_domains "; $sql .= "WHERE domain_uuid=:domain_uuid "; $prep_statement = $this->db->prepare(check_sql($sql)); if ($prep_statement) { //use the prepared statement $prep_statement->bindParam(':domain_uuid', $domain_uuid); $prep_statement->execute(); $row = $prep_statement->fetch(); unset($prep_statement); //set the variables from values in the database $domain_name = $row["domain_name"]; } } //build the provision array foreach ($_SESSION['provision'] as $key => $val) { if (strlen($val['var']) > 0) { $value = $val['var']; } if (strlen($val['text']) > 0) { $value = $val['text']; } $provision[$key] = $value; } //check to see if the mac_address exists in devices if (strlen($_REQUEST['user_id']) == 0 || strlen($_REQUEST['userid']) == 0) { if ($this->mac_exists($mac)) { //get the device_template if (strlen($device_template) == 0) { $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_mac_address=:mac "; //$sql .= "WHERE device_mac_address= '$mac' "; $prep_statement_2 = $this->db->prepare(check_sql($sql)); if ($prep_statement_2) { //use the prepared statement $prep_statement_2->bindParam(':mac', $mac); $prep_statement_2->execute(); $row = $prep_statement_2->fetch(); //set the variables from values in the database $device_uuid = $row["device_uuid"]; $device_label = $row["device_label"]; if (strlen($row["device_vendor"]) > 0) { $device_vendor = strtolower($row["device_vendor"]); } $device_model = $row["device_model"]; $device_firmware_version = $row["device_firmware_version"]; $device_provision_enable = $row["device_provision_enable"]; $device_template = $row["device_template"]; $device_profile_uuid = $row["device_profile_uuid"]; $device_description = $row["device_description"]; } } //find a template that was defined on another phone and use that as the default. if (strlen($device_template) == 0) { $sql = "SELECT * FROM v_devices "; $sql .= "WHERE domain_uuid=:domain_uuid "; $sql .= "limit 1 "; $prep_statement_3 = $this->db->prepare(check_sql($sql)); if ($prep_statement_3) { $prep_statement_3->bindParam(':domain_uuid', $domain_uuid); $prep_statement_3->execute(); $row = $prep_statement_3->fetch(); $device_label = $row["device_label"]; $device_vendor = strtolower($row["device_vendor"]); $device_model = $row["device_model"]; $device_firmware_version = $row["device_firmware_version"]; $device_provision_enable = $row["device_provision_enable"]; $device_template = $row["device_template"]; $device_profile_uuid = $row["device_profile_uuid"]; $device_description = $row["device_description"]; } } } else { //use the user_agent to pre-assign a template for 1-hit provisioning. Enter the a unique string to match in the user agent, and the template it should match. $template_list = array("Linksys/SPA-2102" => "linksys/spa2102", "Linksys/SPA-3102" => "linksys/spa3102", "Linksys/SPA-9212" => "linksys/spa921", "Cisco/SPA301" => "cisco/spa301", "Cisco/SPA301D" => "cisco/spa302d", "Cisco/SPA303" => "cisco/spa303", "Cisco/SPA501G" => "cisco/spa501g", "Cisco/SPA502G" => "cisco/spa502g", "Cisco/SPA504G" => "cisco/spa504g", "Cisco/SPA508G" => "cisco/spa508g", "Cisco/SPA509G" => "cisco/spa509g", "Cisco/SPA512G" => "cisco/spa512g", "Cisco/SPA514G" => "cisco/spa514g", "Cisco/SPA525G2" => "cisco/spa525g2", "snom300-SIP" => "snom/300", "snom320-SIP" => "snom/320", "snom360-SIP" => "snom/360", "snom370-SIP" => "snom/370", "snom820-SIP" => "snom/820", "snom-m3-SIP" => "snom/m3", "yealink SIP-T20" => "yealink/t20", "yealink SIP-T22" => "yealink/t22", "yealink SIP-T26" => "yealink/t26", "Yealink SIP-T32" => "yealink/t32", "HW GXP1450" => "grandstream/gxp1450", "HW GXP2124" => "grandstream/gxp2124", "HW GXV3140" => "grandstream/gxv3140", "HW GXV3175" => "grandstream/gxv3175", "Wget/1.11.3" => "konftel/kt300ip"); foreach ($template_list as $key => $val) { if (stripos($_SERVER['HTTP_USER_AGENT'], $key) !== false) { $device_template = $val; break; } } unset($template_list); //mac address does not exist in the table so add it if ($_SESSION['provision']['auto_insert_enabled']['boolean'] == "true" and strlen($domain_uuid) > 0) { $device_uuid = uuid(); $sql = "INSERT INTO v_devices "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "device_uuid, "; $sql .= "device_mac_address, "; $sql .= "device_vendor, "; $sql .= "device_model, "; $sql .= "device_provision_enable, "; $sql .= "device_template, "; $sql .= "device_description "; $sql .= ") "; $sql .= "VALUES "; $sql .= "("; $sql .= "'" . $domain_uuid . "', "; $sql .= "'{$device_uuid}', "; $sql .= "'{$mac}', "; $sql .= "'{$device_vendor}', "; $sql .= "'', "; $sql .= "'true', "; $sql .= "'{$device_template}', "; $sql .= "'auto {$_SERVER['HTTP_USER_AGENT']}' "; $sql .= ")"; $this->db->exec(check_sql($sql)); unset($sql); } } } //alternate device_uuid if (strlen($device_uuid) > 0) { $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_uuid = '" . $device_uuid . "' "; $prep_statement_3 = $this->db->prepare(check_sql($sql)); if ($prep_statement_3) { $prep_statement_3->execute(); $row = $prep_statement_3->fetch(); $device_uuid_alternate = $row["device_uuid_alternate"]; if (is_uuid($device_uuid_alternate)) { //override the original device_uuid $device_uuid = $device_uuid_alternate; //get the new devices information $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_uuid = '" . $device_uuid . "' "; $prep_statement_4 = $this->db->prepare(check_sql($sql)); if ($prep_statement_4) { $prep_statement_4->execute(); $row = $prep_statement_4->fetch(); $device_label = $row["device_label"]; $device_vendor = strtolower($row["device_vendor"]); $device_firmware_version = $row["device_firmware_version"]; $device_provision_enable = $row["device_provision_enable"]; //keep the original template $device_profile_uuid = $row["device_profile_uuid"]; $device_description = $row["device_description"]; } unset($prep_statement_4); } } unset($prep_statement_3); } //get the device settings table in the provision category and update the provision array if (strlen($device_uuid) > 0) { $sql = "SELECT * FROM v_device_settings "; $sql .= "WHERE device_uuid = '" . $device_uuid . "' "; $sql .= "AND device_setting_enabled = 'true' "; $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); foreach ($result as $row) { $key = $row['device_setting_subcategory']; $value = $row['device_setting_value']; $provision[$key] = $value; } unset($prep_statement); } //initialize a template object $view = new template(); if (strlen($_SESSION['provision']['template_engine']['text']) > 0) { $view->engine = $_SESSION['provision']['template_engine']['text']; //raintpl, smarty, twig } else { $view->engine = "smarty"; } $view->template_dir = $template_dir . "/" . $device_template . "/"; $view->cache_dir = $_SESSION['server']['temp']['dir']; $view->init(); //replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number //get the time zone $time_zone_name = $_SESSION['domain']['time_zone']['name']; if (strlen($time_zone_name) > 0) { $time_zone_offset_raw = get_time_zone_offset($time_zone_name) / 3600; $time_zone_offset_hours = floor($time_zone_offset_raw); $time_zone_offset_minutes = ($time_zone_offset_raw - $time_zone_offset_hours) * 60; $time_zone_offset_minutes = number_pad($time_zone_offset_minutes, 2); if ($time_zone_offset_raw > 0) { $time_zone_offset_hours = number_pad($time_zone_offset_hours, 2); $time_zone_offset_hours = "+" . $time_zone_offset_hours; } else { $time_zone_offset_hours = str_replace("-", "", $time_zone_offset_hours); $time_zone_offset_hours = "-" . number_pad($time_zone_offset_hours, 2); } $time_zone_offset = $time_zone_offset_hours . ":" . $time_zone_offset_minutes; $view->assign("time_zone_offset", $time_zone_offset); } //create a mac address with back slashes for backwards compatability $mac_dash = substr($mac, 0, 2) . '-' . substr($mac, 2, 2) . '-' . substr($mac, 4, 2) . '-' . substr($mac, 6, 2) . '-' . substr($mac, 8, 2) . '-' . substr($mac, 10, 2); //get the contacts array and add to the template engine if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory']['boolean'] == "true") { //get contacts from the database $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension "; $sql .= "from v_contacts as c, v_contact_phones as p "; $sql .= "where c.domain_uuid = '" . $domain_uuid . "' "; $sql .= "and c.contact_uuid = p.contact_uuid "; $sql .= "and p.phone_type_voice = '1' "; $sql .= "order by c.contact_organization desc, c.contact_name_given asc, c.contact_name_family asc "; $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); $contacts = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset($prep_statement, $sql); //assign the contacts array $view->assign("contacts", $contacts); } //get the provisioning information from device lines table if (strlen($device_uuid) > 0) { //get the device lines array $sql = "select * from v_device_lines "; $sql .= "where device_uuid = '" . $device_uuid . "' "; $sql .= "and (enabled = 'true' or enabled is null or enabled = '') "; $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); $device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED); //assign the keys array $view->assign("lines", $device_lines); //set the variables foreach ($device_lines as $row) { //set the variables $line_number = $row['line_number']; $register_expires = $row['register_expires']; $sip_transport = strtolower($row['sip_transport']); $sip_port = $row['sip_port']; //set defaults if (strlen($register_expires) == 0) { $register_expires = "120"; } if (strlen($sip_transport) == 0) { $sip_transport = "tcp"; } if (strlen($sip_port) == 0) { if ($line_number == "" || $line_number == "1") { $sip_port = "5060"; } else { $sip_port = "506" . ($line_number + 1); } } //set a lines array index is the line number $lines[$line_number]['register_expires'] = $register_expires; $lines[$line_number]['sip_transport'] = strtolower($sip_transport); $lines[$line_number]['sip_port'] = $sip_port; $lines[$line_number]['server_address'] = $row["server_address"]; $lines[$line_number]['outbound_proxy'] = $row["outbound_proxy"]; $lines[$line_number]['display_name'] = $row["display_name"]; $lines[$line_number]['auth_id'] = $row["auth_id"]; $lines[$line_number]['user_id'] = $row["user_id"]; $lines[$line_number]['password'] = $row["password"]; //assign the variables $view->assign("server_address_" . $line_number, $row["server_address"]); $view->assign("outbound_proxy_" . $line_number, $row["outbound_proxy"]); $view->assign("display_name_" . $line_number, $row["display_name"]); $view->assign("auth_id_" . $line_number, $row["auth_id"]); $view->assign("user_id_" . $line_number, $row["user_id"]); $view->assign("user_password_" . $line_number, $row["password"]); $view->assign("sip_transport_" . $line_number, $sip_transport); $view->assign("sip_port_" . $line_number, $sip_port); $view->assign("register_expires_" . $line_number, $register_expires); } unset($prep_statement); } //get the provisioning information from device keys if (strlen($device_uuid) > 0) { //get the device keys array $sql = "SELECT * FROM v_device_keys "; $sql .= "WHERE ("; $sql .= "device_uuid = '" . $device_uuid . "' "; if (strlen($device_profile_uuid) > 0) { $sql .= "or device_profile_uuid = '" . $device_profile_uuid . "' "; } $sql .= ") "; //$sql .= "AND domain_uuid = '".$domain_uuid."' "; $sql .= "ORDER BY device_key_category asc, device_key_id asc, device_uuid desc"; $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); $device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED); //rebuild the array to allow profile keys to be overridden by keys assigned to this device $x = 0; $previous_category = ''; $previous_id = ''; foreach ($device_keys as $row) { //set the variables if ($row['device_key_category'] == $previous_category && $row['device_key_id'] == $previous_id) { $device_keys[$x]['device_key_override'] = "true"; $device_keys[$x]['device_key_message'] = "value=" . $device_keys[$x - 1]['device_key_value'] . "&label=" . $device_keys[$x - 1]['device_key_label']; unset($device_keys[$x - 1]); } $device_keys[$x]['device_key_category'] = $row['device_key_category']; $device_keys[$x]['device_key_id'] = $row['device_key_id']; //1 $device_keys[$x]['device_key_type'] = $row['device_key_type']; //line, memory, expansion $device_keys[$x]['device_key_line'] = $row['device_key_line']; $device_keys[$x]['device_key_value'] = $row['device_key_value']; //1 $device_keys[$x]['device_key_extension'] = $row['device_key_extension']; $device_keys[$x]['device_key_label'] = $row['device_key_label']; //label if (is_uuid($row['device_profile_uuid'])) { $device_keys[$x]['device_key_owner'] = "profile"; } else { $device_keys[$x]['device_key_owner'] = "device"; } //set previous values $previous_category = $row['device_key_category']; $previous_id = $row['device_key_id']; //increment the key $x++; } } //debug information if ($debug == "array") { echo "<pre>\n"; print_r($device_keys); echo "<pre>\n"; exit; } //assign the keys array $view->assign("keys", $device_keys); //set the variables foreach ($device_keys as $row) { //set the variables $device_key_category = $row['device_key_category']; $device_key_id = $row['device_key_id']; //1 $device_key_type = $row['device_key_type']; //line $device_key_line = $row['device_key_line']; $device_key_value = $row['device_key_value']; //1 $device_key_extension = $row['device_key_extension']; $device_key_label = $row['device_key_label']; //label //set the line key $x = $device_key_line; //add a simple variable with the index if ($x === 0 || $x === 1) { $device_key_value = str_replace("\${user_id}", $lines[$x]['user_id'], $device_key_value); $device_key_value = str_replace("\${auth_id}", $lines[$x]['auth_id'], $device_key_value); $device_key_value = str_replace("\${extension}", $lines[$x]['user_id'], $device_key_value); $device_key_value = str_replace("\${password}", $lines[$x]['password'], $device_key_value); $device_key_value = str_replace("\${register_expires}", $lines[$x]['register_expires'], $device_key_value); $device_key_value = str_replace("\${sip_transport}", $lines[$x]['sip_transport'], $device_key_value); $device_key_value = str_replace("\${sip_port}", $lines[$x]['sip_port'], $device_key_value); $device_key_value = str_replace("\${server_address}", $lines[$x]['server_address'], $device_key_value); $device_key_value = str_replace("\${outbound_proxy}", $lines[$x]['outbound_proxy'], $device_key_value); $device_key_value = str_replace("\${display_name}", $lines[$x]['display_name'], $device_key_value); $device_key_extension = str_replace("\${user_id}", $lines[$x]['user_id'], $device_key_extension); $device_key_extension = str_replace("\${auth_id}", $lines[$x]['auth_id'], $device_key_extension); $device_key_extension = str_replace("\${extension}", $lines[$x]['user_id'], $device_key_extension); $device_key_extension = str_replace("\${password}", $lines[$x]['password'], $device_key_extension); $device_key_extension = str_replace("\${register_expires}", $lines[$x]['register_expires'], $device_key_extension); $device_key_extension = str_replace("\${sip_transport}", $lines[$x]['sip_transport'], $device_key_extension); $device_key_extension = str_replace("\${sip_port}", $lines[$x]['sip_port'], $device_key_extension); $device_key_extension = str_replace("\${server_address}", $lines[$x]['server_address'], $device_key_extension); $device_key_extension = str_replace("\${outbound_proxy}", $lines[$x]['outbound_proxy'], $device_key_extension); $device_key_extension = str_replace("\${display_name}", $lines[$x]['display_name'], $device_key_extension); $device_key_label = str_replace("\${user_id}", $lines[$x]['user_id'], $device_key_label); $device_key_label = str_replace("\${auth_id}", $lines[$x]['auth_id'], $device_key_label); $device_key_label = str_replace("\${extension}", $lines[$x]['user_id'], $device_key_label); $device_key_label = str_replace("\${password}", $lines[$x]['password'], $device_key_label); $device_key_label = str_replace("\${register_expires}", $lines[$x]['register_expires'], $device_key_label); $device_key_label = str_replace("\${sip_transport}", $lines[$x]['sip_transport'], $device_key_label); $device_key_label = str_replace("\${sip_port}", $lines[$x]['sip_port'], $device_key_label); $device_key_label = str_replace("\${server_address}", $lines[$x]['server_address'], $device_key_label); $device_key_label = str_replace("\${outbound_proxy}", $lines[$x]['outbound_proxy'], $device_key_label); $device_key_label = str_replace("\${display_name}", $lines[$x]['display_name'], $device_key_label); } //add variables with the index $device_key_value = str_replace("\${user_id_{$x}}", $lines[$x]['user_id'], $device_key_value); $device_key_value = str_replace("\${auth_id_{$x}}", $lines[$x]['auth_id'], $device_key_value); $device_key_value = str_replace("\${extension_{$x}}", $lines[$x]['user_id'], $device_key_value); $device_key_value = str_replace("\${password_{$x}}", $lines[$x]['password'], $device_key_value); $device_key_value = str_replace("\${register_expires_{$x}}", $lines[$x]['register_expires'], $device_key_value); $device_key_value = str_replace("\${sip_transport_{$x}}", $lines[$x]['sip_transport'], $device_key_value); $device_key_value = str_replace("\${sip_port_{$x}}", $lines[$x]['sip_port'], $device_key_value); $device_key_value = str_replace("\${server_address_{$x}}", $lines[$x]['server_address'], $device_key_value); $device_key_value = str_replace("\${outbound_proxy_{$x}}", $lines[$x]['outbound_proxy'], $device_key_value); $device_key_value = str_replace("\${display_name_{$x}}", $lines[$x]['display_name'], $device_key_value); $device_key_extension = str_replace("\${user_id_{$x}}", $lines[$x]['user_id'], $device_key_label); $device_key_extension = str_replace("\${auth_id_{$x}}", $lines[$x]['auth_id'], $device_key_label); $device_key_extension = str_replace("\${extension_{$x}}", $lines[$x]['user_id'], $device_key_label); $device_key_extension = str_replace("\${password_{$x}}", $lines[$x]['password'], $device_key_label); $device_key_extension = str_replace("\${register_expires_{$x}}", $lines[$x]['register_expires'], $device_key_label); $device_key_extension = str_replace("\${sip_transport_{$x}}", $lines[$x]['sip_transport'], $device_key_label); $device_key_extension = str_replace("\${sip_port_{$x}}", $lines[$x]['sip_port'], $device_key_label); $device_key_extension = str_replace("\${server_address_{$x}}", $lines[$x]['server_address'], $device_key_label); $device_key_extension = str_replace("\${outbound_proxy_{$x}}", $lines[$x]['outbound_proxy'], $device_key_label); $device_key_extension = str_replace("\${display_name_{$x}}", $lines[$x]['display_name'], $device_key_label); $device_key_label = str_replace("\${user_id_{$x}}", $lines[$x]['user_id'], $device_key_label); $device_key_label = str_replace("\${auth_id_{$x}}", $lines[$x]['auth_id'], $device_key_label); $device_key_label = str_replace("\${extension_{$x}}", $lines[$x]['user_id'], $device_key_label); $device_key_label = str_replace("\${password_{$x}}", $lines[$x]['password'], $device_key_label); $device_key_label = str_replace("\${register_expires_{$x}}", $lines[$x]['register_expires'], $device_key_label); $device_key_label = str_replace("\${sip_transport_{$x}}", $lines[$x]['sip_transport'], $device_key_label); $device_key_label = str_replace("\${sip_port_{$x}}", $lines[$x]['sip_port'], $device_key_label); $device_key_label = str_replace("\${server_address_{$x}}", $lines[$x]['server_address'], $device_key_label); $device_key_label = str_replace("\${outbound_proxy_{$x}}", $lines[$x]['outbound_proxy'], $device_key_label); $device_key_label = str_replace("\${display_name_{$x}}", $lines[$x]['display_name'], $device_key_label); //add general variables $device_key_value = str_replace("\${domain_name}", $domain_name, $device_key_value); $device_key_extension = str_replace("\${domain_name}", $domain_name, $device_key_extension); $device_key_label = str_replace("\${domain_name}", $domain_name, $device_key_label); //grandstream modes are different based on the category if ($device_vendor == "grandstream") { if ($device_key_category == "line") { switch ($device_key_type) { case "line": $device_key_type = "0"; break; case "shared line": $device_key_type = "1"; break; case "speed dial": $device_key_type = "10"; break; case "blf": $device_key_type = "11"; break; case "presence watcher": $device_key_type = "12"; break; case "eventlist blf": $device_key_type = "13"; break; case "speed dial active": $device_key_type = "14"; break; case "dial dtmf": $device_key_type = "15"; break; case "voicemail": $device_key_type = "16"; break; case "call return": $device_key_type = "17"; break; case "transfer": $device_key_type = "18"; break; case "call park": $device_key_type = "19"; break; case "intercom": $device_key_type = "20"; break; case "ldap search": $device_key_type = "21"; break; } } if ($device_key_category == "memory") { switch ($device_key_type) { case "speed dial": $device_key_type = "0"; break; case "blf": $device_key_type = "1"; break; case "presence watcher": $device_key_type = "2"; break; case "eventlist blf": $device_key_type = "3"; break; case "speed dial active": $device_key_type = "4"; break; case "dial dtmf": $device_key_type = "5"; break; case "voicemail": $device_key_type = "6"; break; case "call return": $device_key_type = "7"; break; case "transfer": $device_key_type = "8"; break; case "call park": $device_key_type = "9"; break; case "intercom": $device_key_type = "10"; break; case "ldap search": $device_key_type = "11"; break; } } } //assign the variables if (strlen($device_key_category) == 0) { $view->assign("key_id_" . $device_key_id, $device_key_id); $view->assign("key_type_" . $device_key_id, $device_key_type); $view->assign("key_line_" . $device_key_id, $device_key_line); $view->assign("key_value_" . $device_key_id, $device_key_value); $view->assign("key_extension_" . $device_key_id, $device_key_extension); $view->assign("key_label_" . $device_key_id, $device_key_label); } else { $view->assign($device_key_category . "_key_id_" . $device_key_id, $device_key_id); $view->assign($device_key_category . "_key_type_" . $device_key_id, $device_key_type); $view->assign($device_key_category . "_key_line_" . $device_key_id, $device_key_line); $view->assign($device_key_category . "_key_value_" . $device_key_id, $device_key_value); $view->assign($device_key_category . "_key_extension_" . $device_key_id, $device_key_extension); $view->assign($device_key_category . "_key_label_" . $device_key_id, $device_key_label); } } unset($prep_statement); //set the mac address in the correct format switch (strtolower($device_vendor)) { case "aastra": $mac = strtoupper($mac); break; case "snom": $mac = strtolower($mac); break; case "polycom": $mac = strtolower($mac); break; default: $mac = strtolower($mac); $mac = substr($mac, 0, 2) . '-' . substr($mac, 2, 2) . '-' . substr($mac, 4, 2) . '-' . substr($mac, 6, 2) . '-' . substr($mac, 8, 2) . '-' . substr($mac, 10, 2); } //replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number $view->assign("mac", $mac); $view->assign("label", $device_label); $view->assign("firmware_version", $device_firmware_version); $view->assign("domain_name", $domain_name); $view->assign("project_path", PROJECT_PATH); $view->assign("server1_address", $server1_address); $view->assign("proxy1_address", $proxy1_address); $view->assign("user_id", $user_id); $view->assign("password", $password); $view->assign("template", $device_template); //replace the dynamic provision variables that are defined in default, domain, and device settings foreach ($provision as $key => $val) { $view->assign($key, $val); } //set the template directory if (strlen($provision["template_dir"]) > 0) { $template_dir = $provision["template_dir"]; } //if the domain name directory exists then only use templates from it if (is_dir($template_dir . '/' . $domain_name)) { $device_template = $domain_name . '/' . $device_template; } //if $file is not provided then look for a default file that exists if (strlen($file) == 0) { if (file_exists($template_dir . "/" . $device_template . "/{\$mac}")) { $file = "{\$mac}"; } elseif (file_exists($template_dir . "/" . $device_template . "/{\$mac}.xml")) { $file = "{\$mac}.xml"; } elseif (file_exists($template_dir . "/" . $device_template . "/{\$mac}.cfg")) { $file = "{\$mac}.cfg"; } else { echo "file not found"; exit; } } else { //make sure the file exists if (!file_exists($template_dir . "/" . $device_template . "/" . $file)) { echo "file not found"; if ($_SESSION['provision']['debug']['boolean'] == 'true') { echo ":{$template_dir}/{$device_template}/{$file}<br/>"; echo "template_dir: {$template_dir}<br/>"; echo "device_template: {$device_template}<br/>"; echo "file: {$file}"; } exit; } } //output template to string for header processing $file_contents = $view->render($file); //log file for testing if ($_SESSION['provision']['debug']['boolean'] == 'true') { $tmp_file = "/tmp/provisioning_log.txt"; $fh = fopen($tmp_file, 'w') or die("can't open file"); $tmp_string = $mac . "\n"; fwrite($fh, $tmp_string); fclose($fh); } //returned the rendered template return $file_contents; }
} else { $newpass = ''; for ($i = 0; $i < rand(12, 20); $i++) { $num = rand(48, 122); if ($num > 97 && $num < 122 || $num > 65 && $num < 90 || $num > 48 && $num < 57) { $newpass .= chr($num); } else { $i--; } } // Send message if (!defined('SYS_SMTP')) { require_once BASE . 'subsystems/smtp.php'; } $e_template = new template('loginmodule', '_email_resetdone', $loc); $e_template->assign('newpass', $newpass); $msg = $e_template->render(); if (!defined('SYS_USERS')) { require_once BASE . 'subsystems/users.php'; } $u = exponent_users_getUserById($tok->uid); if (!exponent_smtp_mail($u->email, $i18n['from_name'] . ' <' . $i18n['from_email'] . '@' . HOSTNAME . '>', $i18n['title'], $msg)) { echo $i18n['smtp_error']; } else { // Save new password $u->password = md5($newpass); exponent_users_saveUser($u); $db->delete('passreset_token', 'uid=' . $tok->uid); echo $i18n['sent']; } }
function form($object) { global $user; pathos_lang_loadDictionary('standard', 'core'); pathos_lang_loadDictionary('modules', 'calendarmodule'); if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } pathos_forms_initialize(); $form = new form(); if (!isset($object->id)) { $object->title = ''; $object->body = ''; $object->eventdate = null; $object->eventdate->id = 0; $object->eventdate->date = time(); $object->eventstart = time(); $object->eventend = time() + 3600; $object->is_allday = 0; $object->is_recurring = 0; } else { $form->meta('id', $object->id); } $form->register('title', TR_CALENDARMODULE_TITLE, new textcontrol($object->title)); $form->register('body', TR_CALENDARMODULE_BODY, new htmleditorcontrol($object->body)); $form->register(null, '', new htmlcontrol('<hr size="1" />')); if ($object->is_recurring == 1) { $form->register(null, '', new htmlcontrol(TR_CALENDARMODULE_RECURMOVEWARNING, false)); } $form->register('eventdate', TR_CALENDARMODULE_EVENTDATE, new popupdatetimecontrol($object->eventdate->date, '', false)); $cb = new checkboxcontrol($object->is_allday, true); #Warning: when the box returns true, we have to switch off the time controls $cb->jsHooks = array('onClick' => 'pathos_forms_switch_time(\'eventstart\', this.form, this.checked ? false : true); pathos_forms_switch_time(\'eventend\',this.form, this.checked ? false : true);'); $form->register('is_allday', TR_CALENDARMODULE_ISALLDAY, $cb); #Warning: when the box returns true, we have to switch off the time controls $form->register('eventstart', TR_CALENDARMODULE_EVENTSTART, new timeControl($object->eventstart, $object->is_allday ? false : true)); $form->register('eventend', TR_CALENDARMODULE_EVENTEND, new timeControl($object->eventend, $object->is_allday ? false : true)); if (!isset($object->id)) { $customctl = file_get_contents(BASE . 'modules/calendarmodule/form.part'); $datectl = new popupdatetimecontrol($object->eventstart + 365 * 86400, '', false); $customctl = str_replace('%%UNTILDATEPICKER%%', $datectl->controlToHTML('untildate'), $customctl); $form->register('recur', TR_CALENDARMODULE_RECURRENCE, new customcontrol($customctl)); } else { if ($object->is_recurring == 1) { // Edit applies to one or more... $template = new template('calendarmodule', '_recur_dates'); global $db; $eventdates = $db->selectObjects('eventdate', 'event_id=' . $object->id); if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } if (!function_exists('pathos_sorting_byDateAscending')) { function pathos_sorting_byDateAscending($a, $b) { return $a->date > $b->date ? 1 : -1; } } usort($eventdates, 'pathos_sorting_byDateAscending'); if (isset($object->eventdate)) { $template->assign('checked_date', $object->eventdate); } $template->assign('dates', $eventdates); $form->register(null, '', new htmlcontrol('<hr size="1"/>' . TR_CALENDARMODULE_RECURRENCEWARNING)); $form->register(null, '', new htmlcontrol('<table cellspacing="0" cellpadding="2" width="100%">' . $template->render() . '</table>')); $form->meta('date_id', $object->eventdate->id); // Will be 0 if we are creating. } } $form->register('submit', '', new buttongroupcontrol(TR_CORE_SAVE, '', TR_CORE_CANCEL)); return $form; }
<?php ob_start(); session_start(); if (empty($_SESSION['user_id'])) { header("Location: ./login.php"); } require_once "autoload.php"; require_once "config/server.conf.php"; require_once "reg.php"; $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; $db = new DB(); $user = new res_users($db); $tpl = new template(); $groups = new res_groups($db); $partner = new res_partner($db); $pagination = new pagination(); $tpl->registries = json_decode(json_encode($Registry), FALSE); $tpl->title = "ERP :: Dashboard"; $tpl->userLogin = $user->userName($_SESSION['user_id']); echo $tpl->render("template/header.tpl"); echo $tpl->render("template/top_nav.tpl"); echo "<div class=\"container-fluid\">"; echo $tpl->render("template/form.tpl"); echo "</div>"; echo $tpl->render("template/footer.tpl");
static function folder_get_category($type, $folder, $folders) { $where = array("ftype=@type@", "id!=@id@", $_SESSION["permission_sql_read"]); $vars = array("type" => $type, "id" => $folder); $rows = db_select("simple_sys_tree", "id", $where, "lft asc", "200", $vars); if (is_array($rows) and count($rows) > 0) { foreach ($rows as $key => $row) { $rows[$key]["path"] = modify::getpath($row["id"]); } } $tpl = new template(); $tpl->items = $rows; $tpl->folder = $folder; $tpl->folders = $folders; $tpl->style = $_SESSION["theme"]; return $tpl->render("templates/ajax_folder_categories.php"); }
static function form($object) { global $user; $form = new form(); if (!isset($object->id)) { $object->title = ''; $object->body = ''; $object->eventdate = null; $object->eventdate->id = 0; $object->eventdate->date = time(); $object->eventstart = time(); $object->eventend = time() + 3600; $object->is_allday = 0; $object->is_featured = 0; $object->is_recurring = 0; } else { $form->meta('id', $object->id); } $form->register('title', gt('Title'), new textcontrol($object->title)); $form->register('body', gt('Body'), new htmleditorcontrol($object->body)); $form->register(null, '', new htmlcontrol('<hr size="1" />')); if ($object->is_recurring == 1) { $form->register(null, '', new htmlcontrol(gt('Warning: If you change the date below, it will only affect this specific events. All other changes can be applied to this and other events.'), false)); } //$form->register('eventdate',gt('Event Date'),new popupdatetimecontrol($object->eventdate->date,'',false)); $form->register('eventdate', gt('Event Date'), new yuicalendarcontrol($object->eventdate->date, '', false)); $cb = new checkboxcontrol($object->is_allday, false); $cb->jsHooks = array('onclick' => 'exponent_forms_disable_datetime(\'eventstart\',this.form,this.checked); exponent_forms_disable_datetime(\'eventend\',this.form,this.checked);'); $form->register('is_allday', gt('All Day Event'), $cb); $form->register('eventstart', gt('Start Time'), new datetimecontrol($object->eventstart, false)); $form->register('eventend', gt('End Time'), new datetimecontrol($object->eventend, false)); if (!isset($object->id)) { // $customctl = file_get_contents(BASE.'framework/modules-1/calendarmodule/form.part'); $custom = new formtemplate('forms/calendar', '_recurring'); $customctl = $custom->render(); //$datectl = new popupdatetimecontrol($object->eventstart+365*86400,'',false); $datectl = new yuicalendarcontrol($object->eventdate->date + 365 * 86400, '', false); $customctl = str_replace('%%UNTILDATEPICKER%%', $datectl->controlToHTML('untildate'), $customctl); $form->register('recur', gt('Recurrence'), new customcontrol($customctl)); } else { if ($object->is_recurring == 1) { // Edit applies to one or more... $template = new template('calendarmodule', '_recur_dates'); global $db; $eventdates = $db->selectObjects('eventdate', 'event_id=' . $object->id); $eventdates = expSorter::sort(array('array' => $eventdates, 'sortby' => 'date', 'order' => 'ASC')); if (isset($object->eventdate)) { $template->assign('checked_date', $object->eventdate); } $template->assign('dates', $eventdates); $form->register(null, '', new htmlcontrol('<hr size="1"/>' . gt('This event is a recurring event, and occurs on the dates below. Select which dates you wish to apply these edits to.'))); $form->register(null, '', new htmlcontrol('<table cellspacing="0" cellpadding="2" width="100%" class="exp-skin-table">' . $template->render() . '</table>')); $form->meta('date_id', $object->eventdate->id); // Will be 0 if we are creating. } } $form->register('featured_header', '', new htmlcontrol('<h3>' . gt('Featured Event Info') . '</h3><hr size="1" />')); $form->register('is_featured', gt('Feature this event'), new checkboxcontrol($object->is_featured, false)); /* Why was this even here? No views have it. 6/23/09 Time to implement it - Maia*/ // $form->register('image_header','',new htmlcontrol('<h3>'.gt('Upload Image File').'</h3><hr size="1" />')); // $form->register('file',gt('Upload Image'),new uploadcontrol()); // $form->register('tag_header','',new htmlcontrol('<h3>'.gt('Tags').'</h3><hr size="1" />')); $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel'))); return $form; }
foreach ($sidemenus as $sidemenu) { $side[] = $groups->menuName($sidemenu); } //$tpl->side = $side; foreach ($side as $sm) { $nomer[] = $sm->id; } $tpl->side = $groups->sideMenu($nomer); if (isset($_GET['idmenu'])) { $id_menu = $_GET['idmenu']; $null = null; } else { $null = "ok"; $id_menu = "null"; } $tpl->idmenu = $id_menu; /* * END Menu */ echo $tpl->render("template/header.tpl"); echo $tpl->render("template/top_nav.tpl"); echo "<div class=\"container-fluid\">"; echo $tpl->render("template/sidebar.tpl"); if ($null != "ok") { $tpl->child = $groups->childMenu($id_menu); echo $tpl->render("template/menu_big.tpl"); } else { echo $tpl->render("template/index.tpl"); } echo "</div>"; echo $tpl->render("template/footer.tpl");
} } } $tpl->auto_complete = true; } } if ($code != "") { $content .= "<br/> " . t("{t}%s secs{/t}", number_format(microtime(true) - $start, 4)); $content .= ", " . t("{t}%s M memory usage{/t}", number_format(memory_get_peak_usage(true) / 1048576, 2)); } $tpl->title = $title; $tpl->content = $content; if (isset($_REQUEST["no_gui"])) { echo $content; } else { echo $tpl->render("templates/console.php"); } function show_table($data, $full_texts = false, $vertical = true) { if (count($data) == 0) { return ""; } $limit = Max(round(220 / count($data[0])), 20); if ($vertical) { $limit = 150; } $content = "<table border='0' cellpadding='0' cellspacing='0'>"; if (!$vertical) { $content .= "<tr>"; foreach (array_keys($data[0]) as $value) { if ($full_texts and strlen($value) > $limit) {
/***** GET CONTENT *************************************************/ $modus_function = $modus . "_getContent"; if (function_exists($modus_function)) { $content = $modus_function(); } else { die('Unbekannter Modus'); } /***** GET MENU *************************************************/ $menu = array(); foreach ($active_modules as $module) { $menu_function = $module['modus'] . "_getMenu"; if (function_exists("{$menu_function}")) { $menu = array_merge($menu, $menu_function()); } } $template->addVar('left_menu', $menu); /***** GET SELECTORS ***********************************************/ $selectors = array(); foreach ($active_modules as $module) { $selector_function = $module['modus'] . "_getSelector"; if (function_exists("{$selector_function}")) { $selectors[] = array('modus' => $module['modus'], 'item' => $selector_function()); } } if (sizeof($selectors)) { $template->addVar('selectors', $selectors); } /***** FILL TEMPLATE ***********************************************/ $template->addVars(array('gfx' => GFX_PATH)); $template->render();
# it and/or modify it under the terms of the GNU # General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined("EXPONENT")) { exit(""); } // Sanitize required _GET parameters $_GET['id'] = intval($_GET['id']); $_GET['datatype'] = preg_replace('/[^A-Za-z0-9_]/', '', $_GET['datatype']); $object = $db->selectObject($_GET['datatype'] . "_wf_revision", "id=" . $_GET['id']); $rloc = unserialize($object->location_data); if (exponent_permissions_check("manage_approval", $rloc)) { // We need the module, in order to render the view correctly. $oloc = unserialize($object->location_data); $module = $oloc->mod; $template = new template($module, "_workflowview", $loc); $template->assign("item", $object); $view = $template->render(); $t = new template("workflow", "_viewrevision", $loc); $t->assign("view", $view); $t->assign("back", exponent_flow_get()); $t->assign("revision", $object); $t->output(); } else { echo SITE_403_HTML; }
if (isset($_POST['tambah_episode'])) { $anime->tambah_episode($_POST); } if (isset($_POST['tambah_link'])) { $link->tambah_link($_POST); } if (isset($_POST['tambah_menu'])) { $menu->tambah_menu($_POST); } if (isset($_POST['tambah_pengguna'])) { $pengguna->tambah_pengguna($_POST); } if (isset($_POST['valid_pengguna'])) { echo $pengguna->valid_pengguna($_POST); } echo $tpl->render("tpl/header.tpl"); if (isset($_GET['halaman'])) { $halaman = $_GET['halaman']; $halaman = "tpl/{$halaman}.tpl"; $url = "/?halaman=" . $_GET['halaman']; if ($menu->menuByurl($session_group, $url) == 1) { if (file_exists($halaman)) { echo $tpl->render($halaman); } else { echo "\n\t\t\t<div class=\"alert alert-danger\"> <strong>Warning</strong> <br>File <code>{$halaman}</code> is not axists!</div>\n\t\t\t"; } } else { echo "\n\t\t\t<div class=\"alert alert-danger\"> Anda tidak diijinkan untuk mengakses halaman ini</div>\n\t\t\t"; } } else { echo $tpl->render("tpl/home.tpl");
require "index.php"; sys_check_auth(); $folder_offline = db_select_value("simple_sys_tree", "id", "anchor=@anchor@", array("anchor" => "offline_" . $_SESSION["username"])); $rows = db_select("simple_offline", "*", "folder=@folder@", "id asc", "", array("folder" => (int) $folder_offline)); if (!is_array($rows)) { exit("No entries found."); } foreach ($rows as $key => $row) { $rows[$key] = populate_row($row); } uasort($rows, "sort_rows"); $tpl = new template(); $tpl->sync = isset($_REQUEST["sync"]) ? 1 : 0; $tpl->username = $_SESSION["username"]; $tpl->rows = $rows; echo $tpl->render("templates/offline.php"); function sort_rows($a, $b) { if ($a["path"] == $b["path"]) { return 0; } if ($a["path"] < $b["path"]) { return -1; } else { return 1; } } function populate_row($row) { $row["view"] = "display"; $row["folder"] = 0;
static function show_login() { if (!empty($_SESSION["username"])) { self::process_logout(); } if (isset($_COOKIE[SESSION_NAME])) { unset($_COOKIE[SESSION_NAME]); } if (!defined("NOCONTENT") and empty($_REQUEST["iframe"])) { define("NOCONTENT", true); $tpl = new template(); if (!empty($_REQUEST["view"])) { $tpl->view = $_REQUEST["view"]; } if (!empty($_REQUEST["find"])) { $tpl->find = "&find=" . $_REQUEST["find"]; } if (!empty($_REQUEST["folder"])) { $tpl->folder = $_REQUEST["folder"]; } if (!empty($_REQUEST["folder2"]) and !empty($_REQUEST["view2"])) { $tpl->folder = $_REQUEST["folder2"]; $tpl->view = $_REQUEST["view2"]; } if (isset($_REQUEST["item"]) and is_array($_REQUEST["item"]) and count($_REQUEST["item"]) > 0) { $tpl->item = "&item[]=" . implode("&item[]=", $_REQUEST["item"]); } if (!empty($_REQUEST["page"])) { $tpl->page = "&page=" . $_REQUEST["page"]; } $output = ob_get_contents(); ob_end_clean(); if ($output != "") { sys::$alert[] = $output; } if (sys::$alert) { $tpl->alert = sys::$alert; } exit($tpl->render("templates/login.php")); } if ($_SERVER["REQUEST_METHOD"] == "PROPFIND") { sys_log_message_log("login", sprintf("{t}No username/password.{/t} (Basic Auth) %s %s", _login_get_remoteaddr(), $_SERVER["HTTP_USER_AGENT"])); } // @see http://php.net/manual/en/features.http-auth.php header("HTTP/1.1 401 Authorization Required"); header("WWW-Authenticate: Basic realm=\"Simple Groupware\""); exit; }
/** * Main function, creating the listing * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TYPO3_CONF_VARS, $FILEMOUNTS; // Initialize the template object $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('templates/file_list.html'); $this->doc->getPageRenderer()->loadPrototype(); // Validating the input "id" (the path, directory!) and checking it against the mounts of the user. $this->id = $this->basicFF->is_directory($this->id); $access = $this->id && $this->basicFF->checkPathAgainstMounts($this->id . '/'); // There there was access to this file path, continue, make the list if ($access) { // include the initialization for the flash uploader if ($GLOBALS['BE_USER']->uc['enableFlashUploader']) { $this->doc->JScodeArray['flashUploader'] = ' if (top.TYPO3.FileUploadWindow.isFlashAvailable()) { document.observe("dom:loaded", function() { // monitor the button $("button-upload").observe("click", initFlashUploader); function initFlashUploader(event) { // set the page specific options for the flashUploader var flashUploadOptions = { uploadURL: top.TS.PATH_typo3 + "ajax.php", uploadFileSizeLimit: "' . t3lib_div::getMaxUploadFileSize() . '", uploadFileTypes: { allow: "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['allow'] . '", deny: "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['deny'] . '" }, uploadFilePostName: "upload_1", uploadPostParams: { "file[upload][1][target]": "' . $this->id . '", "file[upload][1][data]": 1, "file[upload][1][charset]": "utf-8", "ajaxID": "TYPO3_tcefile::process" } }; // get the flashUploaderWindow instance from the parent frame var flashUploader = top.TYPO3.FileUploadWindow.getInstance(flashUploadOptions); // add an additional function inside the container to show the checkbox option var infoComponent = new top.Ext.Panel({ autoEl: { tag: "div" }, height: "auto", bodyBorder: false, border: false, hideBorders: true, cls: "t3-upload-window-infopanel", id: "t3-upload-window-infopanel-addition", html: \'<label for="overrideExistingFilesCheckbox"><input id="overrideExistingFilesCheckbox" type="checkbox" onclick="setFlashPostOptionOverwriteExistingFiles(this);" />\' + top.String.format(top.TYPO3.LLL.fileUpload.infoComponentOverrideFiles) + \'</label>\' }); flashUploader.add(infoComponent); // do a reload of this frame once all uploads are done flashUploader.on("totalcomplete", function() { window.location.reload(); }); // this is the callback function that delivers the additional post parameter to the flash application top.setFlashPostOptionOverwriteExistingFiles = function(checkbox) { var uploader = top.TYPO3.getInstance("FileUploadWindow"); if (uploader.isVisible()) { uploader.swf.addPostParam("overwriteExistingFiles", (checkbox.checked == true ? 1 : 0)); } }; event.stop(); }; }); } '; } // Create filelisting object $this->filelist = t3lib_div::makeInstance('fileList'); $this->filelist->backPath = $BACK_PATH; // Apply predefined values for hidden checkboxes // Set predefined value for DisplayBigControlPanel: if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') { $this->MOD_SETTINGS['bigControlPanel'] = TRUE; } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') { $this->MOD_SETTINGS['bigControlPanel'] = FALSE; } // Set predefined value for DisplayThumbnails: if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') { $this->MOD_SETTINGS['displayThumbs'] = TRUE; } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') { $this->MOD_SETTINGS['displayThumbs'] = FALSE; } // Set predefined value for Clipboard: if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') { $this->MOD_SETTINGS['clipBoard'] = TRUE; } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') { $this->MOD_SETTINGS['clipBoard'] = FALSE; } // if user never opened the list module, set the value for displayThumbs if (!isset($this->MOD_SETTINGS['displayThumbs'])) { $this->MOD_SETTINGS['displayThumbs'] = $BE_USER->uc['thumbnailsByDefault']; } $this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs']; // Create clipboard object and initialize that $this->filelist->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); $this->filelist->clipObj->fileMode = 1; $this->filelist->clipObj->initializeClipboard(); $CB = t3lib_div::_GET('CB'); if ($this->cmd == 'setCB') { $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'), t3lib_div::_POST('CBC')), '_FILE'); } if (!$this->MOD_SETTINGS['clipBoard']) { $CB['setP'] = 'normal'; } $this->filelist->clipObj->setCmd($CB); $this->filelist->clipObj->cleanCurrent(); $this->filelist->clipObj->endClipboard(); // Saves // If the "cmd" was to delete files from the list (clipboard thing), do that: if ($this->cmd == 'delete') { $items = $this->filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), '_FILE', 1); if (count($items)) { // Make command array: $FILE = array(); foreach ($items as $v) { $FILE['delete'][] = array('data' => $v); } // Init file processing object for deleting and pass the cmd array. $fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions'); $fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']); $fileProcessor->init_actionPerms($GLOBALS['BE_USER']->getFileoperationPermissions()); $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0; $fileProcessor->start($FILE); $fileProcessor->processData(); $fileProcessor->printLogErrorMessages(); } } if (!isset($this->MOD_SETTINGS['sort'])) { // Set default sorting $this->MOD_SETTINGS['sort'] = 'file'; $this->MOD_SETTINGS['reverse'] = 0; } // Start up filelisting object, include settings. $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000); $this->filelist->start($this->id, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard'], $this->MOD_SETTINGS['bigControlPanel']); // Generate the list $this->filelist->generateList(); // Write the footer $this->filelist->writeBottom(); // Set top JavaScript: $this->doc->JScode = $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["file"] = unescape("' . rawurlencode($this->id) . '"); function jumpToUrl(URL) { // window.location.href = URL; } ' . $this->filelist->CBfunctions()); // This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers. $this->doc->getContextMenuCode(); // Setting up the buttons and markers for docheader list($buttons, $otherMarkers) = $this->filelist->getButtonsAndOtherMarkers($this->id); // add the folder info to the marker array $otherMarkers['FOLDER_INFO'] = $this->filelist->getFolderInfo(); $docHeaderButtons = array_merge($this->getButtons(), $buttons); // Build the <body> for the module // Create output $pageContent = ''; $pageContent .= '<form action="' . htmlspecialchars($this->filelist->listURL()) . '" method="post" name="dblistForm">'; $pageContent .= $this->filelist->HTMLcode; $pageContent .= '<input type="hidden" name="cmd" /></form>'; if ($this->filelist->HTMLcode) { // Making listing options: $pageContent .= ' <!-- Listing options for extended view, clipboard and thumbnails --> <div id="typo3-listOptions"> '; // Add "display bigControlPanel" checkbox: if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable') { $pageContent .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], 'file_list.php', '', 'id="bigControlPanel"') . '<label for="bigControlPanel"> ' . $GLOBALS['LANG']->getLL('bigControlPanel', TRUE) . '</label><br />'; } // Add "display thumbnails" checkbox: if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable') { $pageContent .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[displayThumbs]', $this->MOD_SETTINGS['displayThumbs'], 'file_list.php', '', 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->getLL('displayThumbs', TRUE) . '</label><br />'; } // Add "clipboard" checkbox: if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable') { $pageContent .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], 'file_list.php', '', 'id="checkClipBoard"') . ' <label for="checkClipBoard">' . $GLOBALS['LANG']->getLL('clipBoard', TRUE) . '</label>'; } $pageContent .= ' </div> '; // Set clipboard: if ($this->MOD_SETTINGS['clipBoard']) { $pageContent .= $this->filelist->clipObj->printClipboard(); $pageContent .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_clipboard', $GLOBALS['BACK_PATH']); } } $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent); $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers)); // Renders the module page $this->content = $this->doc->render($LANG->getLL('files'), $this->content); } else { // Create output - no access (no warning though) $this->content = $this->doc->render($LANG->getLL('files'), ''); } }
<?php ob_start(); session_start(); require_once "autoload.php"; require_once "config/server.conf.php"; $db = new DB(); $user = new res_users($db); $tpl = new template(); if ($_POST) { extract($_POST); $doLogin = $user->doLogin($login, $password); if ($doLogin == "ok") { header("Location: ./index.php"); } else { header("Location: ./login.php?err=" . $doLogin); } } $tpl->title = "Login::"; echo $tpl->render("template/header.tpl"); echo $tpl->render("template/login.tpl"); echo $tpl->render("template/footer.tpl");
public function get() { template::render(dirname(__FILE__) . '/templates/test.html'); }
// foreach($items[$i]->tags as $tag) { // if (in_array($tag->id, $available_tags) || count($available_tags) == 0) { // if (!isset($grouped_news[$tag->name])) { $grouped_news[$tag->name] = array();} // array_push($grouped_news[$tag->name],$items[$i]); // } // } // } // } // } // format and send email $subject = $config->email_title_reminder . " - {$title}"; $from_addr = $config->email_address_reminder; $headers = array("From" => $from = $config->email_from_reminder, "Reply-to" => $reply = $config->email_reply_reminder); // set up the html message $template->assign("showdetail", $config->email_showdetail); $htmlmsg = $template->render(); // now the same thing for the text message $msg = chop(strip_tags(str_replace(array("<br />", "<br>", "br/>"), "\n", $htmlmsg))); // Saved. do notifs $notifs = unserialize($config->reminder_notify); $emails = array(); foreach ($db->selectObjects('calendar_reminder_address', "calendar_id='" . $config->id . "'") as $c) { if ($c->user_id != 0) { $u = user::getUserById($c->user_id); $emails[] = $u->email; } else { if ($c->group_id != 0) { $grpusers = group::getUsersInGroup($c->group_id); foreach ($grpusers as $u) { $emails[] = $u->email; }
# Exponent is free software; you can redistribute # it and/or modify it under the terms of the GNU # General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined('EXPONENT')) { exit(''); } $i18n = exponent_lang_loadFile('modules/contactmodule/actions/contact.php'); $template = new template('contactmodule', $_POST['msg'], $loc); $template->assign('post', $_POST); $msg = $template->render(); $config = $db->selectObject('contactmodule_config', "location_data='" . serialize($loc) . "'"); if ($config == null) { $config->subject = $i18n['default_subject']; $config->replyto_address = ''; $config->from_address = 'info@' . HOSTNAME; $config->from_name = $i18n['default_from']; } else { if ($config->subject == '') { $config->subject = $i18n['default_subject']; } } $headers = array(); $headers['From'] = $config->from_name . ' <' . $config->from_address . '>'; if ($config->replyto_address != '') { $headers['Reply-to'] = $config->replyto_address;
function form($object) { global $user; $i18n = exponent_lang_loadFile('datatypes/calendar.php'); if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } exponent_forms_initialize(); $form = new form(); if (!isset($object->id)) { $object->title = ''; $object->body = ''; $object->eventdate = null; $object->eventdate->id = 0; $object->eventdate->date = time(); $object->eventstart = time(); $object->eventend = time() + 3600; $object->is_allday = 0; $object->is_recurring = 0; } else { $form->meta('id', $object->id); } $form->addScript("switchControl", exponent_core_abs2rel(array_shift(exponent_core_resolveFilePaths("forms", "", "js", "switchControl")))); $form->register('title', $i18n['title'], new textcontrol($object->title)); $form->register('body', $i18n['body'], new htmleditorcontrol($object->body)); $form->register(null, '', new htmlcontrol('<hr size="1" />')); if ($object->is_recurring == 1) { $form->register(null, '', new htmlcontrol($i18n['remove_warning'], false)); } $form->register('eventdate', $i18n['eventdate'], new PopupDateTimeControl($object->eventdate->date, '', false)); $cb = new checkboxcontrol($object->is_allday, true); #Warning: when the box returns true, we have to switch OFF the time controls $cb->jsHooks = array('onClick' => 'Exponent.Forms.switchControl(\'eventstart_TimeControl\', this.checked ? false : true); Exponent.Forms.switchControl(\'eventend_TimeControl\', this.checked ? false : true);'); $form->register('is_allday', $i18n['is_allday'], $cb); #Warning: when the box returns true, we have to switch OFF the time controls $form->register('eventstart', $i18n['eventstart'], new TimeControl($object->eventstart, $object->is_allday ? false : true)); $form->register('eventend', $i18n['eventend'], new TimeControl($object->eventend, $object->is_allday ? false : true)); if (!isset($object->id)) { $customctl = file_get_contents(BASE . 'modules/CalendarModule/form.part'); $datectl = new PopupDateTimeControl($object->eventstart + 365 * 86400, '', false); $customctl = str_replace('%%UNTILDATEPICKER%%', $datectl->controlToHTML('untildate'), $customctl); $form->register('recur', $i18n['recurrence'], new customcontrol($customctl)); } else { if ($object->is_recurring == 1) { // Edit applies to one or more... $template = new template('CalendarModule', '_recur_dates'); global $db; $eventdates = $db->selectObjects('eventdate', 'event_id=' . $object->id); if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } if (!function_exists('exponent_sorting_byDateAscending')) { function exponent_sorting_byDateAscending($a, $b) { return $a->date > $b->date ? 1 : -1; } } //Pathos Compatibility::this is deprecated if (@defined(PATHOS)) { if (!function_exists('pathos_sorting_byDateAscending')) { function pathos_sorting_byDateAscending($a, $b) { return exponent_sorting_byDateAscending($a, $b); } } } //End Pathos Compatibility usort($eventdates, 'exponent_sorting_byDateAscending'); if (isset($object->eventdate)) { $template->assign('checked_date', $object->eventdate); } $template->assign('dates', $eventdates); $form->register(null, '', new htmlcontrol('<hr size="1"/>' . $i18n['recurrence_warning'])); $form->register(null, '', new htmlcontrol('<table cellspacing="0" cellpadding="2" width="100%">' . $template->render() . '</table>')); $form->meta('date_id', $object->eventdate->id); // Will be 0 if we are creating. } } $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel'])); return $form; }
# GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined('EXPONENT')) { exit(''); } if (exponent_permissions_check('manage_site', exponent_core_makeLocation('sharedcoremodule'))) { $site = null; if (isset($_POST['site_id'])) { $site = $db->selectObject('sharedcore_site', 'id=' . intval($_POST['site_id'])); } if ($site) { if (!defined('SYS_SHAREDCORE')) { require_once BASE . 'subsystems/sharedcore.php'; } exponent_sharedcore_clear($site->path); // Do not delete other stuff. $template = new template('sharedcoremodule', $_POST['tpl']); $template->assign('reason', $_POST['reason']); $fh = fopen($site->path . 'index.php', 'w'); fwrite($fh, $template->render()); fclose($fh); $site->inactive = 1; $db->updateObject($site, 'sharedcore_site'); exponent_flow_redirect(); } else { echo SITE_404_HTML; } } else { echo SITE_403_HTML; }
$emaillist[] = $address->email; } } } } if ($rpt->text == "") { $template = new template("formbuilder", "_default_report"); } else { $template = new template("formbuilder", "_custom_report"); $template->assign("template", $rpt->text); } $template->assign("fields", $emailFields); $template->assign("captions", $captions); $template->assign('title', $rpt->name); $template->assign("is_email", 1); $emailText = $template->render(); $emailText = chop(strip_tags(str_replace(array("<br />", "<br>", "br/>"), "\n", $emailText))); $template->assign("css", file_get_contents(BASE . "framework/core/assets/css/tables.css")); $emailHtml = $template->render(); if (empty($from)) { $from = trim(SMTP_FROMADDRESS); } if (empty($from_name)) { $from_name = trim(ORGANIZATION_NAME); } $headers = array("MIME-Version" => "1.0", "Content-type" => "text/html; charset=" . LANG_CHARSET); if (count($emaillist)) { //This is an easy way to remove duplicates $emaillist = array_flip(array_flip($emaillist)); $emaillist = array_map('trim', $emaillist); $mail = new expMail();
if ($address->email != '') { $emaillist[] = $address->email; } } } } if ($rpt->text == "") { $template = new template("formbuilder", "_default_report"); } else { $template = new template("formbuilder", "_custom_report"); $template->assign("template", $rpt->text); } $template->assign("fields", $fields); $template->assign("captions", $captions); $template->assign("is_email", 1); $emailHtml = $template->render(); if (count($emaillist)) { //This is an easy way to remove duplicates $emaillist = array_flip(array_flip($emaillist)); if (!defined("SYS_SMTP")) { require_once BASE . "subsystems/smtp.php"; } $headers = array("MIME-Version" => "1.0", "Content-type" => "text/html; charset=iso-8859-1"); if (pathos_smtp_mail($emaillist, "", $f->subject, $emailHtml, $headers) == false) { pathos_lang_loadDictionary('modules', 'formbuilder'); echo TR_FORMBUILDER_ERR_SMTP; } } } //If is a new post show response, otherwise redirect to the flow. if (!isset($_POST['data_id'])) {
<?php require '../vendor/autoload.php'; /* JABH creamos una funcion en App define('DOMPDF_ENABLE_AUTOLOAD', false); require_once '../vendor/dompdf/dompdf/dompdf_config.inc.php'; */ $data = array('nombre' => 'Jonny Alexander Berrio', 'curso' => 'Laravel 5'); /* JABH creamos una funcion en App ob_start(); extract($data); include '../templates/pdf/certificate-2.php'; $html= ob_get_clean(); */ require_once '../app/template.php'; $html = template::render('pdf/certificate-2', $data); /* JABH creamos una funcion en App $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf"); */ require_once '../app/pdf.php'; pdf::render('certificate-2', $html);