code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
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
function remove() { global $db; $section = $db->selectObject('section', 'id=' . $this->params['id']); if ($section) { section::removeLevel($section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); $section->parent = -1; $db->updateObject($section, 'section'); expSession::clearAllUsersSessionCache('navigation'); expHistory::back(); } else { notfoundController::handle_not_authorized(); } }
Class
2
public function disable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
Base
1
function prepareInputForUpdate($input) { if (isset($input["rootdn_passwd"])) { if (empty($input["rootdn_passwd"])) { unset($input["rootdn_passwd"]); } else { $input["rootdn_passwd"] = Toolbox::encrypt(stripslashes($input["rootdn_passwd"]), GLPIKEY); } } if (isset($input["_blank_passwd"]) && $input["_blank_passwd"]) { $input['rootdn_passwd'] = ''; } // Set attributes in lower case if (count($input)) { foreach ($input as $key => $val) { if (preg_match('/_field$/', $key)) { $input[$key] = Toolbox::strtolower($val); } } } //do not permit to override sync_field if ($this->isSyncFieldEnabled() && isset($input['sync_field']) && $this->isSyncFieldUsed() ) { if ($input['sync_field'] == $this->fields['sync_field']) { unset($input['sync_field']); } else { Session::addMessageAfterRedirect( __('Synchronization field cannot be changed once in use.'), false, ERROR ); return false; }; } return $input; }
Class
2
function get_the_generator( $type = '' ) { if ( empty( $type ) ) { $current_filter = current_filter(); if ( empty( $current_filter ) ) { return; } switch ( $current_filter ) { case 'rss2_head': case 'commentsrss2_head': $type = 'rss2'; break; case 'rss_head': case 'opml_head': $type = 'comment'; break; case 'rdf_header': $type = 'rdf'; break; case 'atom_head': case 'comments_atom_head': case 'app_head': $type = 'atom'; break; } } switch ( $type ) { case 'html': $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">'; break; case 'xhtml': $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />'; break; case 'atom': $gen = '<generator uri="https://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>'; break; case 'rss2': $gen = '<generator>https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>'; break; case 'rdf': $gen = '<admin:generatorAgent rdf:resource="https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />'; break; case 'comment': $gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->'; break; case 'export': $gen = '<!-- generator="WordPress/' . get_bloginfo_rss( 'version' ) . '" created="' . date( 'Y-m-d H:i' ) . '" -->'; break; } /** * Filters the HTML for the retrieved generator type. * * The dynamic portion of the hook name, `$type`, refers to the generator type. * * @since 2.5.0 * * @param string $gen The HTML markup output to wp_head(). * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom', * 'rss2', 'rdf', 'comment', 'export'. */ return apply_filters( "get_the_generator_{$type}", $gen, $type ); }
Base
1
function edit_option_master() { expHistory::set('editable', $this->params); $params = isset($this->params['id']) ? $this->params['id'] : $this->params; $record = new option_master($params); assign_to_template(array( 'record'=>$record )); }
Base
1
public function update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { $this->flash->success(t('Swimlane updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { $errors = array('name' => array(t('Another swimlane with the same name exists in the project'))); } } return $this->edit($values, $errors); }
Base
1
public static function val ($vars) { $val = $_SESSION['gxsess']['val']; foreach ($val as $k => $v) { # code... switch ($k) { case $vars: return $v; break; default: //echo "no value"; break; } } }
Base
1
$src = substr($ref->source, strlen($prefix)) . $section->id; if (call_user_func(array($ref->module, 'hasContent'))) { $oloc = expCore::makeLocation($ref->module, $ref->source); $nloc = expCore::makeLocation($ref->module, $src); if ($ref->module != "container") { call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc); } else { call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc, $section->id); } } }
Base
1
public function getErrorMessage() { $vs_error_message = $this->opo_error_messages->get($this->opn_error_number); if ($vs_error_message) { return $vs_error_message; } else { return "Unknown error: ".$this->opn_error_number; } }
Base
1
public static function getParam($param, $post_id) { $sql = "SELECT * FROM `posts_param` WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' LIMIT 1"; $q = Db::result($sql); if (Db::$num_rows > 0) { return $q[0]->value; }else{ return ''; } }
Base
1
public function confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, 'project' => $project, ))); }
Base
1
public function showCredits() { ?> <p><strong><?php _e('Thank you very much for your donation', 'wp-piwik'); ?>:</strong> Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S., Thomas M., John C., Andreas G., Ben M., Myra R. I., Carlos U. R.-S., Oleg I., M. N., Daniel K., James L., Jochen K., Cyril P., Thomas K., Patrik K., <?php _e('the Piwik team itself','wp-piwik');?><?php _e(', and all people flattering this','wp-piwik'); ?>!</p> <p><?php _e('Graphs powered by <a href="http://www.jqplot.com/">jqPlot</a> (License: GPL 2.0 and MIT) and <a href="http://omnipotent.net/jquery.sparkline/">jQuery Sparklines</a> (License: New BSD License).','wp-piwik'); ?></p> <p><?php _e('Metabox support inspired by', 'wp-piwik'); echo ' <a href="http://www.code-styling.de/english/how-to-use-wordpress-metaboxes-at-own-plugins">Heiko Rabe\'s metabox demo plugin</a>.';?></p> <p><?php _e('Tabbed settings page suggested by the', 'wp-piwik'); echo' <a href="http://wp.smashingmagazine.com/2011/10/20/create-tabs-wordpress-settings-pages/">Smashing Magazine</a>.';?></p> <p><?php _e('Thank you very much','wp-piwik'); ?>, Besnik Bleta, FatCow, Rene, Fab, EzBizNiz, Gormer, Natalya, AggelioPolis, Web Hosting Geeks, Web Hosting Rating, Nata Strazda (Web Hosting Hub), Hossein (LibreOffice localization team), Ste &amp; Chris <?php _e('for your translation work','wp-piwik'); ?>!</p> <p><?php _e('Thank you very much, all users who send me mails containing criticism, commendation, feature requests and bug reports! You help me to make WP-Piwik much better.','wp-piwik'); ?></p> <p><?php _e('Thank <strong>you</strong> for using my plugin. It is the best commendation if my piece of code is really used!','wp-piwik'); ?></p> <?php }
Base
1
public function testParsesProvidedUrl() { $uri = new Uri('https://michael:test@test.com:443/path/123?q=abc#test'); // Standard port 443 for https gets ignored. $this->assertEquals( 'https://michael:test@test.com/path/123?q=abc#test', (string) $uri ); $this->assertEquals('test', $uri->getFragment()); $this->assertEquals('test.com', $uri->getHost()); $this->assertEquals('/path/123', $uri->getPath()); $this->assertEquals(null, $uri->getPort()); $this->assertEquals('q=abc', $uri->getQuery()); $this->assertEquals('https', $uri->getScheme()); $this->assertEquals('michael:test', $uri->getUserInfo()); }
Base
1
public function __construct () { Session::start(); self::config('config'); new Db(); new Hooks(); Hooks::run('init'); new Options(); self::lang(Options::v('system_lang')); new Language(); new Site(); new Router(); Vendor::autoload(); Token::create(); Mod::loader(); Theme::loader(); Hooks::attach('admin_page_notif_action', array('System', 'alert')); }
Base
1
foreach ($days as $value) { $regitem[] = $value; }
Class
2
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
Base
1
function get_allowed_files_extensions_for_upload($fileTypes = 'images', $returnAsArray = false) { $are_allowed = ''; switch ($fileTypes) { case 'img': case 'image': case 'images': $are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg,webp,ico'; break; case 'audio': case 'audios': $are_allowed .= ',mp3,mp4,ogg,wav,flac'; break; case 'video': case 'videos': $are_allowed .= ',avi,asf,mpg,mpeg,mp4,flv,mkv,webm,ogg,ogv,3gp,3g2,wma,mov,wmv'; break; case 'file': case 'files': $are_allowed .= ',doc,docx,pdf,json,rtf,txt,zip,gzip,rar,cad,xml,psd,xlsx,csv,7z'; break; case 'documents': case 'doc': $are_allowed .= ',doc,docx,pdf,log,msg,odt,pages,rtf,tex,txt,wpd,wps,pps,ppt,pptx,xml,xlr,xls,xlsx'; break; case 'archives': case 'arc': case 'arch': $are_allowed .= ',zip,zipx,gzip,rar,gz,7z,cbr,tar.gz'; break; case 'all': $are_allowed .= ',*'; break; case '*': $are_allowed .= ',*'; break; default: $are_allowed .= ',' . $fileTypes; } if($are_allowed){ $are_allowed = explode(',',$are_allowed); array_unique($are_allowed); $are_allowed = array_filter($are_allowed); if ($returnAsArray) { return $are_allowed; } $are_allowed = implode(',', $are_allowed); } if ($returnAsArray) { return []; } return $are_allowed; }
Base
1
function captureAuthorization() { //eDebug($this->params,true); $order = new order($this->params['id']); /*eDebug($this->params); //eDebug($order,true);*/ //eDebug($order,true); //$billing = new billing(); //eDebug($billing, true); //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id); $calc = $order->billingmethod[0]->billingcalculator->calculator; $calc->config = $order->billingmethod[0]->billingcalculator->config; //$calc = new $calc- //eDebug($calc,true); if (!method_exists($calc, 'delayed_capture')) { flash('error', gt('The Billing Calculator does not support delayed capture')); expHistory::back(); } $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order); if (empty($result->errorCode)) { flash('message', gt('The authorized payment was successfully captured')); expHistory::back(); } else { flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message); expHistory::back(); } }
Class
2
function new_user() { global $db; $insert = $db->sql_query("INSERT INTO `mod_useronline` (`timestamp`, `ip`) VALUES ('mysql_real_escape_string($this->timestamp)', 'mysql_real_escape_string($this->ip)')"); if (!$insert) { $this->error[$this->i] = "Unable to record new visitor\r\n"; $this->i ++; } }
Base
1
function __construct () { }
Base
1
public function cloneGroup(TransactionGroup $group) { /** @var GroupCloneService $service */ $service = app(GroupCloneService::class); $newGroup = $service->cloneGroup($group); // event! event(new StoredTransactionGroup($newGroup)); app('preferences')->mark(); $title = $newGroup->title ?? $newGroup->transactionJournals->first()->description; $link = route('transactions.show', [$newGroup->id]); session()->flash('success', trans('firefly.stored_journal', ['description' => $title])); session()->flash('success_url', $link); return redirect(route('transactions.show', [$newGroup->id])); }
Compound
4
public function from($dirName) { $this->from = $dirName; return $this; }
Base
1
public function uploadImage() { $filesCheck = array_filter($_FILES); if (!empty($filesCheck) && $this->approvedFileExtension($_FILES['file']['name'], 'image') && strpos($_FILES['file']['type'], 'image/') !== false) { ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '10M'); $tempFile = $_FILES['file']['tmp_name']; $targetPath = $this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'userTabs' . DIRECTORY_SEPARATOR; $this->makeDir($targetPath); $targetFile = $targetPath . $_FILES['file']['name']; $this->setAPIResponse(null, pathinfo($_FILES['file']['name'], PATHINFO_BASENAME) . ' has been uploaded', null); return move_uploaded_file($tempFile, $targetFile); } }
Base
1
function captureAuthorization() { //eDebug($this->params,true); $order = new order($this->params['id']); /*eDebug($this->params); //eDebug($order,true);*/ //eDebug($order,true); //$billing = new billing(); //eDebug($billing, true); //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id); $calc = $order->billingmethod[0]->billingcalculator->calculator; $calc->config = $order->billingmethod[0]->billingcalculator->config; //$calc = new $calc- //eDebug($calc,true); if (!method_exists($calc, 'delayed_capture')) { flash('error', gt('The Billing Calculator does not support delayed capture')); expHistory::back(); } $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order); if (empty($result->errorCode)) { flash('message', gt('The authorized payment was successfully captured')); expHistory::back(); } else { flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message); expHistory::back(); } }
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully.')); } else { $this->flash->failure(t('Unable to remove this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
Base
1
public function IsMail() { $this->Mailer = 'mail'; }
Class
2
public function editspeed() { global $db; if (empty($this->params['id'])) return false; $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']); $calc = new $calcname($this->params['id']); assign_to_template(array( 'calculator'=>$calc )); }
Base
1
$contents[] = ['class' => 'text-center', 'text' => '<br>' . 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('languages.php', 'page=' . $_GET['page'] . '&lID=' . $lInfo->languages_id), null, null, 'btn-light')];
Base
1
function db_case($array) { global $DatabaseType; $counter = 0; if ($DatabaseType == 'mysqli') { $array_count = count($array); $string = " CASE WHEN $array[0] ="; $counter++; $arr_count = count($array); for ($i = 1; $i < $arr_count; $i++) { $value = $array[$i]; if ($value == "''" && substr($string, -1) == '=') { $value = ' IS NULL'; $string = substr($string, 0, -1); } $string .= "$value"; if ($counter == ($array_count - 2) && $array_count % 2 == 0) $string .= " ELSE "; elseif ($counter == ($array_count - 1)) $string .= " END "; elseif ($counter % 2 == 0) $string .= " WHEN $array[0]="; elseif ($counter % 2 == 1) $string .= " THEN "; $counter++; } } return $string; }
Base
1
function connect() { return $this->connectToServer($this->fields['host'], $this->fields['port'], $this->fields['rootdn'], Toolbox::decrypt($this->fields['rootdn_passwd'], GLPIKEY), $this->fields['use_tls'], $this->fields['deref_option']); }
Class
2
public function __construct() { self::$_data = self::load(); }
Base
1
$category_query = "select id from ".prefix_table("nested_tree")." where title LIKE '".$array_category[0]."' AND parent_id = 0"; } else { rest_error('NO_CATEGORY'); } // Delete item $response = DB::delete(prefix_table("items"), "id_tree = (".$category_query.") and label LIKE '".$item."'"); $json['type'] = 'item'; $json['item'] = $item; $json['category'] = $GLOBALS['request'][2]; if ($response) { $json['status'] = 'OK'; } else { $json['status'] = 'KO'; } } if ($json) { echo json_encode($json); } else { rest_error('EMPTY'); } } else { rest_error('METHOD'); } }
Base
1
public function disable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
Base
1
public function __construct () { self::setActive(); }
Base
1
public static function post($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".self::slug($vars)."/{$vars}"; break; default: # code... $url = Options::get('siteurl')."/index.php?post={$vars}"; break; } return $url; }
Base
1
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar');
Base
1
protected function copy($src, $dst, $name) { $srcStat = $this->stat($src); $this->clearcache(); if (!empty($srcStat['thash'])) { $target = $this->decode($srcStat['thash']); if (!$this->inpathCE($target, $this->root)) { return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']), elFinder::ERROR_MKOUTLINK); } $stat = $this->stat($target); $this->clearcache(); return $stat && $this->symlinkCE($target, $dst, $name) ? $this->joinPathCE($dst, $name) : $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash'])); } if ($srcStat['mime'] == 'directory') { $test = $this->stat($this->joinPathCE($dst, $name)); $this->clearcache(); if (($test && $test['mime'] != 'directory') || (! $test = $this->mkdir($this->encode($dst), $name))) { return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash'])); } $dst = $this->decode($test['hash']); foreach ($this->getScandir($src) as $stat) { if (empty($stat['hidden'])) { $name = $stat['name']; $_src = $this->decode($stat['hash']); if (! $this->copy($_src, $dst, $name)) { $this->remove($dst, true); // fall back return $this->setError($this->error, elFinder::ERROR_COPY, $this->_path($src)); } } } $this->clearcache(); return $dst; } if ($res = $this->convEncOut($this->_copy($this->convEncIn($src), $this->convEncIn($dst), $this->convEncIn($name)))) { return is_string($res)? $res : $this->joinPathCE($dst, $name); } return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash'])); }
Base
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
Base
1
$link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr ); } else { $link_text = ''; } if ( trim( $link_text ) == '' ) $link_text = $_post->post_title; /** * Filters a retrieved attachment page link. * * @since 2.7.0 * * @param string $link_html The page link HTML output. * @param int $id Post ID. * @param string|array $size Size of the image. Image size or array of width and height values (in that order). * Default 'thumbnail'. * @param bool $permalink Whether to add permalink to image. Default false. * @param bool $icon Whether to include an icon. Default false. * @param string|bool $text If string, will be link text. Default false. */ return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text ); }
Base
1
public function __get($var) { switch ($var) { case 'configuration_array': $this->configuration_array = array(); if ($this->configuration != ''){ $jsonData = json_decode($this->configuration,true); if ($jsonData !== null) { $this->configuration_array = $jsonData; } else { $this->configuration_array = array(); } } return $this->configuration_array; break; case 'name_support': return $this->name_support = $this->nick; break; case 'has_photo': return $this->filename != ''; break; case 'photo_path': $this->photo_path = ($this->filepath != '' ? '//' . $_SERVER['HTTP_HOST'] . erLhcoreClassSystem::instance()->wwwDir() : erLhcoreClassSystem::instance()->wwwImagesDir() ) .'/'. $this->filepath . $this->filename; return $this->photo_path; break; case 'file_path_server': return $this->filepath . $this->filename; break; default: break; } }
Class
2
public function IsHTML($ishtml = true) { if ($ishtml) { $this->ContentType = 'text/html'; } else { $this->ContentType = 'text/plain'; } }
Class
2
private function _csv_text($text) { $text = stripslashes(htmlspecialchars($text)); return $text; }
Base
1
$this->markTestSkipped('Function openssl_random_pseudo_bytes need LibreSSL version >=2.1.5 or Windows system on server'); } } static::$functions = $functions; // test various string lengths for ($length = 1; $length < 64; $length++) { $key1 = $this->security->generateRandomKey($length); $this->assertInternalType('string', $key1); $this->assertEquals($length, strlen($key1)); $key2 = $this->security->generateRandomKey($length); $this->assertInternalType('string', $key2); $this->assertEquals($length, strlen($key2)); if ($length >= 7) { // avoid random test failure, short strings are likely to collide $this->assertNotEquals($key1, $key2); } } // test for /dev/urandom, reading larger data to see if loop works properly $length = 1024 * 1024; $key1 = $this->security->generateRandomKey($length); $this->assertInternalType('string', $key1); $this->assertEquals($length, strlen($key1)); $key2 = $this->security->generateRandomKey($length); $this->assertInternalType('string', $key2); $this->assertEquals($length, strlen($key2)); $this->assertNotEquals($key1, $key2); // force /dev/urandom reading loop to deal with chunked data // the above test may have read everything in one run. // not sure if this can happen in real life but if it does // we should be prepared static::$fopen = fopen('php://memory', 'rwb'); $length = 1024 * 1024; $key1 = $this->security->generateRandomKey($length); $this->assertInternalType('string', $key1); $this->assertEquals($length, strlen($key1)); }
Class
2
public function setFrom($address, $name = '', $auto = true) { $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim if (!$this->validateAddress($address)) { $this->setError($this->lang('invalid_address') . ': ' . $address); $this->edebug($this->lang('invalid_address') . ': ' . $address); if ($this->exceptions) { throw new phpmailerException($this->lang('invalid_address') . ': ' . $address); } return false; } $this->From = $address; $this->FromName = $name; if ($auto) { if (empty($this->Sender)) { $this->Sender = $address; } } return true; }
Compound
4
public function showall() { expHistory::set('viewable', $this->params); // figure out if should limit the results if (isset($this->params['limit'])) { $limit = $this->params['limit'] == 'none' ? null : $this->params['limit']; } else { $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; } $order = isset($this->config['order']) ? $this->config['order'] : 'publish DESC'; // pull the news posts from the database $items = $this->news->find('all', $this->aggregateWhereClause(), $order); // merge in any RSS news and perform the sort and limit the number of posts we return to the configured amount. if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items); // setup the pagination object to paginate the news stories. $page = new expPaginator(array( 'records'=>$items, 'limit'=>$limit, 'order'=>$order, 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'view'=>empty($this->params['view']) ? null : $this->params['view'] )); assign_to_template(array( 'page'=>$page, 'items'=>$page->records, 'rank'=>($order==='rank')?1:0, 'params'=>$this->params, )); }
Base
1
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
Base
1
public static function loader(){ $theme = Options::v('themes'); define('THEME', $theme); self::incFunc($theme); }
Base
1
function details($selected_events, $queue) { global $database_ged; // get all needed infos into variables $value_parts = explode(":", $selected_events); $id = $value_parts[0]; $ged_type = $value_parts[1]; $sql = "SELECT * FROM ".$ged_type."_queue_".$queue." WHERE id = $id"; $result = sqlrequest($database_ged, $sql); $event = mysqli_fetch_assoc($result); // display event's details echo '<table class="table table-hover table-condensed">'; echo '<tbody>'; createDetailRow($event, "equipment", "label.host"); createDetailRow($event, "host_alias", "label.host_alias"); createDetailRow($event, "ip_address", "label.ip_address"); createDetailRow($event, "service", "label.service"); createDetailRow($event, "state", "label.state"); createDetailRow($event, "description", "label.desc"); createDetailRow($event, "occ", "label.occurence"); createDetailRow($event, "o_sec", "label.o_time"); createDetailRow($event, "l_sec", "label.l_time"); createDetailRow($event, "a_sec", "label.a_time"); createDetailRow($event, "hostgroups", "label.hostgroups"); createDetailRow($event, "servicegroups", "label.servicegroups"); createDetailRow($event, "src", "label.source"); createDetailRow($event, "owner", "label.owner"); createDetailRow($event, "comments", "label.comments"); echo '</tbody>'; echo '</table>'; }
Base
1
function delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->params['date_id'], 'event' => $item, )); } else { // Process a regular delete $item->delete(); } }
Base
1
public static function parseAndTrimImport($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('""', '"', $str); //do this no matter what...in case someone added a quote in a non HTML field if (!$isHTML) { //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char $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
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
Base
1
public function getDigits($key, $default = '', $deep = false) { // we need to remove - and + because they're allowed in the filter return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT, array(), $deep)); }
Base
1
private function filterScheme($scheme) { $scheme = strtolower($scheme); $scheme = rtrim($scheme, ':/'); return $scheme; }
Base
1
private function buildUri($uri, array $config) { if (!isset($config['base_uri'])) { return $uri instanceof UriInterface ? $uri : new Psr7\Uri($uri); } return Psr7\Uri::resolve(Psr7\uri_for($config['base_uri']), $uri); }
Base
1
function duplicate($options = []) { $input = $this->fields; unset($input['id']); if (is_array($options) && count($options)) { foreach ($options as $key => $val) { if (isset($this->fields[$key])) { $input[$key] = $val; } } } if ($newID = $this->clone($input)) { $this->updateDurationCache($newID); return true; } return false; }
Base
1
function PMA_getColumnsList($db, $from=0, $num=25) { $cfgCentralColumns = PMA_centralColumnsGetParams(); if (empty($cfgCentralColumns)) { return array(); } $pmadb = $cfgCentralColumns['db']; $GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']); $central_list_table = $cfgCentralColumns['table']; //get current values of $db from central column list if ($num == 0) { $query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' ' . 'WHERE db_name = \'' . $db . '\';'; } else { $query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' ' . 'WHERE db_name = \'' . $db . '\' ' . 'LIMIT ' . $from . ', ' . $num . ';'; } $has_list = (array) $GLOBALS['dbi']->fetchResult( $query, null, null, $GLOBALS['controllink'] ); PMA_handleColumnExtra($has_list); return $has_list; }
Base
1
static public function getLastArchived($_num = 10, $_admin = 1) { if ($_num > 0) { $archived = array(); $counter = 0; $result_stmt = Database::prepare(" SELECT *, ( SELECT COUNT(`sub`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub` WHERE `sub`.`answerto` = `main`.`id` ) as `ticket_answers` FROM `" . TABLE_PANEL_TICKETS . "` `main` WHERE `main`.`answerto` = '0' AND `main`.`archived` = '1' AND `main`.`adminid` = :adminid ORDER BY `main`.`lastchange` DESC LIMIT 0, ".(int)$_num ); Database::pexecute($result_stmt, array('adminid' => $_admin)); while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { $archived[$counter]['id'] = $row['id']; $archived[$counter]['customerid'] = $row['customerid']; $archived[$counter]['adminid'] = $row['adminid']; $archived[$counter]['lastreplier'] = $row['lastreplier']; $archived[$counter]['ticket_answers'] = $row['ticket_answers']; $archived[$counter]['category'] = $row['category']; $archived[$counter]['priority'] = $row['priority']; $archived[$counter]['subject'] = $row['subject']; $archived[$counter]['message'] = $row['message']; $archived[$counter]['dt'] = $row['dt']; $archived[$counter]['lastchange'] = $row['lastchange']; $archived[$counter]['status'] = $row['status']; $archived[$counter]['by'] = $row['by']; $counter++; } if (isset($archived[0]['id'])) { return $archived; } else { return false; } }
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']), ))); }
Class
2
public static function validateSignature(array $data, XMLSecurityKey $key) { assert('array_key_exists("Query", $data)'); assert('array_key_exists("SigAlg", $data)'); assert('array_key_exists("Signature", $data)'); $query = $data['Query']; $sigAlg = $data['SigAlg']; $signature = $data['Signature']; $signature = base64_decode($signature); if ($key->type !== XMLSecurityKey::RSA_SHA1) { throw new \Exception('Invalid key type for validating signature on query string.'); } if ($key->type !== $sigAlg) { $key = Utils::castKey($key, $sigAlg); } if (!$key->verifySignature($query, $signature)) { throw new \Exception('Unable to validate signature on query string.'); } }
Base
1
private function getFullOutput( $totalResults = false, $skipHeaderFooter = true ) { if ( !$skipHeaderFooter ) { $header = ''; $footer = ''; //Only override header and footers if specified. $_headerType = $this->getHeaderFooterType( 'header', $totalResults ); if ( $_headerType !== false ) { $header = $this->parameters->getParameter( $_headerType ); } $_footerType = $this->getHeaderFooterType( 'footer', $totalResults ); if ( $_footerType !== false ) { $footer = $this->parameters->getParameter( $_footerType ); } $this->setHeader( $header ); $this->setFooter( $footer ); } if ( !$totalResults && !strlen( $this->getHeader() ) && !strlen( $this->getFooter() ) ) { $this->logger->addMessage( \DynamicPageListHooks::WARN_NORESULTS ); } $messages = $this->logger->getMessages( false ); return ( count( $messages ) ? implode( "<br/>\n", $messages ) : null ) . $this->getHeader() . $this->getOutput() . $this->getFooter(); }
Class
2
public function deleteItem(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $item_id = I("item_id/d"); $return = D("Item")->soft_delete_item($item_id); if (!$return) { $this->sendError(10101); }else{ $this->sendResult($return); } }
Compound
4
public function actionView($id){ // add media object to user's recent item list User::addRecentItem('m', $id, Yii::app()->user->getId()); $this->render('view', array( 'model' => $this->loadModel($id), )); }
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(); }
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 function admin_add() { $this->pageTitle = __d('baser', 'テーマアップロード'); $this->subMenuElements = ['themes']; if (!$this->request->is(['post', 'put'])) { return; } if ($this->Theme->isOverPostSize()) { $this->BcMessage->setError( __d( 'baser', '送信できるデータ量を超えています。合計で %s 以内のデータを送信してください。', ini_get('post_max_size') ) ); } if (empty($this->request->data['Theme']['file']['tmp_name'])) { $message = __d('baser', 'ファイルのアップロードに失敗しました。'); if (!empty($this->request->data['Theme']['file']['error']) && $this->request->data['Theme']['file']['error'] == 1) { $message .= __d('baser', 'サーバに設定されているサイズ制限を超えています。'); } $this->BcMessage->setError($message); return; } $name = $this->request->data['Theme']['file']['name']; move_uploaded_file($this->request->data['Theme']['file']['tmp_name'], TMP . $name); App::uses('BcZip', 'Lib'); $BcZip = new BcZip(); if (!$BcZip->extract(TMP . $name, BASER_THEMES)) { $msg = __d('baser', 'アップロードしたZIPファイルの展開に失敗しました。'); $msg .= "\n" . $BcZip->error; $this->BcMessage->setError($msg); return; } unlink(TMP . $name); $this->BcMessage->setInfo('テーマファイル「' . $name . '」を追加しました。'); $this->redirect(['action' => 'index']); }
Base
1
protected function addAnAddress($kind, $address, $name = '') { if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { $this->setError($this->lang('Invalid recipient array') . ': ' . $kind); $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind); if ($this->exceptions) { throw new phpmailerException('Invalid recipient array: ' . $kind); } return false; } $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim if (!$this->validateAddress($address)) { $this->setError($this->lang('invalid_address') . ': ' . $address); $this->edebug($this->lang('invalid_address') . ': ' . $address); if ($this->exceptions) { throw new phpmailerException($this->lang('invalid_address') . ': ' . $address); } return false; } if ($kind != 'Reply-To') { if (!isset($this->all_recipients[strtolower($address)])) { array_push($this->$kind, array($address, $name)); $this->all_recipients[strtolower($address)] = true; return true; } } else { if (!array_key_exists(strtolower($address), $this->ReplyTo)) { $this->ReplyTo[strtolower($address)] = array($address, $name); return true; } } return false; }
Compound
4
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
Base
1
public static function canImportData() { return true; }
Base
1
static function isSearchable() { return true; }
Base
1
function edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['options'] = $oi->opts; $params['user_input_fields'] = $oi->user_input_fields; $oi->product = new product($oi->product->id, true, true); if ($oi->product->parent_id != 0) { $parProd = new product($oi->product->parent_id); //$oi->product->optiongroup = $parProd->optiongroup; $oi->product = $parProd; } //FIXME we don't use selectedOpts? // $oi->selectedOpts = array(); // if (!empty($oi->opts)) { // foreach ($oi->opts as $opt) { // $option = new option($opt[0]); // $og = new optiongroup($option->optiongroup_id); // if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id])) // $oi->selectedOpts[$og->id] = array($option->id); // else // array_push($oi->selectedOpts[$og->id], $option->id); // } // } //eDebug($oi->selectedOpts); assign_to_template(array( 'oi' => $oi, 'params' => $params )); }
Class
2
function manage() { expHistory::set('viewable', $this->params); // $category = new storeCategory(); // $categories = $category->getFullTree(); // // // foreach($categories as $i=>$val){ // // if (!empty($this->values) && in_array($val->id,$this->values)) { // // $this->tags[$i]->value = true; // // } else { // // $this->tags[$i]->value = false; // // } // // $this->tags[$i]->draggable = $this->draggable; // // $this->tags[$i]->checkable = $this->checkable; // // } // // $obj = json_encode($categories); }
Base
1
public function testNameExceptionPhp54() { session_start(); $this->proxy->setName('foo'); }
Base
1
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "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(); }
Base
1
imagepng( $im_crop, $output ); } $new_avatar = false; if ( file_exists( $output ) ) { $old_avatar = get_user_meta( $user_id, '_lp_profile_picture', true ); if ( file_exists( $upload_dir['basedir'] . '/' . $old_avatar ) ) { @unlink( $upload_dir['basedir'] . '/' . $old_avatar ); } $new_avatar = preg_replace( '!^/!', '', $upload_dir['subdir'] ) . '/' . $newname; update_user_meta( $user_id, '_lp_profile_picture', $new_avatar ); update_user_meta( $user_id, '_lp_profile_picture_changed', 'yes' ); $new_avatar = $upload_dir['baseurl'] . '/' . $new_avatar; } @unlink( $path ); return $new_avatar; }
Class
2
protected function loadSelectedViewName() { $code = $this->request->get('code', ''); if (false === \strpos($code, '-')) { $this->selectedViewName = $code; return; } $parts = \explode('-', $code); $this->selectedViewName = empty($parts) ? $code : $parts[0]; }
Base
1
public function delete() { global $DB; global $user; global $events; $ok = false; if($user->permission("themes.delete")=="false") throw new Exception(t(610, "Sorry, you are not allowed to execute this function.")); if(file_exists(NAVIGATE_PATH.'/plugins/'.$this->code.'/'.$this->code.'.plugin')) { core_remove_folder(NAVIGATE_PATH.'/plugins/'.$this->code); $ok = $DB->execute(' DELETE FROM nv_extensions WHERE id = '.protect($this->id) ); if(method_exists($events, 'trigger')) { $events->trigger( 'extension', 'delete', array( 'extension' => $this ) ); } } return $ok; }
Base
1
public function delete(Request $request, TransactionCurrency $currency) { /** @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'))])); Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code)); return redirect(route('currencies.index')); } if ($this->repository->currencyInUse($currency)) { $location = $this->repository->currencyInUseAt($currency); $message = (string) trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]); $request->session()->flash('error', $message); Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but currency is in use.', $currency->code)); return redirect(route('currencies.index')); } // put previous url in session $this->rememberPreviousUri('currencies.delete.uri'); $subTitle = (string) trans('form.delete_currency', ['name' => $currency->name]); Log::channel('audit')->info(sprintf('Visit page to delete currency %s.', $currency->code)); return prefixView('currencies.delete', compact('currency', 'subTitle')); }
Compound
4
Contacts::model()->deleteAll($criteria); } } echo $model->id; } }
Base
1
static function author() { return "Dave Leffler"; }
Class
2
public static function getParent($parent='', $menuid = ''){ if(isset($menuid)){ $where = " AND `menuid` = '{$menuid}'"; }else{ $where = ''; } $sql = sprintf("SELECT * FROM `menus` WHERE `parent` = '%s' %s", $parent, $where); $menu = Db::result($sql); return $menu; }
Base
1
Contacts::model()->deleteAll($criteria); } } echo $model->id; } }
Class
2
public function getQuerySelect() { return $this->getBind()->getQuerySelect(); }
Base
1
public static function desc($vars){ if(!empty($vars)){ $desc = substr(strip_tags(htmlspecialchars_decode($vars).". ".Options::get('sitedesc')),0,150); }else{ $desc = substr(Options::get('sitedesc'),0,150); } return $desc; }
Base
1
protected function _rmdir($path) { return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows; }
Base
1
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
Base
1
static public function onPost( $par, $out, $request ) { global $wgUser; if (!$request->getText('reason')) { $out->addHTML(Html::rawElement( 'p', [ 'class' => 'error '], wfMessage( 'report-error-missing-reason' )->escaped() )); } else { $dbw = wfGetDB( DB_MASTER ); $dbw->startAtomic(__METHOD__); $dbw->insert( 'report_reports', [ 'report_revid' => (int)$par, 'report_reason' => $request->getText('reason'), 'report_user' => $wgUser->getId(), 'report_user_text' => $wgUser->getName(), 'report_timestamp' => wfTimestampNow() ], __METHOD__ ); $dbw->endAtomic(__METHOD__); $out->addWikiMsg( 'report-success' ); $out->addWikiMsg( 'returnto', '[[' . SpecialPage::getTitleFor('Diff', $par)->getPrefixedText() . ']]' ); return; } }
Compound
4
public function rules() { $parentRules = parent::rules(); $parentRules[] = array( 'firstName,lastName', 'required', 'on' => 'webForm'); return $parentRules; }
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully.')); } else { $this->flash->failure(t('Unable to remove this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
Base
1
public function delete(){ $item_id = I("item_id/d"); $login_user = $this->checkLogin(); $uid = $login_user['uid'] ; if(!$this->checkItemManage($uid , $item_id)){ $this->sendError(10303); return ; } $item_member_id = I("item_member_id/d"); if ($item_member_id) { $member_array = D("ItemMember")->where(" item_id = '%d' and item_member_id = '%d' ",array($item_id,$item_member_id))->find(); $ret = D("ItemMember")->where(" item_id = '%d' and item_member_id = '%d' ",array($item_id,$item_member_id))->delete(); } if ($ret) { $this->sendResult($ret); }else{ $this->sendError(10101); } }
Compound
4
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 approve_toggle() { global $history; if (empty($this->params['id'])) return; /* 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']; $simplenote = new expSimpleNote($this->params['id']); $simplenote->approved = $simplenote->approved == 1 ? 0 : 1; $simplenote->save(); $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
Base
1
public static function getItems($term) { $model = X2Model::model(Yii::app()->controller->modelClass); if (isset($model)) { $tableName = $model->tableName(); $sql = 'SELECT id, name as value FROM ' . $tableName . ' WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $term . '%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); } Yii::app()->end(); }
Class
2
function csrf_start() { if ($GLOBALS['csrf']['auto-session'] && session_status() == PHP_SESSION_NONE) { session_start(); } }
Compound
4
private function mail_passthru($to, $subject, $body, $header, $params) { if ( ini_get('safe_mode') || !($this->UseSendmailOptions) ) { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header); } else { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header, $params); } return $rt; }
Base
1
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $manage_all is moot w/ cascading perms now? $manage_all = false; if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) { $manage_all = true; } //FIXME recode to use foreach $key=>$value $navcount = count($nav); for ($i = 0; $i < $navcount; $i++) { if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) { $nav[$i]->manage = 1; $view = true; } else { $nav[$i]->manage = 0; $view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id)); } $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name); if (!$view) unset($nav[$i]); } $nav= array_values($nav); // $nav[$navcount - 1]->last = true; if (count($nav)) $nav[count($nav) - 1]->last = true; // echo expJavascript::ajaxReply(201, '', $nav); $ar = new expAjaxReply(201, '', $nav); $ar->send(); }
Base
1
public static function paginated_list($offset, $limit, $order_by_field, $order_by_ascdesc) { global $DB; global $website; $DB->queryLimit( '*', 'nv_block_groups', 'website = '.protect($website->id), $order_by_field.' '.$order_by_ascdesc, $offset, $limit ); $rs = $DB->result(); $total = $DB->foundRows(); return array($rs, $total); }
Base
1
public static function country_name_by_code($code, $language="") { global $DB; $lang = core_get_language($language); $DB->query('SELECT name FROM nv_countries WHERE lang = '.protect($lang).' AND country_code = '.protect($code)); $row = $DB->first(); return $row->name; }
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($this->tagModel->remove($tag_id)) { $this->flash->success(t('Tag removed successfully.')); } else { $this->flash->failure(t('Unable to remove this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); }
Base
1
public static function getParent($id=''){ $sql = sprintf("SELECT `parent` FROM `cat` WHERE `id` = '%d'", $id); $cat = Db::result($sql); return $cat; }
Base
1