code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
static public function compress_png($path, $max_quality = 85) { $check = shell_exec("pngquant --version"); if(!$check) { return false; }else{ // guarantee that quality won't be worse than that. $min_quality = 60; // '-' makes it use ...
Base
1
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$str); $str = str_replace("&quot;",'"',$str); $str = str_replace("&#39;","'",$str); ...
Base
1
protected function assertNoPHPErrors () { $this->assertElementNotPresent('css=.xdebug-error'); $this->assertElementNotPresent('css=#x2-php-error'); }
Base
1
public function getRequestTarget() { if ($this->requestTarget !== null) { return $this->requestTarget; } $target = $this->uri->getPath(); if ($target == null) { $target = '/'; } if ($this->uri->getQuery()) { $target .= '?' . $t...
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $category = $this->getCategory(); if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->...
Base
1
public function addCC($address, $name = '') { return $this->addAnAddress('cc', $address, $name); }
Compound
4
public function approve_toggle() { 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['re...
Class
2
public static function remove_properties($element_type, $element_id, $website_id) { global $DB; global $website; if(empty($website_id)) $website_id = $website->id; webdictionary::save_element_strings('property-'.$element_type, $element_id, array()); ...
Base
1
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
Base
1
function delete_selected() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item && $item->is_recurring == 1) { $event_remaining = false; $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id); foreach ($eventdates as ...
Base
1
$sloc = expCore::makeLocation('navigation', null, $section->id); // remove any manage permissions for this page and it's children // $db->delete('userpermission', "module='navigationController' AND internal=".$section->id); // $db->delete('grouppermission', "module='na...
Base
1
function getTextColumns($table) { $sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'"; $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $records = array(); while($row = mysqli_fetch_object($res)) { $records[] = $ro...
Base
1
public function view() { $params = func_get_args(); $content = ''; $filename = urldecode(join('/', $params)); // Sanitize filename for securtiy // We don't allow backlinks if (strpos($filename, '..') !== false) { /* if (Plugin::isEnabled('sta...
Class
2
protected function optionsPage() { //FIXME Put Options code in here. }
Base
1
public function testAlwaysReturnsBody() { $r = new Response(); $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody()); }
Base
1
static function author() { return "Dave Leffler"; }
Base
1
public static function loadonce($var){ require_once(GX_LIB."Vendor/".$var); }
Base
1
static function description() { return gt("This module is for managing categories in your store."); }
Base
1
$files[$key]->save(); } // eDebug($files,true); }
Class
2
function checkOldRoutes($path) { $found = false; $x = count($path); while ($x) { $f = sqlfetch(sqlquery("SELECT * FROM bigtree_route_history WHERE old_route = '".implode("/",array_slice($path,0,$x))."'")); if ($f) { $old = $f["old_route"]; $new = $f["new_route"]; $found = true; br...
Base
1
public function activate_discount(){ if (isset($this->params['id'])) { $discount = new discounts($this->params['id']); $discount->update($this->params); //if ($discount->discountulator->hasConfig() && empty($discount->config)) { //flash('messages', $di...
Base
1
static function description() { return gt("This module is for managing categories in your store."); }
Base
1
function article_save() { global $txp_user, $vars, $prefs; extract($prefs); $incoming = array_map('assert_string', psa($vars)); $oldArticle = safe_row('Status, url_title, Title, '. 'unix_timestamp(LastMod) as sLastMod, LastModID, '. 'unix_timestamp(Posted) as sPosted, '. 'unix...
Class
2
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_restriction/show', array( 'status_list' => array( SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::S...
Base
1
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_re...
Base
1
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
Base
1
public function get_news_list($howmany) { $sql = 'SELECT id, subject, body, postedby, UNIX_TIMESTAMP(postdate) AS postdate FROM ' . TABLE_PREFIX .'news ORDER BY postdate DESC LIMIT '.$howmany; return DB::get_results($sql); }
Base
1
static function convertUTF($string) { return $string = str_replace('?', '', htmlspecialchars($string, ENT_IGNORE, 'UTF-8')); }
Class
2
public function Insert() { $ins_stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_TICKETS . "` SET `customerid` = :customerid, `adminid` = :adminid, `category` = :category, `priority` = :priority, `subject` = :subject, ...
Class
2
public function manage_versions() { expHistory::set('manageable', $this->params); $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); $sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h '; $sql .= 'RIGHT JOIN '.DB_TABLE_PREF...
Base
1
public function download($name){ $attachFile = storage_path('app/'.str_replace("-","/",$name)); if(!is_file($attachFile)){ abort(404); } return response()->download($attachFile); }
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $category = $this->getCategory(); if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->...
Base
1
public function __construct($strSystemid = "") { //Generating all the required objects. For this we use our cool cool carrier-object //take care of loading just the necessary objects $objCarrier = class_carrier::getInstance(); $this->objConfig = $objCarrier->getObjConfig(); ...
Base
1
private function getResponse ($size = 128) { $pop3_response = fgets($this->pop_conn, $size); return $pop3_response; }
Base
1
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getA...
Base
1
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank")...
Class
2
function rsvpmaker_relay_menu_pages() { $parent_slug = 'edit.php?post_type=rsvpemail'; add_submenu_page( $parent_slug, __( 'Group Email', 'rsvpmaker' ), __( 'Group Email', 'rsvpmaker' ), 'manage_options', 'rsvpmaker_relay_manual_test', 'rsvpmaker_relay_manual_test' ); add_submenu_page( $parent_slug,...
Base
1
function delete_vendor() { global $db; if (!empty($this->params['id'])){ $db->delete('vendor', 'id =' .$this->params['id']); } expHistory::back(); }
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('D...
Base
1
public function getModuleItemString() { $ret = $this->handler->_moduleName . '_' . $this->handler->_itemname; return $ret; }
Base
1
function get(&$dbh, $proposalId, $handle) { $sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS timestamp FROM package_proposal_votes WHERE pkg_prop_id = ". $dbh->quoteSmart($proposalId) ." AND user_handle= ". $dbh->quoteSmart($handle); $res = $dbh->query($sql); if (DB::isError($res)) { ...
Base
1
function update_vendor() { $vendor = new vendor(); $vendor->update($this->params['vendor']); expHistory::back(); }
Class
2
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['upch...
Class
2
public static function data($vars){ $file = GX_MOD.'/'.$vars.'/index.php'; $handle = fopen($file, 'r'); $data = fread($handle, filesize($file)); fclose($handle); preg_match('/\* Name: (.*)\n\*/U', $data, $matches); $d['name'] = $matches[1]; preg_match('...
Base
1
foreach ($value as $i => $j) { $column_check = explode('_', $i); if ($column_check[0] == 'CUSTOM') { $check_validity = DBGet(DBQuery('SELECT COUNT(*) as REC_EX FROM school_custom_fields WHERE ID=' . $column_check[1] . ' AND (SCHOOL_ID=' ....
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, ))); }
Class
2
public static function getId($id=''){ if(isset($id)){ $sql = sprintf("SELECT * FROM `menus` WHERE `id` = '%d' ORDER BY `order` ASC", $id); $menus = Db::result($sql); $n = Db::$num_rows; }else{ $menus = ''; } return $menus; ...
Base
1
public static function page($vars) { switch (SMART_URL) { case true: $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php/":"/"; if (Options::v('multilang_enable') === 'on') { $lang = Language::isActive(); ...
Base
1
public function testDecrypt($expected, $key, $string) { $this->string(\Toolbox::decrypt($string, $key))->isIdenticalTo($expected); }
Class
2
public static function doTablesUpdate($definition){ $updateInformation = self::getTablesStatus($definition); $db = ezcDbInstance::get(); $errorMessages = array(); try { $db->query('SET GLOBAL innodb_strict_mode = 0;'); $db->query('SET GLOBAL innodb_file_per_table=1;'); ...
Base
1
static function displayname() { return "Events"; }
Base
1
public function params() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) { $this->create(); return; } $action = $this->act...
Base
1
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_restriction/show', array( 'status_list' => array( SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::S...
Base
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
protected function _mkdir($path, $name) { $path = $this->_joinPath($path, $name); if ($this->connect->mkdir($path) === false) { return false; } $this->options['dirMode'] && $this->connect->chmod($this->options['dirMode'], $path); return $path; }
Base
1
public static function getId($id=''){ if(isset($id)){ $sql = sprintf("SELECT * FROM `menus` WHERE `id` = '%d'", $id); $menus = Db::result($sql); $n = Db::$num_rows; }else{ $menus = ''; } return $menus; }
Base
1
public function index(Request $request) { /** @var User $user */ $user = auth()->user(); $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page'); $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; $collection = $this->re...
Compound
4
public function uploadCustomLogoAction(Request $request) { $fileExt = File::getFileExtension($_FILES['Filedata']['name']); if (!in_array($fileExt, ['svg', 'png', 'jpg'])) { throw new \Exception('Unsupported file format'); } if ($fileExt === 'svg' && stripos(file_get_...
Class
2
static public function getHighestOrderNumber($_uid = 0) { $where = ''; $sel_data = array(); if ($_uid > 0) { $where = " WHERE `adminid` = :adminid"; $sel_data['adminid'] = $_uid; } $sql = "SELECT MAX(`logicalorder`) as `highestorder` FROM `" . TABLE_PANEL_TICKET_CATS . "`".$where.";"; $result_stmt =...
Class
2
$layout[$loc] = array_merge($layout[$loc],$data); } } } return $layout; }
Class
2
public static function thmMenu(){ $thm = Options::v('themes'); //$mod = self::modList(); //print_r($mod); $list = ''; # code... $data = self::data($thm); if(isset($_GET['page']) && $_GET['page'] == 'themes' && isset($_GET['view...
Base
1
foreach ($fields as $field => $title) { if($i==0 && $j==0){ echo '<div class="row">'; }elseif($i==0 && $j>0){ echo '</div><div class="row">'; } echo '<div class="col-md-6"><label class="checkbox-inline"><...
Base
1
public function create_media_dir($params) { must_have_access(); $resp = array(); // $target_path = media_base_path() . 'uploaded' . DS; $target_path = media_uploads_path(); $fn_path = media_base_path(); if (isset($_REQUEST['path']) and trim($_REQUEST['path']) != '...
Base
1
$result[$index][1] = preg_replace( "/" . $find . "/", $replaceWith, $row[0] ); } } return $result; }
Base
1
public function fetchFormFromTemplate($id) { }
Base
1
function init_args() { $args = new stdClass(); $args->req_id = isset($_REQUEST['requirement_id']) ? $_REQUEST['requirement_id'] : 0; $args->compare_selected_versions = isset($_REQUEST['compare_selected_versions']); $args->left_item_id = isset($_REQUEST['left_item_id']) ? intval($_REQUEST['left_item_id']) : -1;...
Base
1
function cfdef_input_textbox( array $p_field_def, $p_custom_field_value, $p_required = '' ) { echo '<input ', helper_get_tab_index(), ' type="text" id="custom_field_', $p_field_def['id'] , '" name="custom_field_', $p_field_def['id'], '" ', $p_required; if( $p_field_def['length_max'] > 0 ) { echo ' maxlength="' ....
Base
1
public function execute(&$params){ $action = new Actions; $action->associationType = lcfirst(get_class($params['model'])); $action->associationId = $params['model']->id; $action->subject = $this->parseOption('subject', $params); $action->actionDescription = $this->parseOption...
Base
1
$module_views[$key]['name'] = gt($value['name']); } // look for a config form for this module's current view // $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod); //check to see if hcview was passed along, indicating a hard-coded module // if (!empty($contr...
Base
1
function insertServiceCategorieInDB(){ global $pearDB, $centreon; if (testServiceCategorieExistence($_POST["sc_name"])){ $DBRESULT = $pearDB->query("INSERT INTO `service_categories` (`sc_name`, `sc_description`, `level`, `icon_id`, `sc_activate` ) VALUES ('".$_POST["sc_name"]....
Base
1
public static function generate_location_json( ) { /* TODO: Try to track modification? if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { $http_time = strtotime( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); $mod_time = strtotime( $post->post_modified_gmt . ' GMT' ); if ($mod_time <= $http_time) { re...
Class
2
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, -...
Base
1
public function admin_download() { $this->autoRender = false; $tmpDir = TMP . 'theme' . DS; $Folder = new Folder(); $Folder->create($tmpDir); $path = BASER_THEMES . $this->siteConfigs['theme'] . DS; $Folder->copy([ 'from' => $path, 'to' => $tmpDir . $this->siteConfigs['theme'], 'chmod' => 0777 ...
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 { ...
Base
1
function process_subsections($parent_section, $subtpl) { global $db, $router; $section = new stdClass(); $section->parent = $parent_section->id; $section->name = $subtpl->name; $section->sef_name = $router->encode($section->name); $...
Base
1
public function saveconfig() { 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']); $conf = serialize($calc->parseConfig($this->...
Base
1
public function testPopBeforeSmtpGood() { //Start a fake POP server $pid = shell_exec('nohup ./runfakepopserver.sh >/dev/null 2>/dev/null & printf "%u" $!'); $this->pids[] = $pid; sleep(2); //Test a known-good login $this->assertTrue( POP3::popBeforeS...
Class
2
function addChannelPageTools($agencyid, $websiteId, $channelid, $channelType) { if ($channelType == 'publisher') { $deleteReturlUrl = MAX::constructUrl(MAX_URL_ADMIN, 'affiliate-channels.php'); } else { $deleteReturlUrl = MAX::constructUrl(MAX_URL_ADMIN, 'channel-index.php'); } //du...
Compound
4
$query->whereExists(function ($permissionQuery) use (&$tableDetails, $action) { /** @var Builder $permissionQuery */ $permissionQuery->select(['role_id'])->from('joint_permissions') ->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName...
Class
2
foreach ($pkeys as $k) { $where[] = $k . ' = "' . $row->$k . '"'; }
Base
1
function process_subsections($parent_section, $subtpl) { global $db, $router; $section = new stdClass(); $section->parent = $parent_section->id; $section->name = $subtpl->name; $section->sef_name = $router->encode($section->name); $...
Base
1
public static function render_page_process($PATH) { $search_query = $_REQUEST['search']; $main = null; if(strlen($search_query) < 4) { $main = '<h1>Search Failed</h1>'; $main .= '<p>Search Queries Must Be At Least Four Characters.</p>'; } else { $main .= '<h1>Search Results For: ' . $search_q...
Base
1
public function rules() { return [ 'name' => 'required', 'email' => 'required|email', 'address' => '', 'primary_number' => 'numeric', 'secondary_number' => 'numeric', 'password' => 'sometimes', 'password_confirmation' =>...
Base
1
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Class
2
public function testLogout() { $GLOBALS['cfg']['Server']['auth_swekey_config'] = ''; $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = ''; $GLOBALS['cfg']['CaptchaLoginPublicKey'] = ''; $_REQUEST['old_usr'] = 'pmaolduser'; $GLOBALS['cfg']['LoginCookieDeleteAll'] = false; ...
Class
2
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); if ($this->customFilterModel->remove($filter['id']))...
Base
1
static function description() { return gt("This module is for managing categories in your store."); }
Base
1
public function register() { JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN')); // Get the application $app = JFactory::getApplication(); // Get the form data. $data = $this->input->post->get('user', array(), 'array'); // Get the model and validate the data. $model = $this->getModel(...
Class
2
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
Base
1
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
Base
1
private static function logoutAction() { if (wCMS::$currentPage === 'logout' && hash_equals($_REQUEST['token'], wCMS::generateToken())) { unset($_SESSION['l'], $_SESSION['i'], $_SESSION['u'], $_SESSION['token']); wCMS::redirect(); } }
Base
1
public function open($savePath, $sessionName) { $return = (bool) $this->handler->open($savePath, $sessionName); if (true === $return) { $this->active = true; } return $return; }
Base
1
public function update() { global $user; if (expSession::get('customer-signup')) expSession::set('customer-signup', false); if (isset($this->params['address_country_id'])) { $this->params['country'] = $this->params['address_country_id']; unset($this->params['address_cou...
Base
1
public static function recent_actions($function, $action, $limit=8) { global $DB; global $user; global $website; // last month only! $DB->query(' SELECT DISTINCT nvul.website, nvul.function, nvul.item, nvul.date FROM nv_users_log nvul WHERE nvul.user = '.protect($user->id).' AND nv...
Base
1
protected function configure() { // set ARGS $this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST'? $_POST : $_GET; // set thumbnails path $path = $this->options['tmbPath']; if ($path) { if (!file_exists($path)) { if (@mkdir($path)) { chmod($path, $this->options['tmbPathMode']); } else { $...
Base
1
self::$collectedInfo[$params['name']] = array('definition' => $params, 'value' => $_FILES[$params['name']]); } } else { if (isset(self::$collectedInfo[$params['name']]['value'])){ $valueContent = self::$collectedInfo[$params['name']]['value']; $downloadLink = "<a href=\"http...
Class
2
function columnUpdate($table, $col, $val, $where=1) { $res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where"); /*if ($res == null) return array(); $objects = array(); for ($i = 0; $i < mysqli_num_rows...
Base
1
public function getDisplayName ($plural=true) { $moduleName = X2Model::getModuleName (get_class ($this)); return Modules::displayName ($plural, $moduleName); }
Base
1
function csrf_check($fatal = true) { if ($_SERVER['REQUEST_METHOD'] !== 'POST') { return true; } csrf_start(); $name = $GLOBALS['csrf']['input-name']; $ok = false; $tokens = ''; do { if (!isset($_POST[$name])) { break; } // we don't regenerate a to...
Compound
4
private function isWindows() { return DIRECTORY_SEPARATOR !== '/'; }
Class
2