code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
private function readData() { if (isset($this->tid) && $this->tid != - 1 ) { $_ticket_stmt = Database::prepare(' SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid' ); $_ticket = Database::pexecute_first($_ticket_stmt, array('tid' => $this->tid)); $this->Set('customer', $_ticket['cu...
Class
2
foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_templates WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); return $o...
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
function SafeStripSlashes($string) { return (get_magic_quotes_gpc() ? stripslashes($string) : $string); }
Base
1
static function is_username($username, &$error='') { if (strlen($username)<2) $error = __('Username must have at least two (2) characters'); elseif (!preg_match('/^[\p{L}\d._-]+$/u', $username)) $error = __('Username contains invalid characters'); return $error == '';...
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 downloadfile() { if (empty($this->params['fileid'])) { flash('error', gt('There was an error while trying to download your file. No File Specified.')); expHistory::back(); } $fd = new filedownload($this->params['fileid']); if (empty(...
Base
1
static function displayname() { return gt("Navigation"); }
Class
2
function delete_vendor() { global $db; if (!empty($this->params['id'])){ $db->delete('vendor', 'id =' .$this->params['id']); } expHistory::back(); }
Base
1
public static function update($vars) { if(is_array($vars)){ //print_r($vars); $u = $vars['user']; $sql = array( 'table' => 'user', 'id' => $vars['id'], 'key' => $u, ...
Base
1
public function approve_submit() { if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); expHistory::back(); } /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the...
Base
1
public function upload() { if (!AuthUser::hasPermission('file_manager_upload')) { Flash::set('error', __('You do not have sufficient permissions to upload a file.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_POST[...
Class
2
public function actionGetItems(){ $model = X2Model::model ($this->modelClass); if (isset ($model)) { $tableName = $model->tableName (); $sql = 'SELECT id, fileName as value FROM '.$tableName.' WHERE associationType!="theme" ...
Base
1
public function delete() { global $user; $count = $this->address->find('count', 'user_id=' . $user->id); if($count > 1) { $address = new address($this->params['id']); if ($user->isAdmin() || ($user->id == $address->user_id)) { if ($address->is_bill...
Base
1
function manage() { global $db; expHistory::set('manageable', $this->params); // $classes = array(); $dir = BASE."framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { ...
Base
1
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.m4a','.ogg','.webma','.mp4','.flv', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso','.bz2','.epub', '.pdf','.ofd','.swf','.epub...
Base
1
public function getPLaying(){ $url = "http://api.themoviedb.org/3/movie/now_playing?api_key=".$this->apikey; $now_playing = $this->curl($url); return $now_playing; }
Base
1
function edit() { global $user; /* 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_LOG...
Base
1
public static function _date2timestamp( $datetime, $wtz=null ) { if( !isset( $datetime['hour'] )) $datetime['hour'] = 0; if( !isset( $datetime['min'] )) $datetime['min'] = 0; if( !isset( $datetime['sec'] )) $datetime['sec'] = 0; if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || emp...
Class
2
public static function validateByRegex($path, $values, $regex) { $result = preg_match($regex, $values[$path]); return array($path => ($result ? '' : __('Incorrect value!'))); }
Class
2
$files[$key]->save(); } // eDebug($files,true); }
Base
1
$that->options['id_field'] => new \MongoDate(), ); }));
Base
1
foreach($item->attributes as $name => $value) if ($name !== 'id' && $name !== 'listId') $copy->$name = $value; $lineItems[] = $copy; } return $lineItems; }
Class
2
public static function format ($post, $id) { // split post for readmore... $post = Typo::Xclean($post); $more = explode('[[--readmore--]]', $post); //print_r($more); if (count($more) > 1) { $post = explode('[[--readmore--]]', $post); $post = $po...
Base
1
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
Class
2
public function save($check_notify = false) { if (isset($_POST['email_recipients']) && is_array($_POST['email_recipients'])) { $this->email_recipients = base64_encode(serialize($_POST['email_recipients'])); } return parent::save($check_notify); }
Class
2
public function install(array $options = null, &$status=null) { parent::install($options); parent::setup($options); //check if ssl is enabled $this->appcontext->run('v-list-web-domain', [$this->appcontext->user(), $this->domain, 'json'], $status); $sslEnabled = ($status->json[$this->domain]['SSL'...
Base
1
private function setColumnOption(&$column, string $name, string $key, bool $isWidget, bool $allowEmpty) { $newValue = $this->request->request->get($name . '-' . $key); if ($isWidget) { if (!empty($newValue) || $allowEmpty) { $column['children'][0][$key] = $newValue; ...
Base
1
public function update_version() { // get the current version $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); // check to see if the we have a new current version and unset the old current version. if (!empty($this->params['is_current'])) { // $db...
Class
2
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
Base
1
public function AddBCC($address, $name = '') { return $this->AddAnAddress('bcc', $address, $name); }
Class
2
protected function renderImageByGD($code) { $image = imagecreatetruecolor($this->width, $this->height); $backColor = imagecolorallocate( $image, (int) ($this->backColor % 0x1000000 / 0x10000), (int) ($this->backColor % 0x10000 / 0x100), $this->bac...
Class
2
static public function addCategory($_category = null, $_admin = 1, $_order = 1) { if ($_category != null && $_category != '' ) { if ($_order < 1) { $_order = 1; } $ins_stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_TICKET_CATS . "` SET `name` = :name, `adminid` = :adminid, ...
Class
2
public function formatTemplateArg( $arg, $s, $argNr, $firstCall, $maxLength, Article $article ) { $tableFormat = $this->getParameters()->getParameter( 'tablerow' ); // we could try to format fields differently within the first call of a template // currently we do not make such a difference // if the result s...
Class
2
static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = []) { global $CFG_GLPI; $rand = mt_rand(); $field_id = Html::cleanId("dropdown_".$myname.$rand); $param = [ 'entity_restrict' => ...
Class
2
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
if(!is_array($sections)) $sections = array(); foreach($sections as $section) { if(!empty($section['width']) && !in_array($section['width'], $widths)) array_push($widths, $section['width']); } } return $widths; }
Base
1
function getUserPartForHeader() { global $i18n; if (!$this->id) return null; $user_part = htmlspecialchars($this->name); $user_part .= ' - '.htmlspecialchars($this->role_name); if ($this->behalf_id) { $user_part .= ' <span class="onBehalf">'.$i18n->get('label.on_behalf').' '.htmlspecialchar...
Base
1
$contents = ['form' => tep_draw_form('status', 'orders_status.php', 'page=' . $_GET['page'] . '&action=insert')];
Base
1
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) { if ($is_revisioned) { $object->revision_id++; //if ($table=="text") eDebug($object); $res = $this->insertObject($object, $table); //if ($table=="text") eDebug($objec...
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('zones.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
Base
1
public static function getSName($zdb, $id, $wid = false, $wnick = false) { try { $select = $zdb->select(self::TABLE); $select->where(self::PK . ' = ' . $id); $results = $zdb->execute($select); $row = $results->current(); return self::getNameWi...
Base
1
function searchCategory() { return gt('Event'); }
Base
1
public function actionEditDropdown() { $model = new Dropdowns; if (isset($_POST['Dropdowns'])) { $model = Dropdowns::model()->findByPk( $_POST['Dropdowns']['id']); if ($model->id == Actions::COLORS_DROPDOWN_ID) { if (AuxLib::issetIsArray($...
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 successful...
Base
1
public function showall() { expHistory::set('viewable', $this->params); $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'show...
Base
1
public function upload() { if (!AuthUser::hasPermission('file_manager_upload')) { Flash::set('error', __('You do not have sufficient permissions to upload a file.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_POST[...
Class
2
public function get_view_config() { global $template; // set paths we will search in for the view $paths = array( BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure', BASE.'framework/modules/common/views/file/configure', ); fo...
Class
2
function download_selected($dir) { $dir = get_abs_dir($dir); global $site_name; require_once("_include/fun_archive.php"); $items = qxpage_selected_items(); // check if user selected any items to download switch (count($items)) { case 0: show_error($GLOBALS["error_msg"]["...
Base
1
protected function _restoreDb($data) { if (empty($data['Tool']['backup']['tmp_name'])) { return false; } $tmpPath = TMP . 'schemas' . DS; $targetPath = $tmpPath . $data['Tool']['backup']['name']; if (!move_uploaded_file($data['Tool']['backup']['tmp_name'], $targetPath)) { return false; } /* ZI...
Base
1
protected function curl_get_contents( &$url, $timeout, $redirect_max, $ua, $outfp ){ $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_HEADER, false ); if ($outfp) { curl_setopt( $ch, CURLOPT_FILE, $outfp ); } else { curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); ...
Base
1
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-",...
Base
1
public static function gZip () { #ob_start(ob_gzhandler); ob_start(); ob_implicit_flush(0); }
Base
1
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'paren...
Base
1
public function setPageTextMatchRegex( array $pageTextMatchRegex = [] ) { $this->pageTextMatchRegex = (array)$pageTextMatchRegex; }
Class
2
$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; retur...
Base
1
$cols = explode( '}:', $label ); if ( count( $cols ) <= 1 ) { if ( array_key_exists( $t, $_tableRow ) ) { $tableRow[$groupNr] = $_tableRow[$t]; } } else { $n = count( explode( ':', $cols[1] ) ); $colNr = -1; $t--; for ( $i = 1; $i <= $n; $i++ ) { $colNr++; $t++; ...
Class
2
function update_optiongroup_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $og = new optiongroup_master($id); $oldtitle = $og->title; $og->update($this->params); // if the title of the master changed we should update th...
Base
1
public function index($id) { //check permissions $template = $this->TemplateElement->Template->checkAuthorisation($id, $this->Auth->user(), false); if (!$this->_isSiteAdmin() && !$template) { throw new MethodNotAllowedException('No template with the provided ID exists, or yo...
Base
1
public function manage() { expHistory::set('viewable', $this->params); $page = new expPaginator(array( 'model'=>'order_status', 'where'=>1, 'limit'=>10, 'order'=>'rank', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'control...
Class
2
public static function restoreX2AuthManager () { if (isset (self::$_oldAuthManagerComponent)) { Yii::app()->setComponent ('authManager', self::$_oldAuthManagerComponent); } else { throw new CException ('X2AuthManager component could not be restored'); } }
Base
1
static function testLDAPConnection($auths_id, $replicate_id = -1) { $config_ldap = new self(); $res = $config_ldap->getFromDB($auths_id); // we prevent some delay... if (!$res) { return false; } //Test connection to a replicate if ($replicate_id != -1) { ...
Base
1
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
Class
2
public static function filesBySearch($text, $wid=NULL, $orderby="name ASC") { global $DB; global $website; if(empty($wid)) $wid = $website->id; $DB->query(' SELECT * FROM nv_files WHERE name LIKE '.protect('%'.$text.'%').' AND website = '.$wid.' ORDER BY '.$orderby); ...
Base
1
function selectArraysBySql($sql) { $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($res == null) return array(); $arrays = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $arrays[] = mysqli_fetch_assoc($res...
Class
2
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_notes WHERE website = '.protect($website->id), 'object' ); $out = $DB->result(); if($typ...
Base
1
public function update($key, $qty) { if ((int)$qty && ((int)$qty > 0)) { $this->session->data['cart'][$key] = (int)$qty; } else { $this->remove($key); } $this->data = array(); }
Base
1
public function testNotRemoveAuthorizationHeaderOnRedirect() { $mock = new MockHandler([ new Response(302, ['Location' => 'http://example.com/2']), static function (RequestInterface $request) { self::assertTrue($request->hasHeader('Authorization')); ...
Class
2
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
foreach ($post['fields'] as $abs_pos => $field) { if ($current_cat != $post[$field . '_category']) { //reset position when category has changed $pos = 0; //set new current category $current_cat = $post[$field . '_category']; ...
Base
1
public function setModel(Model $model) { $this->model = $model; $this->extensions = $this->model->getAllowedExtensions(); $this->from($this->model->getObjectTypeDirName()); return $this; }
Base
1
function scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); ...
Class
2
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...
Base
1
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_docs WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = '%'.$_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encod...
Class
2
public static function save_uploaded_user_avatar() { $avatar_data = wp_parse_args( LP_Request::get( 'lp-user-avatar-crop' ), array( 'name' => '', 'width' => '', 'height' => '', 'points' => '', 'nonce' => '', ) ); $current_user_id = get_current_user_id(); if ( ! w...
Class
2
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
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
Base
1
private function _notmodifiedby( $option ) { $user = new \User; $this->addWhere( 'NOT EXISTS (SELECT 1 FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id AND ' . $this->tableNames['revision_actor_temp'] . '.revactor_actor = ' . $this->...
Class
2
public function store() { $data = array( 'type_name' => $this->name ); try { if ($this->id !== null && $this->id > 0) { if ($this->old_name !== null) { $this->deleteTranslation($this->old_name); $this->addTra...
Base
1
$body = str_replace(array("\n"), "<br />", $body); } else { // It's going elsewhere (doesn't like quoted-printable) $body = str_replace(array("\n"), " -- ", $body); } $title = $items[...
Base
1
static function testLDAPConnection($auths_id, $replicate_id = -1) { $config_ldap = new self(); $res = $config_ldap->getFromDB($auths_id); // we prevent some delay... if (!$res) { return false; } //Test connection to a replicate if ($replicate_id != -1) { ...
Class
2
$controller = new $ctlname(); if (method_exists($controller,'isSearchable') && $controller->isSearchable()) { // $mods[$controller->name()] = $controller->addContentToSearch(); $mods[$controller->searchName()] = $controller->addContentToSearch(); } } uksort($mods,'str...
Class
2
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 (...
Base
1
'data' => str_replace(array_keys($tags), array_values($tags), $content), 'status' => array(), 'type' => 'text/html; charset=UTF-8' ) ); }
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->pref...
Base
1
private function writeComment(Worksheet $pSheet, $coordinate) { $result = ''; if (!$this->isPdf && isset($pSheet->getComments()[$coordinate])) { $result .= '<a class="comment-indicator"></a>'; $result .= '<div class="comment">' . nl2br($pSheet->getComment($coordinate)->ge...
Base
1
function edit_optiongroup_master() { expHistory::set('editable', $this->params); $id = isset($this->params['id']) ? $this->params['id'] : null; $record = new optiongroup_master($id); assign_to_template(array( 'record'=>$record )); }
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...
Base
1
private function getStateId(string $state, string $machine) { return $this->getContainer()->get(Connection::class) ->fetchColumn(' SELECT LOWER(HEX(state_machine_state.id)) FROM state_machine_state INNER JOIN state_machine ...
Class
2
public function getDisplayName ($plural=true) { return Yii::t('contacts', '{contact} List|{contact} Lists', array( (int) $plural, '{contact}' => Modules::displayName(false, 'Contacts'), )); }
Class
2
function edit_vendor() { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); assign_to_template(array( 'vendor'=>$vendor )); } }
Base
1
public function save($filename) { $json = []; foreach ($this as $cookie) { /** @var SetCookie $cookie */ if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { $json[] = $cookie->toArray(); } } if (false === file_...
Base
1
foreach ($indexToDelete as $indexName) { $this->addSql('DROP INDEX ' . $indexName . ' ON ' . $users); }
Compound
4
$links[] = CHtml::link(CHtml::encode($tag->tag),array('/search/search','term'=>CHtml::encode($tag->tag)));
Class
2
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); ...
Base
1
public static function url($mod) { $url = Site::$url."/inc/mod/".$mod; return $url; }
Base
1
public function __construct () { }
Base
1
public function setText($text) { $return = $this->setOneToOne($text, Text::class, 'text', 'container'); $this->setType('ctText'); return $return; }
Base
1
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1