code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
public function clearTags() {
$this->_tags = array(); // clear tag cache
return (bool) CActiveRecord::model('Tags')->deleteAllByAttributes(array(
'type' => get_class($this->getOwner()),
'itemId' => $this->getOwner()->id)
);
} | CWE-79 | 1 |
protected function imgCrop($path, $width, $height, $x, $y, $destformat = null, $jpgQuality = null) {
if (($s = @getimagesize($path)) == false) {
return false;
}
$result = false;
if (!$jpgQuality) {
$jpgQuality = $this->options['jpgQuality'];
}
switch ($this->imgLib) {
case 'imagick':
try {
$img = new imagick($path);
} catch (Exception $e) {
return false;
}
$ani = ($img->getNumberImages() > 1);
if ($ani && is_null($destformat)) {
$img = $img->coalesceImages();
do {
$img->setImagePage($s[0], $s[1], 0, 0);
$img->cropImage($width, $height, $x, $y);
$img->setImagePage($width, $height, 0, 0);
} while ($img->nextImage());
$img = $img->optimizeImageLayers();
$result = $img->writeImages($path, true);
} else {
if ($ani) {
$img->setFirstIterator();
}
$img->setImagePage($s[0], $s[1], 0, 0);
$img->cropImage($width, $height, $x, $y);
$img->setImagePage($width, $height, 0, 0);
$result = $this->imagickImage($img, $path, $destformat, $jpgQuality);
}
$img->clear();
return $result ? $path : false;
break;
case 'gd':
$img = $this->gdImageCreate($path,$s['mime']);
if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) {
$this->gdImageBackground($tmp,$this->options['tmbBgColor']);
$size_w = $width;
$size_h = $height;
if ($s[0] < $width || $s[1] < $height) {
$size_w = $s[0];
$size_h = $s[1];
}
if (!imagecopy($tmp, $img, 0, 0, $x, $y, $size_w, $size_h)) {
return false;
}
$result = $this->gdImage($tmp, $path, $destformat, $s['mime'], $jpgQuality);
imagedestroy($img);
imagedestroy($tmp);
return $result ? $path : false;
}
break;
}
return false;
} | CWE-89 | 0 |
function nvweb_content_comments_count($object_id = NULL, $object_type = "item")
{
global $DB;
global $website;
global $current;
$element = $current['object'];
if($current['type']=='structure' && $object_type == "item")
$element = $element->elements(0); // item = structure->elements(first)
if(empty($object_id))
$object_id = $element->id;
$DB->query('SELECT COUNT(*) as total
FROM nv_comments
WHERE website = '.protect($website->id).'
AND object_type = "'.$object_type.'"
AND object_id = '.protect($object_id).'
AND status = 0'
);
$out = $DB->result('total');
return $out[0];
}
| CWE-89 | 0 |
function create_thumbs($updir, $img, $name, $thumbnail_width, $thumbnail_height, $quality){
$arr_image_details = GetImageSize("$updir/$img");
$original_width = $arr_image_details[0];
$original_height = $arr_image_details[1];
$a = $thumbnail_width / $thumbnail_height;
$b = $original_width / $original_height;
if ($a<$b) {
$new_width = $thumbnail_width;
$new_height = intval($original_height*$new_width/$original_width);
} else {
$new_height = $thumbnail_height;
$new_width = intval($original_width*$new_height/$original_height);
}
if(($original_width <= $thumbnail_width) AND ($original_height <= $thumbnail_height)) {
$new_width = $original_width;
$new_height = $original_height;
}
if($arr_image_details[2]==1) { $imgt = "imagegif"; $imgcreatefrom = "imagecreatefromgif"; }
if($arr_image_details[2]==2) { $imgt = "imagejpeg"; $imgcreatefrom = "imagecreatefromjpeg"; }
if($arr_image_details[2]==3) { $imgt = "imagepng"; $imgcreatefrom = "imagecreatefrompng"; }
if($imgt) {
$old_image = $imgcreatefrom("$updir/$img");
$new_image = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($new_image,$old_image,0,0,0,0,$new_width,$new_height,$original_width,$original_height);
imagejpeg($new_image,"$updir/$name",$quality);
imagedestroy($new_image);
}
} | CWE-434 | 5 |
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'])));
} | CWE-639 | 9 |
final public function modifyLimitQuery($query, $limit, $offset = 0)
{
if ($offset < 0) {
throw new Exception(sprintf(
'Offset must be a positive integer or zero, %d given',
$offset
));
}
if ($offset > 0 && ! $this->supportsLimitOffset()) {
throw new Exception(sprintf(
'Platform %s does not support offset values in limit queries.',
$this->getName()
));
}
return $this->doModifyLimitQuery($query, $limit, $offset);
} | CWE-89 | 0 |
$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);
}
}
}
| CWE-89 | 0 |
static function searchUser(AuthLDAP $authldap) {
if (self::connectToServer($authldap->getField('host'), $authldap->getField('port'),
$authldap->getField('rootdn'),
Toolbox::decrypt($authldap->getField('rootdn_passwd'), GLPIKEY),
$authldap->getField('use_tls'),
$authldap->getField('deref_option'))) {
self::showLdapUsers();
} else {
echo "<div class='center b firstbloc'>".__('Unable to connect to the LDAP directory');
}
} | CWE-798 | 18 |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| CWE-89 | 0 |
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);
} | CWE-639 | 9 |
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->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | CWE-639 | 9 |
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;
}
} | CWE-79 | 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->getAll(),
'available_actions' => $this->actionManager->getAvailableActions(),
'project' => $project,
'title' => t('Remove an action')
)));
} | CWE-639 | 9 |
public function html() {
switch( $this->type ) {
case FILE_ADDED:
$t_string = 'timeline_issue_file_added';
break;
case FILE_DELETED:
$t_string = 'timeline_issue_file_deleted';
break;
default:
throw new ServiceException( 'Unknown Event Type', ERROR_GENERIC );
}
$t_bug_link = string_get_bug_view_link( $this->issue_id );
$t_html = $this->html_start( 'fa-file-o' );
$t_html .= '<div class="action">'
. sprintf( lang_get( $t_string ),
prepare_user_name( $this->user_id ),
$t_bug_link,
$this->filename
)
. '</div>';
$t_html .= $this->html_end();
return $t_html;
} | CWE-79 | 1 |
$name = ucfirst($module->name);
if (in_array($name, $skipModules)) {
continue;
}
if($name != 'Document'){
$controllerName = $name.'Controller';
if(file_exists('protected/modules/'.$module->name.'/controllers/'.$controllerName.'.php')){
Yii::import("application.modules.$module->name.controllers.$controllerName");
$controller = new $controllerName($controllerName);
$model = $controller->modelClass;
if(class_exists($model)){
$moduleList[$model] = Yii::t('app', $module->title);
}
}
}
}
return $moduleList;
} | CWE-79 | 1 |
private function getResponse ($size = 128) {
$pop3_response = fgets($this->pop_conn, $size);
return $pop3_response;
} | CWE-79 | 1 |
public function getDisplayName ($plural=true) {
return Yii::t('contacts', '{contact} List|{contact} Lists', array(
(int) $plural,
'{contact}' => Modules::displayName(false, 'Contacts'),
));
} | CWE-79 | 1 |
$res = preg_match("/^$map_part/", $this->url_parts[$i]);
if ($res != 1) {
$matched = false;
break;
}
$pairs[$key] = $this->url_parts[$i];
$i++;
}
} else {
$matched = false;
}
if ($matched) {
// safeguard against false matches when a real action was what the user really wanted.
if (count($this->url_parts) >= 2 && method_exists(expModules::getController($this->url_parts[0]), $this->url_parts[1]))
return false;
$this->url_parts = array();
$this->url_parts[0] = $map['controller'];
$this->url_parts[1] = $map['action'];
if (isset($map['view'])) {
$this->url_parts[2] = 'view';
$this->url_parts[3] = $map['view'];
}
foreach($map as $key=>$value) {
if ($key != 'controller' && $key != 'action' && $key != 'view' && $key != 'url_parts') {
$this->url_parts[] = $key;
$this->url_parts[] = $value;
}
}
foreach($pairs as $key=>$value) {
if ($key != 'controller') {
$this->url_parts[] = $key;
$this->url_parts[] = $value;
}
}
$this->params = $this->convertPartsToParams();
return true;
}
}
return false;
} | CWE-89 | 0 |
public function update()
{
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
$values = $this->request->getValues();
list($valid, $errors) = $this->tagValidator->validateModification($values);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($valid) {
if ($this->tagModel->update($values['id'], $values['name'])) {
$this->flash->success(t('Tag updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} else {
$this->edit($values, $errors);
}
} | CWE-639 | 9 |
foreach($functions as $function)
{
if($function->id == $f)
{
if($function->enabled=='1')
$sortable_assigned[] = '<li class="ui-state-highlight" value="'.$function->id.'" category="'.$function->category.'"><img src="'.NAVIGATE_URL.'/'.$function->icon.'" align="absmiddle" /> '.t($function->lid, $function->lid).'</li>';
else
$sortable_assigned[] = '<li class="ui-state-highlight ui-state-disabled" value="'.$function->id.'" category="'.$function->category.'"><img src="'.NAVIGATE_URL.'/'.$function->icon.'" align="absmiddle" /> '.t($function->lid, $function->lid).'</li>';
}
}
| CWE-79 | 1 |
public function before_content( $content ) {
global $post;
$post_id = $post->ID;
// show on single sell media pages
if ( is_singular( 'sell_media_item' ) || sell_media_attachment( $post_id ) || sell_media_is_search() ) {
// bail if it's password protected item
if ( post_password_required( $post ) || ( isset( $post->post_parent ) && post_password_required( $post->post_parent ) ) ) {
return $content;
}
$has_multiple_attachments = sell_media_has_multiple_attachments( $post_id );
$wrap = ( ! $has_multiple_attachments || 'attachment' === get_post_type( $post_id ) ) ? true : false;
$new_content = '';
// only wrap content if a single image/media is being viewed
if ( $wrap ) {
$new_content .= '<div class="sell-media-content">';
}
$new_content .= sell_media_breadcrumbs();
$new_content .= sell_media_get_media();
$new_content .= $content;
// only wrap content if a single image/media is being viewed
if ( $wrap ) {
$new_content .= '</div>';
}
$content = $new_content;
// set the post views, used for popular query
sell_media_set_post_views( $post_id );
}
return apply_filters( 'sell_media_content', $content );
} | CWE-79 | 1 |
function update_vendor() {
$vendor = new vendor();
$vendor->update($this->params['vendor']);
expHistory::back();
} | CWE-89 | 0 |
static function displayname() {
return gt("e-Commerce Category Manager");
} | CWE-89 | 0 |
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'])));
} | CWE-639 | 9 |
public function showUnpublished() {
expHistory::set('viewable', $this->params);
// setup the where clause for looking up records.
$where = parent::aggregateWhereClause();
$where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where;
if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1';
$page = new expPaginator(array(
'model'=>'news',
'where'=>$where,
'limit'=>25,
'order'=>'unpublish',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title',
gt('Published On')=>'publish',
gt('Status')=>'unpublish'
),
));
assign_to_template(array(
'page'=>$page
));
} | CWE-89 | 0 |
foreach ($page as $pageperm) {
if (!empty($pageperm['manage'])) return true;
}
| CWE-89 | 0 |
foreach($image->expTag as $tag) {
if (isset($used_tags[$tag->id])) {
$used_tags[$tag->id]->count++;
} else {
$exptag = new expTag($tag->id);
$used_tags[$tag->id] = $exptag;
$used_tags[$tag->id]->count = 1;
}
} | CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$link_id = $this->request->getIntegerParam('link_id');
$link = $this->taskExternalLinkModel->getById($link_id);
if (empty($link)) {
throw new PageNotFoundException();
}
$this->response->html($this->template->render('task_external_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | CWE-639 | 9 |
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_converter/show', array(
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
public function executeQuery()
{
if ($this->query !== null) {
$this->query
->offset($this->offset)
->limit($this->limit)
->orderBy($this->order, $this->direction);
if ($this->formatter !== null) {
return $this->formatter->withQuery($this->query)->format();
} else {
return $this->query->findAll();
}
}
return array();
} | CWE-79 | 1 |
public function getQueryOrderby()
{
return $this->name;
} | CWE-89 | 0 |
public function getQueryGroupby()
{
$R1 = 'R1_' . $this->id;
$R2 = 'R2_' . $this->id;
return "$R2.value";
} | CWE-89 | 0 |
$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[$i]->title;
$msg .= "BEGIN:VEVENT\n";
$msg .= $dtstart . $dtend;
$msg .= "UID:" . $items[$i]->date_id . "\n";
$msg .= "DTSTAMP:" . date("Ymd\THis", time()) . "Z\n";
if ($title) {
$msg .= "SUMMARY:$title\n";
}
if ($body) {
$msg .= "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" . $body . "\n";
}
// if($link_url) { $msg .= "URL: $link_url\n";}
if (!empty($this->config['usecategories'])) {
if (!empty($items[$i]->expCat[0]->title)) {
$msg .= "CATEGORIES:".$items[$i]->expCat[0]->title."\n";
} else {
$msg .= "CATEGORIES:".$this->config['uncat']."\n";
}
}
$msg .= "END:VEVENT\n";
}
| CWE-89 | 0 |
private function SendHello($hello, $host) {
fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
$rply = $this->get_lines();
$code = substr($rply,0,3);
if($this->do_debug >= 2) {
$this->edebug("SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />');
}
if($code != 250) {
$this->error =
array("error" => $hello . " not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) {
$this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />');
}
return false;
}
$this->helo_rply = $rply;
return true;
} | CWE-79 | 1 |
public function withQuery($query)
{
if (!is_string($query) && !method_exists($query, '__toString')) {
throw new \InvalidArgumentException(
'Query string must be a string'
);
}
$query = (string) $query;
if (substr($query, 0, 1) === '?') {
$query = substr($query, 1);
}
$query = $this->filterQueryAndFragment($query);
if ($this->query === $query) {
return $this;
}
$new = clone $this;
$new->query = $query;
return $new;
} | CWE-89 | 0 |
$filename = isset($_REQUEST[$request]) ? trim($_REQUEST[$request]) : false;
if (!$filename || empty($filename)) {
continue;
}
if ($filename == wCMS::get('config', 'theme')) {
wCMS::alert('danger', 'Cannot delete currently active theme.');
wCMS::redirect();
continue;
}
if (file_exists("{$folder}/{$filename}")) {
wCMS::recursiveDelete("{$folder}/{$filename}");
wCMS::alert('success', "Deleted {$filename}.");
wCMS::redirect();
}
}
}
}
}
| CWE-22 | 2 |
public static function initializeNavigation() {
$sections = section::levelTemplate(0, 0);
return $sections;
}
| CWE-89 | 0 |
. htmlspecialchars($table['table']) . '`</a>';
$html .= '</li>';
}
}
} else {
$html .= '<li class="warp_link">'
. ($this->_tableType == 'recent'
?__('There are no recent tables.')
:__('There are no favorite tables.'))
. '</li>';
} | CWE-79 | 1 |
public function confirm()
{
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->response->html($this->helper->layout->project('custom_filter/remove', array(
'project' => $project,
'filter' => $filter,
'title' => t('Remove a custom filter')
)));
} | CWE-639 | 9 |
protected function _add_comment_log( $id, $action, $comment = null ) {
if ( is_null( $comment ) )
$comment = get_comment( $id );
aal_insert_log( array(
'action' => $action,
'object_type' => 'Comments',
'object_subtype' => get_post_type( $comment->comment_post_ID ),
'object_name' => get_the_title( $comment->comment_post_ID ),
'object_id' => $id,
) );
} | CWE-79 | 1 |
public function getDisplayName ($plural=true) {
return Yii::t('marketing', 'Web Form');
} | CWE-79 | 1 |
public function specialLogin( $error = null ) {
$request = $this->getRequest();
$out = $this->getOutput();
$out->setPageTitle( wfMessage('soa2-login-title')->escaped() );
if ($error) {
$this->error($error);
} else if (
$request->wasPosted() && $request->getCheck( 'username' )
) {
$username = $request->getVal( 'username', '', );
if (!preg_match(SOA2_USERNAME_REGEX, $username)) {
$this->specialLogin(
wfMessage('soa2-invalid-username', $username)->plain()
);
return;
}
if ($request->getCheck( 'token' )) {
$this->doLogin( $request );
return;
}
$this->loginForm( $request );
return;
}
// Step 11
$out->addHTML(Html::openElement('form', [ 'method' => 'POST' ]));
$out->addHTML(Html::rawElement('p', [], Html::label(
wfMessage('soa2-scratch-username')->escaped(),
'soa2-username-input',
)));
// Step 12
$out->addHTML(Html::rawElement('p', [], Html::input(
'username',
$request->getVal('username', ''),
'text',
[ 'id' => 'soa2-username-input' ]
)));
$out->addHTML(Html::rawElement('p', [], Html::submitButton(
wfMessage('soa2-next')->escaped(), []
)));
$out->addHTML(Html::closeElement('form'));
} | CWE-79 | 1 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-79 | 1 |
function __construct(Frame $frame, Dompdf $dompdf)
{
parent::__construct($frame, $dompdf);
$url = $frame->get_node()->getAttribute("src");
$debug_png = $dompdf->getOptions()->getDebugPng();
if ($debug_png) {
print '[__construct ' . $url . ']';
}
list($this->_image_url, /*$type*/, $this->_image_msg) = Cache::resolve_url(
$url,
$dompdf->getProtocol(),
$dompdf->getBaseHost(),
$dompdf->getBasePath(),
$dompdf
);
if (Cache::is_broken($this->_image_url) &&
$alt = $frame->get_node()->getAttribute("alt")
) {
$fontMetrics = $dompdf->getFontMetrics();
$style = $frame->get_style();
$font = $style->font_family;
$size = $style->font_size;
$word_spacing = $style->word_spacing;
$letter_spacing = $style->letter_spacing;
$style->width = (4 / 3) * $fontMetrics->getTextWidth($alt, $font, $size, $word_spacing, $letter_spacing);
$style->height = $fontMetrics->getFontHeight($font, $size);
}
} | CWE-73 | 23 |
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);
return $arrays;
} | CWE-89 | 0 |
protected function emailExistsInDB($email)
{
/* Build sql query*/
$sql = 'SELECT * FROM '.$this->usersTable;
$sql .= ' WHERE email = "'.$email.'";';
/* Execute query */
$results = $this->wiki->loadAll($sql);
return $results; // If the password does not already exist in DB, $result is an empty table => false
} | CWE-89 | 0 |
} elseif (strtolower($icon) == 'desc') {
$icon = 'fa fa-sort-desc';
} else {
$icon = 'fa fa-unsorted';
}
if (($db_column == '') || (substr_count($db_column, 'nosort'))) {
print '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " class='$nohide $align' " . ((($i+1) == count($header_items)) ? "colspan='$last_item_colspan' " : '') . '>' . $display_text . "</th>\n"; | CWE-79 | 1 |
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,
));
} | CWE-89 | 0 |
protected function _copy($source, $targetDir, $name) {
$this->clearcache();
$id = $this->_joinPath($targetDir, $name);
$sql = $id > 0
? sprintf('REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden`) (SELECT %d, %d, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden` FROM %s WHERE id=%d)', $this->tbf, $id, $this->_dirname($id), $this->tbf, $source)
: sprintf('INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden`) SELECT %d, "%s", content, size, %d, mime, width, height, `read`, `write`, `locked`, `hidden` FROM %s WHERE id=%d', $this->tbf, $targetDir, $this->db->real_escape_string($name), time(), $this->tbf, $source);
return $this->query($sql);
} | CWE-89 | 0 |
$modelName = ucfirst ($module->name);
if (class_exists ($modelName)) {
// prefix widget class name with custom module model name and a delimiter
$cache[$widgetType][$modelName.'::TemplatesGridViewProfileWidget'] =
Yii::t(
'app', '{modelName} Summary', array ('{modelName}' => $modelName));
}
}
}
}
return $cache[$widgetType];
} | CWE-79 | 1 |
$confirm = pack('H*', gps('confirm'));
$name = substr($confirm, 5);
$nonce = safe_field("nonce", 'txp_users', "name = '".doSlash($name)."'");
if ($nonce and $confirm === pack('H*', substr(md5($nonce), 0, 10)).$name) {
include_once txpath.'/lib/txplib_admin.php';
$message = reset_author_pass($name);
}
} | CWE-521 | 4 |
public function testSetActivePhp54()
{
$this->proxy->setActive(true);
} | CWE-89 | 0 |
$mime = mime_content_type($path);
} elseif ($type === 'getimagesize') {
if ($img = @getimagesize($path)) {
$mime = $img['mime'];
}
}
if ($mime) {
$mime = explode(';', $mime);
$mime = trim($mime[0]);
if (in_array($mime, array('application/x-empty', 'inode/x-empty'))) {
// finfo return this mime for empty files
$mime = 'text/plain';
} elseif ($mime == 'application/x-zip') {
// http://elrte.org/redmine/issues/163
$mime = 'application/zip';
}
}
$ext = $mime? $volume->getExtentionByMime($mime) : '';
return $ext? ('.' . $ext) : '';
} | CWE-89 | 0 |
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_billing)
{
$billAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$billAddress->is_billing = true;
$billAddress->save();
}
if ($address->is_shipping)
{
$shipAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$shipAddress->is_shipping = true;
$shipAddress->save();
}
parent::delete();
}
}
else
{
flash("error", gt("You must have at least one address."));
}
expHistory::back();
} | CWE-89 | 0 |
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
$str = str_replace("�", "’", $str);
$str = str_replace("�", "‘", $str);
$str = str_replace("�", "®", $str);
$str = str_replace("�", "-", $str);
$str = str_replace("�", "—", $str);
$str = str_replace("�", "”", $str);
$str = str_replace("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
$str = str_replace("\t", " ", $str);
$str = str_replace(",", "\,", $str);
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
if (!$isHTML) {
$str = str_replace('\"', """, $str);
$str = str_replace('"', """, $str);
} else {
$str = str_replace('"', '""', $str);
}
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
$str = trim(str_replace("�", "™", $str));
//echo "2<br>"; eDebug($str,die);
return $str;
} | CWE-89 | 0 |
self::removeLevel($kid->id);
}
}
| CWE-89 | 0 |
public function getAlnum($key, $default = '', $deep = false)
{
return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default, $deep));
} | CWE-89 | 0 |
public function getDisplayName ($plural=true) {
$moduleName = X2Model::getModuleName (get_class ($this));
return Modules::displayName ($plural, $moduleName);
} | CWE-79 | 1 |
foreach ($page as $pageperm) {
if (!empty($pageperm['manage'])) return true;
}
| CWE-89 | 0 |
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
| CWE-89 | 0 |
public function testAggregatesHeaders()
{
$r = new Request('GET', 'http://foo.com', [
'ZOO' => 'zoobar',
'zoo' => ['foobar', 'zoobar']
]);
$this->assertEquals('zoobar, foobar, zoobar', $r->getHeaderLine('zoo'));
} | CWE-89 | 0 |
$_fn[] = self::buildCondition($v, ' && ');
}
$fn[] = '('.\implode(' || ', $_fn).')';
break;
case '$where':
if (\is_callable($value)) {
// need implementation
}
break;
default:
$d = '$document';
if (\strpos($key, '.') !== false) {
$keys = \explode('.', $key);
foreach ($keys as $k) {
$d .= '[\''.$k.'\']';
}
} else {
$d .= '[\''.$key.'\']';
}
if (\is_array($value)) {
$fn[] = "\\MongoLite\\UtilArrayQuery::check((isset({$d}) ? {$d} : null), ".\var_export($value, true).')';
} else {
if (is_null($value)) {
$fn[] = "(!isset({$d}))";
} else {
$_value = \var_export($value, true);
$fn[] = "(isset({$d}) && (
is_array({$d}) && is_string({$_value})
? in_array({$_value}, {$d})
: {$d}=={$_value}
)
)";
}
}
}
}
return \count($fn) ? \trim(\implode($concat, $fn)) : 'true';
} | CWE-89 | 0 |
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id);
if (!empty($newret)) $ret .= $newret . '<br>';
if ($iLoc->mod == 'container') {
$ret .= scan_container($container->internal, $page_id);
}
}
return $ret;
}
| CWE-89 | 0 |
$_result[$_key] = preg_replace("/<>'\"\[\]{}:;/", "", $_value);
}
$result = $_result;
} else {
$_result = strip_tags($arr[$key]);
$result = preg_replace("/<>'\"\[\]{}:;/", "", $_result);
}
} else {
$result = $def;
}
return $result;
} | CWE-89 | 0 |
public function testValidateRequestUri()
{
new Request('GET', true);
} | CWE-89 | 0 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-79 | 1 |
protected function init() {
if (!($this->options['host'] || $this->options['socket'])
|| !$this->options['user']
|| !$this->options['pass']
|| !$this->options['db']
|| !$this->options['path']
|| !$this->options['files_table']) {
return false;
}
$this->db = new mysqli($this->options['host'], $this->options['user'], $this->options['pass'], $this->options['db'], $this->options['port'], $this->options['socket']);
if ($this->db->connect_error || @mysqli_connect_error()) {
return false;
}
$this->db->set_charset('utf8');
if ($res = $this->db->query('SHOW TABLES')) {
while ($row = $res->fetch_array()) {
if ($row[0] == $this->options['files_table']) {
$this->tbf = $this->options['files_table'];
break;
}
}
}
if (!$this->tbf) {
return false;
}
$this->updateCache($this->options['path'], $this->_stat($this->options['path']));
return true;
} | CWE-89 | 0 |
public function manage_sitemap() {
global $db, $user, $sectionObj, $sections;
expHistory::set('viewable', $this->params);
$id = $sectionObj->id;
$current = null;
// all we need to do is determine the current section
$navsections = $sections;
if ($sectionObj->parent == -1) {
$current = $sectionObj;
} else {
foreach ($navsections as $section) {
if ($section->id == $id) {
$current = $section;
break;
}
}
}
assign_to_template(array(
'sasections' => $db->selectObjects('section', 'parent=-1'),
'sections' => $navsections,
'current' => $current,
'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),
));
}
| CWE-89 | 0 |
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'] ) || empty( $datetime['tz'] )))
return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
$output = $offset = 0;
if( empty( $wtz )) {
if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) {
$offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1;
$wtz = 'UTC';
}
else
$wtz = $datetime['tz'];
}
if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz )))
$wtz = 'UTC';
try {
$strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] );
$d = new DateTime( $strdate, new DateTimeZone( $wtz ));
if( 0 != $offset ) // adjust for offset
$d->modify( $offset.' seconds' );
$output = $d->format( 'U' );
unset( $d );
}
catch( Exception $e ) {
$output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
}
return $output;
}
| CWE-89 | 0 |
function can_process($new) {
if (strlen($_POST['user_id']) < 4) {
display_error( _('The user login entered must be at least 4 characters long.'));
set_focus('user_id');
return false;
}
if (!$new && ($_POST['password'] != '')) {
if (strlen($_POST['password']) < 4) {
display_error( _('The password entered must be at least 4 characters long.'));
set_focus('password');
return false;
}
if (strstr($_POST['password'], $_POST['user_id']) != false) {
display_error( _('The password cannot contain the user login.'));
set_focus('password');
return false;
}
}
return true;
} | CWE-521 | 4 |
$p = $vars['paging']-(ceil($maxpage/2)-1);
$limit = $curr+ceil($maxpage/2)-1;
// echo "more maxpage";
}else{
$p = $vars['paging']-(ceil($maxpage/2)-1);
$limit = $curr + floor($maxpage/2);
}
for ($i=$p ; $i <= $limit /*ceil($total/$vars['max'])+1*/ ; $i++ ) {
# code...
if($smart == true){
$url = $vars['url']."/paging/".$i;
}else{
$url = $vars['url']."&paging=".$i;
}
if($vars['paging'] == $i){ $sel = "class=\"active\"";}else{$sel='';}
$r .= "<li {$sel}><a href=\"{$url}\">$i</a></li>";
}
$r .= "</ul>";
}elseif(isset($vars['type']) && $vars['type'] == 'pager'){ // PAGER
| CWE-89 | 0 |
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();
} | CWE-89 | 0 |
protected function getFile()
{
$task_id = $this->request->getIntegerParam('task_id');
$file_id = $this->request->getIntegerParam('file_id');
$model = 'projectFileModel';
if ($task_id > 0) {
$model = 'taskFileModel';
$project_id = $this->taskFinderModel->getProjectId($task_id);
if ($project_id !== $this->request->getIntegerParam('project_id')) {
throw new AccessForbiddenException();
}
}
$file = $this->$model->getById($file_id);
if (empty($file)) {
throw new PageNotFoundException();
}
$file['model'] = $model;
return $file;
} | CWE-639 | 9 |
$clientIps = array_map('trim', explode(',', $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_IP]))); | CWE-89 | 0 |
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."));
expHistory::back();
} | CWE-89 | 0 |
$iloc = expUnserialize($container->internal);
if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) {
// There is no sectionref for this container. Populate sectionref
if ($container->external != "N;") {
$newSecRef = new stdClass();
$newSecRef->module = $iloc->mod;
$newSecRef->source = $iloc->src;
$newSecRef->internal = '';
$newSecRef->refcount = 1;
// $newSecRef->is_original = 1;
$eloc = expUnserialize($container->external);
// $section = $db->selectObject('sectionref',"module='containermodule' AND source='".$eloc->src."'");
$section = $db->selectObject('sectionref',"module='container' AND source='".$eloc->src."'");
if (!empty($section)) {
$newSecRef->section = $section->id;
$db->insertObject($newSecRef,"sectionref");
$missing_sectionrefs[] = gt("Missing sectionref for container replaced").": ".$iloc->mod." - ".$iloc->src." - PageID #".$section->id;
} else {
$db->delete('container','id="'.$container->id.'"');
$missing_sectionrefs[] = gt("Cant' find the container page for container").": ".$iloc->mod." - ".$iloc->src.' - '.gt('deleted');
}
}
}
}
assign_to_template(array(
'missing_sectionrefs'=>$missing_sectionrefs,
));
} | CWE-89 | 0 |
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($res); $i++)
$objects[] = mysqli_fetch_object($res);*/
//return $objects;
} | CWE-89 | 0 |
$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 );
} | CWE-79 | 1 |
private function getTempDir($volumeTempPath = null) {
$testDirs = array();
if ($this->uploadTempPath) {
$testDirs[] = rtrim(realpath($this->uploadTempPath), DIRECTORY_SEPARATOR);
}
if ($volumeTempPath) {
$testDirs[] = rtrim(realpath($volumeTempPath), DIRECTORY_SEPARATOR);
}
if (function_exists('sys_get_temp_dir')) {
$testDirs[] = sys_get_temp_dir();
}
$tempDir = '';
foreach($testDirs as $testDir) {
if (!$testDir || !is_dir($testDir)) continue;
if (is_writable($testDir)) {
$tempDir = $testDir;
$gc = time() - 3600;
foreach(glob($tempDir . DIRECTORY_SEPARATOR .'ELF*') as $cf) {
if (filemtime($cf) < $gc) {
@unlink($cf);
}
}
break;
}
}
return $tempDir;
} | CWE-89 | 0 |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | CWE-639 | 9 |
function searchName() { return gt('Webpage'); }
| CWE-89 | 0 |
foreach ($day as $extevent) {
$event_cache = new stdClass();
$event_cache->feed = $extgcalurl;
$event_cache->event_id = $extevent->event_id;
$event_cache->title = $extevent->title;
$event_cache->body = $extevent->body;
$event_cache->eventdate = $extevent->eventdate->date;
if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)
$event_cache->dateFinished = $extevent->dateFinished;
if (isset($extevent->eventstart))
$event_cache->eventstart = $extevent->eventstart;
if (isset($extevent->eventend))
$event_cache->eventend = $extevent->eventend;
if (isset($extevent->is_allday))
$event_cache->is_allday = $extevent->is_allday;
$found = false;
if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries
$found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate);
if (!$found)
$db->insertObject($event_cache,'event_cache');
}
| CWE-89 | 0 |
public function __construct () {
}
| CWE-89 | 0 |
public function testPhpSession53()
{
if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
$storage = $this->getStorage();
$this->assertFalse(isset($_SESSION));
$this->assertFalse($storage->getSaveHandler()->isActive());
session_start();
$this->assertTrue(isset($_SESSION));
// in PHP 5.3 we cannot reliably tell if a session has started
$this->assertFalse($storage->getSaveHandler()->isActive());
// PHP session might have started, but the storage driver has not, so false is correct here
$this->assertFalse($storage->isStarted());
$key = $storage->getMetadataBag()->getStorageKey();
$this->assertFalse(isset($_SESSION[$key]));
$storage->start();
$this->assertTrue(isset($_SESSION[$key]));
} | CWE-89 | 0 |
}elseif($p->status == 1){
$status = "<a href=\"index.php?page=users&act=inactive&id={$p->id}&token=".TOKEN."\" class=\"label label-primary\">Active</a>";
}
| CWE-89 | 0 |
public function validate() {
global $db;
// check for an sef url field. If it exists make sure it's valid and not a duplicate
//this needs to check for SEF URLS being turned on also: TODO
if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) {
if (empty($this->sef_url)) $this->makeSefUrl();
if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();
if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();
}
// safeguard again loc data not being pass via forms...sometimes this happens when you're in a router
// mapped view and src hasn't been passed in via link to the form
if (isset($this->id) && empty($this->location_data)) {
$loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);
if (!empty($loc)) $this->location_data = $loc;
}
// run the validation as defined in the models
if (!isset($this->validates)) return true;
$messages = array();
$post = empty($_POST) ? array() : expString::sanitize($_POST);
foreach ($this->validates as $validation=> $field) {
foreach ($field as $key=> $value) {
$fieldname = is_numeric($key) ? $value : $key;
$opts = is_numeric($key) ? array() : $value;
$ret = expValidator::$validation($fieldname, $this, $opts);
if (!is_bool($ret)) {
$messages[] = $ret;
expValidator::setErrorField($fieldname);
unset($post[$fieldname]);
}
}
}
if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);
} | CWE-89 | 0 |
unset($m[0][$i], $m[1][$i], $m[2][$i], $m[3][$i], $k, $v, $i);
}
}
return $r;
} | CWE-502 | 15 |
$cont_title = substr(Typo::Xclean(Typo::strip($data['posts'][0]->title)),0,$limit);
$titlelength = strlen($data['posts'][0]->title);
}else{
| CWE-89 | 0 |
public function update(Request $request, string $attachmentId)
{
$attachment = $this->attachment->newQuery()->findOrFail($attachmentId);
try {
$this->validate($request, [
'attachment_edit_name' => 'required|string|min:1|max:255',
'attachment_edit_url' => 'string|min:1|max:255'
]);
} catch (ValidationException $exception) {
return response()->view('attachments.manager-edit-form', array_merge($request->only(['attachment_edit_name', 'attachment_edit_url']), [
'attachment' => $attachment,
'errors' => new MessageBag($exception->errors()),
]), 422);
}
$this->checkOwnablePermission('view', $attachment->page);
$this->checkOwnablePermission('page-update', $attachment->page);
$this->checkOwnablePermission('attachment-create', $attachment);
$attachment = $this->attachmentService->updateFile($attachment, [
'name' => $request->get('attachment_edit_name'),
'link' => $request->get('attachment_edit_url'),
]);
return view('attachments.manager-edit-form', [
'attachment' => $attachment,
]);
} | CWE-79 | 1 |
public function showall_tags() {
$images = $this->image->find('all');
$used_tags = array();
foreach ($images as $image) {
foreach($image->expTag as $tag) {
if (isset($used_tags[$tag->id])) {
$used_tags[$tag->id]->count++;
} else {
$exptag = new expTag($tag->id);
$used_tags[$tag->id] = $exptag;
$used_tags[$tag->id]->count = 1;
}
}
}
assign_to_template(array(
'tags'=>$used_tags
));
} | CWE-89 | 0 |
public static function filesByMedia($media, $offset=0, $limit=-1, $wid=NULL, $text="", $orderby="date_added DESC, name ASC")
{
global $DB;
global $website;
if(empty($wid))
$wid = $website->id;
if($limit < 1)
$limit = 2147483647;
if(!empty($text))
$text = ' AND name LIKE '.protect('%'.$text.'%');
$DB->query(' SELECT SQL_CALC_FOUND_ROWS * FROM nv_files
WHERE type = '.protect($media).'
AND enabled = 1
AND website = '.$wid.'
'.$text.'
ORDER BY '.$orderby.'
LIMIT '.$limit.'
OFFSET '.$offset);
$total = $DB->foundRows();
$rows = $DB->result();
return array($rows, $total);
}
| CWE-89 | 0 |
unlink($file);
}
foreach (self::$tempImages as $versions) {
foreach ($versions as $file) {
if ($file === self::$broken_image) {
continue;
}
if ($debugPng) {
print "[unlink temp image $file]";
}
if (file_exists($file)) {
unlink($file);
}
}
}
self::$_cache = [];
self::$tempImages = [];
} | CWE-73 | 23 |
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);
} | CWE-89 | 0 |
public static function dropdown($vars) {
if(is_array($vars)){
//print_r($vars);
$name = $vars['name'];
$where = "WHERE ";
if(isset($vars['parent'])) {
$where .= " `parent` = '{$vars['parent']}' ";
}else{
$where .= "1 ";
}
$order_by = "ORDER BY ";
if(isset($vars['order_by'])) {
$order_by .= " {$vars['order_by']} ";
}else{
$order_by .= " `name` ";
}
if (isset($vars['sort'])) {
$sort = " {$vars['sort']}";
}
}
$cat = Db::result("SELECT * FROM `cat` {$where} {$order_by} {$sort}");
$drop = "<select name=\"{$name}\" class=\"form-control\"><option></option>";
if(Db::$num_rows > 0 ){
foreach ($cat as $c) {
# code...
if($c->parent == ''){
if(isset($vars['selected']) && $c->id == $vars['selected']) $sel = "SELECTED"; else $sel = "";
$drop .= "<option value=\"{$c->id}\" $sel style=\"padding-left: 10px;\">{$c->name}</option>";
foreach ($cat as $c2) {
# code...
if($c2->parent == $c->id){
if(isset($vars['selected']) && $c2->id == $vars['selected']) $sel = "SELECTED"; else $sel = "";
$drop .= "<option value=\"{$c2->id}\" $sel style=\"padding-left: 10px;\"> {$c2->name}</option>";
}
}
}
}
}
$drop .= "</select>";
return $drop;
} | CWE-89 | 0 |
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'] == 'showall_tabbed')) {
$limit = '0';
}
$order = isset($this->config['order']) ? $this->config['order'] : "rank";
$page = new expPaginator(array(
'model'=>'photo',
'where'=>$this->aggregateWhereClause(),
'limit'=>$limit,
'order'=>$order,
'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],
'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),
'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),
'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null,
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title'
),
));
assign_to_template(array(
'page'=>$page,
'params'=>$this->params,
));
} | CWE-89 | 0 |
$input = (function ($settingName, $setting, $appView) {
$settingId = str_replace('.', '_', $settingName);
return $this->Bootstrap->switch([
'label' => h($setting['description']),
'checked' => !empty($setting['value']),
'id' => $settingId,
'class' => [
(!empty($setting['error']) ? 'is-invalid' : ''),
(!empty($setting['error']) ? $appView->get('variantFromSeverity')[$setting['severity']] : ''),
],
'attrs' => [
'data-setting-name' => $settingName
]
]);
})($settingName, $setting, $this); | CWE-79 | 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();
$lang = !empty($lang)? $lang . '/': '';
$url = Site::$url.$inFold. $lang .self::slug($vars).GX_URL_PREFIX;
}else{
$url = Site::$url.$inFold.self::slug($vars).GX_URL_PREFIX;
}
break;
default:
if (Options::v('multilang_enable') === 'on') {
$lang = Language::isActive();
$lang = !empty($lang)? '&lang=' . $lang: '';
$url = Site::$url."/?page={$vars}{$lang}";
}else{
$url = Site::$url."/?page={$vars}";
}
break;
}
return $url;
}
| CWE-89 | 0 |
function process_user(){
#'''Call /delta for the given user ID and process any changes.'''
// creation d'un client dropbox
include("lib/dropboxAPI.php");
$myCustomClient = new dbx\Client($accessToken, $clientIdentifier);
//Articles
$pathPrefix="/Chargements appareil photo/ArticleTdm";
$cursortxt = "lib/cursor.txt";
$url="url";
delta($myCustomClient ,$cursortxt, $url, $pathPrefix);
//Challenge
$pathPrefix="/Chargements appareil photo/ChallengeTdm";
$cursortxt = "lib/cursorC.txt";
$url="challenge_update";
delta($myCustomClient , $cursortxt, $url, $pathPrefix);
} | CWE-79 | 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;
} | CWE-89 | 0 |
function ngettext($single, $plural, $number) {
if ($this->short_circuit) {
if ($number != 1)
return $plural;
else
return $single;
}
// find out the appropriate form
$select = $this->select_string($number);
// this should contains all strings separated by NULLs
$key = $single . chr(0) . $plural;
if ($this->enable_cache) {
if (! array_key_exists($key, $this->cache_translations)) {
return ($number != 1) ? $plural : $single;
} else {
$result = $this->cache_translations[$key];
$list = explode(chr(0), $result);
return $list[$select];
}
} else {
$num = $this->find_string($key);
if ($num == -1) {
return ($number != 1) ? $plural : $single;
} else {
$result = $this->get_translation_string($num);
$list = explode(chr(0), $result);
return $list[$select];
}
}
} | CWE-94 | 14 |