/** * Saves the record from an edit form submit * @param string The current GET/POST option */ function saveSyndicate($option) { global $database; $params = mosGetParam($_POST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $id = mosGetParam($_POST, 'id', '17'); $row = new mosComponent($database); $row->load($id); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $msg = T_('Settings successfully Saved'); mosRedirect('index2.php?option=' . $option, $msg); }
function createform($_name, $_type = null) { $this->data->extendForm = true; if (!$this->form) { $this->twig_macro('form'); $this->form = new \lib\form(); $this->data->form = object(); } $args = func_get_args(); if (count($args) === 2) { $submit_value = T_('submit'); if ($_type == 'add') { $submit_value = T_('submit'); } elseif ($_type == 'edit') { $submit_value = T_('save'); } elseif ($_type == 'login') { $submit_value = T_('sing in'); } elseif ($_type == 'register') { $submit_value = T_('create an account'); } elseif (!empty($_type)) { $submit_value = $_type; } array_push($args, $submit_value); } $form = call_user_func_array(array($this->form, 'make'), $args); if (get_class($form) == 'lib\\form' || preg_match("/cls\\\\form/", get_class($form))) { preg_match("/^(@[^\\.]+)*\\.(.+)\$/", $_name, $sName); $this->data->form->{$sName[2]} = $form; } // if type of form is edit then fill it with related data if ($_type == 'edit') { $this->form_fill($form, $sName[2]); } return $form; }
/** * Generate the case status report * * @param mixed $questionnaire_id The quesitonnaire, if specified * @param string $sample_id The sample, if speified * @param mixed $outcome_id THe outcome id, if specified * * @return false if empty otherwise true if table drawn * @author Adam Zammit <*****@*****.**> * @since 2012-10-02 */ function case_status_report($questionnaire_id = false, $sample_id = false, $outcome_id = false) { global $db; $q = ""; if ($questionnaire_id !== false) { $q = "AND c.questionnaire_id = {$questionnaire_id}"; } $s = ""; if ($sample_id !== false) { $s = "AND s.import_id = '{$sample_id}'"; } $o = ""; if ($outcome_id !== false) { $o = "AND c.current_outcome_id = {$outcome_id}"; } $sql = "SELECT \tCONCAT('<a href=\\'supervisor.php?case_id=', c.case_id, '\\'>', c.case_id, '</a>') as case_id,\r\n\t\t\to.description as outcomes,\r\n\t\t\tsi.description as samples, s.Time_zone_name as timezone, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,s.Time_zone_name),'" . TIME_FORMAT . "') as time, (SELECT COUNT(*) FROM `call` WHERE `call`.case_id = c.case_id) as nrcalls, (SELECT COUNT(*) FROM call_attempt WHERE call_attempt.case_id = c.case_id) as nrattempts, \t\r\n\t\t\tCASE WHEN ca.end IS NULL THEN '" . TQ_("Available") . "'\r\n\t\t\t\tWHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . TQ_("Available") . "'\r\n\t\t\t\tELSE CONCAT(ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60),' " . TQ_("minutes") . "')\r\n\t\t\tEND AS availableinmin,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('')\r\n\t\t\tELSE CONCAT('<span class=\\'text-info\\'>', oq.firstName,' ',oq.lastName,'</span>')\r\n\t\t\tEND AS assignedoperator,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('')\r\n\t\t\tELSE CONCAT('   ', cq.sortorder ,' ')\r\n\t\t\tEND AS ordr,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('<span data-toggle=\\'tooltip\\' title=\\'" . TQ_("Not assigned, select to assign") . "\\'><input type=\\'checkbox\\' name=\\'c', c.case_id, '\\' value=\\'', c.case_id, '\\' /></span>')\r\n\t\t\tELSE CONCAT('<a href=\"?questionnaire_id={$questionnaire_id}&sample_import_id={$sample_id}&unassign=', cq.case_queue_id, '\" data-toggle=\\'tooltip\\' title=\\'" . TQ_("Click to unassign") . "\\'><i class=\\'fa fa-trash-o fa-lg text-danger\\'></i></a>')\r\n\t\t\tEND AS flag\t\r\n\t\tFROM `case` as c\r\n\t\tJOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1)\r\n\t\tJOIN outcome as o ON (o.outcome_id = c.current_outcome_id AND o.outcome_type_id = 1)\r\n\t\tJOIN sample as s ON (s.sample_id = c.sample_id {$s})\r\n\t\tJOIN sample_import as si ON (s.import_id = si.sample_import_id AND si.enabled = 1)\r\n\t\tJOIN questionnaire_sample as qs ON (qs.questionnaire_id = {$questionnaire_id} AND qs.sample_import_id = s.import_id)\r\n\t\tLEFT JOIN `call` as ca ON (ca.call_id = c.last_call_id)\r\n\t\tLEFT JOIN outcome as co ON (co.outcome_id = ca.outcome_id)\r\n\t\tLEFT JOIN case_queue as cq ON (cq.case_id = c.case_id)\r\n\t\tLEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id)\r\n\t\tLEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)\r\n\t\tLEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)\r\n\t\tWHERE c.current_operator_id IS NULL {$q} {$o}\r\n\t\tAND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )\r\n\t\tAND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)\r\n\t\tGROUP BY c.case_id ORDER BY c.case_id ASC"; print "<form method=\"post\" action=\"?questionnaire_id={$questionnaire_id}&sample_import_id={$sample_id}\">"; $rs2 = $db->GetAll($sql); translate_array($rs2, array("outcomes")); $datacol = array('case_id', 'samples', 'timezone', 'time', 'nrattempts', 'nrcalls', 'outcomes', 'availableinmin', 'assignedoperator', 'ordr', 'flag'); $headers = array(T_("Case id"), T_("Sample"), T_("Timezone"), T_("Time NOW"), T_("Call attempts"), T_("Calls"), T_("Outcome"), T_("Available in"), T_("Assigned to"), T_("Order"), "<i class='fa fa-check-square-o fa-lg'></i>"); if (isset($_GET['sample_import_id'])) { unset($datacol[1]); unset($headers[1]); } xhtml_table($rs2, $datacol, $headers, "tclass", false, false, "bs-table"); $sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected\r\n\t\tFROM operator\r\n\t\tWHERE enabled = 1"; $rs3 = $db->GetAll($sql); print "<h4 class='col-sm-offset-5 pull-left text-right control-label'>" . T_("Assign selected cases to") . " " . T_("operator") . " : </h4> "; display_chooser($rs3, "operator_id", "operator_id", true, false, false, true, false, true, "pull-left"); print " <button class='btn btn-default' type='submit' data-toggle='tooltip' title='" . T_("Assign cases to operator queue") . "'><i class='fa fa-link fa-lg text-primary'></i> " . T_("Assign") . "</button>"; print "</form></br>"; return true; }
/** * Display the icon legend */ function display_legend() { if (empty($this->icons)) { return; } // There are some icons to display: echo '<div id="icon_legend">' . T_('Legend') . ': '; // Loop on all map array of filenames for icons to display icons list in the same order: foreach ($this->icons as $icon) { $icon_info = get_icon_info($icon); if (!$icon_info) { continue; } echo '<span class="legend_element">' . get_icon($icon) . ' '; if (isset($icon_info['legend'])) { // Icon has a legend: echo $icon_info['legend'] . ' '; } else { // Icon has no legend so we use the alt: echo $icon_info['alt'] . ' '; } echo '</span>'; } echo '</div>'; }
/** * Callback to add filters on top of the result set * * @param Form */ function filter_email_return(&$Form) { global $datestart, $datestop, $email; $Form->date_input('datestartinput', $datestart, T_('From date')); $Form->date_input('datestopinput', $datestop, T_('To date')); $Form->text_input('email', $email, 40, T_('Email')); }
/** * signup to system * @return [type] [description] */ public function post_signup() { // get parameters and set to local variables $mymobile = utility::post('mobile', 'filter'); $mypass = utility::post('password', 'hash'); $myperm = $this->option('account'); if (!$myperm) { $myperm = 'NULL'; } $user_id = \lib\db\users::signup($mymobile, $mypass, $myperm); if ($user_id) { // generate verification code // save in logs table // set SESSION verification_mobile $code = \lib\utility\filter::generate_verification_code($user_id, $mymobile); if ($code) { \lib\utility\sms::send($mymobile, 'signup', $code); debug::true(T_("Register successfully")); $this->redirector()->set_url('verification?from=signup&mobile=' . $mymobile); // $this->redirector()->set_url('login?from=signup&cp=1&mobile='.$mymobile); } else { debug::error(T_("Please contact to administrator!")); } } elseif ($user_id === false) { debug::error(T_("Mobile number exist!")); } else { debug::error(T_("Please contact to administrator!")); } }
function uploadimage($x, $imgname, $tid) { global $site_config; $imagesdir = $site_config["torrent_dir"] . "/images"; $allowed_types =& $site_config["allowed_image_types"]; if (!($_FILES["image{$x}"]["name"] == "")) { if ($imgname != "") { $img = "{$imagesdir}/{$imgname}"; $del = unlink($img); } $y = $x + 1; $im = getimagesize($_FILES["image{$x}"]["tmp_name"]); if (!$im[2]) { show_error_msg(T_("ERROR"), "Invalid Image {$y}.", 1); } if (!array_key_exists($im['mime'], $allowed_types)) { show_error_msg(T_("ERROR"), T_("INVALID_FILETYPE_IMAGE"), 1); } if ($_FILES["image{$x}"]["size"] > $site_config['image_max_filesize']) { show_error_msg(T_("ERROR"), sprintf(T_("INVAILD_FILE_SIZE_IMAGE"), $y), 1); } $uploaddir = "{$imagesdir}/"; $ifilename = $tid . $x . $allowed_types[$im['mime']]; $copy = copy($_FILES["image{$x}"]["tmp_name"], $uploaddir . $ifilename); if (!$copy) { show_error_msg(T_("ERROR"), sprintf(T_("ERROR_UPLOADING_IMAGE"), $y), 1); } return $ifilename; } }
function showBlogLastArticles() { $content = ''; $feed = new SimplePie(); $feed->set_feed_url(array('http://bilboplanet.com/feed/')); $feed->set_cache_duration(600); # $feed->enable_xml_dump(isset($_GET['xmldump']) ? true : false); $success = $feed->init(); $feed->handle_content_type(); if ($success) { $content .= '<div class="box-dashboard"><div class="top-box-dashboard">' . T_('BilboPlanet news - Official Website :') . '</div>'; $content .= '<ul>'; $itemlimit = 0; foreach ($feed->get_items() as $item) { if ($itemlimit == 4) { break; } $content .= '<li>' . $item->get_date('j/m/y') . ' : '; $content .= '<a class="tips" rel="' . $item->get_title() . '" href="' . $item->get_permalink() . '" target="_blank">' . $item->get_title() . '</a>'; $content .= '</li>'; $itemlimit = $itemlimit + 1; } $content .= '</ul></div>'; } return $content; }
public function datarow($_table = null, $_id = null, $_metatable = false) { if (!$_table) { $_table = $this->module(); } // if myid parameter set use it else use url parameter for myid if (!$_id) { $_id = $this->childparam(); } $tmp_result = $this->sql()->table($_table)->where('id', $_id)->select(); if ($tmp_result->num() == 1) { $tmp_result = $tmp_result->assoc(); // add meta table rows as filed to datarow, can access via meta in datarow if ($_metatable) { $metas = $this->sql()->table('options')->where('post_id', $_id)->field('option_key', 'option_value', 'option_meta')->select()->allassoc(); foreach ($metas as $key => $value) { $myval = $value['option_meta']; if (substr($myval, 0, 1) === '{') { $myval = json_decode($myval, true); } $mykey = strtok($value['option_key'], '_'); $tmp_result['meta'][$mykey] = $myval; } } return $tmp_result; } elseif ($tmp_result->num() > 1) { \lib\error::access(T_("id is found 2 or more times. it's imposible!")); } else { \lib\error::access(T_("Url incorrect: id not found")); return false; } return null; }
function navmenu() { ?> <br /> <div class="f-border"> <table cellpadding='0' cellspacing='3' width='100%'> <tr class="f-title"> <th width='100%' height="32" align='center'> <?php print "<a href='account.php'><b>" . T_("YOUR_PROFILE") . "</b></a>"; ?> | <?php print "<a href='account.php?action=edit_settings&do=edit'><b>" . T_("YOUR_SETTINGS") . "</b></a>"; ?> | <?php print "<a href='account.php?action=changepw'><b>" . T_("CHANGE_PASS") . "</b></a>"; ?> | <?php print "<a href='account.php?action=mytorrents'><b>" . T_("YOUR_TORRENTS") . "</b></a>"; ?> | <?php print "<a href='mailbox.php'><b>" . T_("YOUR_MESSAGES") . "</b></a>"; ?> </th> </tr> </table> </div> <br /> <?php }
private function loadSettingsFromFile($dbSettingsFile) { // Check that databaseSettingsFile is valid if (!is_readable($dbSettingsFile)) { ErrorHandling::fatalNoDatabaseError(T_("DB Config File isn't a valid file.") . "({$dbSettingsFile})"); } $settings = file($dbSettingsFile); foreach ($settings as $setting) { list($key, $value) = explode(":", $setting); $value = trim($value); switch ($key) { case 'sql_username': $this->user = $value; break; case 'sql_password': $this->pass = $value; break; case 'sql_server': $this->host = $value; break; case 'sql_database': case 'sql_radmindatabase': $this->db = $value; break; } } }
/** * Contacts Search method * * The sql must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav * @param string Target search string * @param string mathcing option, exact|any|all * @param string ordering option, newest|oldest|popular|alpha|category */ function botSearchContacts($text, $phrase = '', $ordering = '') { global $database, $my; $text = trim($text); if ($text == '') { return array(); } $section = T_('Contact'); switch ($ordering) { case 'alpha': $order = 'a.name ASC'; break; case 'category': $order = 'b.title ASC, a.name ASC'; break; case 'popular': case 'newest': case 'oldest': default: $order = 'a.name DESC'; } $database->setQuery("SELECT id FROM #__menu WHERE link LIKE 'index.php?option=com_contact%' ORDER BY LENGTH(link)"); $citemid = $database->loadResult(); $query = "SELECT a.name AS title," . "\n CONCAT_WS( ', ', a.name, a.con_position, a.misc ) AS text," . "\n '' AS created," . "\n CONCAT_WS( ' / ', '{$section}', b.title ) AS section," . "\n '2' AS browsernav," . "\n CONCAT( 'index.php?option=com_contact&task=view&Itemid={$citemid}&contact_id=', a.id ) AS href" . "\n FROM #__contact_details AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid AND b.access <= '{$my->gid}'" . "\n WHERE ( a.name LIKE '%{$text}%'" . "\n OR a.misc LIKE '%{$text}%'" . "\n OR a.con_position LIKE '%{$text}%'" . "\n OR a.address LIKE '%{$text}%'" . "\n OR a.suburb LIKE '%{$text}%'" . "\n OR a.state LIKE '%{$text}%'" . "\n OR a.country LIKE '%{$text}%'" . "\n OR a.postcode LIKE '%{$text}%'" . "\n OR a.telephone LIKE '%{$text}%'" . "\n OR a.fax LIKE '%{$text}%' )" . "\n AND a.published = '1'" . "\n ORDER BY {$order}"; $database->setQuery($query); $rows = $database->loadObjectList(); return $rows; }
/** * __construct * * @param FCMS_Error $error * @param Database $db * @param int $id * * @return void */ public function __construct(FCMS_Error $error, Database $db, $id = null) { if (!isset($_SESSION['fcms_id']) && is_null($id)) { $this->displayName = 'unknown-user'; $this->email = 'unknow-email'; $this->tzOffset = ''; $this->access = 10; return; } else { if (isset($_SESSION['fcms_id'])) { $this->id = (int) $_SESSION['fcms_id']; } } // Passing in an ID, will overwrite the session // So we can create a user object for a user other than the logged in one if (!is_null($id)) { $this->id = (int) $id; } $this->error = $error; $this->db = $db; // Get User info $sql = "SELECT u.`fname`, u.`lname`, u.`username`, s.`displayname`, u.`email`, s.`timezone`, u.`access`\n FROM `fcms_users` AS u\n LEFT JOIN `fcms_user_settings` AS s ON u.`id` = s.`user`\n WHERE u.`id` = ?"; $userInfo = $this->db->getRow($sql, $this->id); if ($userInfo === false) { $this->error->setMessage(sprintf(T_('Could not get information for user [%s].'), $this->id)); return; } $this->displayName = $this->getDisplayNameFromData($userInfo); $this->email = $userInfo['email']; $this->tzOffset = $userInfo['timezone']; $this->access = $userInfo['access']; return; }
/** * Generate category line when it has children * * @param Chapter generic category we want to display * @param int level of the category in the recursive tree * @return string HTML */ function cat_line($Chapter, $level) { global $line_class, $result_fadeout, $permission_to_edit, $current_User, $Settings; global $GenericCategoryCache; $line_class = $line_class == 'even' ? 'odd' : 'even'; $r = '<tr id="tr-' . $Chapter->ID . '"class="' . $line_class . (isset($result_fadeout[$GenericCategoryCache->dbIDname]) && in_array($Chapter->ID, $result_fadeout[$GenericCategoryCache->dbIDname]) ? ' fadeout-ffff00' : '') . '"> <td class="firstcol shrinkwrap">' . $Chapter->ID . ' </td>'; if ($permission_to_edit) { // We have permission permission to edit: $edit_url = regenerate_url('action,' . $Chapter->dbIDname, $Chapter->dbIDname . '=' . $Chapter->ID . '&action=edit'); $r .= '<td> <strong style="padding-left: ' . $level . 'em;"><a href="' . $edit_url . '" title="' . T_('Edit...') . '">' . $Chapter->dget('name') . '</a></strong> </td>'; } else { $r .= '<td> <strong style="padding-left: ' . $level . 'em;">' . $Chapter->dget('name') . '</strong> </td>'; } $r .= '<td>' . $Chapter->dget('urlname') . '</td>'; $r .= '<td class="lastcol shrinkwrap">'; if ($permission_to_edit) { // We have permission permission to edit, so display action column: $r .= action_icon(T_('New...'), 'new', regenerate_url('action,cat_ID,cat_parent_ID', 'cat_parent_ID=' . $Chapter->ID . '&action=new')) . action_icon(T_('Edit...'), 'edit', $edit_url); if ($Settings->get('allow_moving_chapters')) { // If moving cats between blogs is allowed: $r .= action_icon(T_('Move to a different blog...'), 'file_move', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=move'), T_('Move')); } $r .= action_icon(T_('Delete...'), 'delete', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=delete')); } $r .= '</td>'; $r .= '</tr>'; return $r; }
function post_changepass() { $myid = $this->login('id'); $newpass = utility::post('password-new', 'hash'); $oldpass = utility::post('password-old'); $tmp_result = $this->sql()->tableUsers()->where('id', $myid)->and('user_status', 'active')->select(); // if exist if ($tmp_result->num() == 1) { $tmp_result = $tmp_result->assoc(); $myhashedPassword = $tmp_result['user_pass']; // if password is correct. go for login:) if (isset($myhashedPassword) && utility::hasher($oldpass, $myhashedPassword)) { $newpass = utility::post('password-new', 'hash'); $qry = $this->sql()->table('users')->where('id', $myid)->set('user_pass', $newpass); $sql = $qry->update(); $this->commit(function () { debug::true(T_("change password successfully")); $this->redirector()->set_domain()->set_url(); // \lib\utility\Sms::send($_mobile, 'changepass'); }); // if a query has error or any error occour in any part of codes, run roolback $this->rollback(function () { debug::error(T_("change password failed!")); }); } else { debug::error(T_("Password is incorrect")); } } elseif ($tmp_result->num() == 0) { debug::error(T_("user is incorrect")); } else { debug::error(T_("Please forward this message to administrator")); } sleep(0.1); }
protected function display() { if (Tools::isConnectedUser()) { // Admins only $session_user = UserCache::getInstance()->getUser($_SESSION['userid']); if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) { if (NULL != Constants::$codevtt_logfile && file_exists(Constants::$codevtt_logfile)) { $nbLinesToDisplay = 1500; $lines = file(Constants::$codevtt_logfile); if (count($lines) > $nbLinesToDisplay) { $offset = count($lines) - $nbLinesToDisplay; } else { $offset = 0; } $logs = array(); for ($i = $offset; $i <= $offset + $nbLinesToDisplay, $i < count($lines); $i++) { $logs[$i + 1] = htmlspecialchars($lines[$i], ENT_QUOTES, "UTF-8"); #echo "DEBUG $line_num - ".$logs[$line_num]."<br>"; } $this->smartyHelper->assign('logs', $logs); } else { $this->smartyHelper->assign('error', T_('Sorry, logfile not found:') . ' [' . Constants::$codevtt_logfile . ']'); } } else { $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.')); } } else { $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.')); } }
/** * constructor * This should be called */ public function __construct($id = null, $cached = true) { $sid = session_id(); if (is_null($id)) { $this->reset(); if ($cached) { $data = serialize($this->_state); $sql = 'INSERT INTO `tmp_browse` (`sid`, `data`) ' . 'VALUES(?, ?)'; Dba::write($sql, array($sid, $data)); $this->id = Dba::insert_id(); } else { $this->id = 'nocache'; } return true; } $this->id = $id; $sql = 'SELECT `data` FROM `tmp_browse` ' . 'WHERE `id` = ? AND `sid` = ?'; $db_results = Dba::read($sql, array($id, $sid)); if ($results = Dba::fetch_assoc($db_results)) { $this->_state = unserialize($results['data']); return true; } Error::add('browse', T_('Browse not found or expired, try reloading the page')); return false; }
function _construct() { // define default value for global $this->data->site['title'] = T_("Saloos"); $this->data->site['desc'] = T_("Free PHP Framework & CMS!"); $this->data->site['slogan'] = T_("Saloos is a cirsium vulgare for php programmers! :)"); $this->data->page['desc'] = T_("Saloos is a cirsium vulgare for php programmers! :)"); // if(! ($this->url('sub') === 'cp' || $this->url('sub') === 'account') ) // $this->url->MainStatic = false; /* // add language list for use in display $this->global->langlist = array( 'fa_IR' => 'فارسی', 'en_US' => 'English', 'de_DE' => 'Deutsch' ); // if you need to set a class for body element in html add in this value $this->data->bodyclass = null; */ if (method_exists($this, 'options')) { $this->options(); } }
/** * Draws the menu for Editing an existing module */ function _EDIT() { global $id; mosMenuBar::startTable(); mosMenuBar::save(); mosMenuBar::spacer(); mosMenuBar::apply(); mosMenuBar::spacer(); if ($id) { // for existing content items the button is renamed `close` mosMenuBar::cancel('cancel', T_('Close')); } else { mosMenuBar::cancel(); } mosMenuBar::spacer(); if ($GLOBALS['task'] == 'new') { mosMenuBar::help('new'); } else { if ($_POST) { $cid = (int) $GLOBALS['cid'][0]; } else { $cid = (int) $_GET['id']; } $database =& mamboDatabase::getInstance(); $database->setQuery('select element from #__mambots where id = ' . $cid); $result = $database->loadResult(); mosMenuBar::help($result ? $result : 'edit'); } mosMenuBar::endTable(); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editSection($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for section $lists['componentid'] = mosAdminMenus::Section($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_section_menu_html::editSection($menu, $lists, $params, $option); }
function validate_form() { $error = array(); $NumberTickets = clean_int($_POST['numberoftickets']); $MaxMb = clean_number($_POST['MaxMb']); $Max_Mb = clean_number($_POST['Max_Mb']); $MaxTime = clean_int($_POST['MaxTime']); $Max_Time = clean_int($_POST['Max_Time']); $error[] = validate_int($NumberTickets); if (!\Grase\Validate::numericLimit($MaxMb)) { $error[] = sprintf(T_("Invalid value '%s' for Data Limit"), $MaxMb); } if (!\Grase\Validate::numericLimit($Max_Mb)) { $error[] = sprintf(T_("Invalid value '%s' for Data Limit"), $Max_Mb); } if (!\Grase\Validate::numericLimit($MaxTime)) { $error[] = sprintf(T_("Invalid value '%s' for Time Limit"), $MaxTime); } if (!\Grase\Validate::numericLimit($Max_Time)) { $error[] = sprintf(T_("Invalid value '%s' for Time Limit"), $Max_Time); } if ((is_numeric($Max_Mb) || $_POST['Max_Mb'] == 'inherit') && is_numeric($MaxMb)) { $error[] = T_("Only set one Data limit field"); } if ((is_numeric($Max_Time) || $_POST['Max_Time'] == 'inherit') && is_numeric($MaxTime)) { $error[] = T_("Only set one Time limit field"); } // 1000 seems like a reasonable number, if someone wants it increased we can now that we can delete batches if ($NumberTickets > 1000) { $error[] = T_("Max of 1000 tickets per batch"); } $error[] = validate_group($_POST['Group']); return array_filter($error); }
/** * Get definitions for editable params * * @see Plugin::GetDefaultSettings() * @param local params like 'for_editing' => true */ function get_param_definitions($params) { // Load to use function get_available_thumb_sizes() load_funcs('files/model/_image.funcs.php'); $r = array_merge(array('menu_bg_color' => array('label' => T_('Menu background color'), 'note' => T_('E-g: #0000ff for blue'), 'defaultvalue' => '#333333', 'type' => 'color'), 'menu_text_color' => array('label' => T_('Menu text color'), 'note' => T_('E-g: #ff6600 for orange'), 'defaultvalue' => '#AAAAAA', 'type' => 'color'), 'page_bg_color' => array('label' => T_('Page background color'), 'note' => T_('E-g: #ff0000 for red'), 'defaultvalue' => '#666666', 'type' => 'color'), 'page_text_color' => array('label' => T_('Page text color'), 'note' => T_('E-g: #00ff00 for green'), 'defaultvalue' => '#AAAAAA', 'type' => 'color'), 'post_bg_color' => array('label' => T_('Post info background color'), 'note' => T_('E-g: #0000ff for blue'), 'defaultvalue' => '#555555', 'type' => 'color'), 'post_text_color' => array('label' => T_('Post info text color'), 'note' => T_('E-g: #ff6600 for orange'), 'defaultvalue' => '#AAAAAA', 'type' => 'color'), 'colorbox' => array('label' => T_('Colorbox Image Zoom'), 'note' => T_('Check to enable javascript zooming on images (using the colorbox script)'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'colorbox_vote_post' => array('label' => T_('Voting on Post Images'), 'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'colorbox_vote_post_numbers' => array('label' => T_('Display Votes'), 'note' => T_('Check to display number of likes and dislikes'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'colorbox_vote_comment' => array('label' => T_('Voting on Comment Images'), 'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'colorbox_vote_comment_numbers' => array('label' => T_('Display Votes'), 'note' => T_('Check to display number of likes and dislikes'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'colorbox_vote_user' => array('label' => T_('Voting on User Images'), 'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'colorbox_vote_user_numbers' => array('label' => T_('Display Votes'), 'note' => T_('Check to display number of likes and dislikes'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'gender_colored' => array('label' => T_('Display gender'), 'note' => T_('Use colored usernames to differentiate men & women.'), 'defaultvalue' => 0, 'type' => 'checkbox'), 'bubbletip' => array('label' => T_('Username bubble tips'), 'note' => T_('Check to enable bubble tips on usernames'), 'defaultvalue' => 0, 'type' => 'checkbox'), 'autocomplete_usernames' => array('label' => T_('Autocomplete usernames'), 'note' => T_('Check to enable auto-completion of usernames entered after a "@" sign in the comment forms'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'banner_public' => array('label' => T_('"Public" banner'), 'note' => T_('Display banner for "Public" posts (posts & comments)'), 'defaultvalue' => 1, 'type' => 'checkbox'), 'mediaidx_thumb_size' => array('label' => T_('Thumbnail size for media index'), 'note' => '', 'defaultvalue' => 'fit-128x128', 'options' => get_available_thumb_sizes(), 'type' => 'select'), 'posts_thumb_size' => array('label' => T_('Thumbnail size in post list'), 'note' => '', 'defaultvalue' => 'crop-192x192', 'options' => get_available_thumb_sizes(), 'type' => 'select'), 'single_thumb_size' => array('label' => T_('Thumbnail size in single page'), 'note' => '', 'defaultvalue' => 'fit-256x256', 'options' => get_available_thumb_sizes(), 'type' => 'select')), parent::get_param_definitions($params)); return $r; }
function ticketExpiration($DATA, &$expVal = NULL) { if ($DATA["expire_dln"] || $DATA["last_time"]) { if ($DATA["last_stamp"] && $DATA["last_time"]) { $expVal = $DATA["last_stamp"] + $DATA["last_time"] - time(); return sprintf(T_("About %s"), humanTime($expVal)); } elseif ($DATA["expire_dln"] && $DATA["downloads"]) { $expVal = $DATA["expire_dln"] - $DATA["downloads"]; return sprintf(T_("About %d downloads"), $expVal); } elseif ($DATA["expire"]) { $expVal = $DATA["expire"] - time(); return sprintf(T_("About %s"), humanTime($expVal)); } elseif ($DATA["expire_dln"]) { $expVal = $DATA["expire_dln"]; return sprintf(T_("After %d downloads"), $expVal); } else { $expVal = $DATA["last_time"]; return sprintf(T_("%s after next download"), humanTime($expVal)); } } elseif ($DATA["expire"]) { $expVal = $DATA["expire"] - time(); return sprintf(T_("In %s"), humanTime($expVal)); } $expVal = 4294967295; return "<strong>" . T_("Never") . "</strong>"; }
/** * Sections Search method * * The sql must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav * @param string Target search string * @param string mathcing option, exact|any|all * @param string ordering option, newest|oldest|popular|alpha|category */ function botSearchSections($text, $phrase = '', $ordering = '') { global $database, $my; $text = trim($text); if ($text == '') { return array(); } switch ($ordering) { case 'alpha': $order = 'a.name ASC'; break; case 'category': case 'popular': case 'newest': case 'oldest': default: $order = 'a.name DESC'; } $query = "SELECT a.name AS title," . "\n a.description AS text," . "\n '' AS created," . "\n '2' AS browsernav," . "\n a.id AS secid, m.id AS menuid, m.type AS menutype" . "\n FROM #__sections AS a" . "\n LEFT JOIN #__menu AS m ON m.componentid = a.id" . "\n WHERE ( a.name LIKE '%{$text}%'" . "\n OR a.title LIKE '%{$text}%'" . "\n OR a.description LIKE '%{$text}%' )" . "\n AND a.published = '1'" . "\n AND a.access <= '{$my->gid}'" . "\n AND ( m.type = 'content_section' OR m.type = 'content_blog_section' )" . "\n ORDER BY {$order}"; $database->setQuery($query); $rows = $database->loadObjectList(); $count = count($rows); for ($i = 0; $i < $count; $i++) { if ($rows[$i]->menutype == 'content_section') { $rows[$i]->href = 'index.php?option=com_content&task=section&id=' . $rows[$i]->secid . '&Itemid=' . $rows[$i]->menuid; $rows[$i]->section = T_('Section List'); } if ($rows[$i]->menutype == 'content_blog_section') { $rows[$i]->href = 'index.php?option=com_content&task=blogsection&id=' . $rows[$i]->secid . '&Itemid=' . $rows[$i]->menuid; $rows[$i]->section = T_('Section Blog'); } } return $rows; }
/** * Init */ function PluginInit(&$params) { $this->name = T_('Ping-O-Matic plugin'); $this->short_desc = T_('Pings the Ping-O-Matic service, which relays your ping to the most common services.'); $this->ping_service_name = 'Ping-O-Matic'; $this->ping_service_note = T_('Pings a service that relays the ping to the most common services.'); }
function __call($name, $arg) { if (preg_match("/^(form|sql)([A-Z].*)\$/", $name, $txterr)) { $method = $txterr[1]; $this->{$method}[strtolower($txterr[2])] = $arg[0]; return $this; } if (!is_object($this->validtorFunctions)) { $this->validtorFunctions = array(); } if (!self::$ExtendClass) { self::$ExtendClass = array(); } if (file_exists(lib . "utility/validate/{$name}.php") && !isset(self::$ExtendClass[$name])) { self::$ExtendClass[$name] = (require_once lib . "utility/validate/{$name}.php"); } if (isset(self::$ExtendClass[$name]) && is_object(self::$ExtendClass[$name])) { $closure = self::$ExtendClass[$name]; array_unshift($arg, $closure); $this->validtorFunctions[$name] = count($arg) > 0 ? $arg : true; } $this->validtorFunctions[$name] = count($arg) > 0 ? $arg : true; $this->form[$name] = T_("error in field") . ' ' . T_($name); return $this; }
/** * format * This takes the current playlist object and gussies it up a little * bit so it is presentable to the users */ public function format() { $this->f_name = $this->name; $this->f_type = $this->type == 'private' ? UI::get_icon('lock', T_('Private')) : ''; $client = new User($this->user); $this->f_user = $client->fullname; }
/** * Update options data * @return run update query and no return value */ function put_options() { $myFields = ['title' => 'site-title', 'desc' => 'site-desc', 'email' => 'site-email', 'url' => 'site-url', 'redirect' => 'site-redirect', 'register' => 'site-reg', 'permissions' => 'site-role']; foreach ($myFields as $field => $postName) { $qry = $this->sql()->table('options')->where('option_cat', 'options')->and('option_key', $field)->and('post_id', '#NULL')->and('user_id', '#NULL'); $fieldExist = $qry->select()->num(); // if exist more than 2 times remove all the properties if ($fieldExist > 1) { debug::true(T_("We find a problem and solve it!")); $qry->delete(); $fieldExist = 0; } $value = utility::post($postName); if (!$value) { $value = '#""'; } $qry = $qry->set('option_cat', 'options')->set('option_status', 'enable')->set('option_key', $field)->set('option_value', $value); // if exist update field if ($fieldExist == 1) { $qry->update(); } else { $qry->insert('IGNORE'); } } // exit(); $this->commit(function () { debug::true(T_("Update Successfully")); // $this->redirector()->set_url($_module.'/edit='.$_postId); }); // if a query has error or any error occour in any part of codes, run roolback $this->rollback(function () { debug::title(T_("Transaction error") . ': '); }); }
/** * Get definitions for editable params * * @see Plugin::GetDefaultSettings() * @param local params like 'for_editing' => true */ function get_param_definitions($params) { global $Blog; // Demo data: $r = array_merge(array('title' => array('label' => 'Block title', 'size' => 60, 'defaultvalue' => T_('Linkblog'), 'note' => T_('This is title to display in your skin.')), 'linkblog_ID' => array('label' => T_('Linkblog'), 'size' => 4, 'defaultvalue' => $Blog->get('links_blog_ID'), 'note' => T_('This is ID number of the blog to use as a linkblog.')), 'linkblog_limit' => array('label' => T_('Display'), 'size' => 4, 'defaultvalue' => 100, 'note' => T_('This is the maximum number of links to display.'))), parent::get_param_definitions($params)); return $r; }
protected function display() { if (Tools::isConnectedUser()) { $team = TeamCache::getInstance()->getTeam($this->teamid); $action = filter_input(INPUT_GET, 'action'); // feed the PluginDataProvider $pluginDataProvider = PluginDataProvider::getInstance(); $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $this->session_userid); $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $this->teamid); $weekDates = Tools::week_dates(date('W'), date('Y')); $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $weekDates[1]); $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $weekDates[5]); $dashboardName = 'Admin' . $this->teamid; // save the DataProvider for Ajax calls $_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardName] = serialize($pluginDataProvider); // create the Dashboard $dashboard = new Dashboard($dashboardName); $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_ADMIN); $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK, IndicatorPluginInterface::CATEGORY_ADMIN)); $dashboard->setTeamid($this->teamid); $dashboard->setUserid($this->session_userid); $data = $dashboard->getSmartyVariables($this->smartyHelper); foreach ($data as $smartyKey => $smartyVariable) { $this->smartyHelper->assign($smartyKey, $smartyVariable); } } else { $this->smartyHelper->assign('error', T_('Sorry, you need to be identified.')); } }