code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
function categoryBreadcrumb() { // global $db, $router; //eDebug($this->category); /*if(isset($router->params['action'])) { $ancestors = $this->category->pathToNode(); }else if(isset($router->params['section'])) { $current = $db->selectObject('section',' id= '.$router->params['section']); $ancestors[] = $current; if( $current->parent != -1 || $current->parent != 0 ) { while ($db->selectObject('section',' id= '.$router->params['section']);) if ($section->id == $id) { $current = $section; break; } } } eDebug($sections); $ancestors = $this->category->pathToNode(); }*/ $ancestors = $this->category->pathToNode(); // eDebug($ancestors); assign_to_template(array( 'ancestors' => $ancestors )); }
Base
1
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
Base
1
protected function _dimensions($path, $mime) { clearstatcache(); return strpos($mime, 'image') === 0 && ($s = @getimagesize($path)) !== false ? $s[0].'x'.$s[1] : false; }
Base
1
public function getError() { return $this->error; }
Class
2
protected function getFullPath($path, $base) { $separator = $this->separator; $systemroot = $this->systemRoot; $sepquoted = preg_quote($separator, '#'); // normalize `/../` $normreg = '#('.$sepquoted.')[^'.$sepquoted.']+'.$sepquoted.'\.\.'.$sepquoted.'#'; while(preg_match($normreg, $path)) { $path = preg_replace($normreg, '$1', $path); } // 'Here' if ($path === '' || $path === '.' . $separator) return $base; // Absolute path if ($path[0] === $separator || strpos($path, $systemroot) === 0) { return $path; } $preg_separator = '#' . $sepquoted . '#'; // Relative path from 'Here' if (substr($path, 0, 2) === '.' . $separator || $path[0] !== '.' || substr($path, 0, 3) !== '..' . $separator) { $arrn = preg_split($preg_separator, $path, -1, PREG_SPLIT_NO_EMPTY); if ($arrn[0] !== '.') { array_unshift($arrn, '.'); } $arrn[0] = $base; return join($separator, $arrn); } // Relative path from dirname() if (substr($path, 0, 3) === '../') { $arrn = preg_split($preg_separator, $path, -1, PREG_SPLIT_NO_EMPTY); $arrp = preg_split($preg_separator, $base, -1, PREG_SPLIT_NO_EMPTY); while (! empty($arrn) && $arrn[0] === '..') { array_shift($arrn); array_pop($arrp); } $path = ! empty($arrp) ? $systemroot . join($separator, array_merge($arrp, $arrn)) : (! empty($arrn) ? $systemroot . join($separator, $arrn) : $systemroot); } return $path; }
Base
1
public function getListStart() { // increase start value of ordered lists at multi-column output //The offset that comes from the URL parameter is zero based, but has to be +1'ed for display. $offset = $this->getParameters()->getParameter( 'offset' ) + 1; if ( $offset != 0 ) { //@TODO: So this adds the total count of articles to the offset. I have not found a case where this does not mess up the displayed count. I am commenting this out for now. //$offset += $this->offsetCount; } return sprintf( $this->listStart, $this->listAttributes . ' start="' . $offset . '"' ); }
Class
2
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
Base
1
public function testGetDropdownConnect($params, $expected, $session_params = []) { $this->login(); $bkp_params = []; //set session params if any if (count($session_params)) { foreach ($session_params as $param => $value) { if (isset($_SESSION[$param])) { $bkp_params[$param] = $_SESSION[$param]; } $_SESSION[$param] = $value; } } $params['_idor_token'] = \Session::getNewIDORToken($params['itemtype'] ?? ''); $result = \Dropdown::getDropdownConnect($params, false); //reset session params before executing test if (count($session_params)) { foreach ($session_params as $param => $value) { if (isset($bkp_params[$param])) { $_SESSION[$param] = $bkp_params[$param]; } else { unset($_SESSION[$param]); } } } $this->array($result)->isIdenticalTo($expected); }
Base
1
public function remove() { $project = $this->getProject(); $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { $this->flash->failure(t('Unable to remove this column.')); } $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); }
Base
1
public function confirm() { $task = $this->getTask(); $link = $this->getTaskLink(); $this->response->html($this->template->render('task_internal_link/remove', array( 'link' => $link, 'task' => $task, ))); }
Class
2
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
Class
2
function get_filedisplay_views() { expTemplate::get_filedisplay_views(); $paths = array( BASE.'framework/modules/common/views/file/', BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/', ); $views = array(); foreach ($paths as $path) { if (is_readable($path)) { $dh = opendir($path); while (($file = readdir($dh)) !== false) { if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') { $filename = substr($file, 0, -4); $views[$filename] = gt($filename); } } } } return $views; }
Base
1
return $fa->nameGlyph($icons, 'icon-'); } } else { return array(); } }
Class
2
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
Class
2
public function redirect($url) { if (trim($url) == '') { return false; } $url = str_ireplace('Location:', '', $url); $url = trim($url); $redirectUrl = site_url(); $parseUrl = parse_url($url); if (isset($parseUrl['host'])) { if ($parseUrl['host'] == site_hostname()) { $redirectUrl = $url; } } if (!filter_var($redirectUrl, FILTER_VALIDATE_URL)) { $redirectUrl = site_url(); } if (headers_sent()) { echo '<meta http-equiv="refresh" content="0;url=' . $redirectUrl . '">'; } else { return \Redirect::to($redirectUrl); } }
Base
1
public function duplicate($hash, $suffix='copy') { if ($this->commandDisabled('duplicate')) { return $this->setError(elFinder::ERROR_COPY, '#'.$hash, elFinder::ERROR_PERM_DENIED); } if (($file = $this->file($hash)) == false) { return $this->setError(elFinder::ERROR_COPY, elFinder::ERROR_FILE_NOT_FOUND); } $path = $this->decode($hash); $dir = $this->dirnameCE($path); $name = $this->uniqueName($dir, $file['name'], ' '.$suffix.' '); if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) { return $this->setError(elFinder::ERROR_PERM_DENIED); } return ($path = $this->copy($path, $dir, $name)) == false ? false : $this->stat($path); }
Base
1
public function buildControl() { $control = new colorcontrol(); if (!empty($this->params['value'])) $control->value = $this->params['value']; if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value']; $control->default = $this->params['value']; if (!empty($this->params['hide'])) $control->hide = $this->params['hide']; if (isset($this->params['flip'])) $control->flip = $this->params['flip']; $this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : ''; $control->name = $this->params['name']; $this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : ''; $control->id = isset($this->params['id']) && $this->params['id'] != "" ? $this->params['id'] : ""; //echo $control->id; if (empty($control->id)) $control->id = $this->params['name']; if (empty($control->name)) $control->name = $this->params['id']; // attempt to translate the label if (!empty($this->params['label'])) { $this->params['label'] = gt($this->params['label']); } else { $this->params['label'] = null; } echo $control->toHTML($this->params['label'], $this->params['name']); // $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code))); // $ar->send(); }
Base
1
protected function _joinPath($dir, $name) { return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name; }
Base
1
foreach ($events as $event) { $extevents[$date][] = $event; }
Class
2
public function event() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id'])) { return $this->create(); } return $this->response->html($this->template->render('action_creation/event', array( 'values' => $values, 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
Base
1
public function buildCurrentUrl() { $url = URL_BASE; if ($this->url_style == 'sef') { $url .= substr(PATH_RELATIVE,0,-1).$this->sefPath; } else { $url .= urldecode((empty($_SERVER['REQUEST_URI'])) ? $_ENV['REQUEST_URI'] : $_SERVER['REQUEST_URI']); } return expString::sanitize($url); }
Base
1
public function load_from_resultset($rs) { global $DB; $main = $rs[0]; $this->id = $main->id; $this->codename = $main->codename; $this->icon = $main->icon; $this->lid = $main->lid; $this->notes = $main->notes; $this->enabled = $main->enabled; /* $DB->query('SELECT function_id FROM nv_menu_items WHERE menu_id = '.$this->id.' ORDER BY position ASC'); $this->functions = $DB->result('function_id'); */ $this->functions = json_decode($main->functions); if(empty($this->functions)) $this->functions = array(); }
Base
1
public function redeemable($cart, $webuser) { global $website; global $DB; // 1/ coupon matches the current website $redeemable = true; if($this->website != $website->id) $redeemable = false; // 2/ coupon currency matches the current cart currency if($this->currency != $cart['currency']) $redeemable = false; // 3/ check dates $now = core_time(); if( !empty($this->date_begin) && $now < $this->date_begin) $redeemable = false; if( !empty($this->date_end) && $now > $this->date_end) $redeemable = false; // 4/ minimum spend // TODO: check currencies? if( !empty($this->minimum_spend) && $cart['subtotal'] < $this->minimum_spend ) $redeemable = false; // 5/ check webuser usage if( !empty($this->times_allowed_customer) ) { $times_used_by_customer = $DB->query_single( 'COUNT(*)', 'nv_orders', ' website = '.protect($website->id).' AND webuser = '.protect($webuser).' AND coupon = '.protect($this->id) ); if($times_used_by_customer > $this->times_allowed_customer) $redeemable = false; } // 6/ check global orders usage if( !empty($this->times_allowed_globally) ) { $times_used_globally = $DB->query_single( 'COUNT(*)', 'nv_orders', ' website = '.protect($website->id).' AND coupon = '.protect($this->id) ); if($times_used_globally > $this->times_allowed_globally) $redeemable = false; } return $redeemable; }
Base
1
public function __construct () { }
Base
1
public function searchNew() { global $db, $user; //$this->params['query'] = str_ireplace('-','\-',$this->params['query']); $sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, "; $sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) as relevance, "; $sql .= "CASE when p.model like '" . $this->params['query'] . "%' then 1 else 0 END as modelmatch, "; $sql .= "CASE when p.title like '%" . $this->params['query'] . "%' then 1 else 0 END as titlematch "; $sql .= "from " . $db->prefix . "product as p INNER JOIN " . $db->prefix . "content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN " . $db->prefix . "expFiles as f ON cef.expFiles_id = f.id WHERE "; if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND '; $sql .= " match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) AND p.parent_id=0 "; $sql .= " HAVING relevance > 0 "; //$sql .= "GROUP BY p.id "; $sql .= "order by modelmatch,titlematch,relevance desc LIMIT 10"; eDebug($sql); $res = $db->selectObjectsBySql($sql); eDebug($res, true); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
Base
1
public function approve() { expHistory::set('editable', $this->params); /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for note to approve')); $lastUrl = expHistory::getLast('editable'); } $simplenote = new expSimpleNote($this->params['id']); assign_to_template(array( 'simplenote'=>$simplenote, 'require_login'=>$require_login, 'require_approval'=>$require_approval, 'require_notification'=>$require_notification, 'notification_email'=>$notification_email, 'tab'=>$this->params['tab'] )); }
Base
1
public function testSameInstanceWhenSameProtocol() { $r = new Response(200); $this->assertSame($r, $r->withProtocolVersion('1.1')); }
Base
1
private function checkDecode(array $options, array $headers, $stream) { // Automatically decode responses when instructed. if (!empty($options['decode_content'])) { $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); if (isset($normalizedKeys['content-encoding'])) { $encoding = $headers[$normalizedKeys['content-encoding']]; if ($encoding[0] == 'gzip' || $encoding[0] == 'deflate') { $stream = new Psr7\InflateStream( Psr7\stream_for($stream) ); // Remove content-encoding header unset($headers[$normalizedKeys['content-encoding']]); // Fix content-length header if (isset($normalizedKeys['content-length'])) { $length = (int) $stream->getSize(); if ($length == 0) { unset($headers[$normalizedKeys['content-length']]); } else { $headers[$normalizedKeys['content-length']] = [$length]; } } } } } return [$stream, $headers]; }
Base
1
public function theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('DISPLAY_THEME_REAL', $this->params['theme']); expSession::set('display_theme',$this->params['theme']); $sv = isset($this->params['sv'])?$this->params['sv']:''; if (strtolower($sv)=='default') { $sv = ''; } expSettings::change('THEME_STYLE_REAL',$sv); expSession::set('theme_style',$sv); expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme // $message = (MINIFY != 1) ? "Exponent is now minifying Javascript and CSS" : "Exponent is no longer minifying Javascript and CSS" ; // flash('message',$message); $message = gt("You have selected the")." '".$this->params['theme']."' ".gt("theme"); if ($sv != '') { $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation'); } flash('message',$message); // expSession::un_set('framework'); expSession::set('force_less_compile', 1); // expTheme::removeSmartyCache(); expSession::clearAllUsersSessionCache(); expHistory::returnTo('manageable'); }
Base
1
private function decryptContentEncryptionKey($private_key_or_secret) { switch ($this->header['alg']) { case 'RSA1_5': $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_PKCS1); $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key); break; case 'RSA-OAEP': $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_OAEP); $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key); break; case 'dir': $this->content_encryption_key = $private_key_or_secret; break; case 'A128KW': case 'A256KW': case 'ECDH-ES': case 'ECDH-ES+A128KW': case 'ECDH-ES+A256KW': throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported'); default: throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm'); } if (!$this->content_encryption_key) { # NOTE: # Not to disclose timing difference between CEK decryption error and others. # Mitigating Bleichenbacher Attack on PKCS#1 v1.5 # ref.) http://inaz2.hatenablog.com/entry/2016/01/26/222303 $this->generateContentEncryptionKey(null); } }
Class
2
private function sendString ($string) { $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); return $bytes_sent; }
Base
1
public function __construct() { $this->smtp_conn = 0; $this->error = null; $this->helo_rply = null; $this->do_debug = 0; }
Base
1
static function validUTF($string) { if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { return false; } return true; }
Class
2
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('tax_rates.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
Base
1
public function manage_messages() { expHistory::set('manageable', $this->params); $page = new expPaginator(array( 'model'=>'order_status_messages', 'where'=>1, 'limit'=>10, 'order'=>'body', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); //eDebug($page); assign_to_template(array( 'page'=>$page )); }
Base
1
static function getRSSFeed($url, $cache_duration = DAY_TIMESTAMP) { global $CFG_GLPI; $feed = new SimplePie(); $feed->set_cache_location(GLPI_RSS_DIR); $feed->set_cache_duration($cache_duration); // proxy support if (!empty($CFG_GLPI["proxy_name"])) { $prx_opt = []; $prx_opt[CURLOPT_PROXY] = $CFG_GLPI["proxy_name"]; $prx_opt[CURLOPT_PROXYPORT] = $CFG_GLPI["proxy_port"]; if (!empty($CFG_GLPI["proxy_user"])) { $prx_opt[CURLOPT_HTTPAUTH] = CURLAUTH_ANYSAFE; $prx_opt[CURLOPT_PROXYUSERPWD] = $CFG_GLPI["proxy_user"].":". Toolbox::decrypt($CFG_GLPI["proxy_passwd"], GLPIKEY); } $feed->set_curl_options($prx_opt); } $feed->enable_cache(true); $feed->set_feed_url($url); $feed->force_feed(true); // Initialize the whole SimplePie object. Read the feed, process it, parse it, cache it, and // all that other good stuff. The feed's information will not be available to SimplePie before // this is called. $feed->init(); // We'll make sure that the right content type and character encoding gets set automatically. // This function will grab the proper character encoding, as well as set the content type to text/html. $feed->handle_content_type(); if ($feed->error()) { return false; } return $feed; }
Class
2
public function __invoke(Request $request, Expense $expense) { $this->authorize('update', $expense); $data = json_decode($request->attachment_receipt); if ($data) { if ($request->type === 'edit') { $expense->clearMediaCollection('receipts'); } $expense->addMediaFromBase64($data->data) ->usingFileName($data->name) ->toMediaCollection('receipts'); } return response()->json([ 'success' => 'Expense receipts uploaded successfully', ], 200); }
Base
1
$date->delete(); // event automatically deleted if all assoc eventdates are deleted } expHistory::back(); }
Base
1
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
Base
1
public function sdm_save_upload_meta_data($post_id) { // Save File Upload metabox if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; if (!isset($_POST['sdm_upload_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_upload_box_nonce_check'], 'sdm_upload_box_nonce')) return; if (isset($_POST['sdm_upload'])) { update_post_meta($post_id, 'sdm_upload', $_POST['sdm_upload']); } }
Base
1
public function fixsessions() { global $db; // $test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket'); $fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket'); flash('message', gt('Sessions Table was Repaired')); expHistory::back(); }
Base
1
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) { if ( -1 == $action ) { _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' ); } $adminurl = strtolower( admin_url() ); $referer = strtolower( wp_get_referer() ); $result = isset( $_REQUEST[ $query_arg ] ) ? wp_verify_nonce( $_REQUEST[ $query_arg ], $action ) : false; /** * Fires once the admin request has been validated or not. * * @since 1.5.1 * * @param string $action The nonce action. * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between * 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago. */ do_action( 'check_admin_referer', $action, $result ); if ( ! $result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) { wp_nonce_ays( $action ); die(); } return $result; }
Compound
4
public function IsQmail() { if (stristr(ini_get('sendmail_path'), 'qmail')) { $this->Sendmail = '/var/qmail/bin/sendmail'; } $this->Mailer = 'sendmail'; }
Base
1
private function generateFakeFileData() { return [ 'name' => md5(mt_rand()), 'tmp_name' => md5(mt_rand()), 'type' => 'image/jpeg', 'size' => mt_rand(1000, 10000), 'error' => '0', ]; }
Class
2
public function testRemoveCurlAuthorizationOptionsOnRedirect($auth) { if (!defined('\CURLOPT_HTTPAUTH')) { self::markTestSkipped('ext-curl is required for this test'); } $mock = new MockHandler([ new Response(302, ['Location' => 'http://test.com']), static function (RequestInterface $request, $options) { self::assertFalse( isset($options['curl'][\CURLOPT_HTTPAUTH]), 'curl options still contain CURLOPT_HTTPAUTH entry' ); self::assertFalse( isset($options['curl'][\CURLOPT_USERPWD]), 'curl options still contain CURLOPT_USERPWD entry' ); return new Response(200); } ]); $handler = HandlerStack::create($mock); $client = new Client(['handler' => $handler]); $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass', $auth]]); }
Class
2
protected function checkTrustedHostPattern() { if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] === GeneralUtility::ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL) { $this->messageQueue->enqueue(new FlashMessage( 'Trusted hosts pattern is configured to allow all header values. Check the pattern defined in Admin' . ' Tools -> Settings -> Configure Installation-Wide Options -> System -> trustedHostsPattern' . ' and adapt it to expected host value(s).', 'Trusted hosts pattern is insecure', FlashMessage::WARNING )); } else { if (GeneralUtility::hostHeaderValueMatchesTrustedHostsPattern($_SERVER['HTTP_HOST'])) { $this->messageQueue->enqueue(new FlashMessage( '', 'Trusted hosts pattern is configured to allow current host value.' )); } else { $this->messageQueue->enqueue(new FlashMessage( 'The trusted hosts pattern will be configured to allow all header values. This is because your $SERVER_NAME:$SERVER_PORT' . ' is "' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '" while your HTTP_HOST is "' . $_SERVER['HTTP_HOST'] . '". Check the pattern defined in Admin' . ' Tools -> Settings -> Configure Installation-Wide Options -> System -> trustedHostsPattern' . ' and adapt it to expected host value(s).', 'Trusted hosts pattern mismatch', FlashMessage::ERROR )); } } }
Variant
0
public function updateTab($id, $array) { if (!$id || $id == '') { $this->setAPIResponse('error', 'id was not set', 422); return null; } if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $tabInfo = $this->getTabById($id); if ($tabInfo) { $array = $this->checkKeys($tabInfo, $array); } else { $this->setAPIResponse('error', 'No tab info found', 404); return false; } if (array_key_exists('name', $array)) { $array['name'] = htmlspecialchars($array['name']); if ($this->isTabNameTaken($array['name'], $id)) { $this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409); return false; } } if (array_key_exists('default', $array)) { if ($array['default']) { $this->clearTabDefault(); } } $response = [ array( 'function' => 'query', 'query' => array( 'UPDATE tabs SET', $array, 'WHERE id = ?', $id ) ), ]; $this->setAPIResponse(null, 'Tab info updated'); $this->setLoggerChannel('Tab Management'); $this->logger->debug('Edited Tab Info for [' . $tabInfo['name'] . ']'); return $this->processQueries($response); }
Base
1
public function testSetActivePhp53() { if (PHP_VERSION_ID >= 50400) { $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } $this->proxy->setActive(true); $this->assertTrue($this->proxy->isActive()); $this->proxy->setActive(false); $this->assertFalse($this->proxy->isActive()); }
Base
1
function send_feedback() { $success = false; if (isset($this->params['id'])) { $ed = new eventdate($this->params['id']); // $email_addrs = array(); if ($ed->event->feedback_email != '') { $msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . $this->params['formname'], $this->loc); $msgtemplate->assign('params', $this->params); $msgtemplate->assign('event', $ed); $email_addrs = explode(',', $ed->event->feedback_email); //This is an easy way to remove duplicates $email_addrs = array_flip(array_flip($email_addrs)); $email_addrs = array_map('trim', $email_addrs); $mail = new expMail(); $success += $mail->quickSend(array( "text_message" => $msgtemplate->render(), 'to' => $email_addrs, 'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS), 'subject' => $this->params['subject'], )); } } if ($success) { flashAndFlow('message', gt('Your feedback was successfully sent.')); } else { flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.')); } }
Class
2
public static function botlist() { $botlist = array( "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz", "Twitterbot", "MJ12bot", "AhrefsBot", "bingbot", "YandexBot", "spbot" ); return $botlist; }
Base
1
function advancedFilterSearch($queue, $filter) { global $database_ged; $datas = array(); if($filter == "description"){ echo json_encode($datas); return false; } $gedsql_result1=sqlrequest($database_ged,"SELECT pkt_type_id,pkt_type_name FROM pkt_type WHERE pkt_type_id!='0' AND pkt_type_id<'100';"); while($ged_type = mysqli_fetch_assoc($gedsql_result1)){ $sql = "SELECT DISTINCT $filter FROM ".$ged_type["pkt_type_name"]."_queue_".$queue; $results = sqlrequest($database_ged, $sql); while($result = mysqli_fetch_array($results)){ if( !in_array($result[$filter], $datas) && $result[$filter] != "" ){ array_push($datas, $result[$filter]); } } } echo json_encode($datas); }
Base
1
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
Base
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
public function __construct() { }
Base
1
$file_link = explode(" ", trim($row['file']))[0]; // If the link has no "http://" in front, then add it if (substr(strtolower($file_link), 0, 4) !== 'http') { $file_link = 'http://' . $file_link; } echo '<td><a href="http://anonym.to/?' . $file_link . '" target="_blank"><img class="icon" src="images/warning.png"/>http://anonym.to/?' . $file_link . '</a></td>'; echo '<td><a href="include/play.php?f=' . $row['session'] . '" target="_blank"><img class="icon" src="images/play.ico"/>Play</a></td>'; echo '<td><a href="kippo-scanner.php?file_url=' . $file_link . '" target="_blank">Scan File</a></td>'; echo '</tr>'; $counter++; } //Close tbody and table element, it's ready. echo '</tbody></table>'; echo '<hr /><br />'; }
Base
1
public function editAlt() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->alt = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your alt was updated successfully'), $file); } else { $ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it.")); } $ar->send(); echo json_encode($file); //FIXME we exit before hitting this }
Base
1
public static function sitemap() { switch (SMART_URL) { case true: # code... $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":""; $url = Site::$url.$inFold."/sitemap".GX_URL_PREFIX; break; default: # code... $url = Site::$url."/index.php?page=sitemap"; break; } return $url; }
Base
1
public function create(Request $request) { /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); return redirect(route('currencies.index')); } $subTitleIcon = 'fa-plus'; $subTitle = (string) trans('firefly.create_currency'); // put previous url in session if not redirect from store (not "create another"). if (true !== session('currencies.create.fromStore')) { $this->rememberPreviousUri('currencies.create.uri'); } $request->session()->forget('currencies.create.fromStore'); Log::channel('audit')->info('Create new currency.'); return prefixView('currencies.create', compact('subTitleIcon', 'subTitle')); }
Compound
4
protected function getTempFile($path = '') { static $cache = array(); static $rmfunc; $key = ''; if ($path !== '') { $key = $this->id . '#' . $path; if (isset($cache[$key])) { return $cache[$key]; } } if ($tmpdir = $this->getTempPath()) { if (!$rmfunc) { $rmfunc = create_function('$f', 'is_file($f) && @unlink($f);'); } $name = tempnam($tmpdir, 'ELF'); if ($key) { $cache[$key] = $name; } register_shutdown_function($rmfunc, $name); return $name; } return false; }
Base
1
public function test_create_nonce_url() { $url = yourls_nonce_url( rand_str(), rand_str(), rand_str(), rand_str() ); $this->assertTrue( is_string($url) ); // $this->assertIsString($url); }
Compound
4
public function IsSMTP() { $this->Mailer = 'smtp'; }
Base
1
public static function fixName($name) { $name = preg_replace('/[^A-Za-z0-9\.]/','_',$name); if ($name[0] == '.') $name[0] = '_'; return $name; // return preg_replace('/[^A-Za-z0-9\.]/', '-', $name); }
Base
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
Base
1
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) { throw new AccessForbiddenException(); } return $comment; }
Base
1
public static function scrap($param) { if ($param != '') { foreach ($param as $k => $v) { if (is_array($v)) { foreach ($v as $k2 => $v2) { $data[$k2] = $v2; } }else{ $data = ''; } } } else { $data = ''; } return $data; }
Base
1
function teampass_decrypt_pw($encrypted, $salt, $rand_key, $itcount = 2072) { $encrypted = base64_decode($encrypted); $pass_salt = substr($encrypted, -64); $encrypted = substr($encrypted, 0, -64); $key = teampass_pbkdf2_hash($salt, $pass_salt, $itcount, 16, 32); $iv = base64_decode(substr($encrypted, 0, 43) . '=='); $encrypted = substr($encrypted, 43); $mac = substr($encrypted, -64); $encrypted = substr($encrypted, 0, -64); if ($mac !== hash_hmac('sha256', $encrypted, $salt)) return null; return substr(rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $encrypted, 'ctr', $iv), "\0\4"), strlen($rand_key)); }
Base
1
function download($disposition=false, $expires=false) { $disposition = $disposition ?: 'inline'; $bk = $this->open(); if ($bk->sendRedirectUrl($disposition)) return; $ttl = ($expires) ? $expires - Misc::gmtime() : false; $this->makeCacheable($ttl); $type = $this->getType() ?: 'application/octet-stream'; Http::download($this->getName(), $type, null, 'inline'); header('Content-Length: '.$this->getSize()); $this->sendData(false); exit(); }
Base
1
public function addUser(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $username = I("post.username"); $password = I("post.password"); $uid = I("post.uid"); $name = I("post.name"); if(!$username){ $this->sendError(10101,'用户名不允许为空'); return ; } if($uid){ if($password){ D("User")->updatePwd($uid, $password); } if($name){ D("User")->where(" uid = '$uid' ")->save(array("name"=>$name)); } $this->sendResult(array()); }else{ if (D("User")->isExist($username)) { $this->sendError(10101,L('username_exists')); return ; } $new_uid = D("User")->register($username,$password); if (!$new_uid) { $this->sendError(10101); }else{ if($name){ D("User")->where(" uid = '$new_uid' ")->save(array("name"=>$name)); } $this->sendResult($return); } } }
Base
1
private function getHttpResponseHeader($url) { if (function_exists('curl_exec')) { $c = curl_init(); curl_setopt( $c, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $c, CURLOPT_CUSTOMREQUEST, 'HEAD' ); curl_setopt( $c, CURLOPT_HEADER, 1 ); curl_setopt( $c, CURLOPT_NOBODY, true ); curl_setopt( $c, CURLOPT_URL, $url ); $res = curl_exec( $c ); } else { require_once 'HTTP/Request2.php'; try { $request2 = new HTTP_Request2(); $request2->setConfig(array( 'ssl_verify_peer' => false, 'ssl_verify_host' => false )); $request2->setUrl($url); $request2->setMethod(HTTP_Request2::METHOD_HEAD); $result = $request2->send(); $res = array(); $res[] = 'HTTP/'.$result->getVersion().' '.$result->getStatus().' '.$result->getReasonPhrase(); foreach($result->getHeader() as $key => $val) { $res[] = $key . ': ' . $val; } $res = join("\r\n", $res); } catch( HTTP_Request2_Exception $e ){ $res = ''; } catch (Exception $e){ $res = ''; } } return $res; }
Base
1
public function getQuerySelect() { return ''; }
Base
1
static protected function getFontsizeSelection() { $current_size = $GLOBALS['PMA_Config']->get('fontsize'); // for the case when there is no config file (this is supported) if (empty($current_size)) { if (isset($_COOKIE['pma_fontsize'])) { $current_size = $_COOKIE['pma_fontsize']; } else { $current_size = '82%'; } } $options = PMA_Config::getFontsizeOptions($current_size); $return = '<label for="select_fontsize">' . __('Font size') . ':</label>' . "\n" . '<select name="set_fontsize" id="select_fontsize"' . ' class="autosubmit">' . "\n"; foreach ($options as $option) { $return .= '<option value="' . $option . '"'; if ($option == $current_size) { $return .= ' selected="selected"'; } $return .= '>' . $option . '</option>' . "\n"; } $return .= '</select>'; return $return; }
Base
1
public function addUser(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $username = I("username"); $password = I("password"); $uid = I("uid"); $name = I("name"); if(!$username){ $this->sendError(10101,'用户名不允许为空'); return ; } if($uid){ if($password){ D("User")->updatePwd($uid, $password); } if($name){ D("User")->where(" uid = '$uid' ")->save(array("name"=>$name)); } $this->sendResult(array()); }else{ if (D("User")->isExist($username)) { $this->sendError(10101,L('username_exists')); return ; } $new_uid = D("User")->register($username,$password); if (!$new_uid) { $this->sendError(10101); }else{ if($name){ D("User")->where(" uid = '$new_uid' ")->save(array("name"=>$name)); } $this->sendResult($return); } } }
Compound
4
public static function page($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".self::slug($vars).GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')."/index.php?page={$vars}"; break; } return $url; }
Compound
4
public function newpassword() { if ($token = $this->param('token')) { $user = $this->app->storage->findOne('cockpit/accounts', ['_reset_token' => $token]); if (!$user) { return false; } $user['md5email'] = md5($user['email']); return $this->render('cockpit:views/layouts/newpassword.php', compact('user', 'token')); } return false; }
Base
1
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql); foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;')); if (!empty($multiday_event)) { unset($evs[$key]); continue; } } $evs[$key]->eventstart += $edate->date; $evs[$key]->eventend += $edate->date; $evs[$key]->date_id = $edate->id; if (!empty($event->expCat)) { $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color); // if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';'; $evs[$key]->color = $catcolor; } } if (count($events) < 500) { // magic number to not crash loop? $events = array_merge($events, $evs); } else { // $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'); // $events = array_merge($events, $evs); flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!')); break; // keep from breaking system by too much data } }
Base
1
private function add_timeout(RequestInterface $request, &$options, $value, &$params) { $options['http']['timeout'] = $value; }
Base
1
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
Class
2
public function getDisplayName ($plural=true) { return Yii::t('workflow', '{process}', array( '{process}' => Modules::displayName($plural, 'Process'), )); }
Class
2
public static function parseAndTrim($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); // global $db; $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-", $str); $str = str_replace("�", "&#151;", $str); $str = str_replace("�", "&rdquo;", $str); $str = str_replace("�", "&ldquo;", $str); $str = str_replace("\r\n", " ", $str); //$str = str_replace(",","\,",$str); $str = str_replace('\"', "&quot;", $str); $str = str_replace('"', "&quot;", $str); $str = str_replace("�", "&#188;", $str); $str = str_replace("�", "&#189;", $str); $str = str_replace("�", "&#190;", $str); //$str = htmlspecialchars($str); //$str = utf8_encode($str); // if (DB_ENGINE=='mysqli') { // $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "&trade;", $str))); // } elseif(DB_ENGINE=='mysql') { // $str = @mysql_real_escape_string(trim(str_replace("�", "&trade;", $str)),$db->connection); // } else { // $str = trim(str_replace("�", "&trade;", $str)); // } $str = @expString::escape(trim(str_replace("�", "&trade;", $str))); //echo "2<br>"; eDebug($str,die); return $str; }
Base
1
public function downloadFiles() { App()->loadLibrary('admin.pclzip'); $folder = basename(Yii::app()->request->getPost('folder', 'global')); $files = Yii::app()->request->getPost('files'); $tempdir = Yii::app()->getConfig('tempdir'); $randomizedFileName = $folder.'_'.substr(md5(time()),3,13).'.zip'; $zipfile = $tempdir.DIRECTORY_SEPARATOR.$randomizedFileName; $arrayOfFiles = array_map( function($file){ return $file['path']; }, $files); $archive = new PclZip($zipfile); $checkFileCreate = $archive->create($arrayOfFiles, PCLZIP_OPT_REMOVE_ALL_PATH); $urlFormat = Yii::app()->getUrlManager()->getUrlFormat(); $getFileLink = Yii::app()->createUrl('admin/filemanager/sa/getZipFile'); if($urlFormat == 'path') { $getFileLink .= '?path='.$zipfile; } else { $getFileLink .= '&path='.$zipfile; } $this->_printJsonResponse( [ 'success' => true, 'message' => sprintf(gT("Files are ready for download in archive %s."), $randomizedFileName), 'downloadLink' => $getFileLink , ] ); }
Base
1
public static function strValidCharacters($string, $checkType) { if (trim($string) === '') { return false; } switch ($checkType) { case 'noSpecialChar': // a simple e-mail address should still be possible (like username) $validRegex = '/^[\w.@+-]+$/i'; break; case 'email': $validRegex = '/^[\wáàâåäæçéèêîñóòôöõøœúùûüß.@+-]+$/i'; break; case 'file': $validRegex = '=^[^/?*;:~<>|\"\\\\]+\.[^/?*;:~<>|‚\"\\\\]+$='; break; case 'folder': $validRegex = '=^[^/?*;:~<>|\"\\\\]+$='; break; case 'url': $validRegex = '/^[\wáàâåäæçéèêîñóòôöõøœúùûüß$&!?() \/%=#:~.@+-]+$/i'; break; case 'phone': $validRegex = '/^[\d() \/+-]+$/i'; break; default: return false; } // check if string contains only valid characters if (!preg_match($validRegex, $string)) { return false; } switch ($checkType) { case 'email': return filter_var(trim($string), FILTER_VALIDATE_EMAIL) !== false; case 'url': return filter_var(trim($string), FILTER_VALIDATE_URL) !== false; default: return true; } }
Base
1
foreach($course_RET as $period_day) { $period_days_append_sql .="(sp.start_time<='$period_day[END_TIME]' AND '$period_day[START_TIME]'<=sp.end_time AND DAYS LIKE '%$period_day[DAYS]%') OR "; }
Base
1
protected function connect() { $user = $this->getUser(); $workgroup = null; if (strpos($user, '/')) { list($workgroup, $user) = explode('/', $user); } $this->state->init($workgroup, $user, $this->getPassword()); }
Base
1
public static function restoreX2AuthManager () { if (isset (self::$_oldAuthManagerComponent)) { Yii::app()->setComponent ('authManager', self::$_oldAuthManagerComponent); } else { throw new CException ('X2AuthManager component could not be restored'); } }
Class
2
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
Base
1
public function testSetActivePhp54() { $this->proxy->setActive(true); }
Base
1
} elseif ($exception instanceof ErrorException) { $message = "{$exception->getName()}"; } else {
Base
1
public function search_external() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "external_addresses as a "; //R JOIN " . //$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id "; $sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) "; $sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) ASC LIMIT 12"; $res = $db->selectObjectsBySql($sql); foreach ($res as $key=>$record) { $res[$key]->title = $record->firstname . ' ' . $record->lastname; } //eDebug($sql); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
Class
2
protected function gdImage($image, $filename, $destformat, $mime, $jpgQuality = null ){ if (!$jpgQuality) { $jpgQuality = $this->options['jpgQuality']; } if ($destformat == 'jpg' || ($destformat == null && $mime == 'image/jpeg')) { return imagejpeg($image, $filename, $jpgQuality); } if ($destformat == 'gif' || ($destformat == null && $mime == 'image/gif')) { return imagegif($image, $filename, 7); } return imagepng($image, $filename, 7); }
Base
1
public function addMessage( $errorId ) { $args = func_get_args(); $args = array_map( 'htmlspecialchars', $args ); return call_user_func_array( [ $this, 'msg' ], $args ); }
Class
2
$db->insertObject($obj, 'expeAlerts_subscribers'); } $count = count($this->params['ealerts']); if ($count > 0) { flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.')); } else { flash('error', gt("You have been unsubscribed from all E-Alerts.")); } expHistory::back(); }
Base
1
public function testDestroy() { $collection = $this->createMongoCollectionMock(); $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); $collection->expects($this->once()) ->method('remove') ->with(array($this->options['id_field'] => 'foo')); $this->assertTrue($this->storage->destroy('foo')); }
Base
1
private function generateFakeFileData() { return [ 'name' => md5(mt_rand()), 'tmp_name' => md5(mt_rand()), 'type' => 'image/jpeg', 'size' => mt_rand(1000, 10000), 'error' => '0', ]; }
Class
2
public static function isExist($token){ $json = Options::v('tokens'); $tokens = json_decode($json, true); if(!is_array($tokens) || $tokens == ""){ $tokens = array(); } if(array_key_exists($token, $tokens)){ $call = true; }else{ $call = false; } return $call; }
Base
1
function update_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; //This will make sure that only the country or region that given a rate value will be saved in the db $upcharge = array(); foreach($this->params['upcharge'] as $key => $item) { if(!empty($item)) { $upcharge[$key] = $item; } } $this->config['upcharge'] = $upcharge; $config->update(array('config'=>$this->config)); flash('message', gt('Configuration updated')); expHistory::back(); }
Base
1
static::$functions = ['random_bytes' => false, 'openssl_random_pseudo_bytes' => false, 'mcrypt_create_iv' => false];
Class
2
public function delete() { global $db, $history; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('Missing id for the comment you would like to delete')); $lastUrl = expHistory::getLast('editable'); } // delete the note $simplenote = new expSimpleNote($this->params['id']); $rows = $simplenote->delete(); // delete the assocication too $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']); // send the user back where they came from. $lastUrl = expHistory::getLast('editable'); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
Base
1
$section = new section($this->params); } else { notfoundController::handle_not_found(); exit; } if (!empty($section->id)) { $check_id = $section->id; } else { $check_id = $section->parent; } if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) { if (empty($section->id)) { $section->active = 1; $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); } else { // User does not have permission to manage sections. Throw a 403 notfoundController::handle_not_authorized(); } }
Base
1
public function toolbar() { // global $user; $menu = array(); $dirs = array( BASE.'framework/modules/administration/menus', BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus' ); foreach ($dirs as $dir) { if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) { $menu[substr($file,0,-4)] = include($dir.'/'.$file); if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]); } } } } // sort the top level menus alphabetically by filename ksort($menu); $sorted = array(); foreach($menu as $m) $sorted[] = $m; // slingbar position if (isset($_COOKIE['slingbar-top'])){ $top = $_COOKIE['slingbar-top']; } else { $top = SLINGBAR_TOP; } assign_to_template(array( 'menu'=>(bs3()) ? $sorted : json_encode($sorted), "top"=>$top )); }
Base
1
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Class
2