prompt
stringclasses 1
value | completions
listlengths 1
63.8k
| labels
listlengths 1
63.8k
| source
stringclasses 1
value | other_info
stringlengths 2.06k
101k
| index
int64 0
6.83k
|
|---|---|---|---|---|---|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expRecord\n *\n * @subpackage Models\n * @package Core\n */\nclass expRecord {\n protected $classinfo = null;\n public $classname = '';",
" // database\n public $tablename = '';\n public $identifier = 'id';\n public $rank_by_field = '';\n // for segregating items into uniqueness within a subgroup instead of unique amongst all like items in system\n public $grouping_sql = '';",
" // associated objects\n public $has_extended_fields = array(); // add single object db fields to this object (not the object methods)\n public $has_one = array(); // associate single object w/ matching id\n public $has_many = array(); // associate all objects w/ matching id's\n public $has_many_self = array();\n public $has_and_belongs_to_many = array();\n public $has_and_belongs_to_self = array();\n // sort order/direction for associated objects\n public $default_sort_field = '';\n public $default_sort_direction = '';\n // what associated objects should also receive associated objects when associated\n public $get_assoc_for = array();",
" // attachable items\n protected $attachable_item_types = array();\n /* protected $attachable_item_types = array( // list of available attachments\n 'content_expCats'=>'expCat'\n 'content_expComments'=>'expComment',\n 'content_expDefinableFields'=> 'expDefinableField'\n 'content_expFiles'=>'expFile',\n 'content_expRatings'=>'expRating',\n 'content_expSimpleNote'=>'expSimpleNote',\n 'content_expTags'=>'expTag',\n );*/\n public $attachable_items_to_save;\n // what associated objects should also receive their attachments when associated\n public $get_attachable_for = array();",
" // field validation settings\n public $validate = array();\n public $do_not_validate = array();",
" public $supports_revisions = false; // simple flag to turn on revisions/approval support for module\n public $needs_approval = false; // flag for no approval authority",
" /**\n * is model content searchable?\n *\n * @return bool\n */\n static function isSearchable() {\n return false;\n }",
" /**\n * @param null $params\n * @param bool $get_assoc\n * @param bool $get_attached\n *\n * @return expRecord\n *\n */\n function __construct($params = null, $get_assoc = true, $get_attached = true) {\n global $db;",
" // @TODO Change this conditional check as the default value in argument list\n // if the params come thru as a null value we need to convert to an empty array\n if (empty($params)) {\n $params = array();\n $get_assoc = false;\n $get_attached = false;\n }",
" // figure out the basic table info about this model\n $this->classinfo = new ReflectionClass($this);\n $this->classname = $this->classinfo->getName();\n $this->tablename = isset($this->table) ? $this->table : $this->classinfo->getName();",
" $supports_revisions = $this->supports_revisions && ENABLE_WORKFLOW;\n $needs_approval = $this->needs_approval && ENABLE_WORKFLOW;",
" // if the user passed in arguments to this constructor then we need to",
" // retrieve objects ",
"\n // If a number was sent in, we assume this is a DB record ID, so pull it\n if (!is_object($params) && !is_array($params)) {\n $where = '';\n if (is_numeric($params)) {\n $this->build($db->selectArray($this->tablename, $this->identifier . '=' . $params, null, $supports_revisions));\n $identifier = $this->identifier;\n $params = array($identifier => $params); // Convert $params (given number value) into an key/value pair\n } else {\n // try to look up by sef_url\n $values = $db->selectArray($this->tablename, \"sef_url='\" . expString::sanitize($params) . \"'\", null, $supports_revisions, $needs_approval);\n // if we didn't find it via sef_url then we should check by title\n if (empty($values)) $values = $db->selectArray($this->tablename, \"title='\" . expString::sanitize($params) . \"'\", null, $supports_revisions, $needs_approval);\n $this->build($values);\n $params = array('title'=> $params);\n }\n } else {",
" // Otherwise we assume that in inbound is an array or Object to be processed as is. ",
" $this->build($params);\n }",
" // establish a pseudo publish date\n if (!empty($this->publish)) {\n $this->publish_date = $this->publish;\n } elseif (!empty($this->edited_at)) {\n $this->publish_date = $this->edited_at;\n } elseif (!empty($this->created_at)) {\n $this->publish_date = $this->created_at;\n }\n",
" // setup the exception array if it's not there. This array tells the getAssociatedObjectsForThisModel() function which ",
" // modules NOT to setup. This stops us from getting infinite loops with many to many relationships.\n if (is_array($params)){\n $params['except'] = isset($params['except']) ? $params['except'] : array();\n $params['cascade_except'] = isset($params['cascade_except']) ? $params['cascade_except'] : false;",
" if ($get_assoc)\n $this->getAssociatedObjectsForThisModel($params['except'], $params['cascade_except']);\n } elseif (is_object($params)) {\n $params->except = isset($params->except) ? $params->except : array();\n $params->cascade_except = isset($params->cascade_except) ? $params->cascade_except : false;",
" if ($get_assoc)\n $this->getAssociatedObjectsForThisModel($params->except, $params->cascade_except);\n }\n if ($get_attached) $this->getAttachableItems();\n }",
" /**\n * find an item or items\n *\n * @param string $range\n * @param null $where\n * @param null $order\n * @param null $limit\n * @param int $limitstart\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n *\n * @return array\n */\n public function find($range = 'all', $where = null, $order = null, $limit = null, $limitstart = 0, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n global $db, $user;",
" if (is_numeric($range)) {\n $where = $this->identifier . '=' . intval($range); // If we hit this then we are expecting just a simple id\n $range = 'first';\n }",
" $sql = empty($where) ? 1 : $where;\n //eDebug(\"Supports Revisions:\" . $this->supports_revisions);\n// if ($this->supports_revisions && $range != 'revisions') $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE $where)\";\n// $sql .= empty($order) ? '' : ' ORDER BY ' . $order;",
"",
" $supports_revisions = $this->supports_revisions && ENABLE_WORKFLOW;\n if (ENABLE_WORKFLOW && $this->needs_approval) {\n $needs_approval = $user->id;\n } else {\n $needs_approval = false;\n }",
" if (strcasecmp($range, 'all') == 0) { // return all items matching request, most current revision\n// $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n $limitsql = empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n return $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n } elseif (strcasecmp($range, 'revisions') == 0) { // return all items matching request, all revisions\n// $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n $limitsql = empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n return $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql);\n } elseif (strcasecmp($range, 'first') == 0) { // return the first item matching request\n// $sql .= ' LIMIT 0,1';\n $limitsql = ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'bytitle') == 0) { // return items requested by title/sef_url (will there be more than one?)\n $limitsql = ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, \"title='\" . $where . \"' OR sef_url='\" . $where . \"'\", $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'count') == 0) { // return count of items\n return $db->countObjects($this->tablename, $sql, $supports_revisions, $needs_approval);\n } elseif (strcasecmp($range, 'in') == 0) { // return items requested by array of id#\n if (!is_array($where)) return array();\n foreach ($where as $id)\n $records[] = new $this->classname($id);\n return $records;\n } elseif (strcasecmp($range, 'bytag') == 0) { // return items tagged with request (id or title/sef_url)\n if (!is_int($where)) $where = $db->selectObject($db->prefix . 'expTags',\"title='\" . $where . \"' OR sef_url='\" . $where . \"'\");\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expTags ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.exptags_id=' . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n if ($supports_revisions) $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE ct.exptags_id=\" . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n } elseif (strcasecmp($range, 'bycat') == 0) { // return items categorized/grouped under request (id or title/sef_url)\n if (!is_int($where)) $where = $db->selectObject($db->prefix . 'expCats',\"title='\" . $where . \"' OR sef_url='\" . $where . \"'\");\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expCats ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.expcats_id=' . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n if ($supports_revisions) $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE ct.expcats_id=\" . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n $cat_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($cat_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n }\n }",
" /**\n * find an item by column\n *\n * @param $column\n * @param $value\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n *\n * @return array\n */\n public function findBy($column, $value, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n// global $db;",
" $where = \"`\" . $column . \"`=\";\n if (!is_numeric($value)) $where .= \"'\";\n $where .= $value;\n if (!is_numeric($value)) $where .= \"'\";\n return $this->find('first', $where, null, null, 0, $get_assoc, $get_attached, $except, $cascade_except);\n }",
" /**\n * find a value(s) by column\n *\n * @param string $range\n * @param string $column\n * @param string $where\n * @param string $order\n * @param bool $distinct\n *\n * @return array|bool\n */\n public function findValue($range = 'all', $column, $where=null, $order=null, $distinct=false) {\n global $db;",
" if (strcasecmp($range, 'all') == 0) { // return all items matching request\n return $db->selectColumn($this->tablename, $column, $where, $order, $distinct);\n } elseif (strcasecmp($range, 'first') == 0) { // return single/first item matching request\n return $db->selectValue($this->tablename, $column, $where);\n }\n return false;\n }",
" /**\n * update item\n *\n * @param array $params\n */\n public function update($params = array()) {\n if (is_array($params) && isset($params['current_revision_id'])) {\n $params['revision_id'] = $params['current_revision_id'];\n unset($params['current_revision_id']);\n }\n $this->checkForAttachableItems($params);\n $this->build($params);\n if (is_array($params)) {\n $this->save((isset($params['_validate']) ? $params['_validate'] : true));\n } elseif (is_object($params)) {\n $this->save((isset($params->_validate) ? $params->_validate : true));\n } else {\n $this->save(true);\n }\n }",
" /**\n * re-construct the item from the database\n *\n * @return bool\n */\n public function refresh() {\n if (empty($this->id))\n return false;\n $this->__construct($this->id);\n }",
" /**\n * Adds table fields as class properties to current \"record\" class.\n *\n * Loads Table schema data and creates new class properties based\n * upon the fields in given table.\n *\n * Additionally, if a record ID is given, that record is pulled and\n * field values are also populated into class properties.\n *\n * @name build\n *\n * @category db_record\n * @uses [db_type]::getDataDefinition() Builds a data definition from existing table.\n * @requires $db\n *\n * @access protected\n * @final\n * @PHPUnit Not Defined\n *\n * @global object $db\n *\n * @param mixed $params array or Object for table selection\n */\n public function build($params = array()) {\n global $db;",
" // safeguard against bad data...we can only take objects and arrays here\n if (!is_array($params) && !is_object($params)) $params = array();",
" // get the table definition and make sure all the params being passed in belong in this table\n $table = $db->getDataDefinition($this->tablename);",
" //check for location_data\n if (is_array($params) && ((!empty($params['module']) || !empty($params['controller'])) && !empty($params['src']))) {\n $mod = !empty($params['module']) ? $params['module'] : (!empty($params['controller']) ? $params['controller'] : null);\n if (empty($params['module'])) $params['module'] = $params['controller'];\n $params['location_data'] = serialize(expCore::makeLocation($mod, $params['src']));\n } elseif (is_object($params) && ((!empty($params->module) || !empty($params->controller)) && !empty($params->src))) {\n $mod = !empty($params->module) ? $params->module : (!empty($params->controller) ? $params->controller : null);\n if (empty($params->module)) $params->module = $params->controller;\n $params->location_data = serialize(expCore::makeLocation($mod, $params->src));\n }",
" // Build Class properties based off table fields\n foreach ($table as $col=> $colDef) {\n // check if the DB column has a corresponding value in the params array\n // if not, we check to see if the column is boolean...if so we set it to false",
" // if not, then we check to see if we had a previous value in this particular ",
" // record. if so we reset it to itself so we don't lose the existing value.",
" // this is good for when the developer is trying to update just a field or two \n // in an existing record. ",
" if (array_key_exists($col, $params)) {\n $value = is_array($params) ? $params[$col] : $params->$col;\n if ($colDef[0] == DB_DEF_INTEGER || $colDef[0] == DB_DEF_ID) {\n $this->$col = preg_replace(\"/[^0-9-]/\", \"\", $value);\n } elseif ($colDef[0] == DB_DEF_DECIMAL) {\n $this->$col = preg_replace(\"/[^0-9.-]/\", \"\", $value);\n } else {\n $this->$col = $value;\n }\n } elseif ($colDef[0] == DB_DEF_BOOLEAN) {\n $this->$col = empty($this->$col) ? 0 : $this->$col;\n } elseif ($colDef[0] == DB_DEF_TIMESTAMP) {\n // yuidatetimecontrol sends in a checkbox and a date e.g., publish & publishdate\n $datename = $col . 'date';\n if (is_array($params) && isset($params[$datename])) {\n $this->$col = yuidatetimecontrol::parseData($col, $params);\n } elseif (is_object($params) && isset($params->$datename)) {\n $this->$col = yuidatetimecontrol::parseData($col, object2Array($params));\n } else {\n $this->$col = !empty($this->$col) ? $this->$col : 0;\n }\n } else {\n $this->$col = !empty($this->$col) ? $this->$col : null;\n }",
" //if (isset($this->col)) {\n if ($col != 'data' && is_string($this->$col)) {\n $this->$col = stripslashes($this->$col);\n }\n //}\n if (ENABLE_WORKFLOW && $this->supports_revisions && $col == 'revision_id' && $this->$col == null)\n $this->$col = 1; // first revision is #1\n }\n }",
" /**\n * rerank items\n *\n * @param $direction\n * @param string $where\n */\n public function rerank($direction, $where = '') {\n global $db;",
" if (!empty($this->rank)) {\n $next_prev = $direction == 'up' ? $this->rank - 1 : $this->rank + 1;\n $where .= empty($this->location_data) ? null : (!empty($where) ? \" AND \" : '') . \"location_data='\" . $this->location_data . \"'\" . $this->grouping_sql;\n $db->switchValues($this->tablename, 'rank', $this->rank, $next_prev, $where);\n }\n }",
" /**\n * attach to item\n *\n * @param $item\n * @param string $subtype\n * @param bool $replace\n *\n * @return bool\n */\n public function attachItem($item, $subtype = '', $replace = true) { //FIXME only placed used is in helpController->copydocs (though we don't have attachments), & migration\n global $db;",
" // make sure we have the info we need..otherwise return\n if (empty($item->id) && empty($this->id)) return false;\n // save the attachable items\n// $refname = strtolower($item->classname).'s_id'; //FIXME plural vs single?\n// $refname = strtolower($item->classname) . '_id'; //FIXME plural vs single?\n $refname = strtolower($item->tablename) . '_id';\n if ($replace) $db->delete($item->attachable_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->id . ' AND ' . $refname . '=' . $item->id);\n $obj = new stdClass();\n $obj->$refname = $item->id;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n $obj->subtype = $subtype;\n $obj->rank = 1 + $db->max($item->attachable_table, 'rank', null, 'content_type=\"' . $this->classname . '\" AND subtype=\"' . $subtype . '\" AND content_id' . $this->id);\n $db->insertObject($obj, $item->attachable_table);\n }",
" /**\n * save item\n *\n * @param bool $validate\n * @param bool $force_no_revisions\n */\n public function save($validate = false, $force_no_revisions = false) {\n global $db;",
" // call the validation callback functions if we need to.\n if ($validate) {\n $this->beforeValidation();\n $this->validate();\n $this->afterValidation();\n }",
" $this->beforeSave();",
" // Save this object's associated objects to the database.\n // FIXME: we're not going to do this automagically until we get the refreshing figured out.",
" //$this->saveAssociatedObjects(); ",
"\n //Only grab fields that are valid and save this object\n $saveObj = new stdClass();\n $table = $db->getDataDefinition($this->tablename);\n foreach ($table as $col=> $colDef) {\n $saveObj->$col = empty($this->$col) ? null : $this->$col;\n }",
" if (ENABLE_WORKFLOW && $this->supports_revisions && !$this->approved && expPermissions::check('approve', expUnserialize($this->location_data))) {\n $this->approved = true; // auto-approve item if use has approve perm\n $saveObj->approved = true; // also set property in database item\n }\n $identifier = $this->identifier;\n if (!empty($saveObj->$identifier)) {\n $revise = $force_no_revisions ? false : $this->supports_revisions && ENABLE_WORKFLOW;\n $db->updateObject($saveObj, $this->tablename, null, $identifier, $revise);\n $this->afterUpdate();\n } else {\n $this->$identifier = $db->insertObject($saveObj, $this->tablename);\n $this->afterCreate();\n }",
" // run the afterSave callback(s)\n $this->afterSave();\n }",
" /**\n * before validating item\n */\n public function beforeValidation() {\n $this->runCallback('beforeValidation');\n if (empty($this->id)) {\n $this->beforeValidationOnCreate();\n } else {\n $this->beforeValidationOnUpdate();\n }\n }",
" /**\n * before validating item during creation\n */\n public function beforeValidationOnCreate() {\n $this->runCallback('beforeValidationOnCreate');\n }",
" /**\n * before validating item during update\n */\n public function beforeValidationOnUpdate() {\n $this->runCallback('beforeValidationOnUpdate');\n }",
" /**\n * validate item sef_url\n *\n * @return bool\n */\n public function validate() {\n global $db;\n // check for an sef url field. If it exists make sure it's valid and not a duplicate\n //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))) {\n if (empty($this->sef_url)) $this->makeSefUrl();\n if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();\n if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();\n }",
" // 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)) {\n $loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);\n if (!empty($loc)) $this->location_data = $loc;\n }",
" // run the validation as defined in the models\n if (!isset($this->validates)) return true;\n $messages = array();\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n foreach ($this->validates as $validation=> $field) {\n foreach ($field as $key=> $value) {\n $fieldname = is_numeric($key) ? $value : $key;\n $opts = is_numeric($key) ? array() : $value;\n $ret = expValidator::$validation($fieldname, $this, $opts);\n if (!is_bool($ret)) {\n $messages[] = $ret;\n expValidator::setErrorField($fieldname);\n unset($post[$fieldname]);\n }\n }\n }",
" if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);\n }",
" /**\n * after validating item\n */\n public function afterValidation() {\n $this->runCallback('afterValidation');\n if (empty($this->id)) {\n $this->afterValidationOnCreate();\n } else {\n $this->afterValidationOnUpdate();\n }\n }",
" /**\n * after validating item during creation\n */\n public function afterValidationOnCreate() {\n $this->runCallback('afterValidationOnCreate');\n }",
" /**\n * after validating item during update\n */\n public function afterValidationOnUpdate() {\n $this->runCallback('afterValidationOnUpdate');\n }",
" /**\n * before saving item\n */\n public function beforeSave() {\n global $user, $db;",
" $this->runCallback('beforeSave');\n // populate the magic fields\n if (empty($this->id)) {\n // timestamp the record\n if (property_exists($this, 'created_at')) $this->created_at = time();\n if (property_exists($this, 'edited_at')) $this->edited_at = time();\n // record the user saving the record.\n if (property_exists($this, 'poster')) $this->poster = empty($this->poster) ? $user->id : $this->poster;\n // fill in the rank field if it exist\n if (property_exists($this, 'rank')) {\n// if (!isset($this->rank)) {\n if (empty($this->rank)) { // ranks begin at 1, so 0 is now last\n $where = \"1 \";\n $where .= empty($this->location_data) ? null : \"AND location_data='\" . $this->location_data . \"' \";\n //FIXME: $where .= empty($this->rank_by_field) ? null : \"AND \" . $this->rank_by_field . \"='\" . $this->$this->rank_by_field . \"'\";\n $groupby = empty($this->location_data) ? null : 'location_data';\n $groupby .= empty($this->rank_by_field) ? null : (empty($groupby) ? null : ',' . $this->rank_by_field);\n $this->rank = $db->max($this->tablename, 'rank', $groupby, $where . $this->grouping_sql) + 1;\n } else {\n // check if this rank is already there..if so increment everything below it.\n $obj = $db->selectObject($this->tablename, 'rank=' . $this->rank . $this->grouping_sql);\n if (!empty($obj)) {\n $db->increment($this->tablename, 'rank', 1, 'rank>=' . $this->rank . $this->grouping_sql);\n }\n }\n }",
" $this->beforeCreate();\n } else {\n // put the created_at time back the way it was so we don't set it 0\n if (property_exists($this, 'created_at') && $this->created_at == 0) {\n $this->created_at = $db->selectValue($this->tablename, 'created_at', 'id=' . $this->id);\n }",
" // put the original posters id back the way it was so we don't set it 0\n if (property_exists($this, 'poster') && $this->poster == 0) {\n $this->poster = $db->selectValue($this->tablename, 'poster', 'id=' . $this->id);\n }",
" //put the rank back to what it was so we don't set it 0\n if (property_exists($this, 'rank') && $this->rank == 0) {\n $this->rank = $db->selectValue($this->tablename, 'rank', 'id=' . $this->id);\n }",
" if (property_exists($this, 'edited_at')) $this->edited_at = time();\n if (property_exists($this, 'editor')) $this->editor = $user->id;",
" $this->beforeUpdate();\n }\n }",
" /**\n * before creating item\n */\n public function beforeCreate() {\n $this->runCallback('beforeCreate');\n }",
" /**\n * before updating item\n */\n public function beforeUpdate() {\n // we need some help migrating edited dates\n if (!empty($this->migrated_at)) {\n $this->edited_at = $this->migrated_at;\n unset($this->migrated_at);\n }\n $this->runCallback('beforeUpdate');\n }",
" /**\n * after updating item\n */\n public function afterUpdate() {\n $this->runCallback('afterUpdate');\n }",
" /**\n * after creating item\n */\n public function afterCreate() {\n $this->runCallback('afterCreate');\n }",
" /**\n * after saving item\n */\n public function afterSave() {\n global $db;",
" $this->runCallback('afterSave');",
" // save all attached items\n if (!empty($this->attachable_items_to_save)) {\n foreach ($this->attachable_item_types as $type) {\n if (!empty($this->attachable_items_to_save[$type])) {\n $itemtype = new $type();\n // clean up (delete) old attachments since we'll create all from scratch\n $db->delete($itemtype->attachable_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->id);\n// $refname = strtolower($type).'s_id'; //FIXME: find a better way to pluralize these names!!!\n $refname = strtolower($itemtype->tablename) . '_id'; //FIXME: find a better way to pluralize these names!!!\n foreach ($this->attachable_items_to_save[$type] as $subtype=> $item) {\n $obj = new stdClass();\n if (is_object($item)) {\n if (!empty($item->id)) {\n $obj->$refname = $item->id;\n $obj->subtype = $subtype;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $item->rank + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n } elseif (is_array($item)) {\n foreach ($item as $rank=>$value) {\n if (is_numeric($value)) {\n $obj->$refname = $value;\n $obj->subtype = $subtype;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $rank + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n }\n } elseif (is_numeric($item)) {\n $obj->$refname = $item;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $subtype + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n }\n }\n }\n }\n }",
" /**\n * is run before deleting item\n */\n public function beforeDelete() {\n $this->runCallback('beforeDelete');\n }",
" /**\n * delete item\n *\n * @param string $where\n *\n * @return bool\n */\n public function delete($where = '') {\n global $db;",
" $id = $this->identifier;\n if (empty($this->$id)) return false;\n $this->beforeDelete();\n $db->delete($this->tablename, $id . '=' . $this->$id);\n if (!empty($where)) $where .= ' AND '; // for help in reranking, NOT deleting object\n if (property_exists($this, 'rank')) $db->decrement($this->tablename, 'rank', 1, $where . 'rank>=' . $this->rank . $this->grouping_sql);",
" // delete attached items\n foreach ($this->attachable_item_types as $content_table=> $type) {\n $db->delete($content_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->$id);\n }\n // leave associated items to the model afterDelete method?\n $this->afterDelete();\n }",
" /**\n * is run after deleting item\n */\n public function afterDelete() {\n $this->runCallback('afterDelete');\n }",
" /**\n * jump to subclass calling routine\n *\n * @param $type\n *\n * @return bool\n */\n private function runCallback($type) {\n if (empty($type)) return false;",
" // check for and run any callbacks listed in the $type array.\n if ($this->classinfo->hasProperty($type)) {\n $callbacks = $this->classinfo->getProperty($type);\n foreach ($callbacks->getValue(new $this->classname(null, false, false)) as $func) {\n $this->$func();\n }\n }\n }",
" /**\n * make an sef_url for item\n */\n public function makeSefUrl() {\n global $db, $router;",
" if (!empty($this->title)) {\n\t\t\t$this->sef_url = $router->encode($this->title);\n\t\t} else {\n\t\t\t$this->sef_url = $router->encode('Untitled');\n\t\t}\n $dupe = $db->selectValue($this->tablename, 'sef_url', 'sef_url=\"'.$this->sef_url.'\"' . $this->grouping_sql);\n\t\tif (!empty($dupe)) {\n\t\t\tlist($u, $s) = explode(' ',microtime());\n\t\t\t$this->sef_url .= '-'.$s.'-'.$u;\n\t\t}\n $this->runCallback('makeSefUrl');\n }",
" /**\n * get item's associated objects\n *\n * Type of associations\n * has_one\n * has_many\n * has_and_belongs_to_many\n *\n * @param null $obj\n *\n * @return null\n */\n public function getAssociatedObjects($obj = null) { //FIXME not used??\n global $db;",
" $records = array();",
" foreach ($this->has_one as $assoc_object) {\n $ret = $db->selectObjects($this->tablename, $assoc_object . '_id=' . $obj->id);\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }",
" foreach ($this->has_many as $assoc_object) {\n $ret = $db->selectObjects($assoc_object, $this->tablename . '_id=' . $obj->id);\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }",
" foreach ($this->has_and_belongs_to_many as $assoc_object) {\n if (strcmp($this->tablename, $assoc_object) > 0) {\n $tablename = $assoc_object . '_' . $this->tablename;\n } else {\n $tablename = $this->tablename . '_' . $assoc_object;\n }",
" //$ret = $db->selectObjects($tablename, $this->tablename.'_id='.$obj->id);\n $instances = $db->selectObjects($tablename, $this->tablename . '_id=' . $obj->id);\n $ret = array();\n foreach ($instances as $instance) {\n $fieldname = $assoc_object . '_id';\n $ret[] = $db->selectObject($assoc_object, 'id=' . $instance->$fieldname);\n }\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }",
" return $obj;\n }",
" /**\n * this function finds models that have this attachable item attached\n *\n * @param $content_type\n *\n * @return array\n */\n public function findWhereAttachedTo($content_type) {\n global $db;",
" $objarray = array();\n if (!empty($this->id) && !empty($this->attachable_table)) {\n// $assocs = $db->selectObjects($this->attachable_table, $this->classname.'s_id='.$this->id.' AND content_type=\"'.$content_type.'\"'); //FIXME is it plural where others are single?\n $assocs = $db->selectObjects($this->attachable_table, strtolower($this->tablename) . '_id=' . $this->id . ' AND content_type=\"' . $content_type . '\"');\n foreach ($assocs as $assoc) {\n if (class_exists($assoc->content_type)) $objarray[] = new $assoc->content_type($assoc->content_id);\n }\n }",
" return $objarray;\n }",
" /**\n * check for what objects may be attached\n *\n * @param $params\n *\n * @return bool\n */\n protected function checkForAttachableItems($params) {\n if (empty($params)) return false;\n foreach ($this->attachable_item_types as $type) {\n if (array_key_exists($type, $params)) {\n $this->attachable_items_to_save[$type] = is_array($params) ? $params[$type] : $params->$type;\n }\n }\n }",
" /**\n * used for import/export\n *\n * @return array\n */\n function getAttachableItemTables() {\n return $this->attachable_item_types; //fixme this is the model name, NOT the table name\n }",
" /**\n * get attached objects for this item\n */\n protected function getAttachableItems() {\n global $db;",
" foreach ($this->attachable_item_types as $content_table=> $type) {\n if ($this->classname == $type) break;",
" $tablename = str_ireplace('content_', '', $content_table);\n if (!isset($this->id)) {\n $this->$type = array();\n } else {\n $sql = 'SELECT ef.*, cef.subtype AS subtype FROM ';\n $sql .= $db->prefix . $tablename . ' ef JOIN ' . $db->prefix . $content_table . ' cef ';\n $sql .= \"ON ef.id = cef.\" . $tablename . \"_id\";\n $sql .= \" WHERE content_id=\" . $this->id;\n $sql .= \" AND content_type='\" . $this->classname . \"'\";\n if ($type == 'expComment') {\n $sql .= \" AND approved='1'\";\n }",
" $order = ($type == 'expFile' || $type == 'expCats' || $type == 'expDefinableField') ? ' ORDER BY rank ASC' : null;\n $sql .= $order;",
" $items = $db->selectArraysBySql($sql);",
" $attacheditems = array();\n foreach ($items as $item) {\n //FIXME: find a better way to unpluralize the name!\n $idname = strtolower($type) . '_id';\n if (empty($item['subtype'])) {\n $attacheditems[] = new $type($item, false, false);\n } else {\n if (!isset($attacheditems[$item['subtype']])) $attacheditems[$item['subtype']] = array();\n $attacheditems[$item['subtype']][] = new $type($item, false, false);\n }\n }",
" $this->$type = $attacheditems;\n }\n }\n }",
" /**\n * gets associated objects for this model\n *\n * Type of associations\n * has_extended_fields\n * has_one\n * has_many\n * has_many_self\n * has_and_belongs_to_many\n * has_and_belongs_to_self\n *\n * @param array $except\n * @param bool $cascade_except\n *\n */\n private function getAssociatedObjectsForThisModel($except = array(), $cascade_except = false) {\n global $db;",
" foreach ($this->has_extended_fields as $assoc_object) {\n // figure out the name of the model based off the models tablename\n $obj = new $assoc_object(null, false, false);\n $this->$assoc_object = $obj->find('first', $this->tablename . '_id = ' . $this->id);\n }",
" //this requires a field in the table only with the ID of the associated object we're looking for in its table\n foreach ($this->has_one as $assoc_object) {\n // figure out the name of the model based off the models tablename\n if (!in_array($assoc_object, $except)) {\n $obj = new $assoc_object(null, false, false);\n $id_name = $obj->tablename . '_id';",
" // check to see if we have an association yet. if not we'll initialize an empty model\n $id = empty($this->$id_name) ? array() : $this->$id_name;",
" $this->$assoc_object = new $assoc_object($id, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n } else {\n $this->$assoc_object = array();\n }\n }",
" //TODO: perhaps add a 'in' option to the find so we can pass an array of ids and make ONE db call instead of looping\n foreach ($this->has_many as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assoc_obj = new $assoc_object();",
" $ret = $db->selectArrays($assoc_obj->tablename, $this->tablename . '_id=' . $this->id, $assoc_obj->default_sort_field != '' ? $assoc_obj->default_sort_field . \" \" . $assoc_obj->default_sort_direction : null);\n $records = array();\n if ($cascade_except) {\n $record['except'] = $except;\n $record['cascade_except'] = $cascade_except;\n }\n foreach ($ret as $record) {\n $records[] = new $assoc_object($record, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n //eDebug(\"No: \" .$assoc_object);\n $this->$assoc_object = array();\n }\n }",
" foreach ($this->has_many_self as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assoc_obj = new $assoc_object();",
" $ret = $db->selectArrays($assoc_obj->tablename, $assoc_obj->has_many_self_id . '=' . $this->id, $assoc_obj->default_sort_field != '' ? $assoc_obj->default_sort_field . \" \" . $assoc_obj->default_sort_direction : null);\n $records = array();\n foreach ($ret as $record) {\n $records[] = new $assoc_object($record, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }",
" foreach ($this->has_and_belongs_to_many as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assocObj = new $assoc_object(null, false, false);\n $tablename = $this->makeManyToManyTablename($assocObj->tablename);",
" $ret = $db->selectObjects($assocObj->tablename, 'id IN (SELECT ' . $assocObj->tablename . '_id from ' . $db->prefix . $tablename . ' WHERE ' . $this->tablename . '_id=' . $this->id . ')', $assocObj->default_sort_field != '' ? $assocObj->default_sort_field . \" \" . $assocObj->default_sort_direction : null);\n $records = array();\n foreach ($ret as $record) {\n $record_array = object2Array($record);\n // put in the current model as an exception, otherwise the auto assoc's keep initializing instances of each other in an\n // infinite loop\n $record_array['except'] = array($this->classinfo->name);\n if ($cascade_except) {\n $record_array['except'] = array_merge($record_array['except'], $except);\n $record_array['cascade_except'] = $cascade_except;\n }\n $records[] = new $assoc_object($record_array, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }",
" foreach ($this->has_and_belongs_to_self as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assocObj = new $assoc_object(null, false, false);\n $tablename = $this->makeManyToManyTablename($assocObj->classname);",
" $ret = $db->selectObjects($assocObj->tablename, 'id IN (SELECT ' . $assocObj->classname . '_id from ' . $db->prefix . $tablename . ' WHERE ' . $this->tablename . '_id=' . $this->id . ')');\n $records = array();\n foreach ($ret as $record) {\n $record_array = object2Array($record);\n // put in the current model as an exception, otherwise the auto assoc's keep initializing instances of each other in an\n // infinite loop\n $record_array['except'] = array($this->classinfo->name);\n $records[] = new $assoc_object($record_array, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }\n }",
" /**\n * get objects this item belongs to ??\n *\n * Type of associations\n * has_and_belongs_to_many\n *\n * @param $datatype\n * @param $id\n */\n public function associateWith($datatype, $id) { //FIXME not used??\n global $db;",
" $assocObj = new $datatype();",
" if (in_array($datatype, $this->has_and_belongs_to_many)) {\n $tablename = $this->makeManyToManyTablename($assocObj->tablename);\n $thisid = $this->tablename . '_id';\n $otherid = $assocObj->tablename . '_id';\n $obj = new stdClass();\n $obj->$thisid = $this->id;\n $obj->$otherid = $id;\n $db->insertObject($obj, $tablename);\n }\n }",
" /**\n * save associated objects\n *\n * Type of associations\n * has_one\n *\n */\n public function saveAssociatedObjects() {\n// global $db;",
" foreach ($this->has_one as $assoc_object) {\n $obj = $this->$assoc_object;\n $obj->save();",
" $assoc_id_name = $assoc_object . '_id';\n $this->$assoc_id_name = $obj->id;\n }\n }",
" //why the compare to flip order?\n /**\n * create a many to many table relationship\n *\n * @param $assoc_table\n *\n * @return string\n */\n private function makeManyToManyTablename($assoc_table) {\n if (strcmp($this->tablename, $assoc_table) > 0) {\n $tablename = $assoc_table . '_' . $this->tablename;\n } else {\n $tablename = $this->tablename . '_' . $assoc_table;\n }\n return $tablename;\n }",
" /**\n * return the item poster\n *\n * @param null $display\n * @return null|string\n */\n public function getPoster($display = null) {\n if (isset($this->poster)) {\n $user = new user($this->poster);\n return user::getUserAttribution($user->id, $display);\n } else {\n return null;\n }\n }",
" /**\n * return the item timestamp\n *\n * @param int $type\n *\n * @return mixed\n */\n public function getTimestamp($type = 0) {\n if ($type == 0) $getType = 'created_at';\n elseif ($type == 'publish') $getType = 'publish';\n else $getType = 'edited_at';\n if (isset($this->$getType)) return expDateTime::format_date($this->$getType, DISPLAY_DATETIME_FORMAT);\n else return null;\n }",
"}",
";",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expRecord\n *\n * @subpackage Models\n * @package Core\n */\nclass expRecord {\n protected $classinfo = null;\n public $classname = '';",
" // database\n public $tablename = '';\n public $identifier = 'id';\n public $rank_by_field = '';\n // for segregating items into uniqueness within a subgroup instead of unique amongst all like items in system\n public $grouping_sql = '';",
" // associated objects\n public $has_extended_fields = array(); // add single object db fields to this object (not the object methods)\n public $has_one = array(); // associate single object w/ matching id\n public $has_many = array(); // associate all objects w/ matching id's\n public $has_many_self = array();\n public $has_and_belongs_to_many = array();\n public $has_and_belongs_to_self = array();\n // sort order/direction for associated objects\n public $default_sort_field = '';\n public $default_sort_direction = '';\n // what associated objects should also receive associated objects when associated\n public $get_assoc_for = array();",
" // attachable items\n protected $attachable_item_types = array();\n /* protected $attachable_item_types = array( // list of available attachments\n 'content_expCats'=>'expCat'\n 'content_expComments'=>'expComment',\n 'content_expDefinableFields'=> 'expDefinableField'\n 'content_expFiles'=>'expFile',\n 'content_expRatings'=>'expRating',\n 'content_expSimpleNote'=>'expSimpleNote',\n 'content_expTags'=>'expTag',\n );*/\n public $attachable_items_to_save;\n // what associated objects should also receive their attachments when associated\n public $get_attachable_for = array();",
" // field validation settings\n public $validate = array();\n public $do_not_validate = array();",
" public $supports_revisions = false; // simple flag to turn on revisions/approval support for module\n public $needs_approval = false; // flag for no approval authority",
" /**\n * is model content searchable?\n *\n * @return bool\n */\n static function isSearchable() {\n return false;\n }",
" /**\n * @param null $params\n * @param bool $get_assoc\n * @param bool $get_attached\n *\n * @return expRecord\n *\n */\n function __construct($params = null, $get_assoc = true, $get_attached = true) {\n global $db;",
" // @TODO Change this conditional check as the default value in argument list\n // if the params come thru as a null value we need to convert to an empty array\n if (empty($params)) {\n $params = array();\n $get_assoc = false;\n $get_attached = false;\n }",
" // figure out the basic table info about this model\n $this->classinfo = new ReflectionClass($this);\n $this->classname = $this->classinfo->getName();\n $this->tablename = isset($this->table) ? $this->table : $this->classinfo->getName();",
" $supports_revisions = $this->supports_revisions && ENABLE_WORKFLOW;\n $needs_approval = $this->needs_approval && ENABLE_WORKFLOW;",
" // if the user passed in arguments to this constructor then we need to",
" // retrieve objects",
"\n // If a number was sent in, we assume this is a DB record ID, so pull it\n if (!is_object($params) && !is_array($params)) {\n $where = '';\n if (is_numeric($params)) {\n $this->build($db->selectArray($this->tablename, $this->identifier . '=' . $params, null, $supports_revisions));\n $identifier = $this->identifier;\n $params = array($identifier => $params); // Convert $params (given number value) into an key/value pair\n } else {\n // try to look up by sef_url\n $values = $db->selectArray($this->tablename, \"sef_url='\" . expString::sanitize($params) . \"'\", null, $supports_revisions, $needs_approval);\n // if we didn't find it via sef_url then we should check by title\n if (empty($values)) $values = $db->selectArray($this->tablename, \"title='\" . expString::sanitize($params) . \"'\", null, $supports_revisions, $needs_approval);\n $this->build($values);\n $params = array('title'=> $params);\n }\n } else {",
" // Otherwise we assume that in inbound is an array or Object to be processed as is.",
" $this->build($params);\n }",
" // establish a pseudo publish date\n if (!empty($this->publish)) {\n $this->publish_date = $this->publish;\n } elseif (!empty($this->edited_at)) {\n $this->publish_date = $this->edited_at;\n } elseif (!empty($this->created_at)) {\n $this->publish_date = $this->created_at;\n }\n",
" // setup the exception array if it's not there. This array tells the getAssociatedObjectsForThisModel() function which",
" // modules NOT to setup. This stops us from getting infinite loops with many to many relationships.\n if (is_array($params)){\n $params['except'] = isset($params['except']) ? $params['except'] : array();\n $params['cascade_except'] = isset($params['cascade_except']) ? $params['cascade_except'] : false;",
" if ($get_assoc)\n $this->getAssociatedObjectsForThisModel($params['except'], $params['cascade_except']);\n } elseif (is_object($params)) {\n $params->except = isset($params->except) ? $params->except : array();\n $params->cascade_except = isset($params->cascade_except) ? $params->cascade_except : false;",
" if ($get_assoc)\n $this->getAssociatedObjectsForThisModel($params->except, $params->cascade_except);\n }\n if ($get_attached) $this->getAttachableItems();\n }",
" /**\n * find an item or items\n *\n * @param string $range\n * @param null $where\n * @param null $order\n * @param null $limit\n * @param int $limitstart\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n *\n * @return array\n */\n public function find($range = 'all', $where = null, $order = null, $limit = null, $limitstart = 0, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n global $db, $user;",
" if (is_numeric($range)) {\n $where = $this->identifier . '=' . intval($range); // If we hit this then we are expecting just a simple id\n $range = 'first';\n }",
" $sql = empty($where) ? 1 : $where;\n //eDebug(\"Supports Revisions:\" . $this->supports_revisions);\n// if ($this->supports_revisions && $range != 'revisions') $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE $where)\";\n// $sql .= empty($order) ? '' : ' ORDER BY ' . $order;",
" $order = expString::escape($order);\n if ($limit !== null)\n $limit = intval($limit);\n if ($limitstart !== null)\n $limitstart = intval($limitstart);",
" $supports_revisions = $this->supports_revisions && ENABLE_WORKFLOW;\n if (ENABLE_WORKFLOW && $this->needs_approval) {\n $needs_approval = $user->id;\n } else {\n $needs_approval = false;\n }",
" if (strcasecmp($range, 'all') == 0) { // return all items matching request, most current revision\n// $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n $limitsql = empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n return $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n } elseif (strcasecmp($range, 'revisions') == 0) { // return all items matching request, all revisions\n// $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n $limitsql = empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n return $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql);\n } elseif (strcasecmp($range, 'first') == 0) { // return the first item matching request\n// $sql .= ' LIMIT 0,1';\n $limitsql = ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'bytitle') == 0) { // return items requested by title/sef_url (will there be more than one?)\n $limitsql = ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, \"title='\" . $where . \"' OR sef_url='\" . $where . \"'\", $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'count') == 0) { // return count of items\n return $db->countObjects($this->tablename, $sql, $supports_revisions, $needs_approval);\n } elseif (strcasecmp($range, 'in') == 0) { // return items requested by array of id#\n if (!is_array($where)) return array();\n foreach ($where as $id)\n $records[] = new $this->classname($id);\n return $records;\n } elseif (strcasecmp($range, 'bytag') == 0) { // return items tagged with request (id or title/sef_url)\n if (!is_int($where)) $where = $db->selectObject($db->prefix . 'expTags',\"title='\" . $where . \"' OR sef_url='\" . $where . \"'\");\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expTags ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.exptags_id=' . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n if ($supports_revisions) $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE ct.exptags_id=\" . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n } elseif (strcasecmp($range, 'bycat') == 0) { // return items categorized/grouped under request (id or title/sef_url)\n if (!is_int($where)) $where = $db->selectObject($db->prefix . 'expCats',\"title='\" . $where . \"' OR sef_url='\" . $where . \"'\");\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expCats ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.expcats_id=' . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n if ($supports_revisions) $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE ct.expcats_id=\" . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n $cat_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($cat_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n }\n }",
" /**\n * find an item by column\n *\n * @param $column\n * @param $value\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n *\n * @return array\n */\n public function findBy($column, $value, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n// global $db;",
" $where = \"`\" . $column . \"`=\";\n if (!is_numeric($value)) $where .= \"'\";\n $where .= $value;\n if (!is_numeric($value)) $where .= \"'\";\n return $this->find('first', $where, null, null, 0, $get_assoc, $get_attached, $except, $cascade_except);\n }",
" /**\n * find a value(s) by column\n *\n * @param string $range\n * @param string $column\n * @param string $where\n * @param string $order\n * @param bool $distinct\n *\n * @return array|bool\n */\n public function findValue($range = 'all', $column, $where=null, $order=null, $distinct=false) {\n global $db;",
" if (strcasecmp($range, 'all') == 0) { // return all items matching request\n return $db->selectColumn($this->tablename, $column, $where, $order, $distinct);\n } elseif (strcasecmp($range, 'first') == 0) { // return single/first item matching request\n return $db->selectValue($this->tablename, $column, $where);\n }\n return false;\n }",
" /**\n * update item\n *\n * @param array $params\n */\n public function update($params = array()) {\n if (is_array($params) && isset($params['current_revision_id'])) {\n $params['revision_id'] = $params['current_revision_id'];\n unset($params['current_revision_id']);\n }\n $this->checkForAttachableItems($params);\n $this->build($params);\n if (is_array($params)) {\n $this->save((isset($params['_validate']) ? $params['_validate'] : true));\n } elseif (is_object($params)) {\n $this->save((isset($params->_validate) ? $params->_validate : true));\n } else {\n $this->save(true);\n }\n }",
" /**\n * re-construct the item from the database\n *\n * @return bool\n */\n public function refresh() {\n if (empty($this->id))\n return false;\n $this->__construct($this->id);\n }",
" /**\n * Adds table fields as class properties to current \"record\" class.\n *\n * Loads Table schema data and creates new class properties based\n * upon the fields in given table.\n *\n * Additionally, if a record ID is given, that record is pulled and\n * field values are also populated into class properties.\n *\n * @name build\n *\n * @category db_record\n * @uses [db_type]::getDataDefinition() Builds a data definition from existing table.\n * @requires $db\n *\n * @access protected\n * @final\n * @PHPUnit Not Defined\n *\n * @global object $db\n *\n * @param mixed $params array or Object for table selection\n */\n public function build($params = array()) {\n global $db;",
" // safeguard against bad data...we can only take objects and arrays here\n if (!is_array($params) && !is_object($params)) $params = array();",
" // get the table definition and make sure all the params being passed in belong in this table\n $table = $db->getDataDefinition($this->tablename);",
" //check for location_data\n if (is_array($params) && ((!empty($params['module']) || !empty($params['controller'])) && !empty($params['src']))) {\n $mod = !empty($params['module']) ? $params['module'] : (!empty($params['controller']) ? $params['controller'] : null);\n if (empty($params['module'])) $params['module'] = $params['controller'];\n $params['location_data'] = serialize(expCore::makeLocation($mod, $params['src']));\n } elseif (is_object($params) && ((!empty($params->module) || !empty($params->controller)) && !empty($params->src))) {\n $mod = !empty($params->module) ? $params->module : (!empty($params->controller) ? $params->controller : null);\n if (empty($params->module)) $params->module = $params->controller;\n $params->location_data = serialize(expCore::makeLocation($mod, $params->src));\n }",
" // Build Class properties based off table fields\n foreach ($table as $col=> $colDef) {\n // check if the DB column has a corresponding value in the params array\n // if not, we check to see if the column is boolean...if so we set it to false",
" // if not, then we check to see if we had a previous value in this particular",
" // record. if so we reset it to itself so we don't lose the existing value.",
" // this is good for when the developer is trying to update just a field or two\n // in an existing record.",
" if (array_key_exists($col, $params)) {\n $value = is_array($params) ? $params[$col] : $params->$col;\n if ($colDef[0] == DB_DEF_INTEGER || $colDef[0] == DB_DEF_ID) {\n $this->$col = preg_replace(\"/[^0-9-]/\", \"\", $value);\n } elseif ($colDef[0] == DB_DEF_DECIMAL) {\n $this->$col = preg_replace(\"/[^0-9.-]/\", \"\", $value);\n } else {\n $this->$col = $value;\n }\n } elseif ($colDef[0] == DB_DEF_BOOLEAN) {\n $this->$col = empty($this->$col) ? 0 : $this->$col;\n } elseif ($colDef[0] == DB_DEF_TIMESTAMP) {\n // yuidatetimecontrol sends in a checkbox and a date e.g., publish & publishdate\n $datename = $col . 'date';\n if (is_array($params) && isset($params[$datename])) {\n $this->$col = yuidatetimecontrol::parseData($col, $params);\n } elseif (is_object($params) && isset($params->$datename)) {\n $this->$col = yuidatetimecontrol::parseData($col, object2Array($params));\n } else {\n $this->$col = !empty($this->$col) ? $this->$col : 0;\n }\n } else {\n $this->$col = !empty($this->$col) ? $this->$col : null;\n }",
" //if (isset($this->col)) {\n if ($col != 'data' && is_string($this->$col)) {\n $this->$col = stripslashes($this->$col);\n }\n //}\n if (ENABLE_WORKFLOW && $this->supports_revisions && $col == 'revision_id' && $this->$col == null)\n $this->$col = 1; // first revision is #1\n }\n }",
" /**\n * rerank items\n *\n * @param $direction\n * @param string $where\n */\n public function rerank($direction, $where = '') {\n global $db;",
" if (!empty($this->rank)) {\n $next_prev = $direction == 'up' ? $this->rank - 1 : $this->rank + 1;\n $where .= empty($this->location_data) ? null : (!empty($where) ? \" AND \" : '') . \"location_data='\" . $this->location_data . \"'\" . $this->grouping_sql;\n $db->switchValues($this->tablename, 'rank', $this->rank, $next_prev, $where);\n }\n }",
" /**\n * attach to item\n *\n * @param $item\n * @param string $subtype\n * @param bool $replace\n *\n * @return bool\n */\n public function attachItem($item, $subtype = '', $replace = true) { //FIXME only placed used is in helpController->copydocs (though we don't have attachments), & migration\n global $db;",
" // make sure we have the info we need..otherwise return\n if (empty($item->id) && empty($this->id)) return false;\n // save the attachable items\n// $refname = strtolower($item->classname).'s_id'; //FIXME plural vs single?\n// $refname = strtolower($item->classname) . '_id'; //FIXME plural vs single?\n $refname = strtolower($item->tablename) . '_id';\n if ($replace) $db->delete($item->attachable_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->id . ' AND ' . $refname . '=' . $item->id);\n $obj = new stdClass();\n $obj->$refname = $item->id;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n $obj->subtype = $subtype;\n $obj->rank = 1 + $db->max($item->attachable_table, 'rank', null, 'content_type=\"' . $this->classname . '\" AND subtype=\"' . $subtype . '\" AND content_id' . $this->id);\n $db->insertObject($obj, $item->attachable_table);\n }",
" /**\n * save item\n *\n * @param bool $validate\n * @param bool $force_no_revisions\n */\n public function save($validate = false, $force_no_revisions = false) {\n global $db;",
" // call the validation callback functions if we need to.\n if ($validate) {\n $this->beforeValidation();\n $this->validate();\n $this->afterValidation();\n }",
" $this->beforeSave();",
" // Save this object's associated objects to the database.\n // FIXME: we're not going to do this automagically until we get the refreshing figured out.",
" //$this->saveAssociatedObjects();",
"\n //Only grab fields that are valid and save this object\n $saveObj = new stdClass();\n $table = $db->getDataDefinition($this->tablename);\n foreach ($table as $col=> $colDef) {\n $saveObj->$col = empty($this->$col) ? null : $this->$col;\n }",
" if (ENABLE_WORKFLOW && $this->supports_revisions && !$this->approved && expPermissions::check('approve', expUnserialize($this->location_data))) {\n $this->approved = true; // auto-approve item if use has approve perm\n $saveObj->approved = true; // also set property in database item\n }\n $identifier = $this->identifier;\n if (!empty($saveObj->$identifier)) {\n $revise = $force_no_revisions ? false : $this->supports_revisions && ENABLE_WORKFLOW;\n $db->updateObject($saveObj, $this->tablename, null, $identifier, $revise);\n $this->afterUpdate();\n } else {\n $this->$identifier = $db->insertObject($saveObj, $this->tablename);\n $this->afterCreate();\n }",
" // run the afterSave callback(s)\n $this->afterSave();\n }",
" /**\n * before validating item\n */\n public function beforeValidation() {\n $this->runCallback('beforeValidation');\n if (empty($this->id)) {\n $this->beforeValidationOnCreate();\n } else {\n $this->beforeValidationOnUpdate();\n }\n }",
" /**\n * before validating item during creation\n */\n public function beforeValidationOnCreate() {\n $this->runCallback('beforeValidationOnCreate');\n }",
" /**\n * before validating item during update\n */\n public function beforeValidationOnUpdate() {\n $this->runCallback('beforeValidationOnUpdate');\n }",
" /**\n * validate item sef_url\n *\n * @return bool\n */\n public function validate() {\n global $db;\n // check for an sef url field. If it exists make sure it's valid and not a duplicate\n //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))) {\n if (empty($this->sef_url)) $this->makeSefUrl();\n if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();\n if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();\n }",
" // 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)) {\n $loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);\n if (!empty($loc)) $this->location_data = $loc;\n }",
" // run the validation as defined in the models\n if (!isset($this->validates)) return true;\n $messages = array();\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n foreach ($this->validates as $validation=> $field) {\n foreach ($field as $key=> $value) {\n $fieldname = is_numeric($key) ? $value : $key;\n $opts = is_numeric($key) ? array() : $value;\n $ret = expValidator::$validation($fieldname, $this, $opts);\n if (!is_bool($ret)) {\n $messages[] = $ret;\n expValidator::setErrorField($fieldname);\n unset($post[$fieldname]);\n }\n }\n }",
" if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);\n }",
" /**\n * after validating item\n */\n public function afterValidation() {\n $this->runCallback('afterValidation');\n if (empty($this->id)) {\n $this->afterValidationOnCreate();\n } else {\n $this->afterValidationOnUpdate();\n }\n }",
" /**\n * after validating item during creation\n */\n public function afterValidationOnCreate() {\n $this->runCallback('afterValidationOnCreate');\n }",
" /**\n * after validating item during update\n */\n public function afterValidationOnUpdate() {\n $this->runCallback('afterValidationOnUpdate');\n }",
" /**\n * before saving item\n */\n public function beforeSave() {\n global $user, $db;",
" $this->runCallback('beforeSave');\n // populate the magic fields\n if (empty($this->id)) {\n // timestamp the record\n if (property_exists($this, 'created_at')) $this->created_at = time();\n if (property_exists($this, 'edited_at')) $this->edited_at = time();\n // record the user saving the record.\n if (property_exists($this, 'poster')) $this->poster = empty($this->poster) ? $user->id : $this->poster;\n // fill in the rank field if it exist\n if (property_exists($this, 'rank')) {\n// if (!isset($this->rank)) {\n if (empty($this->rank)) { // ranks begin at 1, so 0 is now last\n $where = \"1 \";\n $where .= empty($this->location_data) ? null : \"AND location_data='\" . $this->location_data . \"' \";\n //FIXME: $where .= empty($this->rank_by_field) ? null : \"AND \" . $this->rank_by_field . \"='\" . $this->$this->rank_by_field . \"'\";\n $groupby = empty($this->location_data) ? null : 'location_data';\n $groupby .= empty($this->rank_by_field) ? null : (empty($groupby) ? null : ',' . $this->rank_by_field);\n $this->rank = $db->max($this->tablename, 'rank', $groupby, $where . $this->grouping_sql) + 1;\n } else {\n // check if this rank is already there..if so increment everything below it.\n $obj = $db->selectObject($this->tablename, 'rank=' . $this->rank . $this->grouping_sql);\n if (!empty($obj)) {\n $db->increment($this->tablename, 'rank', 1, 'rank>=' . $this->rank . $this->grouping_sql);\n }\n }\n }",
" $this->beforeCreate();\n } else {\n // put the created_at time back the way it was so we don't set it 0\n if (property_exists($this, 'created_at') && $this->created_at == 0) {\n $this->created_at = $db->selectValue($this->tablename, 'created_at', 'id=' . $this->id);\n }",
" // put the original posters id back the way it was so we don't set it 0\n if (property_exists($this, 'poster') && $this->poster == 0) {\n $this->poster = $db->selectValue($this->tablename, 'poster', 'id=' . $this->id);\n }",
" //put the rank back to what it was so we don't set it 0\n if (property_exists($this, 'rank') && $this->rank == 0) {\n $this->rank = $db->selectValue($this->tablename, 'rank', 'id=' . $this->id);\n }",
" if (property_exists($this, 'edited_at')) $this->edited_at = time();\n if (property_exists($this, 'editor')) $this->editor = $user->id;",
" $this->beforeUpdate();\n }\n }",
" /**\n * before creating item\n */\n public function beforeCreate() {\n $this->runCallback('beforeCreate');\n }",
" /**\n * before updating item\n */\n public function beforeUpdate() {\n // we need some help migrating edited dates\n if (!empty($this->migrated_at)) {\n $this->edited_at = $this->migrated_at;\n unset($this->migrated_at);\n }\n $this->runCallback('beforeUpdate');\n }",
" /**\n * after updating item\n */\n public function afterUpdate() {\n $this->runCallback('afterUpdate');\n }",
" /**\n * after creating item\n */\n public function afterCreate() {\n $this->runCallback('afterCreate');\n }",
" /**\n * after saving item\n */\n public function afterSave() {\n global $db;",
" $this->runCallback('afterSave');",
" // save all attached items\n if (!empty($this->attachable_items_to_save)) {\n foreach ($this->attachable_item_types as $type) {\n if (!empty($this->attachable_items_to_save[$type])) {\n $itemtype = new $type();\n // clean up (delete) old attachments since we'll create all from scratch\n $db->delete($itemtype->attachable_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->id);\n// $refname = strtolower($type).'s_id'; //FIXME: find a better way to pluralize these names!!!\n $refname = strtolower($itemtype->tablename) . '_id'; //FIXME: find a better way to pluralize these names!!!\n foreach ($this->attachable_items_to_save[$type] as $subtype=> $item) {\n $obj = new stdClass();\n if (is_object($item)) {\n if (!empty($item->id)) {\n $obj->$refname = $item->id;\n $obj->subtype = $subtype;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $item->rank + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n } elseif (is_array($item)) {\n foreach ($item as $rank=>$value) {\n if (is_numeric($value)) {\n $obj->$refname = $value;\n $obj->subtype = $subtype;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $rank + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n }\n } elseif (is_numeric($item)) {\n $obj->$refname = $item;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $subtype + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n }\n }\n }\n }\n }",
" /**\n * is run before deleting item\n */\n public function beforeDelete() {\n $this->runCallback('beforeDelete');\n }",
" /**\n * delete item\n *\n * @param string $where\n *\n * @return bool\n */\n public function delete($where = '') {\n global $db;",
" $id = $this->identifier;\n if (empty($this->$id)) return false;\n $this->beforeDelete();\n $db->delete($this->tablename, $id . '=' . $this->$id);\n if (!empty($where)) $where .= ' AND '; // for help in reranking, NOT deleting object\n if (property_exists($this, 'rank')) $db->decrement($this->tablename, 'rank', 1, $where . 'rank>=' . $this->rank . $this->grouping_sql);",
" // delete attached items\n foreach ($this->attachable_item_types as $content_table=> $type) {\n $db->delete($content_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->$id);\n }\n // leave associated items to the model afterDelete method?\n $this->afterDelete();\n }",
" /**\n * is run after deleting item\n */\n public function afterDelete() {\n $this->runCallback('afterDelete');\n }",
" /**\n * jump to subclass calling routine\n *\n * @param $type\n *\n * @return bool\n */\n private function runCallback($type) {\n if (empty($type)) return false;",
" // check for and run any callbacks listed in the $type array.\n if ($this->classinfo->hasProperty($type)) {\n $callbacks = $this->classinfo->getProperty($type);\n foreach ($callbacks->getValue(new $this->classname(null, false, false)) as $func) {\n $this->$func();\n }\n }\n }",
" /**\n * make an sef_url for item\n */\n public function makeSefUrl() {\n global $db, $router;",
" if (!empty($this->title)) {\n\t\t\t$this->sef_url = $router->encode($this->title);\n\t\t} else {\n\t\t\t$this->sef_url = $router->encode('Untitled');\n\t\t}\n $dupe = $db->selectValue($this->tablename, 'sef_url', 'sef_url=\"'.$this->sef_url.'\"' . $this->grouping_sql);\n\t\tif (!empty($dupe)) {\n\t\t\tlist($u, $s) = explode(' ',microtime());\n\t\t\t$this->sef_url .= '-'.$s.'-'.$u;\n\t\t}\n $this->runCallback('makeSefUrl');\n }",
" /**\n * get item's associated objects\n *\n * Type of associations\n * has_one\n * has_many\n * has_and_belongs_to_many\n *\n * @param null $obj\n *\n * @return null\n */\n public function getAssociatedObjects($obj = null) { //FIXME not used??\n global $db;",
" $records = array();",
" foreach ($this->has_one as $assoc_object) {\n $ret = $db->selectObjects($this->tablename, $assoc_object . '_id=' . $obj->id);\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }",
" foreach ($this->has_many as $assoc_object) {\n $ret = $db->selectObjects($assoc_object, $this->tablename . '_id=' . $obj->id);\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }",
" foreach ($this->has_and_belongs_to_many as $assoc_object) {\n if (strcmp($this->tablename, $assoc_object) > 0) {\n $tablename = $assoc_object . '_' . $this->tablename;\n } else {\n $tablename = $this->tablename . '_' . $assoc_object;\n }",
" //$ret = $db->selectObjects($tablename, $this->tablename.'_id='.$obj->id);\n $instances = $db->selectObjects($tablename, $this->tablename . '_id=' . $obj->id);\n $ret = array();\n foreach ($instances as $instance) {\n $fieldname = $assoc_object . '_id';\n $ret[] = $db->selectObject($assoc_object, 'id=' . $instance->$fieldname);\n }\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }",
" return $obj;\n }",
" /**\n * this function finds models that have this attachable item attached\n *\n * @param $content_type\n *\n * @return array\n */\n public function findWhereAttachedTo($content_type) {\n global $db;",
" $objarray = array();\n if (!empty($this->id) && !empty($this->attachable_table)) {\n// $assocs = $db->selectObjects($this->attachable_table, $this->classname.'s_id='.$this->id.' AND content_type=\"'.$content_type.'\"'); //FIXME is it plural where others are single?\n $assocs = $db->selectObjects($this->attachable_table, strtolower($this->tablename) . '_id=' . $this->id . ' AND content_type=\"' . $content_type . '\"');\n foreach ($assocs as $assoc) {\n if (class_exists($assoc->content_type)) $objarray[] = new $assoc->content_type($assoc->content_id);\n }\n }",
" return $objarray;\n }",
" /**\n * check for what objects may be attached\n *\n * @param $params\n *\n * @return bool\n */\n protected function checkForAttachableItems($params) {\n if (empty($params)) return false;\n foreach ($this->attachable_item_types as $type) {\n if (array_key_exists($type, $params)) {\n $this->attachable_items_to_save[$type] = is_array($params) ? $params[$type] : $params->$type;\n }\n }\n }",
" /**\n * used for import/export\n *\n * @return array\n */\n function getAttachableItemTables() {\n return $this->attachable_item_types; //fixme this is the model name, NOT the table name\n }",
" /**\n * get attached objects for this item\n */\n protected function getAttachableItems() {\n global $db;",
" foreach ($this->attachable_item_types as $content_table=> $type) {\n if ($this->classname == $type) break;",
" $tablename = str_ireplace('content_', '', $content_table);\n if (!isset($this->id)) {\n $this->$type = array();\n } else {\n $sql = 'SELECT ef.*, cef.subtype AS subtype FROM ';\n $sql .= $db->prefix . $tablename . ' ef JOIN ' . $db->prefix . $content_table . ' cef ';\n $sql .= \"ON ef.id = cef.\" . $tablename . \"_id\";\n $sql .= \" WHERE content_id=\" . $this->id;\n $sql .= \" AND content_type='\" . $this->classname . \"'\";\n if ($type == 'expComment') {\n $sql .= \" AND approved='1'\";\n }",
" $order = ($type == 'expFile' || $type == 'expCats' || $type == 'expDefinableField') ? ' ORDER BY rank ASC' : null;\n $sql .= $order;",
" $items = $db->selectArraysBySql($sql);",
" $attacheditems = array();\n foreach ($items as $item) {\n //FIXME: find a better way to unpluralize the name!\n $idname = strtolower($type) . '_id';\n if (empty($item['subtype'])) {\n $attacheditems[] = new $type($item, false, false);\n } else {\n if (!isset($attacheditems[$item['subtype']])) $attacheditems[$item['subtype']] = array();\n $attacheditems[$item['subtype']][] = new $type($item, false, false);\n }\n }",
" $this->$type = $attacheditems;\n }\n }\n }",
" /**\n * gets associated objects for this model\n *\n * Type of associations\n * has_extended_fields\n * has_one\n * has_many\n * has_many_self\n * has_and_belongs_to_many\n * has_and_belongs_to_self\n *\n * @param array $except\n * @param bool $cascade_except\n *\n */\n private function getAssociatedObjectsForThisModel($except = array(), $cascade_except = false) {\n global $db;",
" foreach ($this->has_extended_fields as $assoc_object) {\n // figure out the name of the model based off the models tablename\n $obj = new $assoc_object(null, false, false);\n $this->$assoc_object = $obj->find('first', $this->tablename . '_id = ' . $this->id);\n }",
" //this requires a field in the table only with the ID of the associated object we're looking for in its table\n foreach ($this->has_one as $assoc_object) {\n // figure out the name of the model based off the models tablename\n if (!in_array($assoc_object, $except)) {\n $obj = new $assoc_object(null, false, false);\n $id_name = $obj->tablename . '_id';",
" // check to see if we have an association yet. if not we'll initialize an empty model\n $id = empty($this->$id_name) ? array() : $this->$id_name;",
" $this->$assoc_object = new $assoc_object($id, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n } else {\n $this->$assoc_object = array();\n }\n }",
" //TODO: perhaps add a 'in' option to the find so we can pass an array of ids and make ONE db call instead of looping\n foreach ($this->has_many as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assoc_obj = new $assoc_object();",
" $ret = $db->selectArrays($assoc_obj->tablename, $this->tablename . '_id=' . $this->id, $assoc_obj->default_sort_field != '' ? $assoc_obj->default_sort_field . \" \" . $assoc_obj->default_sort_direction : null);\n $records = array();\n if ($cascade_except) {\n $record['except'] = $except;\n $record['cascade_except'] = $cascade_except;\n }\n foreach ($ret as $record) {\n $records[] = new $assoc_object($record, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n //eDebug(\"No: \" .$assoc_object);\n $this->$assoc_object = array();\n }\n }",
" foreach ($this->has_many_self as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assoc_obj = new $assoc_object();",
" $ret = $db->selectArrays($assoc_obj->tablename, $assoc_obj->has_many_self_id . '=' . $this->id, $assoc_obj->default_sort_field != '' ? $assoc_obj->default_sort_field . \" \" . $assoc_obj->default_sort_direction : null);\n $records = array();\n foreach ($ret as $record) {\n $records[] = new $assoc_object($record, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }",
" foreach ($this->has_and_belongs_to_many as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assocObj = new $assoc_object(null, false, false);\n $tablename = $this->makeManyToManyTablename($assocObj->tablename);",
" $ret = $db->selectObjects($assocObj->tablename, 'id IN (SELECT ' . $assocObj->tablename . '_id from ' . $db->prefix . $tablename . ' WHERE ' . $this->tablename . '_id=' . $this->id . ')', $assocObj->default_sort_field != '' ? $assocObj->default_sort_field . \" \" . $assocObj->default_sort_direction : null);\n $records = array();\n foreach ($ret as $record) {\n $record_array = object2Array($record);\n // put in the current model as an exception, otherwise the auto assoc's keep initializing instances of each other in an\n // infinite loop\n $record_array['except'] = array($this->classinfo->name);\n if ($cascade_except) {\n $record_array['except'] = array_merge($record_array['except'], $except);\n $record_array['cascade_except'] = $cascade_except;\n }\n $records[] = new $assoc_object($record_array, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }",
" foreach ($this->has_and_belongs_to_self as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assocObj = new $assoc_object(null, false, false);\n $tablename = $this->makeManyToManyTablename($assocObj->classname);",
" $ret = $db->selectObjects($assocObj->tablename, 'id IN (SELECT ' . $assocObj->classname . '_id from ' . $db->prefix . $tablename . ' WHERE ' . $this->tablename . '_id=' . $this->id . ')');\n $records = array();\n foreach ($ret as $record) {\n $record_array = object2Array($record);\n // put in the current model as an exception, otherwise the auto assoc's keep initializing instances of each other in an\n // infinite loop\n $record_array['except'] = array($this->classinfo->name);\n $records[] = new $assoc_object($record_array, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }\n }",
" /**\n * get objects this item belongs to ??\n *\n * Type of associations\n * has_and_belongs_to_many\n *\n * @param $datatype\n * @param $id\n */\n public function associateWith($datatype, $id) { //FIXME not used??\n global $db;",
" $assocObj = new $datatype();",
" if (in_array($datatype, $this->has_and_belongs_to_many)) {\n $tablename = $this->makeManyToManyTablename($assocObj->tablename);\n $thisid = $this->tablename . '_id';\n $otherid = $assocObj->tablename . '_id';\n $obj = new stdClass();\n $obj->$thisid = $this->id;\n $obj->$otherid = $id;\n $db->insertObject($obj, $tablename);\n }\n }",
" /**\n * save associated objects\n *\n * Type of associations\n * has_one\n *\n */\n public function saveAssociatedObjects() {\n// global $db;",
" foreach ($this->has_one as $assoc_object) {\n $obj = $this->$assoc_object;\n $obj->save();",
" $assoc_id_name = $assoc_object . '_id';\n $this->$assoc_id_name = $obj->id;\n }\n }",
" //why the compare to flip order?\n /**\n * create a many to many table relationship\n *\n * @param $assoc_table\n *\n * @return string\n */\n private function makeManyToManyTablename($assoc_table) {\n if (strcmp($this->tablename, $assoc_table) > 0) {\n $tablename = $assoc_table . '_' . $this->tablename;\n } else {\n $tablename = $this->tablename . '_' . $assoc_table;\n }\n return $tablename;\n }",
" /**\n * return the item poster\n *\n * @param null $display\n * @return null|string\n */\n public function getPoster($display = null) {\n if (isset($this->poster)) {\n $user = new user($this->poster);\n return user::getUserAttribution($user->id, $display);\n } else {\n return null;\n }\n }",
" /**\n * return the item timestamp\n *\n * @param int $type\n *\n * @return mixed\n */\n public function getTimestamp($type = 0) {\n if ($type == 0) $getType = 'created_at';\n elseif ($type == 'publish') $getType = 'publish';\n else $getType = 'edited_at';\n if (isset($this->$getType)) return expDateTime::format_date($this->$getType, DISPLAY_DATETIME_FORMAT);\n else return null;\n }",
"}",
";",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class mysqli_database\n *\n * This is the MySQLi-specific implementation of the database class.\n * @package Subsystems\n * @subpackage Database\n */\n/** @define \"BASE\" \"../..\" */",
"class mysqli_database extends database {",
" /**\n * Make a connection to the Database Server\n *\n * Takes the supplied credentials (username / password) and tries to\n * connect to the server and select the given database. All the rules\n * governing mysqli_connect also govern this method.\n *\n * @param string $username The username to connect to the server as.\n * @param string $password The password for $username\n * @param string $hostname The hostname of the database server. If\n * localhost is specified, a local socket connection will be attempted.\n * @param string $database The name of the database to use. Multi-database\n * sites are still not yet supported.\n * @param bool $new Whether or not to force the PHP connection function to establish\n * a distinctly new connection handle to the server.\n */",
"\tfunction __construct($username, $password, $hostname, $database, $new=false) {\n\t\tif (strstr($hostname,':')) {\n\t\t\tlist ( $host, $port ) = @explode (\":\", $hostname);\n\t\t} else {\n $host = $hostname;\n }\n\t\tif ($this->connection = @mysqli_connect($host, $username, $password, $database, $port)) {\n\t\t\t$this->havedb = true;\n\t\t}\n\t\t//fix to support utf8, warning it only works from a certain mySQL version on\n\t\t//needed on mySQL servers that don't have the default connection encoding setting to utf8",
"\t\t//As we do not have any setting for ISAM or InnoDB tables yet, i set the minimum specs\n\t\t// for using this feature to 4.1.2, although isam tables got the support for utf8 already in 4.1\n\t\t//anything else would result in an inconsistent user experience\n\t\t//TODO: determine how to handle encoding on postgres",
"\t\tlist($major, $minor, $micro) = sscanf(@mysqli_get_server_info($this->connection), \"%d.%d.%d-%s\");\n\t\tif(defined('DB_ENCODING')) {\n\t\t\t//SET NAMES is possible since version 4.1\n\t\t\tif(($major > 4) OR (($major == 4) AND ($minor >= 1))) {\n\t\t\t\t@mysqli_query($this->connection, \"SET NAMES \" . DB_ENCODING);\n\t\t\t}\n\t\t}",
"\t\t$this->prefix = DB_TABLE_PREFIX . '_';\n\t}",
" /**\n * Create a new Table\n *\n * Creates a new database table, according to the passed data definition.\n *\n * This function abides by the Exponent Data Definition Language, and interprets\n * its general structure for MySQL.\n *\n * @param string $tablename The name of the table to create\n * @param array $datadef The data definition to create, expressed in\n * the Exponent Data Definition Language.\n * @param array $info Information about the table itself.\n * @return array\n\t */\n\tfunction createTable($tablename, $datadef, $info) {\n\t\tif (!is_array($info))\n $info = array(); // Initialize for later use.",
"\t\t$sql = \"CREATE TABLE `\" . $this->prefix . \"$tablename` (\";\n\t\t$primary = array();\n\t\t$fulltext = array();\n\t\t$unique = array();\n\t\t$index = array();\n\t\tforeach ($datadef as $name=>$def) {\n\t\t\tif ($def != null) {\n\t\t\t\t$sql .= $this->fieldSQL($name,$def) . \",\";\n\t\t\t\tif (!empty($def[DB_PRIMARY])) $primary[] = $name;\n\t\t\t\tif (!empty($def[DB_FULLTEXT])) $fulltext[] = $name;\n\t\t\t\tif (isset($def[DB_INDEX]) && ($def[DB_INDEX] > 0)) {\n\t\t\t\t\tif ($def[DB_FIELD_TYPE] == DB_DEF_STRING) {\n\t\t\t\t\t\t$index[$name] = $def[DB_INDEX];\n } else {\n $index[$name] = 0;\n }\n }\n if (isset($def[DB_UNIQUE])) {\n if (!isset($unique[$def[DB_UNIQUE]]))\n $unique[$def[DB_UNIQUE]] = array();\n $unique[$def[DB_UNIQUE]][] = $name;\n }\n }\n }\n $sql = substr($sql, 0, -1);\n if (count($primary)) {\n $sql .= \", PRIMARY KEY ( `\" . implode(\"` , `\", $primary) . \"`)\";\n }\n if (count($fulltext)) {\n// $sql .= \", FULLTEXT ( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n $sql .= \", FULLTEXT `\" . $fulltext[0] . \"`\" . \"( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n }\n if (!empty($unique)) foreach ($unique as $key => $value) {\n $sql .= \", UNIQUE `\" . $key . \"` ( `\" . implode(\"` , `\", $value) . \"`)\";\n }\n foreach ($index as $key => $value) {\n $sql .= \", INDEX (`\" . $key . \"`\" . (($value > 0) ? \"(\" . $value . \")\" : \"\") . \")\";\n }\n $sql .= \")\";\n if (defined(DB_ENCODING)) {\n $sql .= \" ENGINE = MYISAM CHARACTER SET \" . DB_ENCODING;\n } else {\n $sql .= \" ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci\";\n }",
" if (isset($info[DB_TABLE_COMMENT])) {\n $sql .= \" COMMENT = '\" . $info[DB_TABLE_COMMENT] . \"'\";\n }",
" @mysqli_query($this->connection, $sql);",
" $return = array(\n $tablename => ($this->tableExists($tablename) ? DATABASE_TABLE_INSTALLED : DATABASE_TABLE_FAILED)\n );",
" return $return;\n }",
" /**\n * Alter an existing table\n *\n * Alters the structure of an existing database table to conform to the passed\n * data definition.\n *\n * This function abides by the Exponent Data Definition Language, and interprets\n * its general structure for MySQL.\n *\n * @param string $tablename The name of the table to alter\n * @param array $newdatadef The new data definition for the table.\n * This is expressed in the Exponent Data Definition Language\n * @param array $info Information about the table itself.\n * @param bool $aggressive Whether or not to aggressively update the table definition.\n * An aggressive update will drop columns in the table that are not in the Exponent definition.\n * @return array\n */\n function alterTable($tablename, $newdatadef, $info, $aggressive = false) {\n expSession::clearAllUsersSessionCache();\n $dd = $this->getDataDefinition($tablename);\n $modified = false;",
" // collect any indexes & keys to the table\n $primary = array();\n $fulltext = array();\n $unique = array();\n $index = array();\n foreach ($newdatadef as $name=>$def) {\n if ($def != null) {\n if (!empty($def[DB_PRIMARY])) $primary[] = $name;\n if (!empty($def[DB_FULLTEXT])) $fulltext[] = $name;\n if (isset($def[DB_INDEX]) && ($def[DB_INDEX] > 0)) {\n if ($def[DB_FIELD_TYPE] == DB_DEF_STRING) {\n $index[$name] = $def[DB_INDEX];\n } else {\n $index[$name] = 0;\n }\n }\n if (isset($def[DB_UNIQUE])) {\n if (!isset($unique[$def[DB_UNIQUE]]))\n $unique[$def[DB_UNIQUE]] = array();\n $unique[$def[DB_UNIQUE]][] = $name;\n }\n }\n }",
" //Drop any old columns from the table if aggressive mode is set.\n if ($aggressive) {\n //update primary keys to 'release' columns\n $sql = \"ALTER IGNORE TABLE `\" . $this->prefix . \"$tablename` \";\n if (count($primary)) {\n $sql .= \" DROP PRIMARY KEY, ADD PRIMARY KEY ( `\" . implode(\"` , `\",$primary) . \"` )\";\n }\n @mysqli_query($this->connection, $sql);",
" if (is_array($newdatadef) && is_array($dd)) {\n $oldcols = @array_diff_assoc($dd, $newdatadef);\n if (count($oldcols)) {\n $modified = true;\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n foreach ($oldcols as $name => $def) {\n $sql .= \" DROP COLUMN \" . $name . \",\";\n }\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }\n }\n }",
" //Add any new columns to the table\n if (is_array($newdatadef) && is_array($dd)) {\n $diff = @array_diff_assoc($newdatadef, $dd);\n if (count($diff)) {\n $modified = true;\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n foreach ($diff as $name => $def) {\n $sql .= \" ADD COLUMN (\" . $this->fieldSQL($name, $def) . \"),\";\n }\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }",
" // alter any existing columns here\n $diff_c = @expCore::array_diff_assoc_recursive($newdatadef, $dd);\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n $changed = false;\n if (is_array($diff_c)) {\n foreach ($diff_c as $name => $def) {\n if (!array_key_exists($name, $diff) && (isset($def[DB_FIELD_TYPE]) || isset($def[DB_FIELD_LEN]) || isset($def[DB_DEFAULT]) || isset($def[DB_INCREMENT]))) { // wasn't a new column\n if ($dd[$name][DB_FIELD_TYPE] == DB_DEF_STRING) {\n //check for actual lengths vs. exp placeholder lengths\n $newlen = $newdatadef[$name][DB_FIELD_LEN];\n $len = $dd[$name][DB_FIELD_LEN];\n if ($len >= 16777216 && $newlen >= 16777216) {\n continue;\n }\n if ($len >= 65536 && $newlen >= 65536) {\n continue;\n }\n if ($len >= 256 && $newlen >= 256) {\n continue;\n }\n }\n $changed = true;\n $sql .= ' MODIFY ' . $this->fieldSQL($name,$newdatadef[$name]) . \",\";\n }\n }\n }\n if ($changed) {\n $modified = true;\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }\n }",
" //Add any new indexes & keys to the table\n $sql = \"ALTER\" . (empty($aggressive) ? \"\" : \" IGNORE\") . \" TABLE `\" . $this->prefix . \"$tablename` \";",
" $sep = false;\n if (count($primary)) {\n $sql .= \" DROP PRIMARY KEY, ADD PRIMARY KEY ( `\" . implode(\"` , `\",$primary) . \"` )\";\n $sep = true;\n }\n if (count($fulltext)) {\n if ($sep) $sql .= ' ,';\n// $sql .= \" ADD FULLTEXT ( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n // drop the index first so we don't get dupes\n $drop = \"DROP INDEX \" . $fulltext[0] . \" ON \" . $this->prefix . $tablename;\n @mysqli_query($this->connection, $drop);\n $sql .= \" ADD FULLTEXT `\" . $fulltext[0] . \"`\" . \"( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n $sep = true;\n }\n if (!empty($unique)) foreach ($unique as $key=>$value) {\n if ($sep) $sql .= ' ,';\n $sql .= \", ADD UNIQUE `\".$key.\"` ( `\" . implode(\"` , `\",$value) . \" `)\";\n $sep = true;\n }",
" foreach ($index as $key => $value) {\n // drop the index first so we don't get dupes\n $drop = \"DROP INDEX \" . $key . \" ON \" . $this->prefix . $tablename;\n @mysqli_query($this->connection, $drop);",
" // re-add the index\n if ($sep) $sql .= ' ,';\n// $sql .= \" ADD INDEX (`\" . $key . \"`)\"; //FIXME we don't add column length??\n $sql .= \" ADD INDEX (`\" . $key . \"`\" . (($value > 0) ? \"(\" . $value . \")\" : \"\") . \")\";\n $sep = true;\n }\n @mysqli_query($this->connection, $sql);",
" //Get the return code\n $return = array(\n $tablename => ($modified ? TABLE_ALTER_SUCCEEDED : TABLE_ALTER_NOT_NEEDED)\n );",
" return $return;\n }",
" /**\n * Drop a table from the database\n *\n * Removes an existing table from the database. Returns true if the table was dropped, false if there\n * was an error returned by the MySQL server.\n *\n * @param string $table The name of the table to drop.\n * @return bool\n */\n function dropTable($table) {\n return @mysqli_query($this->connection, \"DROP TABLE `\" . $this->prefix . \"$table`\") !== false;\n }",
" /**\n * Run raw SQL. Returns true if the query succeeded, and false\n * if an error was returned from the MySQL server.\n *\n * <div style=\"color:red\">If you can help it, do not use this function. It presents Database Portability Issues.</div>\n *\n * Runs a straight SQL query on the database. This is not a\n * very portable way of dealing with the database, and is only\n * provided as a last resort.\n *\n * @param string $sql The SQL query to run\n\t * @param bool $escape Indicates if the query will be escape\n * @return mixed\n */\n function sql($sql, $escape = true) {\n\t\tif($escape == true) {\n\t\t\t$res = @mysqli_query($this->connection, mysqli_real_escape_string($this->connection, $sql));\n\t\t} else {\n\t\t\t$res = @mysqli_query($this->connection, $sql);\n\t\t}\n return $res;\n }",
"\t/**\n\t * Update a column in all records in a table\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param $val\n\t * @param int|null $where\n\t * @return void\n\t */",
" function columnUpdate($table, $col, $val, $where=1) { ",
" $res = @mysqli_query($this->connection, \"UPDATE `\" . $this->prefix . \"$table` SET `$col`='\" . $val . \"' WHERE $where\");\n /*if ($res == null)\n return array();\n $objects = array();\n for ($i = 0; $i < mysqli_num_rows($res); $i++)\n $objects[] = mysqli_fetch_object($res);*/\n //return $objects;\n }",
" /**\n * Select a series of objects\n *\n * Selects a set of objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of objects, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @return array\n */\n function selectObjects($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;",
" $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }",
"\t/**\n\t * @param $terms\n\t * @param null $where\n\t * @return array\n\t */\n function selectSearch($terms, $where = null) {\n if ($where == null)\n $where = \"1\";",
" $sql = \"SELECT *, MATCH (s.title, s.body) AGAINST ('\" . $terms . \"*') as score from \" . $this->prefix . \"search as s \";\n $sql .= \"WHERE MATCH (title, body) against ('\" . $terms . \"*' IN BOOLEAN MODE) ORDER BY score DESC\";\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }",
"\t/**\n\t * @param null $colsA\n\t * @param null $colsB\n\t * @param $tableA\n\t * @param $tableB\n\t * @param $keyA\n\t * @param null $keyB\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array'\n\t */\n function selectAndJoinObjects($colsA=null, $colsB=null, $tableA, $tableB, $keyA, $keyB=null, $where = null, $orderby = null) {\n $sql = 'SELECT ';\n if ($colsA != null) {\n if (!is_array($colsA)) {\n $sql .= 'a.' . $colsA . ', ';\n } else {\n foreach ($colsA as $colA) {\n $sql .= 'a.' . $colA . ', ';\n }\n }\n } else {\n $sql .= ' a.*, ';\n }",
" if ($colsB != null) {\n if (!is_array($colsB)) {\n $sql .= 'b.' . $colsB . ' ';\n } else {\n $i = 1;\n foreach ($colsB as $colB) {\n $sql .= 'b.' . $colB;\n if ($i < count($colsB))\n $sql .= ', ';\n $i++;\n }\n }\n } else {\n $sql .= ' b.* ';\n }",
" $sql .= ' FROM ' . $this->prefix . $tableA . ' a JOIN ' . $this->prefix . $tableB . ' b ';\n $sql .= is_null($keyB) ? 'USING(' . $keyA . ')' : 'ON a.' . $keyA . ' = b.' . $keyB;",
" if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;",
" $res = @mysqli_query($this->connection, $sql . \" WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }",
"\t/**\n * Select a single object by sql\n *\n\t * @param $sql\n\t * @return null|void\n\t */\n function selectObjectBySql($sql) {\n //$logFile = \"C:\\\\xampp\\\\htdocs\\\\supserg\\\\tmp\\\\queryLog.txt\";\n //$lfh = fopen($logFile, 'a');",
" //fwrite($lfh, $sql . \"\\n\"); \n //fclose($lfh); ",
" $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }",
"\t/**\n * Select a series of objects by sql\n *\n\t * @param $sql\n\t * @return array\n\t */\n function selectObjectsBySql($sql) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @param bool $distinct\n\t * @return array\n\t */\n function selectColumn($table, $col, $where = null, $orderby = null, $distinct=false) {\n if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n $dist = empty($distinct) ? '' : 'DISTINCT ';",
" $res = @mysqli_query($this->connection, \"SELECT \" . $dist . $col . \" FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_array($res, MYSQLI_NUM);\n $resarray[$i] = $row[0];\n }\n return $resarray;\n }",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return int\n\t */\n function selectSum($table, $col, $where = null) {\n if ($where == null)\n $where = \"1\";",
" $res = @mysqli_query($this->connection, \"SELECT SUM(\" . $col . \") FROM `\" . $this->prefix . \"$table` WHERE $where\");\n if ($res == null)\n return 0;\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_array($res, MYSQLI_NUM);\n $resarray[$i] = $row[0];\n }\n return $resarray[0];\n }",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array\n\t */\n function selectDropdown($table, $col, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;",
" $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_object($res);\n $resarray[$row->id] = $row->$col;\n }\n return $resarray;\n }",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return null\n\t */\n function selectValue($table, $col, $where=null) {\n if ($where == null)\n $where = \"1\";\n $sql = \"SELECT \" . $col . \" FROM `\" . $this->prefix . \"$table` WHERE $where LIMIT 0,1\";\n $res = @mysqli_query($this->connection, $sql);",
" if ($res == null)\n return null;\n $obj = mysqli_fetch_object($res);\n if (is_object($obj)) {\n return $obj->$col;\n } else {\n return null;\n }\n }",
"\t/**\n\t * @param $sql\n\t * @return null\n\t */\n function selectValueBySql($sql) {\n $res = $this->sql($sql);\n if ($res == null)\n return null;\n $r = mysqli_fetch_row($res);\n if (is_array($r)) {\n return $r[0];\n } else {\n return null;\n }\n }",
" /**\n * Select a series of objects, and return by ID\n *\n * Selects a set of objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of objects, in any random order. The indices of the array\n * are the IDs of the objects.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @return array\n */\n function selectObjectsIndexedArray($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");",
" if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $o = mysqli_fetch_object($res);\n $objects[$o->id] = $o;\n }\n return $objects;\n }",
" /**\n * Count Objects matching a given criteria\n *\n * @param string $table The name of the table to count objects in.\n * @param string $where Criteria for counting.\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return int\n */\n function countObjects($table, $where = null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $res = @mysqli_query($this->connection, \"SELECT COUNT(*) as c FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where\");\n if ($res == null)\n return 0;\n $obj = mysqli_fetch_object($res);\n return $obj->c;\n }",
" /**\n * Count Objects matching a given criteria using raw sql\n *\n * @param string $sql The sql query to be run\n * @return int\n */\n function countObjectsBySql($sql) {\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return 0;\n $obj = mysqli_fetch_object($res);\n return $obj->c;\n }",
" /**\n * Count Objects matching a given criteria using raw sql\n *\n * @param string $sql The sql query to be run\n * @return int|void\n */\n function queryRows($sql) {\n $res = @mysqli_query($this->connection, $sql);\n return empty($res) ? 0 : mysqli_num_rows($res);\n }",
" /**\n * Select a single object.\n *\n * Selects an objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a single record from a database table. Returns the\n * first record/object found (in the case of multiple-result queries,\n * there is no way to determine which of the set will be returned).\n * If no record(s) match the query, null is returned.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set.\n * @return object/null|void\n */\n function selectObject($table, $where) {\n $where = $this->injectProof($where);\n $res = mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where LIMIT 0,1\");\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }",
"\t/**\n\t * @param $table\n\t * @param string $lockType\n\t * @return mixed\n\t */\n\tfunction lockTable($table,$lockType=\"WRITE\") {\n $sql = \"LOCK TABLES `\" . $this->prefix . \"$table` $lockType\";",
" \n $res = mysqli_query($this->connection, $sql); ",
" return $res;\n }",
"\t/**\n\t * @return mixed\n\t */\n\tfunction unlockTables() {\n $sql = \"UNLOCK TABLES\";",
" ",
" $res = mysqli_query($this->connection, $sql);\n return $res;\n }",
" ",
"\t/**\n * Insert an Object into some table in the Database\n *\n * This method will return the ID assigned to the new record by MySQL. Note that\n * object attributes starting with an underscore ('_') will be ignored and NOT inserted\n * into the table as a field value.\n *\n * @param object $object The object to insert.\n * @param string $table The logical table name to insert into. This does not include the table prefix, which\n * is automagically prepended for you.\n * @return int|void\n */\n function insertObject($object, $table) {",
" //if ($table==\"text\") eDebug($object,true); ",
" $sql = \"INSERT INTO `\" . $this->prefix . \"$table` (\";\n $values = \") VALUES (\";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n if ($var{0} != '_') {\n $sql .= \"`$var`,\";\n if ($values != \") VALUES (\") {\n $values .= \",\";\n }\n $values .= \"'\" . $this->escapeString($val) . \"'\";\n }\n }\n $sql = substr($sql, 0, -1) . substr($values, 0) . \")\";\n //if($table=='text')eDebug($sql,true);\n if (@mysqli_query($this->connection, $sql) != false) {\n $id = mysqli_insert_id($this->connection);\n return $id;\n } else\n return 0;\n }",
" /**\n * Delete one or more objects from the given table.\n *\n * @param string $table The name of the table to delete from.\n * @param string $where Criteria for determining which record(s) to delete.\n * @return mixed\n */\n function delete($table, $where = null) {\n if ($where != null) {\n $res = @mysqli_query($this->connection, \"DELETE FROM `\" . $this->prefix . \"$table` WHERE $where\");\n return $res;\n } else {\n $res = @mysqli_query($this->connection, \"TRUNCATE TABLE `\" . $this->prefix . \"$table`\");\n return $res;\n }\n }",
" /**\n * Update one or more objects in the database.\n *\n * This function will only update the attributes of the resulting record(s)\n * that are also member attributes of the $object object.\n *\n * @param object $object An object specifying the fields and values for updating.\n * In most cases, this will be the altered object originally returned from one of\n * the select* methods.\n * @param string $table The table to update in.\n * @param string $where Optional criteria used to narrow the result set.\n * @param string $identifier\n * @param bool $is_revisioned\n * @return bool|int|void\n */\n function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {",
" if ($is_revisioned) {\n $object->revision_id++;\n //if ($table==\"text\") eDebug($object);\n $res = $this->insertObject($object, $table);",
" //if ($table==\"text\") eDebug($object,true); ",
" $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);\n return $res;\n }\n $sql = \"UPDATE \" . $this->prefix . \"$table SET \";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n //if($is_revisioned && $var=='revision_id') $val++;\n if ($var{0} != '_') {\n if (is_array($val) || is_object($val)) {",
" $val = serialize($val); ",
" $sql .= \"`$var`='\".$val.\"',\";\n } else {\n $sql .= \"`$var`='\" . $this->escapeString($val) . \"',\";\n }\n }\n }\n $sql = substr($sql, 0, -1) . \" WHERE \";\n if ($where != null)\n $sql .= $this->injectProof($where);\n else\n $sql .= \"`\" . $identifier . \"`=\" . $object->$identifier;",
" //if ($table == 'text') eDebug($sql,true); ",
" $res = (@mysqli_query($this->connection, $sql) != false);\n return $res;\n }",
"\t/**\n\t * Find the maximum value of a field. This is similar to a standard\n\t * SELECT MAX(field) ... query.\n\t *\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a maximum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return mixed\n\t */\n function max($table, $attribute, $groupfields = null, $where = null) {\n if (is_array($groupfields))\n $groupfields = implode(\",\", $groupfields);\n $sql = \"SELECT MAX($attribute) as fieldmax FROM `\" . $this->prefix . \"$table`\";\n if ($where != null)\n $sql .= \" WHERE $where\";\n if ($groupfields != null)\n $sql .= \" GROUP BY $groupfields\";",
" $res = @mysqli_query($this->connection, $sql);",
" if ($res != null)\n $res = mysqli_fetch_object($res);\n if (!$res)\n return null;\n return $res->fieldmax;\n }",
"\t/**\n\t * Find the minimum value of a field. This is similar to a standard\n\t * SELECT MIN(field) ... query.\n\t *\n\t * @internal Internal\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a minimum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return null\n\t */\n function min($table, $attribute, $groupfields = null, $where = null) {\n if (is_array($groupfields))\n $groupfields = implode(\",\", $groupfields);\n $sql = \"SELECT MIN($attribute) as fieldmin FROM `\" . $this->prefix . \"$table`\";\n if ($where != null)\n $sql .= \" WHERE $where\";\n if ($groupfields != null)\n $sql .= \" GROUP BY $groupfields\";",
" $res = @mysqli_query($this->connection, $sql);",
" if ($res != null)\n $res = mysqli_fetch_object($res);\n if (!$res)\n return null;\n return $res->fieldmin;\n }",
" /**\n * Increment a numeric table field in a table.\n *\n * @param string $table The name of the table to increment in.\n * @param string $field The field to increment.\n * @param integer $step The step value. Usually 1. This can be negative, to\n * decrement, but the decrement() method is preferred, for readability.\n * @param string $where Optional criteria to determine which records to update.\n * @return mixed\n */\n function increment($table, $field, $step, $where = null) {\n if ($where == null)\n $where = \"1\";\n $sql = \"UPDATE `\" . $this->prefix . \"$table` SET `$field`=`$field`+$step WHERE $where\";\n return @mysqli_query($this->connection, $sql);\n }",
" /**\n * Check to see if the named table exists in the database.\n * Returns true if the table exists, and false if it doesn't.\n *\n * @param string $table Name of the table to look for.\n * @return bool\n */\n function tableExists($table) {\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` LIMIT 0,1\");\n return ($res != null);\n }",
" /**\n * Get a list of all tables in the database. Optionally, only the tables\n * in the current logical database (tables with the same prefix) can\n * be retrieved.\n *\n * @param bool $prefixed_only Whether to return only the tables\n * for the logical database, or all tables in the physical database.\n * @return array\n */\n function getTables($prefixed_only=true) {\n $res = @mysqli_query($this->connection, \"SHOW TABLES\");\n $tables = array();\n for ($i = 0; $res && $i < mysqli_num_rows($res); $i++) {\n $tmp = mysqli_fetch_array($res);\n if ($prefixed_only && substr($tmp[0], 0, strlen($this->prefix)) == $this->prefix) {\n $tables[] = $tmp[0];\n } else if (!$prefixed_only) {\n $tables[] = $tmp[0];\n }\n }\n return $tables;\n }",
" /**\n * Runs whatever table optimization routines the database engine supports.\n *\n * @param string $table The name of the table to optimize.\n * @return bool\n */\n function optimize($table) {\n $res = (@mysqli_query($this->connection, \"OPTIMIZE TABLE `\" . $this->prefix . \"$table`\") != false);\n return $res;\n }",
" /**\n * Retrieve table information for a named table.\n * Returns an object, with the following attributes:\n * <ul>\n * <li><b>rows</b> -- The number of rows in the table.</li>\n * <li><b>average_row_length</b> -- The average storage size of a row in the table.</li>\n * <li><b>data_total</b> -- How much total disk space is used by the table.</li>\n * <li><b>data_overhead</b> -- How much storage space in the table is unused (for compacting purposes)</li>\n * </ul>\n * @param $table\n * @return null\n */\n function tableInfo($table) {\n $sql = \"SHOW TABLE STATUS LIKE '\" . $this->prefix . \"$table'\";\n $res = @mysqli_query($this->connection, $sql);\n if (!$res)\n return null;\n return $this->translateTableStatus(mysqli_fetch_object($res));\n }",
" /**\n * Returns table information for all tables in the database.\n * This function effectively calls tableInfo() on each table found.\n * @return array\n */\n function databaseInfo() {\n// $sql = \"SHOW TABLE STATUS\";\n $res = @mysqli_query($this->connection, \"SHOW TABLE STATUS LIKE '\" . $this->prefix . \"%'\");\n $info = array();\n for ($i = 0; $res && $i < mysqli_num_rows($res); $i++) {\n $obj = mysqli_fetch_object($res);\n $info[substr($obj->Name, strlen($this->prefix))] = $this->translateTableStatus($obj);\n }\n return $info;\n }",
"\t/**\n\t * @param $table\n\t * @return array\n\t */\n function describeTable($table) {\n if (!$this->tableExists($table))\n return array();\n $res = @mysqli_query($this->connection, \"DESCRIBE `\" . $this->prefix . \"$table`\");\n $dd = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $fieldObj = mysqli_fetch_object($res);",
" $fieldObj->ExpFieldType = $this->getDDFieldType($fieldObj);\n if ($fieldObj->ExpFieldType == DB_DEF_STRING) {\n $fieldObj->ExpFieldLength = $this->getDDStringLen($fieldObj);\n }",
" $dd[$fieldObj->Field] = $fieldObj;\n }",
" return $dd;\n }",
" /**\n * Build a data definition from a pre-existing table. This is used\n * to intelligently alter tables that have already been installed.\n *\n * @param string $table The name of the table to get a data definition for.\n * @return array|null\n */\n function getDataDefinition($table) {\n // make sure the table exists\n if (!$this->tableExists($table))\n return array();",
" // check if we have a cached version of this table description.\n if (expSession::issetTableCache($table))\n return expSession::getTableCache($table);",
" $res = @mysqli_query($this->connection, \"DESCRIBE `\" . $this->prefix . \"$table`\");\n $dd = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $fieldObj = mysqli_fetch_object($res);",
" $field = array();\n $field[DB_FIELD_TYPE] = $this->getDDFieldType($fieldObj);\n if ($field[DB_FIELD_TYPE] == DB_DEF_STRING) {\n $field[DB_FIELD_LEN] = $this->getDDStringLen($fieldObj);\n }\n //additional field attributes\n $default = $this->getDDDefault($fieldObj);\n if ($default != null)\n $field[DB_DEFAULT] = $default;\n $field[DB_INCREMENT] = $this->getDDAutoIncrement($fieldObj);\n $key = $this->getDDKey($fieldObj);\n if ($key)\n $field[$key] = true;",
" $dd[$fieldObj->Field] = $field;\n }",
" // save this table description to cache so we don't need to go the DB next time.\n expSession::setTableCache($table, $dd);\n return $dd;\n }",
" /**\n * Returns an error message from the database server. This is intended to be\n * used by the implementers of the database wrapper, so that certain\n * cryptic error messages can be reworded.\n * @return string\n */\n function error() {\n if ($this->connection && mysqli_errno($this->connection) != 0) {\n $errno = mysqli_errno($this->connection);\n switch ($errno) {\n case 1046:\n return \"1046 : \".gt(\"Selected database does not exist\");\n default:\n return mysqli_errno($this->connection) . \" : \" . mysqli_error($this->connection);\n }\n } else if ($this->connection == false) {\n return gt(\"Unable to connect to database server\");\n } else\n return \"\";\n }",
" /**\n * Checks whether the database connection has experienced an error.\n * @return bool\n */\n function inError() {\n return ($this->connection != null && mysqli_errno($this->connection) != 0);\n }",
"\t/**",
"\t * Unescape a string based on the database connection",
"\t * @param $string\n\t * @return string\n\t */\n\tfunction escapeString($string) {\n\t return (mysqli_real_escape_string($this->connection, $string));\n\t}",
" /**\n * Select an array of arrays\n *\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param string $orderby\n * @return array\n */\n function selectArrays($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;",
" $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }",
" /**\n * Select an array of arrays\n *\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $sql The name of the table/object to look at\n * @return array\n */",
" function selectArraysBySql($sql) { ",
" $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }",
" /**\n * Select a record from the database as an array\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array|void\n */\n function selectArray($table, $where = null, $orderby = null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $orderby = empty($orderby) ? '' : \"ORDER BY \" . $orderby;\n $sql = \"SELECT * FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where $orderby LIMIT 0,1\";\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n return mysqli_fetch_assoc($res);\n }",
" /**\n * Instantiate objects from selected records from the database\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param string $classname\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @param null $order\n * @param null $limitsql\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array\n */\n function selectExpObjects($table, $where=null, $classname, $get_assoc=true, $get_attached=true, $except=array(), $cascade_except=false, $order=null, $limitsql=null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $sql = \"SELECT * FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where\";\n $sql .= empty($order) ? '' : ' ORDER BY ' . $order;\n $sql .= empty($limitsql) ? '' : $limitsql;\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n $arrays = array();\n $numrows = mysqli_num_rows($res);\n for ($i = 0; $i < $numrows; $i++) { //FIXME this can run us out of memory with too many rows\n $assArr = mysqli_fetch_assoc($res);\n $assArr['except'] = $except;\n if($cascade_except) $assArr['cascade_except'] = $cascade_except;\n $arrays[] = new $classname($assArr, $get_assoc, $get_attached);\n }\n return $arrays;\n }",
" /**\n * Instantiate objects from selected records from the database",
" * @param string $sql The sql statement to run on the model/classname\n * @param string $classname Can be $this->baseclassname\n * Returns an array of fields\n * @param bool $get_assoc\n * @param bool $get_attached\n * @return array\n */\n function selectExpObjectsBySql($sql, $classname, $get_assoc=true, $get_attached=true) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n $numrows = mysqli_num_rows($res);\n for ($i = 0; $i < $numrows; $i++)\n $arrays[] = new $classname(mysqli_fetch_assoc($res), true, true);\n return $arrays;\n }",
"\t/**\n\t * This function returns all the text columns in the given table\n\t * @param $table\n\t * @return array\n\t */\n\tfunction getTextColumns($table) {\n\t\t$sql = \"SHOW COLUMNS FROM \" . $this->prefix.$table . \" WHERE type = 'text' OR type like 'varchar%'\";\n\t\t$res = @mysqli_query($this->connection, $sql);\n\t\tif ($res == null)\n return array();\n\t\t$records = array();\n\t\twhile($row = mysqli_fetch_object($res)) {\n\t\t\t$records[] = $row->Field;\n\t\t}",
"\t\t",
"\t\treturn $records;\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class mysqli_database\n *\n * This is the MySQLi-specific implementation of the database class.\n * @package Subsystems\n * @subpackage Database\n */\n/** @define \"BASE\" \"../..\" */",
"class mysqli_database extends database {",
" /**\n * Make a connection to the Database Server\n *\n * Takes the supplied credentials (username / password) and tries to\n * connect to the server and select the given database. All the rules\n * governing mysqli_connect also govern this method.\n *\n * @param string $username The username to connect to the server as.\n * @param string $password The password for $username\n * @param string $hostname The hostname of the database server. If\n * localhost is specified, a local socket connection will be attempted.\n * @param string $database The name of the database to use. Multi-database\n * sites are still not yet supported.\n * @param bool $new Whether or not to force the PHP connection function to establish\n * a distinctly new connection handle to the server.\n */",
"\tfunction __construct($username, $password, $hostname, $database, $new=false) {\n\t\tif (strstr($hostname,':')) {\n\t\t\tlist ( $host, $port ) = @explode (\":\", $hostname);\n\t\t} else {\n $host = $hostname;\n }\n\t\tif ($this->connection = @mysqli_connect($host, $username, $password, $database, $port)) {\n\t\t\t$this->havedb = true;\n\t\t}\n\t\t//fix to support utf8, warning it only works from a certain mySQL version on\n\t\t//needed on mySQL servers that don't have the default connection encoding setting to utf8",
"\t\t//As we do not have any setting for ISAM or InnoDB tables yet, i set the minimum specs\n\t\t// for using this feature to 4.1.2, although isam tables got the support for utf8 already in 4.1\n\t\t//anything else would result in an inconsistent user experience\n\t\t//TODO: determine how to handle encoding on postgres",
"\t\tlist($major, $minor, $micro) = sscanf(@mysqli_get_server_info($this->connection), \"%d.%d.%d-%s\");\n\t\tif(defined('DB_ENCODING')) {\n\t\t\t//SET NAMES is possible since version 4.1\n\t\t\tif(($major > 4) OR (($major == 4) AND ($minor >= 1))) {\n\t\t\t\t@mysqli_query($this->connection, \"SET NAMES \" . DB_ENCODING);\n\t\t\t}\n\t\t}",
"\t\t$this->prefix = DB_TABLE_PREFIX . '_';\n\t}",
" /**\n * Create a new Table\n *\n * Creates a new database table, according to the passed data definition.\n *\n * This function abides by the Exponent Data Definition Language, and interprets\n * its general structure for MySQL.\n *\n * @param string $tablename The name of the table to create\n * @param array $datadef The data definition to create, expressed in\n * the Exponent Data Definition Language.\n * @param array $info Information about the table itself.\n * @return array\n\t */\n\tfunction createTable($tablename, $datadef, $info) {\n\t\tif (!is_array($info))\n $info = array(); // Initialize for later use.",
"\t\t$sql = \"CREATE TABLE `\" . $this->prefix . \"$tablename` (\";\n\t\t$primary = array();\n\t\t$fulltext = array();\n\t\t$unique = array();\n\t\t$index = array();\n\t\tforeach ($datadef as $name=>$def) {\n\t\t\tif ($def != null) {\n\t\t\t\t$sql .= $this->fieldSQL($name,$def) . \",\";\n\t\t\t\tif (!empty($def[DB_PRIMARY])) $primary[] = $name;\n\t\t\t\tif (!empty($def[DB_FULLTEXT])) $fulltext[] = $name;\n\t\t\t\tif (isset($def[DB_INDEX]) && ($def[DB_INDEX] > 0)) {\n\t\t\t\t\tif ($def[DB_FIELD_TYPE] == DB_DEF_STRING) {\n\t\t\t\t\t\t$index[$name] = $def[DB_INDEX];\n } else {\n $index[$name] = 0;\n }\n }\n if (isset($def[DB_UNIQUE])) {\n if (!isset($unique[$def[DB_UNIQUE]]))\n $unique[$def[DB_UNIQUE]] = array();\n $unique[$def[DB_UNIQUE]][] = $name;\n }\n }\n }\n $sql = substr($sql, 0, -1);\n if (count($primary)) {\n $sql .= \", PRIMARY KEY ( `\" . implode(\"` , `\", $primary) . \"`)\";\n }\n if (count($fulltext)) {\n// $sql .= \", FULLTEXT ( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n $sql .= \", FULLTEXT `\" . $fulltext[0] . \"`\" . \"( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n }\n if (!empty($unique)) foreach ($unique as $key => $value) {\n $sql .= \", UNIQUE `\" . $key . \"` ( `\" . implode(\"` , `\", $value) . \"`)\";\n }\n foreach ($index as $key => $value) {\n $sql .= \", INDEX (`\" . $key . \"`\" . (($value > 0) ? \"(\" . $value . \")\" : \"\") . \")\";\n }\n $sql .= \")\";\n if (defined(DB_ENCODING)) {\n $sql .= \" ENGINE = MYISAM CHARACTER SET \" . DB_ENCODING;\n } else {\n $sql .= \" ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci\";\n }",
" if (isset($info[DB_TABLE_COMMENT])) {\n $sql .= \" COMMENT = '\" . $info[DB_TABLE_COMMENT] . \"'\";\n }",
" @mysqli_query($this->connection, $sql);",
" $return = array(\n $tablename => ($this->tableExists($tablename) ? DATABASE_TABLE_INSTALLED : DATABASE_TABLE_FAILED)\n );",
" return $return;\n }",
" /**\n * Alter an existing table\n *\n * Alters the structure of an existing database table to conform to the passed\n * data definition.\n *\n * This function abides by the Exponent Data Definition Language, and interprets\n * its general structure for MySQL.\n *\n * @param string $tablename The name of the table to alter\n * @param array $newdatadef The new data definition for the table.\n * This is expressed in the Exponent Data Definition Language\n * @param array $info Information about the table itself.\n * @param bool $aggressive Whether or not to aggressively update the table definition.\n * An aggressive update will drop columns in the table that are not in the Exponent definition.\n * @return array\n */\n function alterTable($tablename, $newdatadef, $info, $aggressive = false) {\n expSession::clearAllUsersSessionCache();\n $dd = $this->getDataDefinition($tablename);\n $modified = false;",
" // collect any indexes & keys to the table\n $primary = array();\n $fulltext = array();\n $unique = array();\n $index = array();\n foreach ($newdatadef as $name=>$def) {\n if ($def != null) {\n if (!empty($def[DB_PRIMARY])) $primary[] = $name;\n if (!empty($def[DB_FULLTEXT])) $fulltext[] = $name;\n if (isset($def[DB_INDEX]) && ($def[DB_INDEX] > 0)) {\n if ($def[DB_FIELD_TYPE] == DB_DEF_STRING) {\n $index[$name] = $def[DB_INDEX];\n } else {\n $index[$name] = 0;\n }\n }\n if (isset($def[DB_UNIQUE])) {\n if (!isset($unique[$def[DB_UNIQUE]]))\n $unique[$def[DB_UNIQUE]] = array();\n $unique[$def[DB_UNIQUE]][] = $name;\n }\n }\n }",
" //Drop any old columns from the table if aggressive mode is set.\n if ($aggressive) {\n //update primary keys to 'release' columns\n $sql = \"ALTER IGNORE TABLE `\" . $this->prefix . \"$tablename` \";\n if (count($primary)) {\n $sql .= \" DROP PRIMARY KEY, ADD PRIMARY KEY ( `\" . implode(\"` , `\",$primary) . \"` )\";\n }\n @mysqli_query($this->connection, $sql);",
" if (is_array($newdatadef) && is_array($dd)) {\n $oldcols = @array_diff_assoc($dd, $newdatadef);\n if (count($oldcols)) {\n $modified = true;\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n foreach ($oldcols as $name => $def) {\n $sql .= \" DROP COLUMN \" . $name . \",\";\n }\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }\n }\n }",
" //Add any new columns to the table\n if (is_array($newdatadef) && is_array($dd)) {\n $diff = @array_diff_assoc($newdatadef, $dd);\n if (count($diff)) {\n $modified = true;\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n foreach ($diff as $name => $def) {\n $sql .= \" ADD COLUMN (\" . $this->fieldSQL($name, $def) . \"),\";\n }\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }",
" // alter any existing columns here\n $diff_c = @expCore::array_diff_assoc_recursive($newdatadef, $dd);\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n $changed = false;\n if (is_array($diff_c)) {\n foreach ($diff_c as $name => $def) {\n if (!array_key_exists($name, $diff) && (isset($def[DB_FIELD_TYPE]) || isset($def[DB_FIELD_LEN]) || isset($def[DB_DEFAULT]) || isset($def[DB_INCREMENT]))) { // wasn't a new column\n if ($dd[$name][DB_FIELD_TYPE] == DB_DEF_STRING) {\n //check for actual lengths vs. exp placeholder lengths\n $newlen = $newdatadef[$name][DB_FIELD_LEN];\n $len = $dd[$name][DB_FIELD_LEN];\n if ($len >= 16777216 && $newlen >= 16777216) {\n continue;\n }\n if ($len >= 65536 && $newlen >= 65536) {\n continue;\n }\n if ($len >= 256 && $newlen >= 256) {\n continue;\n }\n }\n $changed = true;\n $sql .= ' MODIFY ' . $this->fieldSQL($name,$newdatadef[$name]) . \",\";\n }\n }\n }\n if ($changed) {\n $modified = true;\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }\n }",
" //Add any new indexes & keys to the table\n $sql = \"ALTER\" . (empty($aggressive) ? \"\" : \" IGNORE\") . \" TABLE `\" . $this->prefix . \"$tablename` \";",
" $sep = false;\n if (count($primary)) {\n $sql .= \" DROP PRIMARY KEY, ADD PRIMARY KEY ( `\" . implode(\"` , `\",$primary) . \"` )\";\n $sep = true;\n }\n if (count($fulltext)) {\n if ($sep) $sql .= ' ,';\n// $sql .= \" ADD FULLTEXT ( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n // drop the index first so we don't get dupes\n $drop = \"DROP INDEX \" . $fulltext[0] . \" ON \" . $this->prefix . $tablename;\n @mysqli_query($this->connection, $drop);\n $sql .= \" ADD FULLTEXT `\" . $fulltext[0] . \"`\" . \"( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n $sep = true;\n }\n if (!empty($unique)) foreach ($unique as $key=>$value) {\n if ($sep) $sql .= ' ,';\n $sql .= \", ADD UNIQUE `\".$key.\"` ( `\" . implode(\"` , `\",$value) . \" `)\";\n $sep = true;\n }",
" foreach ($index as $key => $value) {\n // drop the index first so we don't get dupes\n $drop = \"DROP INDEX \" . $key . \" ON \" . $this->prefix . $tablename;\n @mysqli_query($this->connection, $drop);",
" // re-add the index\n if ($sep) $sql .= ' ,';\n// $sql .= \" ADD INDEX (`\" . $key . \"`)\"; //FIXME we don't add column length??\n $sql .= \" ADD INDEX (`\" . $key . \"`\" . (($value > 0) ? \"(\" . $value . \")\" : \"\") . \")\";\n $sep = true;\n }\n @mysqli_query($this->connection, $sql);",
" //Get the return code\n $return = array(\n $tablename => ($modified ? TABLE_ALTER_SUCCEEDED : TABLE_ALTER_NOT_NEEDED)\n );",
" return $return;\n }",
" /**\n * Drop a table from the database\n *\n * Removes an existing table from the database. Returns true if the table was dropped, false if there\n * was an error returned by the MySQL server.\n *\n * @param string $table The name of the table to drop.\n * @return bool\n */\n function dropTable($table) {\n return @mysqli_query($this->connection, \"DROP TABLE `\" . $this->prefix . \"$table`\") !== false;\n }",
" /**\n * Run raw SQL. Returns true if the query succeeded, and false\n * if an error was returned from the MySQL server.\n *\n * <div style=\"color:red\">If you can help it, do not use this function. It presents Database Portability Issues.</div>\n *\n * Runs a straight SQL query on the database. This is not a\n * very portable way of dealing with the database, and is only\n * provided as a last resort.\n *\n * @param string $sql The SQL query to run\n\t * @param bool $escape Indicates if the query will be escape\n * @return mixed\n */\n function sql($sql, $escape = true) {\n\t\tif($escape == true) {\n\t\t\t$res = @mysqli_query($this->connection, mysqli_real_escape_string($this->connection, $sql));\n\t\t} else {\n\t\t\t$res = @mysqli_query($this->connection, $sql);\n\t\t}\n return $res;\n }",
"\t/**\n\t * Update a column in all records in a table\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param $val\n\t * @param int|null $where\n\t * @return void\n\t */",
" function columnUpdate($table, $col, $val, $where=1) {",
" $res = @mysqli_query($this->connection, \"UPDATE `\" . $this->prefix . \"$table` SET `$col`='\" . $val . \"' WHERE $where\");\n /*if ($res == null)\n return array();\n $objects = array();\n for ($i = 0; $i < mysqli_num_rows($res); $i++)\n $objects[] = mysqli_fetch_object($res);*/\n //return $objects;\n }",
" /**\n * Select a series of objects\n *\n * Selects a set of objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of objects, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @return array\n */\n function selectObjects($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;",
" $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }",
"\t/**\n\t * @param $terms\n\t * @param null $where\n\t * @return array\n\t */\n function selectSearch($terms, $where = null) {\n if ($where == null)\n $where = \"1\";",
" $sql = \"SELECT *, MATCH (s.title, s.body) AGAINST ('\" . $terms . \"*') as score from \" . $this->prefix . \"search as s \";\n $sql .= \"WHERE MATCH (title, body) against ('\" . $terms . \"*' IN BOOLEAN MODE) ORDER BY score DESC\";\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }",
"\t/**\n\t * @param null $colsA\n\t * @param null $colsB\n\t * @param $tableA\n\t * @param $tableB\n\t * @param $keyA\n\t * @param null $keyB\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array'\n\t */\n function selectAndJoinObjects($colsA=null, $colsB=null, $tableA, $tableB, $keyA, $keyB=null, $where = null, $orderby = null) {\n $sql = 'SELECT ';\n if ($colsA != null) {\n if (!is_array($colsA)) {\n $sql .= 'a.' . $colsA . ', ';\n } else {\n foreach ($colsA as $colA) {\n $sql .= 'a.' . $colA . ', ';\n }\n }\n } else {\n $sql .= ' a.*, ';\n }",
" if ($colsB != null) {\n if (!is_array($colsB)) {\n $sql .= 'b.' . $colsB . ' ';\n } else {\n $i = 1;\n foreach ($colsB as $colB) {\n $sql .= 'b.' . $colB;\n if ($i < count($colsB))\n $sql .= ', ';\n $i++;\n }\n }\n } else {\n $sql .= ' b.* ';\n }",
" $sql .= ' FROM ' . $this->prefix . $tableA . ' a JOIN ' . $this->prefix . $tableB . ' b ';\n $sql .= is_null($keyB) ? 'USING(' . $keyA . ')' : 'ON a.' . $keyA . ' = b.' . $keyB;",
" if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;",
" $res = @mysqli_query($this->connection, $sql . \" WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }",
"\t/**\n * Select a single object by sql\n *\n\t * @param $sql\n\t * @return null|void\n\t */\n function selectObjectBySql($sql) {\n //$logFile = \"C:\\\\xampp\\\\htdocs\\\\supserg\\\\tmp\\\\queryLog.txt\";\n //$lfh = fopen($logFile, 'a');",
" //fwrite($lfh, $sql . \"\\n\");\n //fclose($lfh);",
" $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }",
"\t/**\n * Select a series of objects by sql\n *\n\t * @param $sql\n\t * @return array\n\t */\n function selectObjectsBySql($sql) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @param bool $distinct\n\t * @return array\n\t */\n function selectColumn($table, $col, $where = null, $orderby = null, $distinct=false) {\n if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n $dist = empty($distinct) ? '' : 'DISTINCT ';",
" $res = @mysqli_query($this->connection, \"SELECT \" . $dist . $col . \" FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_array($res, MYSQLI_NUM);\n $resarray[$i] = $row[0];\n }\n return $resarray;\n }",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return int\n\t */\n function selectSum($table, $col, $where = null) {\n if ($where == null)\n $where = \"1\";",
" $res = @mysqli_query($this->connection, \"SELECT SUM(\" . $col . \") FROM `\" . $this->prefix . \"$table` WHERE $where\");\n if ($res == null)\n return 0;\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_array($res, MYSQLI_NUM);\n $resarray[$i] = $row[0];\n }\n return $resarray[0];\n }",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array\n\t */\n function selectDropdown($table, $col, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;",
" $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_object($res);\n $resarray[$row->id] = $row->$col;\n }\n return $resarray;\n }",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return null\n\t */\n function selectValue($table, $col, $where=null) {\n if ($where == null)\n $where = \"1\";\n $sql = \"SELECT \" . $col . \" FROM `\" . $this->prefix . \"$table` WHERE $where LIMIT 0,1\";\n $res = @mysqli_query($this->connection, $sql);",
" if ($res == null)\n return null;\n $obj = mysqli_fetch_object($res);\n if (is_object($obj)) {\n return $obj->$col;\n } else {\n return null;\n }\n }",
"\t/**\n\t * @param $sql\n\t * @return null\n\t */\n function selectValueBySql($sql) {\n $res = $this->sql($sql);\n if ($res == null)\n return null;\n $r = mysqli_fetch_row($res);\n if (is_array($r)) {\n return $r[0];\n } else {\n return null;\n }\n }",
" /**\n * Select a series of objects, and return by ID\n *\n * Selects a set of objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of objects, in any random order. The indices of the array\n * are the IDs of the objects.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @return array\n */\n function selectObjectsIndexedArray($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");",
" if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $o = mysqli_fetch_object($res);\n $objects[$o->id] = $o;\n }\n return $objects;\n }",
" /**\n * Count Objects matching a given criteria\n *\n * @param string $table The name of the table to count objects in.\n * @param string $where Criteria for counting.\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return int\n */\n function countObjects($table, $where = null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $res = @mysqli_query($this->connection, \"SELECT COUNT(*) as c FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where\");\n if ($res == null)\n return 0;\n $obj = mysqli_fetch_object($res);\n return $obj->c;\n }",
" /**\n * Count Objects matching a given criteria using raw sql\n *\n * @param string $sql The sql query to be run\n * @return int\n */\n function countObjectsBySql($sql) {\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return 0;\n $obj = mysqli_fetch_object($res);\n return $obj->c;\n }",
" /**\n * Count Objects matching a given criteria using raw sql\n *\n * @param string $sql The sql query to be run\n * @return int|void\n */\n function queryRows($sql) {\n $res = @mysqli_query($this->connection, $sql);\n return empty($res) ? 0 : mysqli_num_rows($res);\n }",
" /**\n * Select a single object.\n *\n * Selects an objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a single record from a database table. Returns the\n * first record/object found (in the case of multiple-result queries,\n * there is no way to determine which of the set will be returned).\n * If no record(s) match the query, null is returned.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set.\n * @return object/null|void\n */\n function selectObject($table, $where) {\n $where = $this->injectProof($where);\n $res = mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where LIMIT 0,1\");\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }",
"\t/**\n\t * @param $table\n\t * @param string $lockType\n\t * @return mixed\n\t */\n\tfunction lockTable($table,$lockType=\"WRITE\") {\n $sql = \"LOCK TABLES `\" . $this->prefix . \"$table` $lockType\";",
"\n $res = mysqli_query($this->connection, $sql);",
" return $res;\n }",
"\t/**\n\t * @return mixed\n\t */\n\tfunction unlockTables() {\n $sql = \"UNLOCK TABLES\";",
"",
" $res = mysqli_query($this->connection, $sql);\n return $res;\n }",
"",
"\t/**\n * Insert an Object into some table in the Database\n *\n * This method will return the ID assigned to the new record by MySQL. Note that\n * object attributes starting with an underscore ('_') will be ignored and NOT inserted\n * into the table as a field value.\n *\n * @param object $object The object to insert.\n * @param string $table The logical table name to insert into. This does not include the table prefix, which\n * is automagically prepended for you.\n * @return int|void\n */\n function insertObject($object, $table) {",
" //if ($table==\"text\") eDebug($object,true);",
" $sql = \"INSERT INTO `\" . $this->prefix . \"$table` (\";\n $values = \") VALUES (\";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n if ($var{0} != '_') {\n $sql .= \"`$var`,\";\n if ($values != \") VALUES (\") {\n $values .= \",\";\n }\n $values .= \"'\" . $this->escapeString($val) . \"'\";\n }\n }\n $sql = substr($sql, 0, -1) . substr($values, 0) . \")\";\n //if($table=='text')eDebug($sql,true);\n if (@mysqli_query($this->connection, $sql) != false) {\n $id = mysqli_insert_id($this->connection);\n return $id;\n } else\n return 0;\n }",
" /**\n * Delete one or more objects from the given table.\n *\n * @param string $table The name of the table to delete from.\n * @param string $where Criteria for determining which record(s) to delete.\n * @return mixed\n */\n function delete($table, $where = null) {\n if ($where != null) {\n $res = @mysqli_query($this->connection, \"DELETE FROM `\" . $this->prefix . \"$table` WHERE $where\");\n return $res;\n } else {\n $res = @mysqli_query($this->connection, \"TRUNCATE TABLE `\" . $this->prefix . \"$table`\");\n return $res;\n }\n }",
" /**\n * Update one or more objects in the database.\n *\n * This function will only update the attributes of the resulting record(s)\n * that are also member attributes of the $object object.\n *\n * @param object $object An object specifying the fields and values for updating.\n * In most cases, this will be the altered object originally returned from one of\n * the select* methods.\n * @param string $table The table to update in.\n * @param string $where Optional criteria used to narrow the result set.\n * @param string $identifier\n * @param bool $is_revisioned\n * @return bool|int|void\n */\n function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {",
" if ($is_revisioned) {\n $object->revision_id++;\n //if ($table==\"text\") eDebug($object);\n $res = $this->insertObject($object, $table);",
" //if ($table==\"text\") eDebug($object,true);",
" $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);\n return $res;\n }\n $sql = \"UPDATE \" . $this->prefix . \"$table SET \";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n //if($is_revisioned && $var=='revision_id') $val++;\n if ($var{0} != '_') {\n if (is_array($val) || is_object($val)) {",
" $val = serialize($val);",
" $sql .= \"`$var`='\".$val.\"',\";\n } else {\n $sql .= \"`$var`='\" . $this->escapeString($val) . \"',\";\n }\n }\n }\n $sql = substr($sql, 0, -1) . \" WHERE \";\n if ($where != null)\n $sql .= $this->injectProof($where);\n else\n $sql .= \"`\" . $identifier . \"`=\" . $object->$identifier;",
" //if ($table == 'text') eDebug($sql,true);",
" $res = (@mysqli_query($this->connection, $sql) != false);\n return $res;\n }",
"\t/**\n\t * Find the maximum value of a field. This is similar to a standard\n\t * SELECT MAX(field) ... query.\n\t *\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a maximum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return mixed\n\t */\n function max($table, $attribute, $groupfields = null, $where = null) {\n if (is_array($groupfields))\n $groupfields = implode(\",\", $groupfields);\n $sql = \"SELECT MAX($attribute) as fieldmax FROM `\" . $this->prefix . \"$table`\";\n if ($where != null)\n $sql .= \" WHERE $where\";\n if ($groupfields != null)\n $sql .= \" GROUP BY $groupfields\";",
" $res = @mysqli_query($this->connection, $sql);",
" if ($res != null)\n $res = mysqli_fetch_object($res);\n if (!$res)\n return null;\n return $res->fieldmax;\n }",
"\t/**\n\t * Find the minimum value of a field. This is similar to a standard\n\t * SELECT MIN(field) ... query.\n\t *\n\t * @internal Internal\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a minimum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return null\n\t */\n function min($table, $attribute, $groupfields = null, $where = null) {\n if (is_array($groupfields))\n $groupfields = implode(\",\", $groupfields);\n $sql = \"SELECT MIN($attribute) as fieldmin FROM `\" . $this->prefix . \"$table`\";\n if ($where != null)\n $sql .= \" WHERE $where\";\n if ($groupfields != null)\n $sql .= \" GROUP BY $groupfields\";",
" $res = @mysqli_query($this->connection, $sql);",
" if ($res != null)\n $res = mysqli_fetch_object($res);\n if (!$res)\n return null;\n return $res->fieldmin;\n }",
" /**\n * Increment a numeric table field in a table.\n *\n * @param string $table The name of the table to increment in.\n * @param string $field The field to increment.\n * @param integer $step The step value. Usually 1. This can be negative, to\n * decrement, but the decrement() method is preferred, for readability.\n * @param string $where Optional criteria to determine which records to update.\n * @return mixed\n */\n function increment($table, $field, $step, $where = null) {\n if ($where == null)\n $where = \"1\";\n $sql = \"UPDATE `\" . $this->prefix . \"$table` SET `$field`=`$field`+$step WHERE $where\";\n return @mysqli_query($this->connection, $sql);\n }",
" /**\n * Check to see if the named table exists in the database.\n * Returns true if the table exists, and false if it doesn't.\n *\n * @param string $table Name of the table to look for.\n * @return bool\n */\n function tableExists($table) {\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` LIMIT 0,1\");\n return ($res != null);\n }",
" /**\n * Get a list of all tables in the database. Optionally, only the tables\n * in the current logical database (tables with the same prefix) can\n * be retrieved.\n *\n * @param bool $prefixed_only Whether to return only the tables\n * for the logical database, or all tables in the physical database.\n * @return array\n */\n function getTables($prefixed_only=true) {\n $res = @mysqli_query($this->connection, \"SHOW TABLES\");\n $tables = array();\n for ($i = 0; $res && $i < mysqli_num_rows($res); $i++) {\n $tmp = mysqli_fetch_array($res);\n if ($prefixed_only && substr($tmp[0], 0, strlen($this->prefix)) == $this->prefix) {\n $tables[] = $tmp[0];\n } else if (!$prefixed_only) {\n $tables[] = $tmp[0];\n }\n }\n return $tables;\n }",
" /**\n * Runs whatever table optimization routines the database engine supports.\n *\n * @param string $table The name of the table to optimize.\n * @return bool\n */\n function optimize($table) {\n $res = (@mysqli_query($this->connection, \"OPTIMIZE TABLE `\" . $this->prefix . \"$table`\") != false);\n return $res;\n }",
" /**\n * Retrieve table information for a named table.\n * Returns an object, with the following attributes:\n * <ul>\n * <li><b>rows</b> -- The number of rows in the table.</li>\n * <li><b>average_row_length</b> -- The average storage size of a row in the table.</li>\n * <li><b>data_total</b> -- How much total disk space is used by the table.</li>\n * <li><b>data_overhead</b> -- How much storage space in the table is unused (for compacting purposes)</li>\n * </ul>\n * @param $table\n * @return null\n */\n function tableInfo($table) {\n $sql = \"SHOW TABLE STATUS LIKE '\" . $this->prefix . \"$table'\";\n $res = @mysqli_query($this->connection, $sql);\n if (!$res)\n return null;\n return $this->translateTableStatus(mysqli_fetch_object($res));\n }",
" /**\n * Returns table information for all tables in the database.\n * This function effectively calls tableInfo() on each table found.\n * @return array\n */\n function databaseInfo() {\n// $sql = \"SHOW TABLE STATUS\";\n $res = @mysqli_query($this->connection, \"SHOW TABLE STATUS LIKE '\" . $this->prefix . \"%'\");\n $info = array();\n for ($i = 0; $res && $i < mysqli_num_rows($res); $i++) {\n $obj = mysqli_fetch_object($res);\n $info[substr($obj->Name, strlen($this->prefix))] = $this->translateTableStatus($obj);\n }\n return $info;\n }",
"\t/**\n\t * @param $table\n\t * @return array\n\t */\n function describeTable($table) {\n if (!$this->tableExists($table))\n return array();\n $res = @mysqli_query($this->connection, \"DESCRIBE `\" . $this->prefix . \"$table`\");\n $dd = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $fieldObj = mysqli_fetch_object($res);",
" $fieldObj->ExpFieldType = $this->getDDFieldType($fieldObj);\n if ($fieldObj->ExpFieldType == DB_DEF_STRING) {\n $fieldObj->ExpFieldLength = $this->getDDStringLen($fieldObj);\n }",
" $dd[$fieldObj->Field] = $fieldObj;\n }",
" return $dd;\n }",
" /**\n * Build a data definition from a pre-existing table. This is used\n * to intelligently alter tables that have already been installed.\n *\n * @param string $table The name of the table to get a data definition for.\n * @return array|null\n */\n function getDataDefinition($table) {\n // make sure the table exists\n if (!$this->tableExists($table))\n return array();",
" // check if we have a cached version of this table description.\n if (expSession::issetTableCache($table))\n return expSession::getTableCache($table);",
" $res = @mysqli_query($this->connection, \"DESCRIBE `\" . $this->prefix . \"$table`\");\n $dd = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $fieldObj = mysqli_fetch_object($res);",
" $field = array();\n $field[DB_FIELD_TYPE] = $this->getDDFieldType($fieldObj);\n if ($field[DB_FIELD_TYPE] == DB_DEF_STRING) {\n $field[DB_FIELD_LEN] = $this->getDDStringLen($fieldObj);\n }\n //additional field attributes\n $default = $this->getDDDefault($fieldObj);\n if ($default != null)\n $field[DB_DEFAULT] = $default;\n $field[DB_INCREMENT] = $this->getDDAutoIncrement($fieldObj);\n $key = $this->getDDKey($fieldObj);\n if ($key)\n $field[$key] = true;",
" $dd[$fieldObj->Field] = $field;\n }",
" // save this table description to cache so we don't need to go the DB next time.\n expSession::setTableCache($table, $dd);\n return $dd;\n }",
" /**\n * Returns an error message from the database server. This is intended to be\n * used by the implementers of the database wrapper, so that certain\n * cryptic error messages can be reworded.\n * @return string\n */\n function error() {\n if ($this->connection && mysqli_errno($this->connection) != 0) {\n $errno = mysqli_errno($this->connection);\n switch ($errno) {\n case 1046:\n return \"1046 : \".gt(\"Selected database does not exist\");\n default:\n return mysqli_errno($this->connection) . \" : \" . mysqli_error($this->connection);\n }\n } else if ($this->connection == false) {\n return gt(\"Unable to connect to database server\");\n } else\n return \"\";\n }",
" /**\n * Checks whether the database connection has experienced an error.\n * @return bool\n */\n function inError() {\n return ($this->connection != null && mysqli_errno($this->connection) != 0);\n }",
"\t/**",
"\t * Escape a string based on the database connection",
"\t * @param $string\n\t * @return string\n\t */\n\tfunction escapeString($string) {\n\t return (mysqli_real_escape_string($this->connection, $string));\n\t}",
" /**\n * Select an array of arrays\n *\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param string $orderby\n * @return array\n */\n function selectArrays($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;",
" $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }",
" /**\n * Select an array of arrays\n *\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $sql The name of the table/object to look at\n * @return array\n */",
" function selectArraysBySql($sql) {",
" $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }",
" /**\n * Select a record from the database as an array\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array|void\n */\n function selectArray($table, $where = null, $orderby = null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $orderby = empty($orderby) ? '' : \"ORDER BY \" . $orderby;\n $sql = \"SELECT * FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where $orderby LIMIT 0,1\";\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n return mysqli_fetch_assoc($res);\n }",
" /**\n * Instantiate objects from selected records from the database\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param string $classname\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @param null $order\n * @param null $limitsql\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array\n */\n function selectExpObjects($table, $where=null, $classname, $get_assoc=true, $get_attached=true, $except=array(), $cascade_except=false, $order=null, $limitsql=null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $sql = \"SELECT * FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where\";\n $sql .= empty($order) ? '' : ' ORDER BY ' . $order;\n $sql .= empty($limitsql) ? '' : $limitsql;\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n $arrays = array();\n $numrows = mysqli_num_rows($res);\n for ($i = 0; $i < $numrows; $i++) { //FIXME this can run us out of memory with too many rows\n $assArr = mysqli_fetch_assoc($res);\n $assArr['except'] = $except;\n if($cascade_except) $assArr['cascade_except'] = $cascade_except;\n $arrays[] = new $classname($assArr, $get_assoc, $get_attached);\n }\n return $arrays;\n }",
" /**\n * Instantiate objects from selected records from the database",
" * @param string $sql The sql statement to run on the model/classname\n * @param string $classname Can be $this->baseclassname\n * Returns an array of fields\n * @param bool $get_assoc\n * @param bool $get_attached\n * @return array\n */\n function selectExpObjectsBySql($sql, $classname, $get_assoc=true, $get_attached=true) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n $numrows = mysqli_num_rows($res);\n for ($i = 0; $i < $numrows; $i++)\n $arrays[] = new $classname(mysqli_fetch_assoc($res), true, true);\n return $arrays;\n }",
"\t/**\n\t * This function returns all the text columns in the given table\n\t * @param $table\n\t * @return array\n\t */\n\tfunction getTextColumns($table) {\n\t\t$sql = \"SHOW COLUMNS FROM \" . $this->prefix.$table . \" WHERE type = 'text' OR type like 'varchar%'\";\n\t\t$res = @mysqli_query($this->connection, $sql);\n\t\tif ($res == null)\n return array();\n\t\t$records = array();\n\t\twhile($row = mysqli_fetch_object($res)) {\n\t\t\t$records[] = $row->Field;\n\t\t}",
"",
"\t\treturn $records;\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the expDatabase subsystem\n * Handles all database abstraction in Exponent.\n *\n * @package Subsystems\n * @subpackage Subsystems\n */\nclass expDatabase {",
"\t/**\n\t * Connect to the Exponent database\n\t *\n\t * This function attempts to connect to the exponent database,\n\t * and then returns the database object to the caller.\n\t *\n\t * @param string $username the database username\n\t * @param string $password the database password\n\t * @param string $hostname the url of the database server\n\t * @param string $database the name of the database\n\t * @param string $dbclass\n\t * @param bool $new\n\t * @return \\database the database object\n\t */\n\tpublic static function connect($username,$password,$hostname,$database,$dbclass = '',$new=false,$log=null) {\n\t\tif (!defined('DB_ENGINE')) {\n\t\t\t$backends = array_keys(self::backends(1));\n\t\t\tif (count($backends)) {\n\t\t\t\tdefine('DB_ENGINE',$backends[0]);\n\t\t\t} else {\n\t\t\t\tdefine('DB_ENGINE','NOTSUPPORTED');\n\t\t\t}\n\t\t}\n\t\t(include_once(BASE.'framework/core/subsystems/database/'.DB_ENGINE.'.php')) or exit(gt('None of the installed Exponent Database Backends will work with this server\\'s version of PHP.'));\n\t\tif ($dbclass == '' || $dbclass == null) $dbclass = DB_ENGINE;\n\t\t(include_once(BASE.'framework/core/subsystems/database/'.$dbclass.'.php')) or exit(gt('The specified database backend').' ('.$dbclass.') '.gt('is not supported by Exponent'));\n\t\t$dbclass .= '_database';\n\t\t$newdb = new $dbclass($username,$password,$hostname,$database,$new,$log);\n if (!$newdb->tableExists('user')) {\n $newdb->havedb = false;\n }\n\t\treturn $newdb;\n\t}",
"\t/**\n\t * List all available database backends\n\t *\n\t * This function looks for available database engines,\n\t * and then returns an array to the caller.\n\t *\n\t * @param int $valid_only\n\t * @return Array An associative array of engine identifiers.\n\t *\tThe internal engine name is the key, and the external\n\t *\tdescriptive name is the value.\n\t */\n\tpublic static function backends($valid_only = 1) {\n\t\t$options = array();\n\t\t$dh = opendir(BASE.'framework/core/subsystems/database');\n\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\tif (is_file(BASE.'framework/core/subsystems/database/'.$file) && is_readable(BASE.'framework/core/subsystems/database/'.$file) && substr($file,-9,9) == '.info.php') {\n\t\t\t\t$info = include(BASE.'framework/core/subsystems/database/'.$file);\n\t\t\t\tif ($info['is_valid'] == 1 || !$valid_only) {\n\t\t\t\t\t$options[substr($file,0,-9)] = $info['name'];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $options;\n\t}",
" public static function fix_table_names() {\n global $db;",
" // fix table names\n $tablenames = array (\n 'content_expcats'=>'content_expCats',\n 'content_expcomments'=>'content_expComments',\n 'content_expdefinablefields'=>'content_expDefinableFields',\n 'content_expdefinablefields_value'=>'content_expDefinableFields_value',\n 'content_expfiles'=>'content_expFiles',\n 'content_expratings'=>'content_expRatings',\n 'content_expsimplenote'=>'content_expSimpleNote',\n 'content_exptags'=>'content_expTags',\n 'expcats'=>'expCats',\n 'expcomments'=>'expComments',\n 'expdefinablefields'=>'expDefinableFields',\n 'expealerts'=>'expeAlerts',\n 'expealerts_temp'=>'expeAlerts_temp',\n 'expfiles'=>'expFiles',\n 'expratings'=>'expRatings',\n 'exprss'=>'expRss',\n 'expsimplenote'=>'expSimpleNote',\n 'exptags'=>'expTags',\n\t\t\t'bing_product_types_storecategories'=>'bing_product_types_storeCategories',\n\t\t\t'google_product_types_storecategories'=>'google_product_types_storeCategories',\n\t\t\t'nextag_product_types_storecategories'=>'nextag_product_types_storeCategories',\n\t\t\t'pricegrabber_product_types_storecategories'=>'pricegrabber_product_types_storeCategories',\n\t\t\t'shopping_product_types_storecategories'=>'shopping_product_types_storeCategories',\n\t\t\t'shopzilla_product_types_storecategories'=>'shopzilla_product_types_storeCategories',\n\t\t\t'crosssellitem_product'=>'crosssellItem_product',\n\t\t\t'product_storecategories'=>'product_storeCategories',\n\t\t\t'storecategories'=>'storeCategories',\n );",
" $renamed = array();\n foreach ($tablenames as $oldtablename=>$newtablename) {\n if (!$db->tableExists($newtablename)) {\n $db->sql('RENAME TABLE '.$db->prefix.$oldtablename.' TO '.$db->prefix.$newtablename);\n $renamed[] = $newtablename;\n }\n }\n return $renamed;\n }",
" public static function install_dbtables($aggressive=false, $workflow=ENABLE_WORKFLOW) {\n \t global $db;",
" \t\texpSession::clearAllUsersSessionCache();\n \t\t$tables = array();",
" \t\t// first the core definitions\n \t\t$coredefs = BASE.'framework/core/definitions';\n \t\tif (is_readable($coredefs)) {\n \t\t\t$dh = opendir($coredefs);\n \t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\tif (is_readable(\"$coredefs/$file\") && is_file(\"$coredefs/$file\") && substr($file,-4,4) == \".php\" && substr($file,-9,9) != \".info.php\") {\n \t\t\t\t\t$tablename = substr($file,0,-4);\n \t\t\t\t\t$dd = include(\"$coredefs/$file\");\n \t\t\t\t\t$info = null;\n \t\t\t\t\tif (is_readable(\"$coredefs/$tablename.info.php\")) $info = include(\"$coredefs/$tablename.info.php\");\n \t\t\t\t\tif (!$db->tableExists($tablename)) {\n \t\t\t\t\t\tforeach ($db->createTable($tablename, $dd, $info) as $key=>$status) {\n \t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t}\n \t\t\t\t\t} else {\n \t\t\t\t\t\tforeach ($db->alterTable($tablename, $dd, $info, $aggressive) as $key=>$status) {\n//\t\t\t\t\t\t\tif (isset($tables[$key])) echo \"$tablename, $key<br>\"; //FIXME we shouldn't echo this, already installed?\n \t\t\t\t\t\t\tif ($status == TABLE_ALTER_FAILED){\n \t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t$tables[$key] = ($status == TABLE_ALTER_NOT_NEEDED ? DATABASE_TABLE_EXISTED : DATABASE_TABLE_ALTERED);\n \t\t\t\t\t\t\t}",
" \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}",
" \t\t// then search for module definitions\n \t\t$moddefs = array(\n \t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules',\n \t\t\tBASE.\"framework/modules\",\n \t\t\t);\n $models = expModules::initializeModels();\n \t\tforeach ($moddefs as $moddef) {\n \t\t\tif (is_readable($moddef)) {\n \t\t\t\t$dh = opendir($moddef);\n \t\t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\t\tif (is_dir($moddef.'/'.$file) && ($file != '..' && $file != '.')) {\n \t\t\t\t\t\t$dirpath = $moddef.'/'.$file.'/definitions';\n \t\t\t\t\t\tif (file_exists($dirpath)) {\n \t\t\t\t\t\t\t$def_dir = opendir($dirpath);\n \t\t\t\t\t\t\twhile (($def = readdir($def_dir)) !== false) {\n \t//\t\t\t\t\t\t\teDebug(\"$dirpath/$def\");\n \t\t\t\t\t\t\t\tif (is_readable(\"$dirpath/$def\") && is_file(\"$dirpath/$def\") && substr($def,-4,4) == \".php\" && substr($def,-9,9) != \".info.php\") {\n \t\t\t\t\t\t\t\t\t$tablename = substr($def,0,-4);\n \t\t\t\t\t\t\t\t\t$dd = include(\"$dirpath/$def\");\n \t\t\t\t\t\t\t\t\t$info = null;\n// foreach ($models as $modelname=>$modelpath) {\n $rev_aggressive = $aggressive;\n // add workflow fields\n if (!empty($models[substr($def,0,-4)])) {\n $modelname = substr($def,0,-4);\n $model = new $modelname();\n if ($model->supports_revisions && $workflow) {\n $dd['revision_id'] = array(\n DB_FIELD_TYPE=>DB_DEF_INTEGER,\n DB_PRIMARY=>true,\n DB_DEFAULT=>1,\n );\n $dd['approved'] = array(\n DB_FIELD_TYPE=>DB_DEF_BOOLEAN\n );\n $rev_aggressive = true;\n }\n }\n \t\t\t\t\t\t\t\t\tif (is_readable(\"$dirpath/$tablename.info.php\")) $info = include(\"$dirpath/$tablename.info.php\");\n \t\t\t\t\t\t\t\t\tif (!$db->tableExists($tablename)) {\n \t\t\t\t\t\t\t\t\t\tforeach ($db->createTable($tablename, $dd, $info) as $key=>$status) {\n \t\t\t\t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\tforeach ($db->alterTable($tablename, $dd, $info, $rev_aggressive) as $key=>$status) {\n//\t\t\t\t\t\t\t\t\t\t\tif (isset($tables[$key])) echo \"$tablename, $key<br>\"; //FIXME we shouldn't echo this, already installed?\n \t\t\t\t\t\t\t\t\t\t\tif ($status == TABLE_ALTER_FAILED){\n \t\t\t\t\t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t\t$tables[$key] = ($status == TABLE_ALTER_NOT_NEEDED ? DATABASE_TABLE_EXISTED : DATABASE_TABLE_ALTERED);\n \t\t\t\t\t\t\t\t\t\t\t}",
" \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn $tables;\n \t}\n}",
"/**\n* This is the class database\n*\n* This is the generic implementation of the database class.\n* @subpackage Database\n* @package Subsystems\n*/",
"abstract class database {",
"\t/**\n\t* @var string $connection Database connection string\n\t*/\n\tvar $connection = null;\n\t/**\n\t* @var boolean $havedb\n\t*/\n\tvar $havedb = false;\n\t/**\n\t* @var string $prefix Database prefix\n\t*/\n\tvar $prefix = \"\";",
"\t/**\n\t * Make a connection to the Database Server\n\t *\n\t * Takes the supplied credentials (username / password) and tries to\n\t * connect to the server and select the given database. All the rules\n\t * governing database connect also govern this method.\n\t *\n\t * @param string $username The username to connect to the server as.\n\t * @param string $password The password for $username\n\t * @param string $hostname The hostname of the database server. If\n\t * localhost is specified, a local socket connection will be attempted.\n\t * @param string $database The name of the database to use. Multi-database\n\t * sites are still not yet supported.\n\t * @param bool $new Whether or not to force the PHP connection function to establish\n\t * a distinctly new connection handle to the server.\n\t */",
"\t//\tfunction connect ($username, $password, $hostname, $database, $new=false) {\n\tabstract function __construct($username, $password, $hostname, $database, $new=false);",
"\t /**\n\t * Create a new Table\n\t *\n\t * Creates a new database table, according to the passed data definition.\n\t *\n\t * This function abides by the Exponent Data Definition Language, and interprets\n\t * its general structure for databases.\n\t *\n\t * @param string $tablename The name of the table to create\n\t * @param array $datadef The data definition to create, expressed in\n\t * the Exponent Data Definition Language.\n\t * @param array $info Information about the table itself.\n\t * @return array\n\t */\n\tabstract function createTable($tablename, $datadef, $info);",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $name\n\t* @param $def\n\t* @return bool|string\n\t*/\n\tfunction fieldSQL($name, $def) {\n\t $sql = \"`$name`\";\n\t if (!isset($def[DB_FIELD_TYPE])) {\n\t return false;\n\t }\n\t $type = $def[DB_FIELD_TYPE];\n\t if ($type == DB_DEF_ID) {\n\t $sql .= \" INT(11)\";\n\t } else if ($type == DB_DEF_BOOLEAN) {\n\t $sql .= \" TINYINT(1)\";\n\t } else if ($type == DB_DEF_TIMESTAMP) {\n\t $sql .= \" INT(14)\";\n } else if ($type == DB_DEF_DATETIME) {\n \t $sql .= \" DATETIME\";\n\t } else if ($type == DB_DEF_INTEGER) {\n\t $sql .= \" INT(8)\";\n\t } else if ($type == DB_DEF_STRING) {\n\t if (isset($def[DB_FIELD_LEN]) && is_int($def[DB_FIELD_LEN])) {\n\t $len = $def[DB_FIELD_LEN];\n\t if ($len < 256)\n\t $sql .= \" VARCHAR($len)\";\n\t else if ($len < 65536)\n\t $sql .= \" TEXT\";\n\t else if ($len < 16777216)\n\t $sql .= \" MEDIUMTEXT\";\n\t else\n\t $sql .= \"LONGTEXT\";\n\t } else { // default size of 'TEXT'instead of error\n $sql .= \" TEXT\";\n\t }\n\t } else if ($type == DB_DEF_DECIMAL) {\n\t $sql .= \" DOUBLE\";\n\t } else {\n\t return false; // must specify known FIELD_TYPE\n\t }\n\t $sql .= \" NOT NULL\";\n\t if (isset($def[DB_DEFAULT]))\n\t $sql .= \" DEFAULT '\" . $def[DB_DEFAULT] . \"'\";",
"\t if (isset($def[DB_INCREMENT]) && $def[DB_INCREMENT])\n\t $sql .= \" AUTO_INCREMENT\";\n\t return $sql;\n\t}",
"\t/**\n\t* Switch field values between two entries in a Table\n\t*\n\t* Switches values between two table entries for things like swapping rank, etc...\n\t* @param $table\n\t* @param $field\n\t* @param $a\n\t* @param $b\n\t* @param null $additional_where\n\t* @return bool\n\t*/\n\tfunction switchValues($table, $field, $a, $b, $additional_where = null) {\n\t if ($additional_where == null) {\n\t $additional_where = '1';\n\t }\n $a = intval($a);\n $b = intval($b);\n\t $object_a = $this->selectObject($table, \"$field='$a' AND $additional_where\");\n\t $object_b = $this->selectObject($table, \"$field='$b' AND $additional_where\");",
"\t if ($object_a && $object_b) {\n\t $tmp = $object_a->$field;\n\t $object_a->$field = $object_b->$field;\n\t $object_b->$field = $tmp;",
"\t $this->updateObject($object_a, $table);\n\t $this->updateObject($object_b, $table);",
"\t return true;\n\t } else {\n\t return false;\n\t }\n\t}",
"\t/**\n\t* Checks to see if the connection for this database object is valid.\n\t* @return bool True if the connection can be used to execute SQL queries.\n\t*/\n\tfunction isValid() {\n\t return ($this->connection != null && $this->havedb);\n\t}",
"\t/**\n\t* Test the privileges of the user account for the connection.\n\t* Tests run include:\n\t* <ul>\n\t* <li>CREATE TABLE</li>\n\t* <li>INSERT</li>\n\t* <li>SELECT</li>\n\t* <li>UPDATE</li>\n\t* <li>DELETE</li>\n\t* <li>ALTER TABLE</li>\n\t* <li>DROP TABLE</li>\n\t* </ul>\n\t* These tests must be performed in order, for logical reasons. Execution\n\t* terminates when the first test fails, and the status flag array is returned then.\n\t* Returns an array of status flags. Key is the test name. Value is a boolean,\n\t* true if the test succeeded, and false if it failed.\n\t* @return array\n\t*/\n\tfunction testPrivileges() {",
"\t $status = array();",
"\t $tablename = \"___testertable\" . uniqid(\"\");\n\t $dd = array(\n\t \"id\" => array(\n\t DB_FIELD_TYPE => DB_DEF_ID,\n\t DB_PRIMARY => true,\n\t DB_INCREMENT => true),\n\t \"name\" => array(\n\t DB_FIELD_TYPE => DB_DEF_STRING,\n\t DB_FIELD_LEN => 100)\n\t );",
"\t $this->createTable($tablename, $dd, array());\n\t if (!$this->tableExists($tablename)) {\n\t $status[\"CREATE TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"CREATE TABLE\"] = true;",
"\t $o = new stdClass();\n\t $o->name = \"Testing Name\";\n\t $insert_id = $this->insertObject($o, $tablename);\n\t if ($insert_id == 0) {\n\t $status[\"INSERT\"] = false;\n\t return $status;\n\t } else\n\t $status[\"INSERT\"] = true;",
"\t $o = $this->selectObject($tablename, \"id=\" . $insert_id);\n\t if ($o == null || $o->name != \"Testing Name\") {\n\t $status[\"SELECT\"] = false;\n\t return $status;\n\t } else\n\t $status[\"SELECT\"] = true;",
"\t $o->name = \"Testing 2\";\n\t if (!$this->updateObject($o, $tablename)) {\n\t $status[\"UPDATE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"UPDATE\"] = true;",
"\t $this->delete($tablename, \"id=\" . $insert_id);\n\t $o = $this->selectObject($tablename, \"id=\" . $insert_id);\n\t if ($o != null) {\n\t $status[\"DELETE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"DELETE\"] = true;",
"\t $dd[\"thirdcol\"] = array(\n\t DB_FIELD_TYPE => DB_DEF_TIMESTAMP);",
"\t $this->alterTable($tablename, $dd, array());\n\t $o = new stdClass();\n\t $o->name = \"Alter Test\";\n\t $o->thirdcol = \"Third Column\";\n\t if (!$this->insertObject($o, $tablename)) {\n\t $status[\"ALTER TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"ALTER TABLE\"] = true;",
"\t $this->dropTable($tablename);\n\t if ($this->tableExists($tablename)) {\n\t $status[\"DROP TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"DROP TABLE\"] = true;",
"\t foreach ($this->getTables() as $t) {\n\t if (substr($t, 0, 14 + strlen($this->prefix)) == $this->prefix . \"___testertable\")\n\t $this->dropTable($t);\n\t }",
"\t return $status;\n\t}",
"\t/**\n\t* Alter an existing table\n\t*\n\t* Alters the structure of an existing database table to conform to the passed\n\t* data definition.\n\t*\n\t* This function abides by the Exponent Data Definition Language, and interprets\n\t* its general structure for databases.\n\t*\n\t* @param string $tablename The name of the table to alter\n\t* @param array $newdatadef The new data definition for the table.\n\t* This is expressed in the Exponent Data Definition Language\n\t* @param array $info Information about the table itself.\n\t* @param bool $aggressive Whether or not to aggressively update the table definition.\n\t* An aggressive update will drop columns in the table that are not in the Exponent definition.\n\t* @return array\n\t*/\n\tabstract function alterTable($tablename, $newdatadef, $info, $aggressive = false);",
"\t/**\n\t* Drop a table from the database\n\t*\n\t* Removes an existing table from the database. Returns true if the table was dropped, false if there\n\t* was an error returned by the database server.\n\t*\n\t* @param string $table The name of the table to drop.\n\t* @return bool\n\t*/\n\tabstract function dropTable($table);",
"\t/**\n\t * Run raw SQL. Returns true if the query succeeded, and false\n\t * if an error was returned from the database server.\n\t *\n\t * <div style=\"color:red\">If you can help it, do not use this function. It presents Database Portability Issues.</div>\n\t *\n\t * Runs a straight SQL query on the database. This is not a\n\t * very portable way of dealing with the database, and is only\n\t * provided as a last resort.\n\t *\n\t * @param string $sql The SQL query to run\n\t * @param bool $escape\n\t * @return mixed\n\t */\n\tabstract function sql($sql, $escape = true);",
"\t/**\n\t * Toggle a boolean value in a Table Entry\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return void\n\t */\n\tfunction toggle($table, $col, $where=null) {\n\t $obj = $this->selectObject($table, $where);\n\t $obj->$col = ($obj->$col == 0) ? 1 : 0;\n\t $this->updateObject($obj, $table);\n\t}",
"\t/**\n\t * Update a column in all records in a table\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param $val\n\t * @param int|null $where\n\t * @return void\n\t */\n\tabstract function columnUpdate($table, $col, $val, $where=1);",
"\t/**\n\t * @param $object\n\t * @param $table\n\t * @param $col\n\t * @param int|null $where\n\t * @return bool\n\t */\n\tfunction setUniqueFlag($object, $table, $col, $where=1) {\n\t if (isset($object->id)) {\n\t $this->sql(\"UPDATE \" . $this->prefix . $table . \" SET \" . $col . \"=0 WHERE \" . $where);\n\t $this->sql(\"UPDATE \" . $this->prefix . $table . \" SET \" . $col . \"=1 WHERE id=\" . $object->id);\n\t return true;\n\t }\n\t return false;\n\t}",
"\t/**\n\t* Select a series of objects\n\t*\n\t* Selects a set of objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of objects, in any random order.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tabstract function selectObjects($table, $where = null, $orderby = null);",
"\t/**\n\t * @param $terms\n\t * @param null $where\n\t * @return array\n\t */\n\tfunction selectSearch($terms, $where = null) { //FIXME never used",
"\t}",
"\t/**\n\t * @param null $colsA\n\t * @param null $colsB\n\t * @param $tableA\n\t * @param $tableB\n\t * @param $keyA\n\t * @param null $keyB\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array'\n\t */\n\tfunction selectAndJoinObjects($colsA=null, $colsB=null, $tableA, $tableB, $keyA, $keyB=null, $where = null, $orderby = null) { //FIXME never used",
"\t}",
"\t/**\n\t * Select a single object by sql\n\t *\n\t * @param $sql\n\t * @return null|void\n\t */\n\tabstract function selectObjectBySql($sql);",
"\t/**\n\t * Select a series of objects by sql\n\t *\n\t * @param $sql\n\t * @return array\n\t */\n\tabstract function selectObjectsBySql($sql);",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @param bool $distinct\n\t * @return array\n\t */\n\tabstract function selectColumn($table, $col, $where = null, $orderby = null, $distinct=false);",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return int\n\t */\n\tfunction selectSum($table, $col, $where = null) { //FIXME never used",
"\t}",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array\n\t */\n\tabstract function selectDropdown($table, $col, $where = null, $orderby = null);",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return null\n\t */\n\tabstract function selectValue($table, $col, $where=null);",
"\t/**\n\t * @param $sql\n\t * @return null\n\t */\n\tfunction selectValueBySql($sql) { //FIXME never used",
"\t}",
"\t/**\n\t* This function takes an array of indexes and returns an array with the objects associated with each id\n\t* @param $table\n\t* @param array $array\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tfunction selectObjectsInArray($table, $array=array(), $orderby=null) {\n\t $where = 'id IN ' . implode(\",\", $array);\n\t $res = $this->selectObjects($table, $where, $orderby);\n\t return $res;\n\t}",
"\t/**\n\t* Select a series of objects, and return by ID\n\t*\n\t* Selects a set of objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of objects, in any random order. The indices of the array\n\t* are the IDs of the objects.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tabstract function selectObjectsIndexedArray($table, $where = null, $orderby = null);",
" /**\n * Count Objects matching a given criteria\n *\n * @param string $table The name of the table to count objects in.\n * @param string $where Criteria for counting.\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return int\n */\n\tabstract function countObjects($table, $where = null, $is_revisioned=false, $needs_approval=false);",
"\t/**\n\t* Count Objects matching a given criteria using raw sql\n\t*\n\t* @param string $sql The sql query to be run\n\t* @return int\n\t*/\n\tabstract function countObjectsBySql($sql);",
"\t/**\n\t* Count Objects matching a given criteria using raw sql\n\t*\n\t* @param string $sql The sql query to be run\n\t* @return int|void\n\t*/\n\tfunction queryRows($sql) { //FIXME never used",
"\t}",
"\t/**\n\t* Select a single object.\n\t*\n\t* Selects an objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a single record from a database table. Returns the\n\t* first record/object found (in the case of multiple-result queries,\n\t* there is no way to determine which of the set will be returned).\n\t* If no record(s) match the query, null is returned.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set.\n\t* @return object|null|void\n\t*/\n\tabstract function selectObject($table, $where);",
"\t/**\n\t * @param $table\n\t * @param string $lockType\n\t * @return mixed\n\t */\n\tabstract function lockTable($table,$lockType=\"WRITE\");",
"\t/**\n\t * @return mixed\n\t */\n\tabstract function unlockTables();",
"\t/**\n\t* Insert an Object into some table in the Database\n\t*\n\t* This method will return the ID assigned to the new record by database. Note that\n\t* object attributes starting with an underscore ('_') will be ignored and NOT inserted\n\t* into the table as a field value.\n\t*\n\t* @param object $object The object to insert.\n\t* @param string $table The logical table name to insert into. This does not include the table prefix, which\n\t* is automagically prepended for you.\n\t* @return int|void\n\t*/\n\tabstract function insertObject($object, $table);",
"\t/**\n\t* Delete one or more objects from the given table.\n\t*\n\t* @param string $table The name of the table to delete from.\n\t* @param string $where Criteria for determining which record(s) to delete.\n\t* @return mixed\n\t*/\n\tabstract function delete($table, $where = null);",
"\t/**\n\t* Update one or more objects in the database.\n\t*\n\t* This function will only update the attributes of the resulting record(s)\n\t* that are also member attributes of the $object object.\n\t*\n\t* @param object $object An object specifying the fields and values for updating.\n\t* In most cases, this will be the altered object originally returned from one of\n\t* the select* methods.\n\t* @param string $table The table to update in.\n\t* @param string $where Optional criteria used to narrow the result set.\n\t* @param string $identifier\n\t* @param bool $is_revisioned\n\t* @return bool|int|void\n\t*/\n\tabstract function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false);",
" /**\n * Reduces table item revisions to a passed total\n *\n * @param string $table The name of the table to trim\n * @param integer $id The item id\n * @param integer $num The number of revisions to retain\n * @param int $workflow is workflow turned on (or force)\n */\n public function trim_revisions($table, $id, $num, $workflow=ENABLE_WORKFLOW) {\n if ($workflow && $num) {\n $max_revision = $this->max($table, 'revision_id', null, 'id='.$id);\n $max_approved = $this->max($table, 'revision_id', null, 'id='.$id.' AND approved=1');\n $min_revision = $this->min($table, 'revision_id', null, 'id='.$id);\n if ($max_revision == null) {\n return;\n }\n if (($max_revision - $num) > $max_approved) {\n $approved_max = ' AND revision_id < ' . $max_approved; // never delete most recent approved item\n } else {\n $approved_max = '';\n }\n if ($max_revision - $min_revision >= $num) {\n $this->delete($table, 'id=' . $id . ' AND revision_id <= ' . ($max_revision - $num) . $approved_max);\n }\n if (!empty($approved_max)) {\n // we've trimmed all the fat below the newest approved item, now trim the dead wood above it\n $this->delete($table, 'id=' . $id . ' AND revision_id <= ' . ($max_revision - $num + 1) . ' AND revision_id > ' . $max_approved);\n }\n }\n }",
"\t/**\n\t * Find the maximum value of a field. This is similar to a standard\n\t * SELECT MAX(field) ... query.\n\t *\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a maximum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return mixed\n\t */\n\tabstract function max($table, $attribute, $groupfields = null, $where = null);",
"\t/**\n\t * Find the minimum value of a field. This is similar to a standard\n\t * SELECT MIN(field) ... query.\n\t *\n\t * @internal Internal\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a minimum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return null\n\t */\n\tabstract function min($table, $attribute, $groupfields = null, $where = null);",
"\t/**\n\t* Increment a numeric table field in a table.\n\t*\n\t* @param string $table The name of the table to increment in.\n\t* @param string $field The field to increment.\n\t* @param integer $step The step value. Usually 1. This can be negative, to\n\t* decrement, but the decrement() method is preferred, for readability.\n\t* @param string $where Optional criteria to determine which records to update.\n\t* @return mixed\n\t*/\n\tabstract function increment($table, $field, $step, $where = null);",
"\t/**\n\t* Decrement a numeric table field in a table.\n\t*\n\t* @param string $table The name of the table to decrement in.\n\t* @param string $field The field to decrement.\n\t* @param integer $step The step value. Usually 1. This can be negative, to\n\t* increment, but the increment() method is preferred, for readability.\n\t* @param string $where Optional criteria to determine which records to update.\n\t*/",
"\tfunction decrement($table, $field, $step, $where = null) {\n\t $this->increment($table, $field, -1 * $step, $where);\n\t}",
"\t/**\n\t* Check to see if the named table exists in the database.\n\t* Returns true if the table exists, and false if it doesn't.\n\t*\n\t* @param string $table Name of the table to look for.\n\t* @return bool\n\t*/\n\tabstract function tableExists($table);",
"\t/**\n\t* Get a list of all tables in the database. Optionally, only the tables\n\t* in the current logical database (tables with the same prefix) can\n\t* be retrieved.\n\t*\n\t* @param bool $prefixed_only Whether to return only the tables\n\t* for the logical database, or all tables in the physical database.\n\t* @return array\n\t*/\n\tabstract function getTables($prefixed_only=true);",
"\t/**\n\t* Runs whatever table optimization routines the database engine supports.\n\t*\n\t* @param string $table The name of the table to optimize.\n\t* @return bool\n\t*/\n\tabstract function optimize($table);",
"\t/**\n\t* Retrieve table information for a named table.\n\t* Returns an object, with the following attributes:\n\t* <ul>\n\t* <li><b>rows</b> -- The number of rows in the table.</li>\n\t* <li><b>average_row_length</b> -- The average storage size of a row in the table.</li>\n\t* <li><b>data_total</b> -- How much total disk space is used by the table.</li>\n\t* <li><b>data_overhead</b> -- How much storage space in the table is unused (for compacting purposes)</li>\n\t* </ul>\n\t* @param $table\n\t* @return null\n\t*/\n\tfunction tableInfo($table) { //FIXME never used",
"\t}",
"\t/**\n\t* Check whether or not a table in the database is empty (0 rows).\n\t* Returns tue of the specified table has no rows, and false if otherwise.\n\t*\n\t* @param string $table Name of the table to check.\n\t* @return bool\n\t*/\n\tfunction tableIsEmpty($table) {\n\t return ($this->countObjects($table) == 0);\n\t}",
"\t/**\n\t* Returns table information for all tables in the database.\n\t* This function effectively calls tableInfo() on each table found.\n\t* @return array\n\t*/\n\tabstract function databaseInfo();",
"\t/**\n\t* This is an internal function for use only within the database database class\n\t* @internal Internal\n\t* @param $status\n\t* @return null\n\t*/\n\tfunction translateTableStatus($status) {\n\t $data = new stdClass();\n\t $data->rows = $status->Rows;\n\t $data->average_row_lenth = $status->Avg_row_length;\n\t $data->data_overhead = $status->Data_free;\n\t $data->data_total = $status->Data_length;",
"\t return $data;\n\t}",
"\t/**\n\t * @param $table\n\t * @return array\n\t */\n\tfunction describeTable($table) { //FIXME never used",
"\t}",
"\t/**\n\t* Build a data definition from a pre-existing table. This is used\n\t* to intelligently alter tables that have already been installed.\n\t*\n\t* @param string $table The name of the table to get a data definition for.\n\t* @return array|null\n\t*/\n\tabstract function getDataDefinition($table);",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int\n\t*/\n\tfunction getDDFieldType($fieldObj) {\n\t $type = strtolower($fieldObj->Type);",
"\t if ($type == \"int(11)\")\n\t return DB_DEF_ID;\n\t if ($type == \"int(8)\")\n\t return DB_DEF_INTEGER;\n\t elseif ($type == \"tinyint(1)\")\n\t return DB_DEF_BOOLEAN;\n\t elseif ($type == \"int(14)\")\n\t return DB_DEF_TIMESTAMP;\n elseif ($type == \"datetime\")\n \t return DB_DEF_TIMESTAMP;\n\t //else if (substr($type,5) == \"double\")\n //return DB_DEF_DECIMAL;\n\t elseif ($type == \"double\")\n\t return DB_DEF_DECIMAL;\n\t // Strings\n\t elseif ($type == \"text\" || $type == \"mediumtext\" || $type == \"longtext\" || strpos($type, \"varchar(\") !== false) {\n\t return DB_DEF_STRING;\n\t } else {\n return DB_DEF_INTEGER;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDStringLen($fieldObj) {\n\t $type = strtolower($fieldObj->Type);\n\t if ($type == \"text\")\n\t return 65535;\n\t else if ($type == \"mediumtext\")\n\t return 16777215;\n\t else if ($type == \"longtext\")\n\t return 16777216;\n\t else if (strpos($type, \"varchar(\") !== false) {\n\t return str_replace(array(\"varchar(\", \")\"), \"\", $type) + 0;\n\t } else {\n return 256;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDKey($fieldObj) {\n\t $key = strtolower($fieldObj->Key);\n\t if ($key == \"pri\")\n\t return DB_PRIMARY;\n\t else if ($key == \"uni\") {\n\t return DB_UNIQUE;\n\t } else {\n return false;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDAutoIncrement($fieldObj) {\n\t $auto = strtolower($fieldObj->Extra);\n\t if ($auto == \"auto_increment\") {\n\t return true;\n\t } else {\n return false;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDIsNull($fieldObj) {\n\t $null = strtolower($fieldObj->Null);\n\t if ($null == \"yes\") {\n\t return true;\n\t } else {\n return false;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDDefault($fieldObj) {\n\t\treturn strtolower($fieldObj->Default);\n\t}",
"\t/**\n\t* Returns an error message from the database server. This is intended to be\n\t* used by the implementers of the database wrapper, so that certain\n\t* cryptic error messages can be reworded.\n\t* @return string\n\t*/\n\tabstract function error();",
"\t/**\n\t* Checks whether the database connection has experienced an error.\n\t* @return bool\n\t*/\n\tabstract function inError();",
"\t/**",
"\t * Unescape a string based on the database connection",
"\t * @param $string\n\t * @return string\n\t */\n\tabstract function escapeString($string);",
" /**",
" \t * Unescape a string based on the database connection",
" \t * @param $string\n \t * @return string\n \t */\n \tfunction injectProof($string) {\n \t $quotes = substr_count(\"'\", $string);\n if ($quotes % 2 != 0)\n $string = $this->escapeString($string);\n $dquotes = substr_count('\"', $string);\n if ($dquotes % 2 != 0)\n $string = $this->escapeString($string);\n return $string;\n }",
"\t/**\n\t * Create a SQL \"limit\" phrase\n\t *\n\t * @param $num\n\t * @param $offset\n\t * @return string\n\t */\n\tfunction limit($num, $offset) {\n\t return ' LIMIT ' . $offset . ',' . $num . ' ';\n\t}",
"\t/**\n\t* Select an array of arrays\n\t*\n\t* Selects a set of arrays from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of arrays, in any random order.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param string $orderby\n\t* @return array\n\t*/\n\tabstract function selectArrays($table, $where = null, $orderby = null);",
"\t/**\n\t* Select an array of arrays\n\t*\n\t* Selects a set of arrays from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of arrays, in any random order.\n\t*\n\t* @param string $sql The name of the table/object to look at\n\t* @return array\n\t*/\n\tabstract function selectArraysBySql($sql);",
" /**\n * Select a record from the database as an array\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array|void\n */\n\tabstract function selectArray($table, $where = null, $orderby = null, $is_revisioned=false, $needs_approval=false);",
" /**\n\t * Instantiate objects from selected records from the database\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param $classname\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @param null $order\n * @param null $limitsql\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array\n */\n\tabstract function selectExpObjects($table, $where=null, $classname, $get_assoc=true, $get_attached=true, $except=array(), $cascade_except=false, $order=null, $limitsql=null, $is_revisioned=false, $needs_approval=false);",
"\t/**\n\t * Instantiate objects from selected records from the database\n\t *\n\t* @param string $sql The sql statement to run on the model/classname\n\t* @param string $classname Can be $this->baseclassname\n\t* Returns an array of fields\n\t* @param bool $get_assoc\n\t* @param bool $get_attached\n\t* @return array\n\t*/\n\tfunction selectExpObjectsBySql($sql, $classname, $get_assoc=true, $get_attached=true) { //FIXME never used",
"\t}",
"\t/**\n\t * @param $table\n\t * @return array\n\t */\n\tfunction selectNestedTree($table) {\n\t $sql = 'SELECT node.*, (COUNT(parent.sef_url) - 1) AS depth\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tGROUP BY node.sef_url\n\t\tORDER BY node.lft';\n\t return $this->selectObjectsBySql($sql);\n\t}",
"\tfunction selectFormattedNestedTree($table) {\n\t\t$sql = \"SELECT CONCAT( REPEAT( '   ', (COUNT(parent.title) -1) ), node.title) AS title, node.id\n\t\t\t\tFROM \" .$this->prefix . $table. \" as node, \" .$this->prefix . $table. \" as parent\n\t\t\t\tWHERE node.lft BETWEEN parent.lft and parent.rgt\n\t\t\t\tGROUP BY node.title, node.id\n\t\t\t\tORDER BY node.lft\";",
"\t\treturn $this->selectObjectsBySql($sql);\n\t}",
"\t/**\n\t * @param $table\n\t * @param $start\n\t * @param $width\n\t * @return void\n\t */\n\tfunction adjustNestedTreeFrom($table, $start, $width) {\n\t $table = $this->prefix . $table;\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt + ' . $width . ' WHERE rgt >=' . $start);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft + ' . $width . ' WHERE lft >=' . $start);\n\t //eDebug('UPDATE `'.$table.'` SET rgt = rgt + '.$width.' WHERE rgt >='.$start);\n\t //eDebug('UPDATE `'.$table.'` SET lft = lft + '.$width.' WHERE lft >='.$start);\n\t}",
"\t/**\n\t * @param $table\n\t * @param $lft\n\t * @param $rgt\n\t * @param $width\n\t * @return void\n\t */\n\tfunction adjustNestedTreeBetween($table, $lft, $rgt, $width) {\n\t $table = $this->prefix . $table;\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt + ' . $width . ' WHERE rgt BETWEEN ' . $lft . ' AND ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft + ' . $width . ' WHERE lft BETWEEN ' . $lft . ' AND ' . $rgt);\n\t //eDebug('UPDATE `'.$table.'` SET rgt = rgt + '.$width.' WHERE rgt BETWEEN '.$lft.' AND '.$rgt);\n\t //eDebug('UPDATE `'.$table.'` SET lft = lft + '.$width.' WHERE lft BETWEEN '.$lft.' AND '.$rgt);\n\t}",
"\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedBranch($table, $node=null) {\n\t if (empty($node))\n\t return array();",
"\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n//\t global $db;\n\t $sql = 'SELECT node.*,\n\t (COUNT(parent.title) - (sub_tree.depth + 1)) AS depth\n\t FROM `' . $this->prefix . $table . '` AS node,\n\t `' . $this->prefix . $table . '` AS parent,\n\t `' . $this->prefix . $table . '` AS sub_parent,\n\t ( SELECT node.*, (COUNT(parent.title) - 1) AS depth\n\t FROM `' . $this->prefix . $table . '` AS node,\n\t `' . $this->prefix . $table . '` AS parent\n\t WHERE node.lft BETWEEN parent.lft\n\t AND parent.rgt AND node.' . $where . '\n\t GROUP BY node.title\n\t ORDER BY node.lft )\n\t AS sub_tree\n\t WHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt\n\t AND sub_parent.title = sub_tree.title\n\t GROUP BY node.title\n\t ORDER BY node.lft;';",
"\t return $this->selectObjectsBySql($sql);\n\t}",
"\t/**\n\t * @param $table\n\t * @param $lft\n\t * @param $rgt\n\t * @return void\n\t */\n\tfunction deleteNestedNode($table, $lft, $rgt) {\n\t $table = $this->prefix . $table;",
"\t $width = ($rgt - $lft) + 1;\n\t $this->sql('DELETE FROM `' . $table . '` WHERE lft BETWEEN ' . $lft . ' AND ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt - ' . $width . ' WHERE rgt > ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft - ' . $width . ' WHERE lft > ' . $rgt);\n\t}",
"\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectPathToNestedNode($table, $node=null) {\n\t if (empty($node))\n\t return array();",
"\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n\t $sql = 'SELECT parent.*\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tAND node.' . $where . '\n\t\tORDER BY parent.lft;';\n\t return $this->selectObjectsBySql($sql);\n\t}",
"\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedNodeParent($table, $node=null) {\n\t if (empty($node))\n\t return array();",
"\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n\t $sql = 'SELECT parent.*\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tAND node.' . $where . '\n\t\tORDER BY parent.lft DESC\n\t\tLIMIT 1, 1;';\n\t $parent_array = $this->selectObjectsBySql($sql);\n\t return $parent_array[0];\n\t}",
"\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedNodeChildren($table, $node=null) {\n\t if (empty($node))\n\t return array();",
"\t $where = is_numeric($node) ? 'node.id=' . $node : 'node.title=\"' . $node . '\"';\n\t $sql = '\n\t\tSELECT node.*, (COUNT(parent.title) - (sub_tree.depth + 1)) AS depth\n\t\tFROM ' . $this->prefix . $table . ' AS node,\n\t\t\t' . $this->prefix . $table . ' AS parent,\n\t\t\t' . $this->prefix . $table . ' AS sub_parent,\n\t\t\t(\n\t\t\t\tSELECT node.*, (COUNT(parent.title) - 1) AS depth\n\t\t\t\tFROM ' . $this->prefix . $table . ' AS node,\n\t\t\t\t' . $this->prefix . $table . ' AS parent\n\t\t\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\t\t\tAND ' . $where . '\n\t\t\t\tGROUP BY node.title\n\t\t\t\tORDER BY node.lft\n\t\t\t)AS sub_tree\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\t\tAND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt\n\t\t\tAND sub_parent.title = sub_tree.title\n\t\tGROUP BY node.title\n\t\tHAVING depth = 1\n\t\tORDER BY node.lft;';\n\t$children = $this->selectObjectsBySql($sql);\n\t return $children;\n\t}",
"\t/**\n\t * This function returns all the text columns in the given table\n\t * @param $table\n\t * @return array\n\t */\n\tabstract function getTextColumns($table);",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the expDatabase subsystem\n * Handles all database abstraction in Exponent.\n *\n * @package Subsystems\n * @subpackage Subsystems\n */\nclass expDatabase {",
"\t/**\n\t * Connect to the Exponent database\n\t *\n\t * This function attempts to connect to the exponent database,\n\t * and then returns the database object to the caller.\n\t *\n\t * @param string $username the database username\n\t * @param string $password the database password\n\t * @param string $hostname the url of the database server\n\t * @param string $database the name of the database\n\t * @param string $dbclass\n\t * @param bool $new\n\t * @return \\database the database object\n\t */\n\tpublic static function connect($username,$password,$hostname,$database,$dbclass = '',$new=false,$log=null) {\n\t\tif (!defined('DB_ENGINE')) {\n\t\t\t$backends = array_keys(self::backends(1));\n\t\t\tif (count($backends)) {\n\t\t\t\tdefine('DB_ENGINE',$backends[0]);\n\t\t\t} else {\n\t\t\t\tdefine('DB_ENGINE','NOTSUPPORTED');\n\t\t\t}\n\t\t}\n\t\t(include_once(BASE.'framework/core/subsystems/database/'.DB_ENGINE.'.php')) or exit(gt('None of the installed Exponent Database Backends will work with this server\\'s version of PHP.'));\n\t\tif ($dbclass == '' || $dbclass == null) $dbclass = DB_ENGINE;\n\t\t(include_once(BASE.'framework/core/subsystems/database/'.$dbclass.'.php')) or exit(gt('The specified database backend').' ('.$dbclass.') '.gt('is not supported by Exponent'));\n\t\t$dbclass .= '_database';\n\t\t$newdb = new $dbclass($username,$password,$hostname,$database,$new,$log);\n if (!$newdb->tableExists('user')) {\n $newdb->havedb = false;\n }\n\t\treturn $newdb;\n\t}",
"\t/**\n\t * List all available database backends\n\t *\n\t * This function looks for available database engines,\n\t * and then returns an array to the caller.\n\t *\n\t * @param int $valid_only\n\t * @return Array An associative array of engine identifiers.\n\t *\tThe internal engine name is the key, and the external\n\t *\tdescriptive name is the value.\n\t */\n\tpublic static function backends($valid_only = 1) {\n\t\t$options = array();\n\t\t$dh = opendir(BASE.'framework/core/subsystems/database');\n\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\tif (is_file(BASE.'framework/core/subsystems/database/'.$file) && is_readable(BASE.'framework/core/subsystems/database/'.$file) && substr($file,-9,9) == '.info.php') {\n\t\t\t\t$info = include(BASE.'framework/core/subsystems/database/'.$file);\n\t\t\t\tif ($info['is_valid'] == 1 || !$valid_only) {\n\t\t\t\t\t$options[substr($file,0,-9)] = $info['name'];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $options;\n\t}",
" public static function fix_table_names() {\n global $db;",
" // fix table names\n $tablenames = array (\n 'content_expcats'=>'content_expCats',\n 'content_expcomments'=>'content_expComments',\n 'content_expdefinablefields'=>'content_expDefinableFields',\n 'content_expdefinablefields_value'=>'content_expDefinableFields_value',\n 'content_expfiles'=>'content_expFiles',\n 'content_expratings'=>'content_expRatings',\n 'content_expsimplenote'=>'content_expSimpleNote',\n 'content_exptags'=>'content_expTags',\n 'expcats'=>'expCats',\n 'expcomments'=>'expComments',\n 'expdefinablefields'=>'expDefinableFields',\n 'expealerts'=>'expeAlerts',\n 'expealerts_temp'=>'expeAlerts_temp',\n 'expfiles'=>'expFiles',\n 'expratings'=>'expRatings',\n 'exprss'=>'expRss',\n 'expsimplenote'=>'expSimpleNote',\n 'exptags'=>'expTags',\n\t\t\t'bing_product_types_storecategories'=>'bing_product_types_storeCategories',\n\t\t\t'google_product_types_storecategories'=>'google_product_types_storeCategories',\n\t\t\t'nextag_product_types_storecategories'=>'nextag_product_types_storeCategories',\n\t\t\t'pricegrabber_product_types_storecategories'=>'pricegrabber_product_types_storeCategories',\n\t\t\t'shopping_product_types_storecategories'=>'shopping_product_types_storeCategories',\n\t\t\t'shopzilla_product_types_storecategories'=>'shopzilla_product_types_storeCategories',\n\t\t\t'crosssellitem_product'=>'crosssellItem_product',\n\t\t\t'product_storecategories'=>'product_storeCategories',\n\t\t\t'storecategories'=>'storeCategories',\n );",
" $renamed = array();\n foreach ($tablenames as $oldtablename=>$newtablename) {\n if (!$db->tableExists($newtablename)) {\n $db->sql('RENAME TABLE '.$db->prefix.$oldtablename.' TO '.$db->prefix.$newtablename);\n $renamed[] = $newtablename;\n }\n }\n return $renamed;\n }",
" public static function install_dbtables($aggressive=false, $workflow=ENABLE_WORKFLOW) {\n \t global $db;",
" \t\texpSession::clearAllUsersSessionCache();\n \t\t$tables = array();",
" \t\t// first the core definitions\n \t\t$coredefs = BASE.'framework/core/definitions';\n \t\tif (is_readable($coredefs)) {\n \t\t\t$dh = opendir($coredefs);\n \t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\tif (is_readable(\"$coredefs/$file\") && is_file(\"$coredefs/$file\") && substr($file,-4,4) == \".php\" && substr($file,-9,9) != \".info.php\") {\n \t\t\t\t\t$tablename = substr($file,0,-4);\n \t\t\t\t\t$dd = include(\"$coredefs/$file\");\n \t\t\t\t\t$info = null;\n \t\t\t\t\tif (is_readable(\"$coredefs/$tablename.info.php\")) $info = include(\"$coredefs/$tablename.info.php\");\n \t\t\t\t\tif (!$db->tableExists($tablename)) {\n \t\t\t\t\t\tforeach ($db->createTable($tablename, $dd, $info) as $key=>$status) {\n \t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t}\n \t\t\t\t\t} else {\n \t\t\t\t\t\tforeach ($db->alterTable($tablename, $dd, $info, $aggressive) as $key=>$status) {\n//\t\t\t\t\t\t\tif (isset($tables[$key])) echo \"$tablename, $key<br>\"; //FIXME we shouldn't echo this, already installed?\n \t\t\t\t\t\t\tif ($status == TABLE_ALTER_FAILED){\n \t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t$tables[$key] = ($status == TABLE_ALTER_NOT_NEEDED ? DATABASE_TABLE_EXISTED : DATABASE_TABLE_ALTERED);\n \t\t\t\t\t\t\t}",
" \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}",
" \t\t// then search for module definitions\n \t\t$moddefs = array(\n \t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules',\n \t\t\tBASE.\"framework/modules\",\n \t\t\t);\n $models = expModules::initializeModels();\n \t\tforeach ($moddefs as $moddef) {\n \t\t\tif (is_readable($moddef)) {\n \t\t\t\t$dh = opendir($moddef);\n \t\t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\t\tif (is_dir($moddef.'/'.$file) && ($file != '..' && $file != '.')) {\n \t\t\t\t\t\t$dirpath = $moddef.'/'.$file.'/definitions';\n \t\t\t\t\t\tif (file_exists($dirpath)) {\n \t\t\t\t\t\t\t$def_dir = opendir($dirpath);\n \t\t\t\t\t\t\twhile (($def = readdir($def_dir)) !== false) {\n \t//\t\t\t\t\t\t\teDebug(\"$dirpath/$def\");\n \t\t\t\t\t\t\t\tif (is_readable(\"$dirpath/$def\") && is_file(\"$dirpath/$def\") && substr($def,-4,4) == \".php\" && substr($def,-9,9) != \".info.php\") {\n \t\t\t\t\t\t\t\t\t$tablename = substr($def,0,-4);\n \t\t\t\t\t\t\t\t\t$dd = include(\"$dirpath/$def\");\n \t\t\t\t\t\t\t\t\t$info = null;\n// foreach ($models as $modelname=>$modelpath) {\n $rev_aggressive = $aggressive;\n // add workflow fields\n if (!empty($models[substr($def,0,-4)])) {\n $modelname = substr($def,0,-4);\n $model = new $modelname();\n if ($model->supports_revisions && $workflow) {\n $dd['revision_id'] = array(\n DB_FIELD_TYPE=>DB_DEF_INTEGER,\n DB_PRIMARY=>true,\n DB_DEFAULT=>1,\n );\n $dd['approved'] = array(\n DB_FIELD_TYPE=>DB_DEF_BOOLEAN\n );\n $rev_aggressive = true;\n }\n }\n \t\t\t\t\t\t\t\t\tif (is_readable(\"$dirpath/$tablename.info.php\")) $info = include(\"$dirpath/$tablename.info.php\");\n \t\t\t\t\t\t\t\t\tif (!$db->tableExists($tablename)) {\n \t\t\t\t\t\t\t\t\t\tforeach ($db->createTable($tablename, $dd, $info) as $key=>$status) {\n \t\t\t\t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\tforeach ($db->alterTable($tablename, $dd, $info, $rev_aggressive) as $key=>$status) {\n//\t\t\t\t\t\t\t\t\t\t\tif (isset($tables[$key])) echo \"$tablename, $key<br>\"; //FIXME we shouldn't echo this, already installed?\n \t\t\t\t\t\t\t\t\t\t\tif ($status == TABLE_ALTER_FAILED){\n \t\t\t\t\t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t\t$tables[$key] = ($status == TABLE_ALTER_NOT_NEEDED ? DATABASE_TABLE_EXISTED : DATABASE_TABLE_ALTERED);\n \t\t\t\t\t\t\t\t\t\t\t}",
" \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn $tables;\n \t}\n}",
"/**\n* This is the class database\n*\n* This is the generic implementation of the database class.\n* @subpackage Database\n* @package Subsystems\n*/",
"abstract class database {",
"\t/**\n\t* @var string $connection Database connection string\n\t*/\n\tvar $connection = null;\n\t/**\n\t* @var boolean $havedb\n\t*/\n\tvar $havedb = false;\n\t/**\n\t* @var string $prefix Database prefix\n\t*/\n\tvar $prefix = \"\";",
"\t/**\n\t * Make a connection to the Database Server\n\t *\n\t * Takes the supplied credentials (username / password) and tries to\n\t * connect to the server and select the given database. All the rules\n\t * governing database connect also govern this method.\n\t *\n\t * @param string $username The username to connect to the server as.\n\t * @param string $password The password for $username\n\t * @param string $hostname The hostname of the database server. If\n\t * localhost is specified, a local socket connection will be attempted.\n\t * @param string $database The name of the database to use. Multi-database\n\t * sites are still not yet supported.\n\t * @param bool $new Whether or not to force the PHP connection function to establish\n\t * a distinctly new connection handle to the server.\n\t */",
"\t//\tfunction connect ($username, $password, $hostname, $database, $new=false) {\n\tabstract function __construct($username, $password, $hostname, $database, $new=false);",
"\t /**\n\t * Create a new Table\n\t *\n\t * Creates a new database table, according to the passed data definition.\n\t *\n\t * This function abides by the Exponent Data Definition Language, and interprets\n\t * its general structure for databases.\n\t *\n\t * @param string $tablename The name of the table to create\n\t * @param array $datadef The data definition to create, expressed in\n\t * the Exponent Data Definition Language.\n\t * @param array $info Information about the table itself.\n\t * @return array\n\t */\n\tabstract function createTable($tablename, $datadef, $info);",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $name\n\t* @param $def\n\t* @return bool|string\n\t*/\n\tfunction fieldSQL($name, $def) {\n\t $sql = \"`$name`\";\n\t if (!isset($def[DB_FIELD_TYPE])) {\n\t return false;\n\t }\n\t $type = $def[DB_FIELD_TYPE];\n\t if ($type == DB_DEF_ID) {\n\t $sql .= \" INT(11)\";\n\t } else if ($type == DB_DEF_BOOLEAN) {\n\t $sql .= \" TINYINT(1)\";\n\t } else if ($type == DB_DEF_TIMESTAMP) {\n\t $sql .= \" INT(14)\";\n } else if ($type == DB_DEF_DATETIME) {\n \t $sql .= \" DATETIME\";\n\t } else if ($type == DB_DEF_INTEGER) {\n\t $sql .= \" INT(8)\";\n\t } else if ($type == DB_DEF_STRING) {\n\t if (isset($def[DB_FIELD_LEN]) && is_int($def[DB_FIELD_LEN])) {\n\t $len = $def[DB_FIELD_LEN];\n\t if ($len < 256)\n\t $sql .= \" VARCHAR($len)\";\n\t else if ($len < 65536)\n\t $sql .= \" TEXT\";\n\t else if ($len < 16777216)\n\t $sql .= \" MEDIUMTEXT\";\n\t else\n\t $sql .= \"LONGTEXT\";\n\t } else { // default size of 'TEXT'instead of error\n $sql .= \" TEXT\";\n\t }\n\t } else if ($type == DB_DEF_DECIMAL) {\n\t $sql .= \" DOUBLE\";\n\t } else {\n\t return false; // must specify known FIELD_TYPE\n\t }\n\t $sql .= \" NOT NULL\";\n\t if (isset($def[DB_DEFAULT]))\n\t $sql .= \" DEFAULT '\" . $def[DB_DEFAULT] . \"'\";",
"\t if (isset($def[DB_INCREMENT]) && $def[DB_INCREMENT])\n\t $sql .= \" AUTO_INCREMENT\";\n\t return $sql;\n\t}",
"\t/**\n\t* Switch field values between two entries in a Table\n\t*\n\t* Switches values between two table entries for things like swapping rank, etc...\n\t* @param $table\n\t* @param $field\n\t* @param $a\n\t* @param $b\n\t* @param null $additional_where\n\t* @return bool\n\t*/\n\tfunction switchValues($table, $field, $a, $b, $additional_where = null) {\n\t if ($additional_where == null) {\n\t $additional_where = '1';\n\t }\n $a = intval($a);\n $b = intval($b);\n\t $object_a = $this->selectObject($table, \"$field='$a' AND $additional_where\");\n\t $object_b = $this->selectObject($table, \"$field='$b' AND $additional_where\");",
"\t if ($object_a && $object_b) {\n\t $tmp = $object_a->$field;\n\t $object_a->$field = $object_b->$field;\n\t $object_b->$field = $tmp;",
"\t $this->updateObject($object_a, $table);\n\t $this->updateObject($object_b, $table);",
"\t return true;\n\t } else {\n\t return false;\n\t }\n\t}",
"\t/**\n\t* Checks to see if the connection for this database object is valid.\n\t* @return bool True if the connection can be used to execute SQL queries.\n\t*/\n\tfunction isValid() {\n\t return ($this->connection != null && $this->havedb);\n\t}",
"\t/**\n\t* Test the privileges of the user account for the connection.\n\t* Tests run include:\n\t* <ul>\n\t* <li>CREATE TABLE</li>\n\t* <li>INSERT</li>\n\t* <li>SELECT</li>\n\t* <li>UPDATE</li>\n\t* <li>DELETE</li>\n\t* <li>ALTER TABLE</li>\n\t* <li>DROP TABLE</li>\n\t* </ul>\n\t* These tests must be performed in order, for logical reasons. Execution\n\t* terminates when the first test fails, and the status flag array is returned then.\n\t* Returns an array of status flags. Key is the test name. Value is a boolean,\n\t* true if the test succeeded, and false if it failed.\n\t* @return array\n\t*/\n\tfunction testPrivileges() {",
"\t $status = array();",
"\t $tablename = \"___testertable\" . uniqid(\"\");\n\t $dd = array(\n\t \"id\" => array(\n\t DB_FIELD_TYPE => DB_DEF_ID,\n\t DB_PRIMARY => true,\n\t DB_INCREMENT => true),\n\t \"name\" => array(\n\t DB_FIELD_TYPE => DB_DEF_STRING,\n\t DB_FIELD_LEN => 100)\n\t );",
"\t $this->createTable($tablename, $dd, array());\n\t if (!$this->tableExists($tablename)) {\n\t $status[\"CREATE TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"CREATE TABLE\"] = true;",
"\t $o = new stdClass();\n\t $o->name = \"Testing Name\";\n\t $insert_id = $this->insertObject($o, $tablename);\n\t if ($insert_id == 0) {\n\t $status[\"INSERT\"] = false;\n\t return $status;\n\t } else\n\t $status[\"INSERT\"] = true;",
"\t $o = $this->selectObject($tablename, \"id=\" . $insert_id);\n\t if ($o == null || $o->name != \"Testing Name\") {\n\t $status[\"SELECT\"] = false;\n\t return $status;\n\t } else\n\t $status[\"SELECT\"] = true;",
"\t $o->name = \"Testing 2\";\n\t if (!$this->updateObject($o, $tablename)) {\n\t $status[\"UPDATE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"UPDATE\"] = true;",
"\t $this->delete($tablename, \"id=\" . $insert_id);\n\t $o = $this->selectObject($tablename, \"id=\" . $insert_id);\n\t if ($o != null) {\n\t $status[\"DELETE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"DELETE\"] = true;",
"\t $dd[\"thirdcol\"] = array(\n\t DB_FIELD_TYPE => DB_DEF_TIMESTAMP);",
"\t $this->alterTable($tablename, $dd, array());\n\t $o = new stdClass();\n\t $o->name = \"Alter Test\";\n\t $o->thirdcol = \"Third Column\";\n\t if (!$this->insertObject($o, $tablename)) {\n\t $status[\"ALTER TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"ALTER TABLE\"] = true;",
"\t $this->dropTable($tablename);\n\t if ($this->tableExists($tablename)) {\n\t $status[\"DROP TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"DROP TABLE\"] = true;",
"\t foreach ($this->getTables() as $t) {\n\t if (substr($t, 0, 14 + strlen($this->prefix)) == $this->prefix . \"___testertable\")\n\t $this->dropTable($t);\n\t }",
"\t return $status;\n\t}",
"\t/**\n\t* Alter an existing table\n\t*\n\t* Alters the structure of an existing database table to conform to the passed\n\t* data definition.\n\t*\n\t* This function abides by the Exponent Data Definition Language, and interprets\n\t* its general structure for databases.\n\t*\n\t* @param string $tablename The name of the table to alter\n\t* @param array $newdatadef The new data definition for the table.\n\t* This is expressed in the Exponent Data Definition Language\n\t* @param array $info Information about the table itself.\n\t* @param bool $aggressive Whether or not to aggressively update the table definition.\n\t* An aggressive update will drop columns in the table that are not in the Exponent definition.\n\t* @return array\n\t*/\n\tabstract function alterTable($tablename, $newdatadef, $info, $aggressive = false);",
"\t/**\n\t* Drop a table from the database\n\t*\n\t* Removes an existing table from the database. Returns true if the table was dropped, false if there\n\t* was an error returned by the database server.\n\t*\n\t* @param string $table The name of the table to drop.\n\t* @return bool\n\t*/\n\tabstract function dropTable($table);",
"\t/**\n\t * Run raw SQL. Returns true if the query succeeded, and false\n\t * if an error was returned from the database server.\n\t *\n\t * <div style=\"color:red\">If you can help it, do not use this function. It presents Database Portability Issues.</div>\n\t *\n\t * Runs a straight SQL query on the database. This is not a\n\t * very portable way of dealing with the database, and is only\n\t * provided as a last resort.\n\t *\n\t * @param string $sql The SQL query to run\n\t * @param bool $escape\n\t * @return mixed\n\t */\n\tabstract function sql($sql, $escape = true);",
"\t/**\n\t * Toggle a boolean value in a Table Entry\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return void\n\t */\n\tfunction toggle($table, $col, $where=null) {\n\t $obj = $this->selectObject($table, $where);\n\t $obj->$col = ($obj->$col == 0) ? 1 : 0;\n\t $this->updateObject($obj, $table);\n\t}",
"\t/**\n\t * Update a column in all records in a table\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param $val\n\t * @param int|null $where\n\t * @return void\n\t */\n\tabstract function columnUpdate($table, $col, $val, $where=1);",
"\t/**\n\t * @param $object\n\t * @param $table\n\t * @param $col\n\t * @param int|null $where\n\t * @return bool\n\t */\n\tfunction setUniqueFlag($object, $table, $col, $where=1) {\n\t if (isset($object->id)) {\n\t $this->sql(\"UPDATE \" . $this->prefix . $table . \" SET \" . $col . \"=0 WHERE \" . $where);\n\t $this->sql(\"UPDATE \" . $this->prefix . $table . \" SET \" . $col . \"=1 WHERE id=\" . $object->id);\n\t return true;\n\t }\n\t return false;\n\t}",
"\t/**\n\t* Select a series of objects\n\t*\n\t* Selects a set of objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of objects, in any random order.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tabstract function selectObjects($table, $where = null, $orderby = null);",
"\t/**\n\t * @param $terms\n\t * @param null $where\n\t * @return array\n\t */\n\tfunction selectSearch($terms, $where = null) { //FIXME never used",
"\t}",
"\t/**\n\t * @param null $colsA\n\t * @param null $colsB\n\t * @param $tableA\n\t * @param $tableB\n\t * @param $keyA\n\t * @param null $keyB\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array'\n\t */\n\tfunction selectAndJoinObjects($colsA=null, $colsB=null, $tableA, $tableB, $keyA, $keyB=null, $where = null, $orderby = null) { //FIXME never used",
"\t}",
"\t/**\n\t * Select a single object by sql\n\t *\n\t * @param $sql\n\t * @return null|void\n\t */\n\tabstract function selectObjectBySql($sql);",
"\t/**\n\t * Select a series of objects by sql\n\t *\n\t * @param $sql\n\t * @return array\n\t */\n\tabstract function selectObjectsBySql($sql);",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @param bool $distinct\n\t * @return array\n\t */\n\tabstract function selectColumn($table, $col, $where = null, $orderby = null, $distinct=false);",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return int\n\t */\n\tfunction selectSum($table, $col, $where = null) { //FIXME never used",
"\t}",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array\n\t */\n\tabstract function selectDropdown($table, $col, $where = null, $orderby = null);",
"\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return null\n\t */\n\tabstract function selectValue($table, $col, $where=null);",
"\t/**\n\t * @param $sql\n\t * @return null\n\t */\n\tfunction selectValueBySql($sql) { //FIXME never used",
"\t}",
"\t/**\n\t* This function takes an array of indexes and returns an array with the objects associated with each id\n\t* @param $table\n\t* @param array $array\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tfunction selectObjectsInArray($table, $array=array(), $orderby=null) {\n\t $where = 'id IN ' . implode(\",\", $array);\n\t $res = $this->selectObjects($table, $where, $orderby);\n\t return $res;\n\t}",
"\t/**\n\t* Select a series of objects, and return by ID\n\t*\n\t* Selects a set of objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of objects, in any random order. The indices of the array\n\t* are the IDs of the objects.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tabstract function selectObjectsIndexedArray($table, $where = null, $orderby = null);",
" /**\n * Count Objects matching a given criteria\n *\n * @param string $table The name of the table to count objects in.\n * @param string $where Criteria for counting.\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return int\n */\n\tabstract function countObjects($table, $where = null, $is_revisioned=false, $needs_approval=false);",
"\t/**\n\t* Count Objects matching a given criteria using raw sql\n\t*\n\t* @param string $sql The sql query to be run\n\t* @return int\n\t*/\n\tabstract function countObjectsBySql($sql);",
"\t/**\n\t* Count Objects matching a given criteria using raw sql\n\t*\n\t* @param string $sql The sql query to be run\n\t* @return int|void\n\t*/\n\tfunction queryRows($sql) { //FIXME never used",
"\t}",
"\t/**\n\t* Select a single object.\n\t*\n\t* Selects an objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a single record from a database table. Returns the\n\t* first record/object found (in the case of multiple-result queries,\n\t* there is no way to determine which of the set will be returned).\n\t* If no record(s) match the query, null is returned.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set.\n\t* @return object|null|void\n\t*/\n\tabstract function selectObject($table, $where);",
"\t/**\n\t * @param $table\n\t * @param string $lockType\n\t * @return mixed\n\t */\n\tabstract function lockTable($table,$lockType=\"WRITE\");",
"\t/**\n\t * @return mixed\n\t */\n\tabstract function unlockTables();",
"\t/**\n\t* Insert an Object into some table in the Database\n\t*\n\t* This method will return the ID assigned to the new record by database. Note that\n\t* object attributes starting with an underscore ('_') will be ignored and NOT inserted\n\t* into the table as a field value.\n\t*\n\t* @param object $object The object to insert.\n\t* @param string $table The logical table name to insert into. This does not include the table prefix, which\n\t* is automagically prepended for you.\n\t* @return int|void\n\t*/\n\tabstract function insertObject($object, $table);",
"\t/**\n\t* Delete one or more objects from the given table.\n\t*\n\t* @param string $table The name of the table to delete from.\n\t* @param string $where Criteria for determining which record(s) to delete.\n\t* @return mixed\n\t*/\n\tabstract function delete($table, $where = null);",
"\t/**\n\t* Update one or more objects in the database.\n\t*\n\t* This function will only update the attributes of the resulting record(s)\n\t* that are also member attributes of the $object object.\n\t*\n\t* @param object $object An object specifying the fields and values for updating.\n\t* In most cases, this will be the altered object originally returned from one of\n\t* the select* methods.\n\t* @param string $table The table to update in.\n\t* @param string $where Optional criteria used to narrow the result set.\n\t* @param string $identifier\n\t* @param bool $is_revisioned\n\t* @return bool|int|void\n\t*/\n\tabstract function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false);",
" /**\n * Reduces table item revisions to a passed total\n *\n * @param string $table The name of the table to trim\n * @param integer $id The item id\n * @param integer $num The number of revisions to retain\n * @param int $workflow is workflow turned on (or force)\n */\n public function trim_revisions($table, $id, $num, $workflow=ENABLE_WORKFLOW) {\n if ($workflow && $num) {\n $max_revision = $this->max($table, 'revision_id', null, 'id='.$id);\n $max_approved = $this->max($table, 'revision_id', null, 'id='.$id.' AND approved=1');\n $min_revision = $this->min($table, 'revision_id', null, 'id='.$id);\n if ($max_revision == null) {\n return;\n }\n if (($max_revision - $num) > $max_approved) {\n $approved_max = ' AND revision_id < ' . $max_approved; // never delete most recent approved item\n } else {\n $approved_max = '';\n }\n if ($max_revision - $min_revision >= $num) {\n $this->delete($table, 'id=' . $id . ' AND revision_id <= ' . ($max_revision - $num) . $approved_max);\n }\n if (!empty($approved_max)) {\n // we've trimmed all the fat below the newest approved item, now trim the dead wood above it\n $this->delete($table, 'id=' . $id . ' AND revision_id <= ' . ($max_revision - $num + 1) . ' AND revision_id > ' . $max_approved);\n }\n }\n }",
"\t/**\n\t * Find the maximum value of a field. This is similar to a standard\n\t * SELECT MAX(field) ... query.\n\t *\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a maximum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return mixed\n\t */\n\tabstract function max($table, $attribute, $groupfields = null, $where = null);",
"\t/**\n\t * Find the minimum value of a field. This is similar to a standard\n\t * SELECT MIN(field) ... query.\n\t *\n\t * @internal Internal\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a minimum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return null\n\t */\n\tabstract function min($table, $attribute, $groupfields = null, $where = null);",
"\t/**\n\t* Increment a numeric table field in a table.\n\t*\n\t* @param string $table The name of the table to increment in.\n\t* @param string $field The field to increment.\n\t* @param integer $step The step value. Usually 1. This can be negative, to\n\t* decrement, but the decrement() method is preferred, for readability.\n\t* @param string $where Optional criteria to determine which records to update.\n\t* @return mixed\n\t*/\n\tabstract function increment($table, $field, $step, $where = null);",
"\t/**\n\t* Decrement a numeric table field in a table.\n\t*\n\t* @param string $table The name of the table to decrement in.\n\t* @param string $field The field to decrement.\n\t* @param integer $step The step value. Usually 1. This can be negative, to\n\t* increment, but the increment() method is preferred, for readability.\n\t* @param string $where Optional criteria to determine which records to update.\n\t*/",
"\tfunction decrement($table, $field, $step, $where = null) {\n\t $this->increment($table, $field, -1 * $step, $where);\n\t}",
"\t/**\n\t* Check to see if the named table exists in the database.\n\t* Returns true if the table exists, and false if it doesn't.\n\t*\n\t* @param string $table Name of the table to look for.\n\t* @return bool\n\t*/\n\tabstract function tableExists($table);",
"\t/**\n\t* Get a list of all tables in the database. Optionally, only the tables\n\t* in the current logical database (tables with the same prefix) can\n\t* be retrieved.\n\t*\n\t* @param bool $prefixed_only Whether to return only the tables\n\t* for the logical database, or all tables in the physical database.\n\t* @return array\n\t*/\n\tabstract function getTables($prefixed_only=true);",
"\t/**\n\t* Runs whatever table optimization routines the database engine supports.\n\t*\n\t* @param string $table The name of the table to optimize.\n\t* @return bool\n\t*/\n\tabstract function optimize($table);",
"\t/**\n\t* Retrieve table information for a named table.\n\t* Returns an object, with the following attributes:\n\t* <ul>\n\t* <li><b>rows</b> -- The number of rows in the table.</li>\n\t* <li><b>average_row_length</b> -- The average storage size of a row in the table.</li>\n\t* <li><b>data_total</b> -- How much total disk space is used by the table.</li>\n\t* <li><b>data_overhead</b> -- How much storage space in the table is unused (for compacting purposes)</li>\n\t* </ul>\n\t* @param $table\n\t* @return null\n\t*/\n\tfunction tableInfo($table) { //FIXME never used",
"\t}",
"\t/**\n\t* Check whether or not a table in the database is empty (0 rows).\n\t* Returns tue of the specified table has no rows, and false if otherwise.\n\t*\n\t* @param string $table Name of the table to check.\n\t* @return bool\n\t*/\n\tfunction tableIsEmpty($table) {\n\t return ($this->countObjects($table) == 0);\n\t}",
"\t/**\n\t* Returns table information for all tables in the database.\n\t* This function effectively calls tableInfo() on each table found.\n\t* @return array\n\t*/\n\tabstract function databaseInfo();",
"\t/**\n\t* This is an internal function for use only within the database database class\n\t* @internal Internal\n\t* @param $status\n\t* @return null\n\t*/\n\tfunction translateTableStatus($status) {\n\t $data = new stdClass();\n\t $data->rows = $status->Rows;\n\t $data->average_row_lenth = $status->Avg_row_length;\n\t $data->data_overhead = $status->Data_free;\n\t $data->data_total = $status->Data_length;",
"\t return $data;\n\t}",
"\t/**\n\t * @param $table\n\t * @return array\n\t */\n\tfunction describeTable($table) { //FIXME never used",
"\t}",
"\t/**\n\t* Build a data definition from a pre-existing table. This is used\n\t* to intelligently alter tables that have already been installed.\n\t*\n\t* @param string $table The name of the table to get a data definition for.\n\t* @return array|null\n\t*/\n\tabstract function getDataDefinition($table);",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int\n\t*/\n\tfunction getDDFieldType($fieldObj) {\n\t $type = strtolower($fieldObj->Type);",
"\t if ($type == \"int(11)\")\n\t return DB_DEF_ID;\n\t if ($type == \"int(8)\")\n\t return DB_DEF_INTEGER;\n\t elseif ($type == \"tinyint(1)\")\n\t return DB_DEF_BOOLEAN;\n\t elseif ($type == \"int(14)\")\n\t return DB_DEF_TIMESTAMP;\n elseif ($type == \"datetime\")\n \t return DB_DEF_TIMESTAMP;\n\t //else if (substr($type,5) == \"double\")\n //return DB_DEF_DECIMAL;\n\t elseif ($type == \"double\")\n\t return DB_DEF_DECIMAL;\n\t // Strings\n\t elseif ($type == \"text\" || $type == \"mediumtext\" || $type == \"longtext\" || strpos($type, \"varchar(\") !== false) {\n\t return DB_DEF_STRING;\n\t } else {\n return DB_DEF_INTEGER;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDStringLen($fieldObj) {\n\t $type = strtolower($fieldObj->Type);\n\t if ($type == \"text\")\n\t return 65535;\n\t else if ($type == \"mediumtext\")\n\t return 16777215;\n\t else if ($type == \"longtext\")\n\t return 16777216;\n\t else if (strpos($type, \"varchar(\") !== false) {\n\t return str_replace(array(\"varchar(\", \")\"), \"\", $type) + 0;\n\t } else {\n return 256;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDKey($fieldObj) {\n\t $key = strtolower($fieldObj->Key);\n\t if ($key == \"pri\")\n\t return DB_PRIMARY;\n\t else if ($key == \"uni\") {\n\t return DB_UNIQUE;\n\t } else {\n return false;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDAutoIncrement($fieldObj) {\n\t $auto = strtolower($fieldObj->Extra);\n\t if ($auto == \"auto_increment\") {\n\t return true;\n\t } else {\n return false;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDIsNull($fieldObj) {\n\t $null = strtolower($fieldObj->Null);\n\t if ($null == \"yes\") {\n\t return true;\n\t } else {\n return false;\n }\n\t}",
"\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDDefault($fieldObj) {\n\t\treturn strtolower($fieldObj->Default);\n\t}",
"\t/**\n\t* Returns an error message from the database server. This is intended to be\n\t* used by the implementers of the database wrapper, so that certain\n\t* cryptic error messages can be reworded.\n\t* @return string\n\t*/\n\tabstract function error();",
"\t/**\n\t* Checks whether the database connection has experienced an error.\n\t* @return bool\n\t*/\n\tabstract function inError();",
"\t/**",
"\t * Escape a string based on the database connection",
"\t * @param $string\n\t * @return string\n\t */\n\tabstract function escapeString($string);",
" /**",
" \t * Attempt to prevent a sql injection",
" \t * @param $string\n \t * @return string\n \t */\n \tfunction injectProof($string) {\n \t $quotes = substr_count(\"'\", $string);\n if ($quotes % 2 != 0)\n $string = $this->escapeString($string);\n $dquotes = substr_count('\"', $string);\n if ($dquotes % 2 != 0)\n $string = $this->escapeString($string);\n return $string;\n }",
"\t/**\n\t * Create a SQL \"limit\" phrase\n\t *\n\t * @param $num\n\t * @param $offset\n\t * @return string\n\t */\n\tfunction limit($num, $offset) {\n\t return ' LIMIT ' . $offset . ',' . $num . ' ';\n\t}",
"\t/**\n\t* Select an array of arrays\n\t*\n\t* Selects a set of arrays from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of arrays, in any random order.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param string $orderby\n\t* @return array\n\t*/\n\tabstract function selectArrays($table, $where = null, $orderby = null);",
"\t/**\n\t* Select an array of arrays\n\t*\n\t* Selects a set of arrays from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of arrays, in any random order.\n\t*\n\t* @param string $sql The name of the table/object to look at\n\t* @return array\n\t*/\n\tabstract function selectArraysBySql($sql);",
" /**\n * Select a record from the database as an array\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array|void\n */\n\tabstract function selectArray($table, $where = null, $orderby = null, $is_revisioned=false, $needs_approval=false);",
" /**\n\t * Instantiate objects from selected records from the database\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param $classname\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @param null $order\n * @param null $limitsql\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array\n */\n\tabstract function selectExpObjects($table, $where=null, $classname, $get_assoc=true, $get_attached=true, $except=array(), $cascade_except=false, $order=null, $limitsql=null, $is_revisioned=false, $needs_approval=false);",
"\t/**\n\t * Instantiate objects from selected records from the database\n\t *\n\t* @param string $sql The sql statement to run on the model/classname\n\t* @param string $classname Can be $this->baseclassname\n\t* Returns an array of fields\n\t* @param bool $get_assoc\n\t* @param bool $get_attached\n\t* @return array\n\t*/\n\tfunction selectExpObjectsBySql($sql, $classname, $get_assoc=true, $get_attached=true) { //FIXME never used",
"\t}",
"\t/**\n\t * @param $table\n\t * @return array\n\t */\n\tfunction selectNestedTree($table) {\n\t $sql = 'SELECT node.*, (COUNT(parent.sef_url) - 1) AS depth\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tGROUP BY node.sef_url\n\t\tORDER BY node.lft';\n\t return $this->selectObjectsBySql($sql);\n\t}",
"\tfunction selectFormattedNestedTree($table) {\n\t\t$sql = \"SELECT CONCAT( REPEAT( '   ', (COUNT(parent.title) -1) ), node.title) AS title, node.id\n\t\t\t\tFROM \" .$this->prefix . $table. \" as node, \" .$this->prefix . $table. \" as parent\n\t\t\t\tWHERE node.lft BETWEEN parent.lft and parent.rgt\n\t\t\t\tGROUP BY node.title, node.id\n\t\t\t\tORDER BY node.lft\";",
"\t\treturn $this->selectObjectsBySql($sql);\n\t}",
"\t/**\n\t * @param $table\n\t * @param $start\n\t * @param $width\n\t * @return void\n\t */\n\tfunction adjustNestedTreeFrom($table, $start, $width) {\n\t $table = $this->prefix . $table;\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt + ' . $width . ' WHERE rgt >=' . $start);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft + ' . $width . ' WHERE lft >=' . $start);\n\t //eDebug('UPDATE `'.$table.'` SET rgt = rgt + '.$width.' WHERE rgt >='.$start);\n\t //eDebug('UPDATE `'.$table.'` SET lft = lft + '.$width.' WHERE lft >='.$start);\n\t}",
"\t/**\n\t * @param $table\n\t * @param $lft\n\t * @param $rgt\n\t * @param $width\n\t * @return void\n\t */\n\tfunction adjustNestedTreeBetween($table, $lft, $rgt, $width) {\n\t $table = $this->prefix . $table;\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt + ' . $width . ' WHERE rgt BETWEEN ' . $lft . ' AND ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft + ' . $width . ' WHERE lft BETWEEN ' . $lft . ' AND ' . $rgt);\n\t //eDebug('UPDATE `'.$table.'` SET rgt = rgt + '.$width.' WHERE rgt BETWEEN '.$lft.' AND '.$rgt);\n\t //eDebug('UPDATE `'.$table.'` SET lft = lft + '.$width.' WHERE lft BETWEEN '.$lft.' AND '.$rgt);\n\t}",
"\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedBranch($table, $node=null) {\n\t if (empty($node))\n\t return array();",
"\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n//\t global $db;\n\t $sql = 'SELECT node.*,\n\t (COUNT(parent.title) - (sub_tree.depth + 1)) AS depth\n\t FROM `' . $this->prefix . $table . '` AS node,\n\t `' . $this->prefix . $table . '` AS parent,\n\t `' . $this->prefix . $table . '` AS sub_parent,\n\t ( SELECT node.*, (COUNT(parent.title) - 1) AS depth\n\t FROM `' . $this->prefix . $table . '` AS node,\n\t `' . $this->prefix . $table . '` AS parent\n\t WHERE node.lft BETWEEN parent.lft\n\t AND parent.rgt AND node.' . $where . '\n\t GROUP BY node.title\n\t ORDER BY node.lft )\n\t AS sub_tree\n\t WHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt\n\t AND sub_parent.title = sub_tree.title\n\t GROUP BY node.title\n\t ORDER BY node.lft;';",
"\t return $this->selectObjectsBySql($sql);\n\t}",
"\t/**\n\t * @param $table\n\t * @param $lft\n\t * @param $rgt\n\t * @return void\n\t */\n\tfunction deleteNestedNode($table, $lft, $rgt) {\n\t $table = $this->prefix . $table;",
"\t $width = ($rgt - $lft) + 1;\n\t $this->sql('DELETE FROM `' . $table . '` WHERE lft BETWEEN ' . $lft . ' AND ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt - ' . $width . ' WHERE rgt > ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft - ' . $width . ' WHERE lft > ' . $rgt);\n\t}",
"\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectPathToNestedNode($table, $node=null) {\n\t if (empty($node))\n\t return array();",
"\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n\t $sql = 'SELECT parent.*\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tAND node.' . $where . '\n\t\tORDER BY parent.lft;';\n\t return $this->selectObjectsBySql($sql);\n\t}",
"\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedNodeParent($table, $node=null) {\n\t if (empty($node))\n\t return array();",
"\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n\t $sql = 'SELECT parent.*\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tAND node.' . $where . '\n\t\tORDER BY parent.lft DESC\n\t\tLIMIT 1, 1;';\n\t $parent_array = $this->selectObjectsBySql($sql);\n\t return $parent_array[0];\n\t}",
"\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedNodeChildren($table, $node=null) {\n\t if (empty($node))\n\t return array();",
"\t $where = is_numeric($node) ? 'node.id=' . $node : 'node.title=\"' . $node . '\"';\n\t $sql = '\n\t\tSELECT node.*, (COUNT(parent.title) - (sub_tree.depth + 1)) AS depth\n\t\tFROM ' . $this->prefix . $table . ' AS node,\n\t\t\t' . $this->prefix . $table . ' AS parent,\n\t\t\t' . $this->prefix . $table . ' AS sub_parent,\n\t\t\t(\n\t\t\t\tSELECT node.*, (COUNT(parent.title) - 1) AS depth\n\t\t\t\tFROM ' . $this->prefix . $table . ' AS node,\n\t\t\t\t' . $this->prefix . $table . ' AS parent\n\t\t\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\t\t\tAND ' . $where . '\n\t\t\t\tGROUP BY node.title\n\t\t\t\tORDER BY node.lft\n\t\t\t)AS sub_tree\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\t\tAND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt\n\t\t\tAND sub_parent.title = sub_tree.title\n\t\tGROUP BY node.title\n\t\tHAVING depth = 1\n\t\tORDER BY node.lft;';\n\t$children = $this->selectObjectsBySql($sql);\n\t return $children;\n\t}",
"\t/**\n\t * This function returns all the text columns in the given table\n\t * @param $table\n\t * @return array\n\t */\n\tabstract function getTextColumns($table);",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expPaginator\n * Exponent Pagination Subsystem\n *\n * The expPaginator class is used to retrieve objects from the database\n * and paginate them and optionally group the by category.\n * It automagically handles the calls to other pages\n * and has built-in sorting using the defined column headers.",
" * ",
" * Usage Example:",
" * ",
" * <code>\n *\n * $page = new expPaginator(array(\n * 'model'=>'faq',",
" * 'where'=>1, ",
" * 'limit'=>25,\n * 'order'=>'rank',\n * 'controller'=>$this->baseclassname,\n * 'action'=>$this->params['action'],\n * 'columns'=>array('In FAQ'=>'include_in_faq', 'Submitted'=>'created_at', 'Submitted By'=>'submitter_name'),\n * ));\n * </code>",
" * ",
" * @package Subsystems\n * @subpackage Subsystems\n */",
"class expPaginator {\n /**#@+\n * @access public\n * @var string\n */\n\tpublic $model = null;\n public $search_string = '';\n\tpublic $sql = '';\n public $count_sql = '';",
"\tpublic $where = '';\t",
"\tpublic $controller = '';\n\tpublic $action = '';\n\tpublic $order = '';\n\tpublic $order_direction = '';\n\tpublic $firstpage = '';\n\tpublic $lastpage = '';\n\tpublic $previous_page = '';\n\tpublic $next_page = '';\n\tpublic $previous_shift = '';\n\tpublic $next_shift = '';\n\tpublic $pagelink = '';\n\tpublic $header_columns = '';\n\tpublic $default = '';\n\tpublic $view = null;\n public $uncat ='';\n// public $content_type = '';\n// public $author = '';\n// public $tag = '';\n// public $tags = '';\n\t/**#@+\n * @access public\n * @var integer\n */\n\tpublic $page = 1;\n//\tpublic $limit = 10;\n public $limit = 0;\n\tpublic $start = 0;\n\tpublic $last = 0;\n\tpublic $pages_to_show = 10;\n\tpublic $total_records = 0;\n\tpublic $total_pages = 0;\n\tpublic $page_offset = 0;\n public $categorize = false;\n// public $version = 0;\n// public $content_id = 0;\n\t/**#@+\n * @access public\n * @var array",
" */\t",
"\tpublic $pages = array();\n\tpublic $records = array();\n public $cats = array();\n public $sort_dropdown = array();",
"\t/**\n\t * expPaginator Constructor\n\t *\n\t * This is the main entry point for using the expPaginator. See example above.\n\t *\n\t * @param array $params Use this to set any of the class variables. Ones not passed will be set to a default.\n\t * @return \\expPaginator\n\t */\n\tpublic function __construct($params=array()) {",
"\t\tglobal $router,$db;",
"\n $this->pages_to_show = expTheme::is_mobile() ? 6 : 10; // fewer paging links for small devices\n\t\t$this->where = empty($params['where']) ? null : $params['where'];\n\t\t$this->records = empty($params['records']) ? array() : $params['records'];\n//\t\t$this->limit = empty($params['limit']) ? 10 : $params['limit'];",
" $this->limit = empty($params['limit']) ? 0 : $params['limit'];",
" $this->page = empty($params['page']) ? 1 : intval($params['page']);\n\t\t$this->action = empty($params['action']) ? '' : $params['action'];\n\t\t$this->controller = empty($params['controller']) ? '' : $params['controller'];\n\t\t$this->sql = empty($params['sql']) ? '' : $params['sql'];\n $this->count_sql = empty($params['count_sql']) ? '' : $params['count_sql'];",
"\t\t$this->order = empty($params['order']) ? 'id' : $params['order'];\n\t\t$this->dir = empty($params['dir']) ? 'ASC' : $params['dir'];\n\t\t$this->src = empty($params['src']) ? null : $params['src'];",
" $this->categorize = empty($params['categorize']) ? false : $params['categorize'];\n $this->uncat = !empty($params['uncat']) ? $params['uncat'] : gt('Not Categorized');\n $this->groups = !empty($params['groups']) ? $params['groups'] : array();\n $this->grouplimit = !empty($params['grouplimit']) ? $params['grouplimit'] : null;\n $this->dontsortwithincat = !empty($params['dontsortwithincat']) ? $params['dontsortwithincat'] : null;\n $this->dontsort = !empty($params['dontsort']) ? $params['dontsort'] : null;",
"\t\t// if a view was passed we'll use it.\n\t\tif (isset($params['view']))\n $this->view = $params['view'];",
" // setup the model if one was passed.\n if (isset($params['model'])) {\n $this->model = $params['model'];\n $class = new $this->model(null, false, false);\n }",
"\t",
"\t // auto-include the CSS for pagination links\n\t expCSS::pushToHead(array(\n//\t\t \"unique\"=>\"pagination\",\n//\t\t \"link\"=>PATH_RELATIVE.\"framework/core/assets/css/pagination.css\",\n 'corecss'=>'pagination'\n\t\t )\n\t\t);",
"\t\t",
"\t\tif ($this->limit)\n $this->start = (($this->page * $this->limit) - $this->limit);\n if ($this->start < 0)\n $this->start = 0;",
"\t\t//setup the columns\n $this->columns = array();\n\t\tif (isset($params['columns'])) {\n\t\t foreach($params['columns'] as $key=>$col){\n\t\t $colparse[$key] = explode('|',$col);\n\t\t $column = array($key=>$colparse[$key][0]);\n\t\t $this->columns = array_merge($this->columns,$column);\n\t\t if (!empty($colparse[$key][1])) {\n\t\t $params = explode(',',$colparse[$key][1]);\n\t\t foreach ($params as $paramval) {\n\t\t $prm = explode('=',$paramval);\n\t\t $this->linkables[$key][$prm[0]] = $prm[1];\n\t\t }\n\t\t }\n\t\t }\n\t\t}",
"\t\t",
"\t\t//setup the default ordering of records\n\t\t// if we are in an action, see if the action is for this controller/action..if so pull the order\n\t\t// and order direction from the request params...this is how the params are passed via the column\n\t\t// headers.",
"\t\t$this->order_direction = $this->dir;\t",
"\n // allow passing of a single order/dir as stored in config\n if (strstr($this->order,\" \")) {\n $orderby = explode(\" \",$this->order);\n $this->order = $orderby[0];\n $this->order_direction = $orderby[1];\n }",
"",
" if ($this->dontsort)\n $sort = null;\n else\n $sort = $this->order.' '.$this->order_direction;",
"\t\t// figure out how many records we're dealing with & grab the records\n\t\t//if (!empty($this->records)) { //from Merge <~~ this doesn't work. Could be empty, but still need to hit.\n if (!empty($this->categorize))\n $limit = null;\n else\n $limit = $this->limit;",
"\t\tif (isset($params['records'])) { // if we pass $params['records'], we WANT to hit this\n\t\t // sort the records that were passed in to us\n if (!empty($sort))\n usort($this->records,array('expPaginator', strtolower($this->order_direction)));\n//\t\t $this->total_records = count($this->records);\n\t\t} elseif (!empty($class)) { //where clause //FJD: was $this->class, but wasn't working...\n\t\t\t$this->total_records = $class->find('count', $this->where);\n $this->records = $class->find('all', $this->where, $sort, $limit, $this->start);\n\t\t} elseif (!empty($this->where)) { //from Merge....where clause\n\t\t\t$this->total_records = $class->find('count', $this->where);\n $this->records = $class->find('all', $this->where, $sort, $limit, $this->start);\n\t\t} else { //sql clause //FIXME we don't get attachments in this approach\n\t\t\t//$records = $db->selectObjectsBySql($this->sql);\n\t\t\t//$this->total_records = count($records);\n //this is MUCH faster if you supply a proper count_sql param using a COUNT() function; if not,\n //we'll run the standard sql and do a queryRows with it\n\t\t\t//$this->total_records = $this->count_sql == '' ? $db->queryRows($this->sql) : $db->selectValueBySql($this->count_sql); //From Merge",
" ",
"//\t\t\t$this->total_records = $db->countObjectsBySql($this->count_sql); //$db->queryRows($this->sql); //From most current Trunk",
" if (!empty($sort)) $this->sql .= ' ORDER BY '.$sort;\n if (!empty($this->count_sql)) $this->total_records = $db->countObjectsBySql($this->count_sql);\n\t\t\tif (!empty($this->limit)) $this->sql .= ' LIMIT '.$this->start.','.$this->limit;",
"\t\t\t",
"\t\t\t$this->records = array();\n\t\t\tif (isset($this->model) || isset($params['model_field'])) {\n\t\t\t foreach($db->selectObjectsBySql($this->sql) as $record) {\n $type = $params['model_field'];\n\t\t\t $classname = isset($params['model_field']) ? $record->$type : $this->model;\n\t\t\t //$this->records[] = new $classname($record->id, true, true); //From current trunk // added false, true, as we shouldn't need associated items here, but do need attached. FJD.\n\t\t\t\t\t$this->records[] = new $classname($record->id, false, true); //From Merge //added false, true, as we shouldn't need associated items here, but do need attached. FJD.\n\t\t\t }\n\t\t\t} else {\n\t\t\t $this->records = $db->selectObjectsBySql($this->sql);\n\t\t\t}",
"\t\t}\t",
"\n // next we'll sort them based on categories if needed\n if (!empty($this->categorize) && $this->categorize && empty($this->dontsort))\n expCatController::addCats($this->records,$sort,$this->uncat,$this->groups,$this->dontsortwithincat);",
" // let's see how many total records there are\n if (empty($this->total_records))\n $this->total_records = count($this->records);\n if ($this->limit && $this->start >= $this->total_records)\n $this->start = $this->total_records - $this->limit;",
" // at this point we generally have all our records, now we'll trim the records to the number requested\n //FIXME we may want some more intelligent selection here based on cats/groups, e.g., don't break groups across pages, number of picture rows, etc...\n if (empty($this->grouplimit) && ($this->limit) && count($this->records) > $this->limit)\n $this->records = array_slice($this->records, $this->start, $this->limit);\n // finally, we'll create another multi-dimensional array of categories populated with assoc items\n if (empty($this->dontsort)) {\n if (!empty($this->categorize) && $this->categorize) {\n expCatController::sortedByCats($this->records,$this->cats,$this->groups,$this->grouplimit);\n } elseif (empty($this->dontsortwithincat)) { // categorized is off, so let's categorize by alpha instead for 'rolodex' type use\n $order = $this->order;\n if (in_array($order,array('created_at','edited_at','publish'))) {\n if ($this->total_records && (abs($this->records[0]->$order - $this->records[count($this->records)-1]->$order) >= (60 * 60 * 24 *365 *2))) {\n $datetype = 'Y'; // more than 2 years of records, so break down by year\n } else {\n $datetype = 'M Y'; // less than 2 years of records, so break down by month/year\n }\n foreach ($this->records as $record) {\n if (is_numeric($record->$order)) {\n $title = date($datetype,$record->$order);\n $title = empty($title)?gt('Undated'):$title;\n } else {\n $title = gt('Undated');\n }\n if (empty($this->cats[$title])) {\n $this->cats[$title] = new stdClass();\n $this->cats[$title]->count = 1;\n $this->cats[$title]->name = $title;\n } else {\n $this->cats[$title]->count++;\n }\n $this->cats[$title]->records[] = $record;\n }\n } else {\n foreach ($this->records as $record) {\n if (!empty($record->$order) && is_string($record->$order) && !is_numeric($record->$order)) {\n $title = ucfirst($record->$order);\n $title = empty($title[0])?'':$title[0];\n } else {\n $title = '';\n }\n if (empty($this->cats[$title])) {\n $this->cats[$title] = new stdClass();\n $this->cats[$title]->count = 1;\n $this->cats[$title]->name = $title;\n } else {\n $this->cats[$title]->count++;\n }\n $this->cats[$title]->records[] = $record;\n }\n }\n }\n if (!empty($this->grouplimit)) {\n if ($this->limit)\n $this->records = array_slice($this->records, $this->start, $this->limit);\n } else {\n if ($this->limit)\n $this->cats = array_slice($this->cats, $this->start, $this->limit);\n }\n }",
" if (isset($params['records']))\n $this->runCallback(); // isset($params['records']) added to correct search for products.",
" //eDebug($this->records);\n\t\t// get the number of the last record we are showing...this is used in the page links.\n\t\t// i.e. \"showing 10-19 of 57\"...$this->last would be the 19 in that string\n\t\tif ($this->total_records > 0) {\n\t\t\t$this->firstrecord = $this->start + 1;\n\t\t\t$this->lastrecord = ($this->total_records < $this->limit) ? ($this->start + $this->total_records) : ($this->start + $this->limit);\n\t\t\tif ($this->lastrecord > $this->total_records || $this->lastrecord == 0)\n $this->lastrecord = $this->total_records;\n\t\t} else {\n\t\t\t$this->firstrecord = 0;\n\t\t\t$this->lastrecord = 0;\n\t\t}",
"\t\t\t",
"\t\t// get the page parameters from the router to build the links\n $page_params = $router->params;\n//\t\t$page_params = $this->cleanParams($router->params);\n foreach (array(\"__utma\", \"__utmz\", \"route_sanitized\") as $key) {\n if (isset($page_params[$key]))\n unset($page_params[$key]);\n }\n if (!empty($page_params['search_string']))\n $page_params['search_string'] = urlencode($page_params['search_string']);",
"\t\t//if (empty($page_params['module'])) $page_params['module'] = $this->controller;\n\t\t//if (empty($page_params['action'])) $page_params['action'] = $this->action;\n\t\t//if (empty($page_params['src']) && isset($params['src'])) $page_params['src'] = $params['src'];\n\t\tif (!empty($this->controller)) {\n\t\t unset($page_params['module']);\n\t\t $page_params['controller'] = expModules::getModuleName($this->controller);\n\t\t} else {\n if (expTheme::inAction() && empty($params)) {\n //FIXME: module/controller glue code\n //\t\t $mod = !empty($_REQUEST['controller']) ? expString::sanitize($_REQUEST['controller']) : expString::sanitize($_REQUEST['module']);\n //\t\t if ($this->controller == $mod && $this->action == $_REQUEST['action']) {\n //\t\t\t $this->order = isset($_REQUEST['order']) ? $_REQUEST['order'] : $this->order;\n //\t\t\t $this->order_direction = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : $this->dir;\n //\t\t\t}\n $mod = !empty($router->params['controller']) ? $router->params['controller'] : $router->params['module'];\n if ($this->controller == $mod && $this->action == $router->params['action']) {\n $this->order = isset($router->params['order']) ? $router->params['order'] : $this->order;\n $this->order_direction = isset($router->params['dir']) ? $router->params['dir'] : $this->dir;",
"",
" }\n } else {\n if (isset($params->controller)) {\n $mod = $params->controller;\n } else {\n $mod = '';\n }\n }\n $page_params['controller'] = $mod; // we can't be passing an empty controller or module to the router\n }",
"\t\t",
"\t\tif (!empty($this->action))\n $page_params['action'] = $this->action;\n\t\tif (!empty($this->src))\n $page_params['src'] = $this->src;",
"\t\t",
"\t\tif (isset($page_params['section']))\n unset($page_params['section']);",
"\t\t//build a 'more' link we can use in the headlines views.\n\t\t$this->morelink = $router->makeLink($page_params, false, false, true);",
"\t\tif (!empty($this->view))\n $page_params['view'] = $this->view;",
"\t\t//build a couple more links we can use in the views.\n\t\t$this->pagelink = $router->makeLink($page_params, false, false, true);",
"\t\t",
"\t\t// if don't have enough records for more than one page then we're done.\n\t\t//if ($this->total_records <= $this->limit) return true;",
"\t\t",
"\t\t$this->total_pages = ($this->limit > 0) ? ceil($this->total_records/$this->limit) : 0;",
" // correct current page # to be within limits of number of pages\n\t\tif ($this->page > $this->total_pages) {\n\t\t\t$this->page = $this->total_pages;\n //FIXME return 404 error for infinite page scroll plugin\n if (!empty($this->total_pages)) header(':', true, 404);\n\t\t}",
" // setup the previous link\n if ($this->page > 1) {\n $page_params['page'] = $this->page - 1;\n $this->previous_pagenum = $this->page - 1;\n $this->previous_page = $router->makeLink($page_params, false, false, true);\n if (expTheme::is_mobile())\n $this->pages_to_show--;\n }",
" // setup the next link\n if ($this->page < $this->total_pages) {\n $page_params['page'] = $this->page + 1;\n $this->next_pagenum = $this->page + 1;\n $this->next_page = $router->makeLink($page_params, false, false, true);\n if (expTheme::is_mobile())\n $this->pages_to_show--;\n }",
"\t\t//setup the pages for the links\n\t\tif ($this->total_pages > $this->pages_to_show) {\n\t\t\t$this->first_pagelink = max(1, floor(($this->page) - ($this->pages_to_show) / 2));\n\t\t $this->last_pagelink = $this->first_pagelink + $this->pages_to_show - 1;\n\t\t if ($this->last_pagelink > $this->total_pages) {\n\t\t $this->first_pagelink = max(1, $this->total_pages - $this->pages_to_show) + 1;",
"\t\t $this->last_pagelink = $this->total_pages; ",
"\t\t }\n\t\t} else {\n\t\t\t$this->first_pagelink = 1;\n\t\t\t$this->last_pagelink = $this->total_pages;\n\t\t}",
"\t\t// setup the previous 10 'group jump' link\n\t\tif ($this->page > $this->pages_to_show) {\n\t\t\t$page_params['page'] = $this->first_pagelink - 1;\n $this->previous_shiftnum = $this->first_pagelink - 1;\n \t$this->previous_shift = $router->makeLink($page_params, false, false, true);\n\t\t\t$page_params['page'] = 1;\n\t\t\t$this->firstpage = $router->makeLink($page_params, false, false, true);\n\t\t}",
"\t\t// setup the next 10 'group jump' link\n\t\tif ($this->page < ($this->total_pages - $this->pages_to_show)) {\n $page_params['page'] = $this->last_pagelink + 1;\n $this->next_shiftnum = $this->last_pagelink + 1;\n $this->next_shift = $router->makeLink($page_params, false, false, true);\n\t\t\t$page_params['page'] = $this->total_pages;\n\t\t\t$this->lastpage = $router->makeLink($page_params, false, false, true);\n }",
"\t\t// setup the links to the remaining pages being displayed.",
"\t\tfor($i=$this->first_pagelink; $i<=$this->last_pagelink; $i++) { ",
"\t\t\t$page_params['page'] = $i;\n\t\t\t$this->pages[$i] = $router->makeLink($page_params, false, false, true);",
"\t\t} \t",
"\n\t\t$links_template = expTemplate::get_common_template('pagination_links', null, 'common');\n\t\t$links_template->assign('page', $this);\n\t\t$this->links = $links_template->render();",
"\t\t",
"\t\t$this->makeHeaderCols($page_params); // headers for table view",
" ",
" $sortparams = array_merge($page_params, $router->params);",
"\t\t",
"\t\t//From Merge ****\n if (isset($router->params['page']))\n $sortparams['page'] = $router->params['page'];\n else\n unset($sortparams['page']);\n //End From Merge ****",
"\t\t$this->makeSortDropdown($sortparams); // used on non-table views",
" ",
" $table_template = expTemplate::get_common_template('pagination_table', null, 'common');\n $table_template->assign('page', $this);\n $this->table = $table_template->render(); // table view",
" ",
"\t}",
"\t",
"\t//From Merge\n private function cleanParams($params) {\n $defaultParams = array('title'=>'','module'=>'','controller'=>'','src'=>'','id'=>'','dir'=>'','_common'=>'');\n $newParams = array();",
" $func = new ReflectionClass($this); ",
" foreach ($params as $pKey=>$pVal) {\n $propname = $pKey;\n if (array_key_exists($propname,$defaultParams)) {",
" $newParams[$propname] = $params[$propname]; \n } \n } ",
" foreach ($func->getProperties() as $p) {\n $propname = $p->name;\n if (array_key_exists($propname,$params)) {",
" $newParams[$propname] = $params[$propname]; \n } \n } \n ",
" return $newParams;\n }",
" ",
" public function makeHeaderCols($params) {\n global $router;",
" if (!empty($this->columns) && is_array($this->columns)) {\n $this->header_columns = '';",
" ",
" // get the parameters used to make this page.\n if (!expTheme::inAction()) {\n unset($params['section']);\n if (empty($params['controller'])) $params['controller'] = $this->controller;\n if (empty($params['action'])) $params['action'] = $this->action;\n }",
" ",
"// $current = '';\n if (isset($params['order'])) {\n $current = $params['order'];\n unset($params['order']);\n } else {\n $current = $this->order;\n }",
" ",
" //loop over the columns and build out a list of <th>'s to be used in the page table\n foreach ($this->columns as $colname=>$col) {\n // if this is the column we are sorting on right now we need to setup some class info\n $class = isset($this->class) ? $this->class : 'page';\n $params['dir'] = 'ASC';",
" ",
" if ($col == $current) {\n $class = 'current '.strtolower($this->order_direction);\n $params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';",
" } ",
"\n $params['order'] = $col;",
" ",
" $this->header_columns .= '<th class=\"'.$class.'\">';\n // if this column is empty then it's not supposed to be a sortable column",
" if (empty($col)) {\n $this->header_columns .= '<span>'.$colname.'</span>';\n $this->columns[$colname] = ' ';\n } else if($colname==\"actupon\") {\n $this->header_columns .= '<input type=checkbox name=selall id=selall value=1 class=\"select-all\"/>';",
" ",
"// $js = \"\n// YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {\n// Y.all('input[type=checkbox]').on('click',function(e){\n// if (e.target.test('.select-all')) {\n// if (!e.target.get('checked')) {\n// this.each(function(n){\n// n.set('checked',false);\n// });\n// } else {\n// this.each(function(n){\n// n.set('checked',true);\n// });\n// };\n// };\n// });\n// });\n// \";",
" $js = \"\n $('#selall').change(function () {\n $('input[name=\\\"act-upon[]\\\"]').prop('checked', this.checked);\n });\n \";",
" expJavascript::pushToFoot(array(\n \"unique\"=>'select-all',\n// \"yui3mods\"=>1,\n \"jquery\"=>1,\n \"content\"=>$js,\n// \"src\"=>\"\"\n ));",
" } else {\n\t\t\t\t\tunset($params['page']); // we want to go back to the first page on a re-sort\n if ($col == 'no-sort') {\n $this->header_columns .= $colname;\n } else {\n $this->header_columns .= '<a href=\"'.$router->makeLink($params, false, false, true).'\" alt=\"sort by '.$colname.'\" rel=\"nofollow\">'.$colname.'</a>';\n }\n }",
" ",
" $this->header_columns .= '</th>';\n }\n }\n }",
" ",
" //here if we want to modify the record for some reason. e.g. Using in search results w/ products\n private function runCallback() {\n foreach ($this->records as &$record) {\n if (isset($record->ref_type)) {\n $refType = $record->ref_type;\n if (class_exists($record->ref_type)) {\n $type = new $refType();\n $classinfo = new ReflectionClass($type);\n if ($classinfo->hasMethod('paginationCallback')) {\n $item = new $type($record->original_id);\n $item->paginationCallback($record);\n }\n }\n }",
" } ",
" }",
" ",
"\tpublic function makeSortDropdown($params) {\n\t\tglobal $router;",
"\t\tif (!empty($this->columns) && is_array($this->columns)) {\n\t\t\t$this->sort_dropdown = array();",
"\t\t\t// get the parameters used to make this page.\n\t\t\tif (!expTheme::inAction()) {\n\t\t\t\tunset($params['section']);\n\t\t\t\tif (empty($params['controller'])) $params['controller'] = $this->controller;\n\t\t\t\tif (empty($params['action'])) $params['action'] = $this->action;\n\t\t\t}",
"\t\t\t",
"\t\t\t/*$current = '';\n\t\t\tif (isset($params['order'])) {\n\t\t\t\t$current = $params['order'];\n\t\t\t\tunset($params['order']);\n\t\t\t} else {\n\t\t\t\t$current = $this->order;\n\t\t\t} */",
"\t\t\t",
"\t\t\t//loop over the columns and build out a list of <th>'s to be used in the page table\n // eDebug($router);\n $defaultParams['controller'] = $params['controller'];\n $defaultParams['action'] = $params['action'];\n if (isset($params['title']))\n $defaultParams['title'] = $params['title'];\n if (isset($params['page']))\n $defaultParams['page'] = $params['page'];",
" ",
" $this->sort_dropdown[$router->makeLink($defaultParams, false, false, true)] = \"Default\";\n\t\t\tforeach ($this->columns as $colname=>$col) {\n\t\t\t\t// if this is the column we are sorting on right now we need to setup some class info\n\t\t\t\t/*$class = isset($this->class) ? $this->class : 'page';\n\t\t\t\t$params['dir'] = 'ASC';*/",
"\t\t\t\t",
"\t\t\t\t/*if ($col == $current) {\n\t\t\t\t\t$class = 'current';\n\t\t\t\t\t$class .= ' '.$this->order_direction;\n\t\t\t\t\tif (isset($params['dir'])) {\n\t\t\t\t\t\t$params['dir'] = $params['dir'] == 'ASC' ? 'DESC' : 'ASC';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';\n\t\t\t\t\t}",
"\t\t\t\t} ",
" */",
"\t\t\t\t$params['order'] = $col; \t\t\t\t \n\t\t\t\t\n\t\t\t\tif (!empty($col)) {\t",
" if ($colname == 'Price') {",
" $params['dir'] = 'ASC'; ",
" $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Lowest to Highest\";",
" $params['dir'] = 'DESC'; ",
" $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Highest to Lowest\";\n } else {",
" $params['dir'] = 'ASC'; ",
" $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - A-Z\";\n $params['dir'] = 'DESC';\n $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Z-A\";",
" }\t\n\t\t\t\t} \t\t\t\t\t\t\t\t",
"\t\t\t}\n\t\t}\n\t}",
"\t",
" /** exdoc\n * Object/Array sorting comparison function -- sorts by a specified column in ascending order.\n * @node Subsystems:expPaginator\n */\n public function asc($a,$b) {\n $col = $this->order;\n if (is_object($a)) {\n return ($a->$col < $b->$col ? -1 : 1);\n } elseif (is_array($a)) {\n return ($a[$col] < $b[$col] ? -1 : 1);\n } else {\n return ($a < $b ? -1 : 1);\n }\n }",
" /** exdoc\n * Object/Array sorting comparison function -- sorts by a specified column in descending order.\n * @node Subsystems:expPaginator\n */\n public function desc($a,$b) {\n $col = $this->order;\n if (is_object($a)) {\n return ($a->$col > $b->$col ? -1 : 1);\n } elseif (is_array($a)) {\n return ($a[$col] > $b[$col] ? -1 : 1);\n } else {\n return ($a > $b ? -1 : 1);\n }\n }\n}",
"?>"
] |
[
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expPaginator\n * Exponent Pagination Subsystem\n *\n * The expPaginator class is used to retrieve objects from the database\n * and paginate them and optionally group the by category.\n * It automagically handles the calls to other pages\n * and has built-in sorting using the defined column headers.",
" *",
" * Usage Example:",
" *",
" * <code>\n *\n * $page = new expPaginator(array(\n * 'model'=>'faq',",
" * 'where'=>1,",
" * 'limit'=>25,\n * 'order'=>'rank',\n * 'controller'=>$this->baseclassname,\n * 'action'=>$this->params['action'],\n * 'columns'=>array('In FAQ'=>'include_in_faq', 'Submitted'=>'created_at', 'Submitted By'=>'submitter_name'),\n * ));\n * </code>",
" *",
" * @package Subsystems\n * @subpackage Subsystems\n */",
"class expPaginator {\n /**#@+\n * @access public\n * @var string\n */\n\tpublic $model = null;\n public $search_string = '';\n\tpublic $sql = '';\n public $count_sql = '';",
"\tpublic $where = '';",
"\tpublic $controller = '';\n\tpublic $action = '';\n\tpublic $order = '';\n\tpublic $order_direction = '';\n\tpublic $firstpage = '';\n\tpublic $lastpage = '';\n\tpublic $previous_page = '';\n\tpublic $next_page = '';\n\tpublic $previous_shift = '';\n\tpublic $next_shift = '';\n\tpublic $pagelink = '';\n\tpublic $header_columns = '';\n\tpublic $default = '';\n\tpublic $view = null;\n public $uncat ='';\n// public $content_type = '';\n// public $author = '';\n// public $tag = '';\n// public $tags = '';\n\t/**#@+\n * @access public\n * @var integer\n */\n\tpublic $page = 1;\n//\tpublic $limit = 10;\n public $limit = 0;\n\tpublic $start = 0;\n\tpublic $last = 0;\n\tpublic $pages_to_show = 10;\n\tpublic $total_records = 0;\n\tpublic $total_pages = 0;\n\tpublic $page_offset = 0;\n public $categorize = false;\n// public $version = 0;\n// public $content_id = 0;\n\t/**#@+\n * @access public\n * @var array",
" */",
"\tpublic $pages = array();\n\tpublic $records = array();\n public $cats = array();\n public $sort_dropdown = array();",
"\t/**\n\t * expPaginator Constructor\n\t *\n\t * This is the main entry point for using the expPaginator. See example above.\n\t *\n\t * @param array $params Use this to set any of the class variables. Ones not passed will be set to a default.\n\t * @return \\expPaginator\n\t */\n\tpublic function __construct($params=array()) {",
"\t\tglobal $router, $db;",
"\n $this->pages_to_show = expTheme::is_mobile() ? 6 : 10; // fewer paging links for small devices\n\t\t$this->where = empty($params['where']) ? null : $params['where'];\n\t\t$this->records = empty($params['records']) ? array() : $params['records'];\n//\t\t$this->limit = empty($params['limit']) ? 10 : $params['limit'];",
" $this->limit = empty($params['limit']) ? 0 : intval($params['limit']);",
" $this->page = empty($params['page']) ? 1 : intval($params['page']);\n\t\t$this->action = empty($params['action']) ? '' : $params['action'];\n\t\t$this->controller = empty($params['controller']) ? '' : $params['controller'];\n\t\t$this->sql = empty($params['sql']) ? '' : $params['sql'];\n $this->count_sql = empty($params['count_sql']) ? '' : $params['count_sql'];",
"\t\t$this->order = empty($params['order']) ? 'id' : expString::escape($params['order']);\n\t\t$this->dir = empty($params['dir']) || !in_array($params['dir'], array('ASC', 'DESC')) ? 'ASC' : $params['dir'];\n\t\t$this->src = empty($params['src']) ? null : expString::escape($params['src']);",
" $this->categorize = empty($params['categorize']) ? false : $params['categorize'];\n $this->uncat = !empty($params['uncat']) ? $params['uncat'] : gt('Not Categorized');\n $this->groups = !empty($params['groups']) ? $params['groups'] : array();\n $this->grouplimit = !empty($params['grouplimit']) ? $params['grouplimit'] : null;\n $this->dontsortwithincat = !empty($params['dontsortwithincat']) ? $params['dontsortwithincat'] : null;\n $this->dontsort = !empty($params['dontsort']) ? $params['dontsort'] : null;",
"\t\t// if a view was passed we'll use it.\n\t\tif (isset($params['view']))\n $this->view = $params['view'];",
" // setup the model if one was passed.\n if (isset($params['model'])) {\n $this->model = $params['model'];\n $class = new $this->model(null, false, false);\n }",
"",
"\t // auto-include the CSS for pagination links\n\t expCSS::pushToHead(array(\n//\t\t \"unique\"=>\"pagination\",\n//\t\t \"link\"=>PATH_RELATIVE.\"framework/core/assets/css/pagination.css\",\n 'corecss'=>'pagination'\n\t\t )\n\t\t);",
"",
"\t\tif ($this->limit)\n $this->start = (($this->page * $this->limit) - $this->limit);\n if ($this->start < 0)\n $this->start = 0;",
"\t\t//setup the columns\n $this->columns = array();\n\t\tif (isset($params['columns'])) {\n\t\t foreach($params['columns'] as $key=>$col){\n\t\t $colparse[$key] = explode('|',$col);\n\t\t $column = array($key=>$colparse[$key][0]);\n\t\t $this->columns = array_merge($this->columns,$column);\n\t\t if (!empty($colparse[$key][1])) {\n\t\t $params = explode(',',$colparse[$key][1]);\n\t\t foreach ($params as $paramval) {\n\t\t $prm = explode('=',$paramval);\n\t\t $this->linkables[$key][$prm[0]] = $prm[1];\n\t\t }\n\t\t }\n\t\t }\n\t\t}",
"",
"\t\t//setup the default ordering of records\n\t\t// if we are in an action, see if the action is for this controller/action..if so pull the order\n\t\t// and order direction from the request params...this is how the params are passed via the column\n\t\t// headers.",
"\t\t$this->order_direction = $this->dir;",
"\n // allow passing of a single order/dir as stored in config\n if (strstr($this->order,\" \")) {\n $orderby = explode(\" \",$this->order);\n $this->order = $orderby[0];\n $this->order_direction = $orderby[1];\n }",
" if(!preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/', $this->order))\n $this->order = 'id';\n if (!in_array($this->order_direction, array('ASC', 'DESC')))\n $this->order_direction = 'ASC';",
" if ($this->dontsort)\n $sort = null;\n else\n $sort = $this->order.' '.$this->order_direction;",
"\t\t// figure out how many records we're dealing with & grab the records\n\t\t//if (!empty($this->records)) { //from Merge <~~ this doesn't work. Could be empty, but still need to hit.\n if (!empty($this->categorize))\n $limit = null;\n else\n $limit = $this->limit;",
"\t\tif (isset($params['records'])) { // if we pass $params['records'], we WANT to hit this\n\t\t // sort the records that were passed in to us\n if (!empty($sort))\n usort($this->records,array('expPaginator', strtolower($this->order_direction)));\n//\t\t $this->total_records = count($this->records);\n\t\t} elseif (!empty($class)) { //where clause //FJD: was $this->class, but wasn't working...\n\t\t\t$this->total_records = $class->find('count', $this->where);\n $this->records = $class->find('all', $this->where, $sort, $limit, $this->start);\n\t\t} elseif (!empty($this->where)) { //from Merge....where clause\n\t\t\t$this->total_records = $class->find('count', $this->where);\n $this->records = $class->find('all', $this->where, $sort, $limit, $this->start);\n\t\t} else { //sql clause //FIXME we don't get attachments in this approach\n\t\t\t//$records = $db->selectObjectsBySql($this->sql);\n\t\t\t//$this->total_records = count($records);\n //this is MUCH faster if you supply a proper count_sql param using a COUNT() function; if not,\n //we'll run the standard sql and do a queryRows with it\n\t\t\t//$this->total_records = $this->count_sql == '' ? $db->queryRows($this->sql) : $db->selectValueBySql($this->count_sql); //From Merge",
"",
"//\t\t\t$this->total_records = $db->countObjectsBySql($this->count_sql); //$db->queryRows($this->sql); //From most current Trunk",
" if (!empty($sort)) $this->sql .= ' ORDER BY '.$sort;\n if (!empty($this->count_sql)) $this->total_records = $db->countObjectsBySql($this->count_sql);\n\t\t\tif (!empty($this->limit)) $this->sql .= ' LIMIT '.$this->start.','.$this->limit;",
"",
"\t\t\t$this->records = array();\n\t\t\tif (isset($this->model) || isset($params['model_field'])) {\n\t\t\t foreach($db->selectObjectsBySql($this->sql) as $record) {\n $type = $params['model_field'];\n\t\t\t $classname = isset($params['model_field']) ? $record->$type : $this->model;\n\t\t\t //$this->records[] = new $classname($record->id, true, true); //From current trunk // added false, true, as we shouldn't need associated items here, but do need attached. FJD.\n\t\t\t\t\t$this->records[] = new $classname($record->id, false, true); //From Merge //added false, true, as we shouldn't need associated items here, but do need attached. FJD.\n\t\t\t }\n\t\t\t} else {\n\t\t\t $this->records = $db->selectObjectsBySql($this->sql);\n\t\t\t}",
"\t\t}",
"\n // next we'll sort them based on categories if needed\n if (!empty($this->categorize) && $this->categorize && empty($this->dontsort))\n expCatController::addCats($this->records,$sort,$this->uncat,$this->groups,$this->dontsortwithincat);",
" // let's see how many total records there are\n if (empty($this->total_records))\n $this->total_records = count($this->records);\n if ($this->limit && $this->start >= $this->total_records)\n $this->start = $this->total_records - $this->limit;",
" // at this point we generally have all our records, now we'll trim the records to the number requested\n //FIXME we may want some more intelligent selection here based on cats/groups, e.g., don't break groups across pages, number of picture rows, etc...\n if (empty($this->grouplimit) && ($this->limit) && count($this->records) > $this->limit)\n $this->records = array_slice($this->records, $this->start, $this->limit);\n // finally, we'll create another multi-dimensional array of categories populated with assoc items\n if (empty($this->dontsort)) {\n if (!empty($this->categorize) && $this->categorize) {\n expCatController::sortedByCats($this->records,$this->cats,$this->groups,$this->grouplimit);\n } elseif (empty($this->dontsortwithincat)) { // categorized is off, so let's categorize by alpha instead for 'rolodex' type use\n $order = $this->order;\n if (in_array($order,array('created_at','edited_at','publish'))) {\n if ($this->total_records && (abs($this->records[0]->$order - $this->records[count($this->records)-1]->$order) >= (60 * 60 * 24 *365 *2))) {\n $datetype = 'Y'; // more than 2 years of records, so break down by year\n } else {\n $datetype = 'M Y'; // less than 2 years of records, so break down by month/year\n }\n foreach ($this->records as $record) {\n if (is_numeric($record->$order)) {\n $title = date($datetype,$record->$order);\n $title = empty($title)?gt('Undated'):$title;\n } else {\n $title = gt('Undated');\n }\n if (empty($this->cats[$title])) {\n $this->cats[$title] = new stdClass();\n $this->cats[$title]->count = 1;\n $this->cats[$title]->name = $title;\n } else {\n $this->cats[$title]->count++;\n }\n $this->cats[$title]->records[] = $record;\n }\n } else {\n foreach ($this->records as $record) {\n if (!empty($record->$order) && is_string($record->$order) && !is_numeric($record->$order)) {\n $title = ucfirst($record->$order);\n $title = empty($title[0])?'':$title[0];\n } else {\n $title = '';\n }\n if (empty($this->cats[$title])) {\n $this->cats[$title] = new stdClass();\n $this->cats[$title]->count = 1;\n $this->cats[$title]->name = $title;\n } else {\n $this->cats[$title]->count++;\n }\n $this->cats[$title]->records[] = $record;\n }\n }\n }\n if (!empty($this->grouplimit)) {\n if ($this->limit)\n $this->records = array_slice($this->records, $this->start, $this->limit);\n } else {\n if ($this->limit)\n $this->cats = array_slice($this->cats, $this->start, $this->limit);\n }\n }",
" if (isset($params['records']))\n $this->runCallback(); // isset($params['records']) added to correct search for products.",
" //eDebug($this->records);\n\t\t// get the number of the last record we are showing...this is used in the page links.\n\t\t// i.e. \"showing 10-19 of 57\"...$this->last would be the 19 in that string\n\t\tif ($this->total_records > 0) {\n\t\t\t$this->firstrecord = $this->start + 1;\n\t\t\t$this->lastrecord = ($this->total_records < $this->limit) ? ($this->start + $this->total_records) : ($this->start + $this->limit);\n\t\t\tif ($this->lastrecord > $this->total_records || $this->lastrecord == 0)\n $this->lastrecord = $this->total_records;\n\t\t} else {\n\t\t\t$this->firstrecord = 0;\n\t\t\t$this->lastrecord = 0;\n\t\t}",
"",
"\t\t// get the page parameters from the router to build the links\n $page_params = $router->params;\n//\t\t$page_params = $this->cleanParams($router->params);\n foreach (array(\"__utma\", \"__utmz\", \"route_sanitized\") as $key) {\n if (isset($page_params[$key]))\n unset($page_params[$key]);\n }\n if (!empty($page_params['search_string']))\n $page_params['search_string'] = urlencode($page_params['search_string']);",
"\t\t//if (empty($page_params['module'])) $page_params['module'] = $this->controller;\n\t\t//if (empty($page_params['action'])) $page_params['action'] = $this->action;\n\t\t//if (empty($page_params['src']) && isset($params['src'])) $page_params['src'] = $params['src'];\n\t\tif (!empty($this->controller)) {\n\t\t unset($page_params['module']);\n\t\t $page_params['controller'] = expModules::getModuleName($this->controller);\n\t\t} else {\n if (expTheme::inAction() && empty($params)) {\n //FIXME: module/controller glue code\n //\t\t $mod = !empty($_REQUEST['controller']) ? expString::sanitize($_REQUEST['controller']) : expString::sanitize($_REQUEST['module']);\n //\t\t if ($this->controller == $mod && $this->action == $_REQUEST['action']) {\n //\t\t\t $this->order = isset($_REQUEST['order']) ? $_REQUEST['order'] : $this->order;\n //\t\t\t $this->order_direction = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : $this->dir;\n //\t\t\t}\n $mod = !empty($router->params['controller']) ? $router->params['controller'] : $router->params['module'];\n if ($this->controller == $mod && $this->action == $router->params['action']) {\n $this->order = isset($router->params['order']) ? $router->params['order'] : $this->order;\n $this->order_direction = isset($router->params['dir']) ? $router->params['dir'] : $this->dir;",
" if(!preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/', $this->order))\n $this->order = 'id';\n if (!in_array($this->order_direction, array('ASC', 'DESC')))\n $this->order_direction = 'ASC';",
" }\n } else {\n if (isset($params->controller)) {\n $mod = $params->controller;\n } else {\n $mod = '';\n }\n }\n $page_params['controller'] = $mod; // we can't be passing an empty controller or module to the router\n }",
"",
"\t\tif (!empty($this->action))\n $page_params['action'] = $this->action;\n\t\tif (!empty($this->src))\n $page_params['src'] = $this->src;",
"",
"\t\tif (isset($page_params['section']))\n unset($page_params['section']);",
"\t\t//build a 'more' link we can use in the headlines views.\n\t\t$this->morelink = $router->makeLink($page_params, false, false, true);",
"\t\tif (!empty($this->view))\n $page_params['view'] = $this->view;",
"\t\t//build a couple more links we can use in the views.\n\t\t$this->pagelink = $router->makeLink($page_params, false, false, true);",
"",
"\t\t// if don't have enough records for more than one page then we're done.\n\t\t//if ($this->total_records <= $this->limit) return true;",
"",
"\t\t$this->total_pages = ($this->limit > 0) ? ceil($this->total_records/$this->limit) : 0;",
" // correct current page # to be within limits of number of pages\n\t\tif ($this->page > $this->total_pages) {\n\t\t\t$this->page = $this->total_pages;\n //FIXME return 404 error for infinite page scroll plugin\n if (!empty($this->total_pages)) header(':', true, 404);\n\t\t}",
" // setup the previous link\n if ($this->page > 1) {\n $page_params['page'] = $this->page - 1;\n $this->previous_pagenum = $this->page - 1;\n $this->previous_page = $router->makeLink($page_params, false, false, true);\n if (expTheme::is_mobile())\n $this->pages_to_show--;\n }",
" // setup the next link\n if ($this->page < $this->total_pages) {\n $page_params['page'] = $this->page + 1;\n $this->next_pagenum = $this->page + 1;\n $this->next_page = $router->makeLink($page_params, false, false, true);\n if (expTheme::is_mobile())\n $this->pages_to_show--;\n }",
"\t\t//setup the pages for the links\n\t\tif ($this->total_pages > $this->pages_to_show) {\n\t\t\t$this->first_pagelink = max(1, floor(($this->page) - ($this->pages_to_show) / 2));\n\t\t $this->last_pagelink = $this->first_pagelink + $this->pages_to_show - 1;\n\t\t if ($this->last_pagelink > $this->total_pages) {\n\t\t $this->first_pagelink = max(1, $this->total_pages - $this->pages_to_show) + 1;",
"\t\t $this->last_pagelink = $this->total_pages;",
"\t\t }\n\t\t} else {\n\t\t\t$this->first_pagelink = 1;\n\t\t\t$this->last_pagelink = $this->total_pages;\n\t\t}",
"\t\t// setup the previous 10 'group jump' link\n\t\tif ($this->page > $this->pages_to_show) {\n\t\t\t$page_params['page'] = $this->first_pagelink - 1;\n $this->previous_shiftnum = $this->first_pagelink - 1;\n \t$this->previous_shift = $router->makeLink($page_params, false, false, true);\n\t\t\t$page_params['page'] = 1;\n\t\t\t$this->firstpage = $router->makeLink($page_params, false, false, true);\n\t\t}",
"\t\t// setup the next 10 'group jump' link\n\t\tif ($this->page < ($this->total_pages - $this->pages_to_show)) {\n $page_params['page'] = $this->last_pagelink + 1;\n $this->next_shiftnum = $this->last_pagelink + 1;\n $this->next_shift = $router->makeLink($page_params, false, false, true);\n\t\t\t$page_params['page'] = $this->total_pages;\n\t\t\t$this->lastpage = $router->makeLink($page_params, false, false, true);\n }",
"\t\t// setup the links to the remaining pages being displayed.",
"\t\tfor($i=$this->first_pagelink; $i<=$this->last_pagelink; $i++) {",
"\t\t\t$page_params['page'] = $i;\n\t\t\t$this->pages[$i] = $router->makeLink($page_params, false, false, true);",
"\t\t}",
"\n\t\t$links_template = expTemplate::get_common_template('pagination_links', null, 'common');\n\t\t$links_template->assign('page', $this);\n\t\t$this->links = $links_template->render();",
"",
"\t\t$this->makeHeaderCols($page_params); // headers for table view",
"",
" $sortparams = array_merge($page_params, $router->params);",
"",
"\t\t//From Merge ****\n if (isset($router->params['page']))\n $sortparams['page'] = $router->params['page'];\n else\n unset($sortparams['page']);\n //End From Merge ****",
"\t\t$this->makeSortDropdown($sortparams); // used on non-table views",
"",
" $table_template = expTemplate::get_common_template('pagination_table', null, 'common');\n $table_template->assign('page', $this);\n $this->table = $table_template->render(); // table view",
"",
"\t}",
"",
"\t//From Merge\n private function cleanParams($params) {\n $defaultParams = array('title'=>'','module'=>'','controller'=>'','src'=>'','id'=>'','dir'=>'','_common'=>'');\n $newParams = array();",
" $func = new ReflectionClass($this);",
" foreach ($params as $pKey=>$pVal) {\n $propname = $pKey;\n if (array_key_exists($propname,$defaultParams)) {",
" $newParams[$propname] = $params[$propname];\n }\n }",
" foreach ($func->getProperties() as $p) {\n $propname = $p->name;\n if (array_key_exists($propname,$params)) {",
" $newParams[$propname] = $params[$propname];\n }\n }\n",
" return $newParams;\n }",
"",
" public function makeHeaderCols($params) {\n global $router;",
" if (!empty($this->columns) && is_array($this->columns)) {\n $this->header_columns = '';",
"",
" // get the parameters used to make this page.\n if (!expTheme::inAction()) {\n unset($params['section']);\n if (empty($params['controller'])) $params['controller'] = $this->controller;\n if (empty($params['action'])) $params['action'] = $this->action;\n }",
"",
"// $current = '';\n if (isset($params['order'])) {\n $current = $params['order'];\n unset($params['order']);\n } else {\n $current = $this->order;\n }",
"",
" //loop over the columns and build out a list of <th>'s to be used in the page table\n foreach ($this->columns as $colname=>$col) {\n // if this is the column we are sorting on right now we need to setup some class info\n $class = isset($this->class) ? $this->class : 'page';\n $params['dir'] = 'ASC';",
"",
" if ($col == $current) {\n $class = 'current '.strtolower($this->order_direction);\n $params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';",
" }",
"\n $params['order'] = $col;",
"",
" $this->header_columns .= '<th class=\"'.$class.'\">';\n // if this column is empty then it's not supposed to be a sortable column",
" if (empty($col)) {\n $this->header_columns .= '<span>'.$colname.'</span>';\n $this->columns[$colname] = ' ';\n } else if($colname==\"actupon\") {\n $this->header_columns .= '<input type=checkbox name=selall id=selall value=1 class=\"select-all\"/>';",
"",
"// $js = \"\n// YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {\n// Y.all('input[type=checkbox]').on('click',function(e){\n// if (e.target.test('.select-all')) {\n// if (!e.target.get('checked')) {\n// this.each(function(n){\n// n.set('checked',false);\n// });\n// } else {\n// this.each(function(n){\n// n.set('checked',true);\n// });\n// };\n// };\n// });\n// });\n// \";",
" $js = \"\n $('#selall').change(function () {\n $('input[name=\\\"act-upon[]\\\"]').prop('checked', this.checked);\n });\n \";",
" expJavascript::pushToFoot(array(\n \"unique\"=>'select-all',\n// \"yui3mods\"=>1,\n \"jquery\"=>1,\n \"content\"=>$js,\n// \"src\"=>\"\"\n ));",
" } else {\n\t\t\t\t\tunset($params['page']); // we want to go back to the first page on a re-sort\n if ($col == 'no-sort') {\n $this->header_columns .= $colname;\n } else {\n $this->header_columns .= '<a href=\"'.$router->makeLink($params, false, false, true).'\" alt=\"sort by '.$colname.'\" rel=\"nofollow\">'.$colname.'</a>';\n }\n }",
"",
" $this->header_columns .= '</th>';\n }\n }\n }",
"",
" //here if we want to modify the record for some reason. e.g. Using in search results w/ products\n private function runCallback() {\n foreach ($this->records as &$record) {\n if (isset($record->ref_type)) {\n $refType = $record->ref_type;\n if (class_exists($record->ref_type)) {\n $type = new $refType();\n $classinfo = new ReflectionClass($type);\n if ($classinfo->hasMethod('paginationCallback')) {\n $item = new $type($record->original_id);\n $item->paginationCallback($record);\n }\n }\n }",
" }",
" }",
"",
"\tpublic function makeSortDropdown($params) {\n\t\tglobal $router;",
"\t\tif (!empty($this->columns) && is_array($this->columns)) {\n\t\t\t$this->sort_dropdown = array();",
"\t\t\t// get the parameters used to make this page.\n\t\t\tif (!expTheme::inAction()) {\n\t\t\t\tunset($params['section']);\n\t\t\t\tif (empty($params['controller'])) $params['controller'] = $this->controller;\n\t\t\t\tif (empty($params['action'])) $params['action'] = $this->action;\n\t\t\t}",
"",
"\t\t\t/*$current = '';\n\t\t\tif (isset($params['order'])) {\n\t\t\t\t$current = $params['order'];\n\t\t\t\tunset($params['order']);\n\t\t\t} else {\n\t\t\t\t$current = $this->order;\n\t\t\t} */",
"",
"\t\t\t//loop over the columns and build out a list of <th>'s to be used in the page table\n // eDebug($router);\n $defaultParams['controller'] = $params['controller'];\n $defaultParams['action'] = $params['action'];\n if (isset($params['title']))\n $defaultParams['title'] = $params['title'];\n if (isset($params['page']))\n $defaultParams['page'] = $params['page'];",
"",
" $this->sort_dropdown[$router->makeLink($defaultParams, false, false, true)] = \"Default\";\n\t\t\tforeach ($this->columns as $colname=>$col) {\n\t\t\t\t// if this is the column we are sorting on right now we need to setup some class info\n\t\t\t\t/*$class = isset($this->class) ? $this->class : 'page';\n\t\t\t\t$params['dir'] = 'ASC';*/",
"",
"\t\t\t\t/*if ($col == $current) {\n\t\t\t\t\t$class = 'current';\n\t\t\t\t\t$class .= ' '.$this->order_direction;\n\t\t\t\t\tif (isset($params['dir'])) {\n\t\t\t\t\t\t$params['dir'] = $params['dir'] == 'ASC' ? 'DESC' : 'ASC';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';\n\t\t\t\t\t}",
"\t\t\t\t}",
" */",
"\t\t\t\t$params['order'] = $col;",
"\t\t\t\tif (!empty($col)) {",
" if ($colname == 'Price') {",
" $params['dir'] = 'ASC';",
" $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Lowest to Highest\";",
" $params['dir'] = 'DESC';",
" $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Highest to Lowest\";\n } else {",
" $params['dir'] = 'ASC';",
" $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - A-Z\";\n $params['dir'] = 'DESC';\n $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Z-A\";",
" }\n\t\t\t\t}",
"\t\t\t}\n\t\t}\n\t}",
"",
" /** exdoc\n * Object/Array sorting comparison function -- sorts by a specified column in ascending order.\n * @node Subsystems:expPaginator\n */\n public function asc($a,$b) {\n $col = $this->order;\n if (is_object($a)) {\n return ($a->$col < $b->$col ? -1 : 1);\n } elseif (is_array($a)) {\n return ($a[$col] < $b[$col] ? -1 : 1);\n } else {\n return ($a < $b ? -1 : 1);\n }\n }",
" /** exdoc\n * Object/Array sorting comparison function -- sorts by a specified column in descending order.\n * @node Subsystems:expPaginator\n */\n public function desc($a,$b) {\n $col = $this->order;\n if (is_object($a)) {\n return ($a->$col > $b->$col ? -1 : 1);\n } elseif (is_array($a)) {\n return ($a[$col] > $b[$col] ? -1 : 1);\n } else {\n return ($a > $b ? -1 : 1);\n }\n }\n}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expSettings\n *\n * @package Subsystems\n * @subpackage Subsystems\n */",
"/** @define \"BASE\" \"../../..\" */\nclass expSettings\n{",
" public static function initialize()\n {\n /**\n * overides function html entity decode\n *\n * @param $str\n *\n * @return string\n */\n function exponent_unhtmlentities($str)\n {\n $trans = get_html_translation_table(HTML_ENTITIES);\n $trans['''] = '\\'';\n $trans = array_flip($trans);",
" $trans['''] = '\\'';\n $trans['''] = '\\'';\n return strtr($str, $trans);\n }",
" // include global constants\n @include_once(BASE . \"framework/conf/config.php\");\n if (!defined('SITE_TITLE')) { // check for upgrade from older file structure\n if (!file_exists(BASE . \"framework/conf/config.php\") && file_exists(BASE . \"conf/config.php\")) {\n rename(BASE . \"conf/config.php\", BASE . \"framework/conf/config.php\");\n @include_once(BASE . \"framework/conf/config.php\");\n }\n }",
" // include default constants, fill in missing pieces\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n $dh = opendir(BASE . \"framework/conf/extensions\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/extensions/$file\") && substr(\n $file,\n -13,\n 13\n ) == \".defaults.php\"\n ) {\n @include_once(BASE . \"framework/conf/extensions/$file\");\n }\n }\n }\n }",
" /** exdoc\n * Uses magical regular expressions voodoo to pull the\n * actual define() calls out of a configuration PHP file,\n * and return them in an associative array, for use in\n * viewing and analyzing configs. Returns an associative\n * array of constant names => values\n *\n * @param string $configname Configuration Profile name\n * @param null $site_root\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function parse($configname = '', $site_root = null)\n {\n if ($site_root == null) {\n $site_root = BASE;\n }",
" if ($configname == '') {\n $file = $site_root . 'framework/conf/config.php';\n } else {\n $file = $site_root . \"framework/conf/profiles/$configname.php\";\n }\n $options = array();\n//\t\t$valid = array();\n if (is_readable($file)) {\n $options = self::parseFile($file);\n }\n // include default constants, fill in missing pieces\n if (is_readable($site_root . 'framework/conf/extensions')) {\n $dh = opendir($site_root . 'framework/conf/extensions');\n while (($file = readdir($dh)) !== false) {\n if (substr($file, -13, 13) == '.defaults.php') {\n $options = array_merge(\n self::parseFile($site_root . 'framework/conf/extensions/' . $file),\n $options\n );\n }\n//\t\t\t\telse if (substr($file,-14,14) == '.structure.php') {\n//\t\t\t\t\t$tmp = include($site_root.'framework/conf/extensions/'.$file);\n//\t\t\t\t\t$valid = array_merge($valid,array_keys($tmp[1]));\n//\t\t\t\t}\n }\n }",
"//\t\t$valid = array_flip($valid);",
"//\t\tforeach ($options as $key=>$value) {\n//\t\t\tif (!isset($valid[$key])) unset($options[$key]);\n//\t\t}",
" return $options;\n }",
" /** exdoc\n * Looks through the source of a given configuration PHP file,\n * and pulls out (by mysterious regular expressions) the define()\n * calls and returns those values. Returns an associative array\n * of constant names => values\n *\n * @param string $file The full path to the file to parse.\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function parseFile($file)\n {\n $options = array();\n foreach (file($file) as $line) {\n //$line = trim(preg_replace(array(\"/^.*define\\([\\\"']/\",\"/[^&][#].*$/\"),\"\",$line));\n $line = trim(preg_replace(array(\"/^.*define\\([\\\"']/\", \"/[^&][#][@].*$/\"), \"\", $line));\n if ($line != \"\" && substr($line, 0, 2) != \"<?\" && substr($line, -2, 2) != \"?>\") {\n $line = str_replace(array(\"<?php\", \"?>\", \"<?\",), \"\", $line);",
" $opts = preg_split(\"/[\\\"'],/\", $line);",
" if (count($opts) == 2) {\n if (substr($opts[1], 0, 1) == '\"' || substr($opts[1], 0, 1) == \"'\") {\n $opts[1] = substr($opts[1], 1, -3);\n } else {\n $opts[1] = substr($opts[1], 0, -2);\n }",
" if (substr($opts[0], -5, 5) == \"_HTML\") {\n $opts[1] = eval(\"return \" . $opts[1] . \";\");\n /*\t\t\t\t\t$opts[1] = preg_replace('/<[bB][rR]\\s?\\/?>/',\"\\r\\n\",$opts[1]); */\n }\n $options[$opts[0]] = str_replace(\"\\'\", \"'\", $opts[1]);\n }\n }\n }\n return $options;\n }",
" /**\n * Saves values to config file\n *\n * @param $values\n * @param string $configname\n */\n public static function saveValues($values, $configname = '') //FIXME only used with themes and self::change() method\n {\n $profile = null;\n $str = \"<?php\\n\";\n foreach ($values as $directive => $value) {\n $directive = trim(strtoupper($directive));\n if ($directive == 'CURRENTCONFIGNAME') { // save and strip out the profile name\n $profile = $value;\n continue;\n }\n $str .= \"define(\\\"$directive\\\",\";\n $value = stripslashes($value); // slashes added by POST\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities($value, ENT_QUOTES, LANG_CHARSET);\n// $value = str_replace(array(\"\\r\\n\",\"\\r\",\"\\n\"),\"<br />\",$value);\n $value = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"\", $value);\n// $value = str_replace(array('\\r\\n', '\\r', '\\n'), \"\", $value);\n $str .= \"exponent_unhtmlentities('$value')\";\n } elseif (is_int($value)) {",
" $str .= \"'\" . $value . \"'\";",
" } else {\n if ($directive != 'SESSION_TIMEOUT') {",
" $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\"; //FIXME is this still necessary since we stripslashes above???",
" } // $str .= \"'\".$value.\"'\";\n else {",
" $str .= \"'\" . str_replace(\"'\", '', $value) . \"'\";",
" }\n }\n $str .= \");\\n\";\n }",
" $str .= '?>';\n//\t\t$configname = empty($values['CURRENTCONFIGNAME']) ? '' : $values['CURRENTCONFIGNAME'];\n if ($configname == '') {\n $str .= \"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$profile\\\");\\n?>\"; // add profile name to end of active profile\n }\n self::writeFile($str, $configname);\n }",
" /**\n * Update/Add a single configuration setting to the current/active site configuration\n *\n * @param $var\n * @param $val\n */\n public static function change($var, $val)\n {\n $conf = self::parseFile(BASE . 'framework/conf/config.php');\n $conf[$var] = $val;\n self::saveValues($conf);\n }",
" public static function writeFile($str, $configname = '')\n {\n // if ($configname != \"\") {\n // // Wishing to save\n // if ((file_exists(BASE.\"framework/conf/profiles/$configname.php\") && expUtil::isReallyWritable(BASE.\"framework/conf/profiles/$configname.php\")) ||\n // expUtil::isReallyWritable($BASE.\"framework/conf/profiles\")) {\n //\n // $fh = fopen(BASE.\"framework/conf/profiles/$configname.php\",\"w\");\n // fwrite($fh,$str);\n // fclose($fh);\n // } else {\n // echo gt('Unable to write profile configuration').'<br />';\n // }\n // }",
" //if (isset($values['activate']) || $configname == \"\") {\n if ($configname == \"\") {\n $configname = BASE . \"framework/conf/config.php\";\n }\n//\t\tif ((file_exists(BASE.\"framework/conf/config.php\") && expUtil::isReallyWritable(BASE.\"framework/conf/config.php\")) || expUtil::isReallyWritable(BASE.\"framework/conf\")) {\n $conffolder = pathinfo($configname);\n if ((file_exists($configname) && expUtil::isReallyWritable($configname)) || expUtil::isReallyWritable(\n $conffolder['dirname']\n )\n ) {\n $fh = fopen($configname, \"w\");\n fwrite($fh, $str);\n /*fwrite($fh,\"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$configname\\\");\\n?>\\n\");*/\n fclose($fh);\n } else {\n echo gt('Unable to write configuration') . '<br />';\n }\n //}\n }",
" /** exdoc\n * Processes the POSTed data from the configuration form\n * object generated by self::configurationForm, and writes\n * a bunch of define() statements to the profiles config file.\n *\n * @param array $values The _POST array to pull configuration data from.\n * @param null $site_root\n *\n * @node Subsystems:Config\n */\n public static function saveConfiguration($values, $site_root = null) //FIXME this method is only used in install, and doesn't deal with profiles\n {\n if ($site_root == null) {\n $site_root = BASE;\n }",
" if (empty($values['configname']) || $values['configname'] == 'Default') {\n $configname = '';\n } else {\n //\t\t$configname = str_replace(\" \",\"_\",$values['configname']);\n $configname = expFile::fixName($values['configname']);\n }",
" $original_config = self::parse($configname, $site_root);",
" $str = \"<?php\\n\\n\";\n foreach ($values['c'] as $directive => $value) {\n $directive = strtoupper($directive);",
" // Because we may not have all config options in the POST,\n // we need to unset the ones we do have from the original config.\n unset($original_config[$directive]);",
" $str .= \"define(\\\"$directive\\\",\";\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities(stripslashes($value), ENT_QUOTES, LANG_CHARSET); // slashes added by POST\n $value = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"<br />\", $value);\n $str .= \"exponent_unhtmlentities('$value')\";\n } elseif (is_int($value)) {\n $str .= $value;\n } else {\n if ($directive != 'SESSION_TIMEOUT') {\n $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n } else {\n $str .= str_replace(\"'\", '', $value);\n }\n }\n $str .= \");\\n\";\n }\n foreach ($values['opts'] as $directive => $val) {\n $directive = strtoupper($directive);",
" // Because we may not have all config options in the POST,\n // we need to unset the ones we do have from the original config.\n unset($original_config[$directive]);",
" $str .= \"define(\\\"$directive\\\",\" . (isset($values['o'][$directive]) ? 1 : 0) . \");\\n\";\n }\n // Now pick up all of the unspecified values\n // THIS MAY SCREW UP on checkboxes.\n foreach ($original_config as $directive => $value) {\n $str .= \"define(\\\"$directive\\\",\";\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities(stripslashes($value), ENT_QUOTES, LANG_CHARSET); // slashes added by POST\n $str .= \"exponent_unhtmlentities('$value')\";\n } else {\n if (is_int($value)) {\n $str .= $value;\n } else {\n $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n }\n }\n $str .= \");\\n\";\n }\n $str .= \"\\n?>\";",
" // if ($configname != \"\") {\n // // Wishing to save\n // if ( (file_exists($site_root.\"framework/conf/profiles/$configname.php\") && expUtil::isReallyWritable($site_root.\"framework/conf/profiles/$configname.php\")) ||\n // expUtil::isReallyWritable($site_root.\"framework/conf/profiles\")) {\n //\n // $fh = fopen($site_root.\"framework/conf/profiles/$configname.php\",\"w\");\n // fwrite($fh,$str);\n // fclose($fh);\n // } else {\n // echo gt('Unable to write profile configuration').'<br />';\n // }\n // }",
"//\t\tif (isset($values['activate']) || $configname == \"\") {\n//\t\t\tif ((file_exists($site_root.\"framework/conf/config.php\") && expUtil::isReallyWritable($site_root.\"framework/conf/config.php\")) ||\n//\t\t\t\t expUtil::isReallyWritable($site_root.\"framework/conf\")) {\n//\t\t\t\t$fh = fopen($site_root.\"framework/conf/config.php\",\"w\");\n//\t\t\t\tfwrite($fh,$str);\n//\n /*\t\t\t\t/*fwrite($fh,\"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$configname\\\");\\n?>\\n\");*/\n//\t\t\t\tfclose($fh);\n//\t\t\t} else {\n//\t\t\t\techo gt('Unable to write profile configuration').'<br />';\n//\t\t\t}\n//\t\t}\n self::writeFile($str);\n }",
" /** exdoc\n * This function looks through all of the available configuration\n * extensions, and generates a form object consisting of each\n * extension's form part. This can then be used to edit the full\n * site configuration. Returns a form object intended for editing the profile.\n *\n * @param string $configname The name of the configuration profile,\n * for filling in default values.\n * @param bool $database\n *\n * @return \\form\n * @node Subsystems:Config\n */\n public static function configurationForm($configname, $database = false) //FIXME this method is never used\n {\n // $configname = \"\" for active config\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n global $user;\n $options = self::parse($configname);",
" $form = new form();",
" $form->register(null, '', new htmlcontrol('<h3 id=\"config_top\">' . gt('Configuration Options') . '</h3>'));\n $form->register('configname', gt('Profile Name'), new textcontrol($configname));\n $form->register(\n 'activate',\n gt('Activate'),\n new checkboxcontrol((!defined('CURRENTCONFIGNAME') || CURRENTCONFIGNAME == $configname))\n );",
" $sections = array();",
" $dh = opendir(BASE . 'framework/conf/extensions');\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . 'framework/conf/extensions/' . $file) && substr(\n $file,\n -14,\n 14\n ) == '.structure.php'\n ) {\n $arr = include(BASE . 'framework/conf/extensions/' . $file);\n // Check to see if the current user is a super admin, and only include database if so\n if (substr($file, 0, -14) != 'database' || $user->is_admin == 1) {\n $form->register(\n null,\n '',\n new htmlcontrol('<div id=\"config_' . count(\n $sections\n ) . '\" style=\"font-weight: bold; margin-top: 1.5em; border-top: 1px solid black; border-bottom: 1px solid black; background-color: #ccc; font-size: 12pt;\">' . $arr[0] . '</div><a href=\"#config_top\">Top</a>')\n );\n $sections[] = '<a href=\"#config_' . count($sections) . '\">' . $arr[0] . '</a>';\n foreach ($arr[1] as $directive => $info) {",
" if ($info['description'] != '') {\n $form->register(\n null,\n '',\n new htmlcontrol('<br /><br />' . $info['description'], false)\n );\n }\n if (is_a($info['control'], \"checkboxcontrol\")) {\n $form->meta(\"opts[$directive]\", 1);\n $info['control']->default = $options[$directive];\n $info['control']->flip = true;\n $form->register(\n \"o[$directive]\",\n '<strong>' . $info['title'] . '</strong>',\n $info['control']\n );\n } else {\n if (isset($options[$directive])) {\n $info[\"control\"]->default = $options[$directive];\n }\n $form->register(\n \"c[$directive]\",\n '<strong>' . $info['title'] . '</strong>',\n $info['control'],\n $info['description']\n );\n }\n }\n //$form->register(null,'',new buttongroupcontrol(gt('Save'),'',gt('Cancel')));\n }\n }\n }\n// $form->registerAfter('activate',null,'',new htmlcontrol('<hr size=\"1\" />'.implode('  |  ')));\n $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel')));",
" return $form;\n }\n return null;\n }",
" /** exdoc\n * Takes care of setting the appropriate template variables\n * to be used when viewing a profile or set of profiles.\n * Returns the initializes template.\n *\n * @param template $template The template object to assign to.\n * @param string $configname The name of the configuration profile.\n *\n * @return \\template\n * @node Subsystems:Config\n */\n public static function outputConfigurationTemplate($template, $configname) //FIXME this method is never used\n {\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n $categorized = array();\n $options = self::parse($configname);",
" $dh = opendir(BASE . \"framework/conf/extensions\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/extensions/$file\") && substr(\n $file,\n -14,\n 14\n ) == \".structure.php\"\n ) {\n $arr = include(BASE . \"framework/conf/extensions/$file\");\n $categorized[$arr[0]] = array();\n foreach ($arr[1] as $directive => $info) {\n if (is_a($info[\"control\"], \"passwordcontrol\")) {\n $info[\"value\"] = '<' . gt('hidden') . '>';\n } else {\n if (is_a($info[\"control\"], \"checkboxcontrol\")) {\n $info[\"value\"] = (isset($options[$directive]) ? ($options[$directive] ? \"yes\" : \"no\") : \"no\");\n } else {\n if (is_a($info[\"control\"], \"dropdowncontrol\") && isset($options[$directive])) {\n $info[\"value\"] = @$info[\"control\"]->items[$options[$directive]];\n } else {\n $info[\"value\"] = (isset($options[$directive]) ? $options[$directive] : \"\");\n }\n }\n }\n unset($info[\"control\"]);",
" $categorized[$arr[0]][$directive] = $info;\n }\n }\n }\n $template->assign(\"configuration\", $categorized);\n }\n return $template;\n }",
" /** exdoc\n * Looks through the framework/conf/profiles directory, and finds all of\n * the configuration profiles in existence. This function also\n * performs some minor name-mangling, to make the Profile Names\n * more user friendly. Returns an array of Profile names.\n *\n * @node Subsystems:Config\n * @return array\n */\n public static function profiles()\n {\n $profiles = array();\n if (is_readable(BASE . \"framework/conf/profiles\")) {\n $dh = opendir(BASE . \"framework/conf/profiles\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/profiles/$file\") && substr($file, -4, 4) == \".php\") {\n $name = substr($file, 0, -4);\n $profiles[$name] = str_replace(\"_\", \" \", $name);\n }\n }\n }\n return $profiles;\n }",
" /** exdoc\n * Creates a configuration profile from the current configuration\n *\n * @param string $profile The name of the Profile to remove.\n *\n * @return string\n *\n * @node Subsystems:Config\n */\n public static function createProfile($profile)\n {\n if (!file_exists(BASE . \"framework/conf/profiles\")) {\n @mkdir(\n BASE . \"framework/conf/profiles\",\n DIR_DEFAULT_MODE_STR,\n true\n );\n }\n //FIXME do we need to delete an existing profile first??\n $profile = expFile::fixName($profile);\n// copy(BASE.\"framework/conf/config.php\",BASE.\"framework/conf/profiles/\".$profile.\".php\");\n// $baseprofile = self::parseFile(BASE . \"framework/conf/config.php\");\n $baseprofile = self::parse(); // get current configuration plus missing defaults\n unset($baseprofile['CURRENTCONFIGNAME']); // don't save profile name within actual profile\n self::saveValues($baseprofile, BASE . \"framework/conf/profiles/\" . $profile . \".php\");\n return $profile;\n }",
" /** exdoc\n * Deletes a configuration profile from the framework/conf/profiles\n * directory.\n *\n * @param string $profile The name of the Profile to remove.\n *\n * @node Subsystems:Config\n */\n public static function deleteProfile($profile) //FIXME this method is never used\n {\n if (file_exists(BASE . \"framework/conf/profiles/$profile.php\")) {\n unlink(BASE . \"framework/conf/profiles/$profile.php\");\n }\n }",
" /** exdoc\n * Activates a Configuration Profile.\n *\n * @param string $profile The name of the Profile to activate.\n *\n * @node Subsystems:Config\n */\n public static function activateProfile($profile)\n {",
"",
" if (is_readable(BASE . \"framework/conf/profiles/$profile.php\") && expUtil::isReallyWritable(\n BASE . \"framework/conf\"\n )\n ) {\n //FIXME do we need to delete current config first??\n copy(BASE . \"framework/conf/profiles/$profile.php\", BASE . \"framework/conf/config.php\");\n // tag it with the profile name\n $fh = fopen(BASE . \"framework/conf/config.php\", \"a\");\n fwrite(\n $fh,\n \"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$profile\\\");\\n?>\"\n ); // add activated profile name to end of profile\n fclose($fh);\n }\n }",
" /** exdoc\n * Parse Drop Down options from a file.\n *\n * @param string $dropdown_name The name of the dropdown type. The name of the\n * file will be retrieved by adding .dropdown as a suffix, and searching the framework/conf/data directory.\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function dropdownData($dropdown_name)\n {\n $array = array();\n if (is_readable(BASE . \"framework/conf/data/$dropdown_name.dropdown\")) {\n $t = array();\n foreach (file(BASE . \"framework/conf/data/$dropdown_name.dropdown\") as $l) {\n $l = trim($l);\n if ($l != \"\" && substr($l, 0, 1) != \"#\") {\n $go = count($t);",
" $t[] = trim($l);",
" if ($go) {\n $array[$t[0]] = gt($t[1]);\n $t = array();\n }\n }\n }\n }\n return $array;\n }",
"}",
"expSettings::initialize(); // auto-initialize when loaded",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expSettings\n *\n * @package Subsystems\n * @subpackage Subsystems\n */",
"/** @define \"BASE\" \"../../..\" */\nclass expSettings\n{",
" public static function initialize()\n {\n /**\n * overides function html entity decode\n *\n * @param $str\n *\n * @return string\n */\n function exponent_unhtmlentities($str)\n {\n $trans = get_html_translation_table(HTML_ENTITIES);\n $trans['''] = '\\'';\n $trans = array_flip($trans);",
" $trans['''] = '\\'';\n $trans['''] = '\\'';\n return strtr($str, $trans);\n }",
" // include global constants\n @include_once(BASE . \"framework/conf/config.php\");\n if (!defined('SITE_TITLE')) { // check for upgrade from older file structure\n if (!file_exists(BASE . \"framework/conf/config.php\") && file_exists(BASE . \"conf/config.php\")) {\n rename(BASE . \"conf/config.php\", BASE . \"framework/conf/config.php\");\n @include_once(BASE . \"framework/conf/config.php\");\n }\n }",
" // include default constants, fill in missing pieces\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n $dh = opendir(BASE . \"framework/conf/extensions\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/extensions/$file\") && substr(\n $file,\n -13,\n 13\n ) == \".defaults.php\"\n ) {\n @include_once(BASE . \"framework/conf/extensions/$file\");\n }\n }\n }\n }",
" /** exdoc\n * Uses magical regular expressions voodoo to pull the\n * actual define() calls out of a configuration PHP file,\n * and return them in an associative array, for use in\n * viewing and analyzing configs. Returns an associative\n * array of constant names => values\n *\n * @param string $configname Configuration Profile name\n * @param null $site_root\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function parse($configname = '', $site_root = null)\n {\n if ($site_root == null) {\n $site_root = BASE;\n }",
" if ($configname == '') {\n $file = $site_root . 'framework/conf/config.php';\n } else {\n $file = $site_root . \"framework/conf/profiles/$configname.php\";\n }\n $options = array();\n//\t\t$valid = array();\n if (is_readable($file)) {\n $options = self::parseFile($file);\n }\n // include default constants, fill in missing pieces\n if (is_readable($site_root . 'framework/conf/extensions')) {\n $dh = opendir($site_root . 'framework/conf/extensions');\n while (($file = readdir($dh)) !== false) {\n if (substr($file, -13, 13) == '.defaults.php') {\n $options = array_merge(\n self::parseFile($site_root . 'framework/conf/extensions/' . $file),\n $options\n );\n }\n//\t\t\t\telse if (substr($file,-14,14) == '.structure.php') {\n//\t\t\t\t\t$tmp = include($site_root.'framework/conf/extensions/'.$file);\n//\t\t\t\t\t$valid = array_merge($valid,array_keys($tmp[1]));\n//\t\t\t\t}\n }\n }",
"//\t\t$valid = array_flip($valid);",
"//\t\tforeach ($options as $key=>$value) {\n//\t\t\tif (!isset($valid[$key])) unset($options[$key]);\n//\t\t}",
" return $options;\n }",
" /** exdoc\n * Looks through the source of a given configuration PHP file,\n * and pulls out (by mysterious regular expressions) the define()\n * calls and returns those values. Returns an associative array\n * of constant names => values\n *\n * @param string $file The full path to the file to parse.\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function parseFile($file)\n {\n $options = array();\n foreach (file($file) as $line) {\n //$line = trim(preg_replace(array(\"/^.*define\\([\\\"']/\",\"/[^&][#].*$/\"),\"\",$line));\n $line = trim(preg_replace(array(\"/^.*define\\([\\\"']/\", \"/[^&][#][@].*$/\"), \"\", $line));\n if ($line != \"\" && substr($line, 0, 2) != \"<?\" && substr($line, -2, 2) != \"?>\") {\n $line = str_replace(array(\"<?php\", \"?>\", \"<?\",), \"\", $line);",
" $opts = preg_split(\"/[\\\"'],/\", $line);",
" if (count($opts) == 2) {\n if (substr($opts[1], 0, 1) == '\"' || substr($opts[1], 0, 1) == \"'\") {\n $opts[1] = substr($opts[1], 1, -3);\n } else {\n $opts[1] = substr($opts[1], 0, -2);\n }",
" if (substr($opts[0], -5, 5) == \"_HTML\") {\n $opts[1] = eval(\"return \" . $opts[1] . \";\");\n /*\t\t\t\t\t$opts[1] = preg_replace('/<[bB][rR]\\s?\\/?>/',\"\\r\\n\",$opts[1]); */\n }\n $options[$opts[0]] = str_replace(\"\\'\", \"'\", $opts[1]);\n }\n }\n }\n return $options;\n }",
" /**\n * Saves values to config file\n *\n * @param $values\n * @param string $configname\n */\n public static function saveValues($values, $configname = '') //FIXME only used with themes and self::change() method\n {\n $profile = null;\n $str = \"<?php\\n\";\n foreach ($values as $directive => $value) {\n $directive = trim(strtoupper($directive));\n if ($directive == 'CURRENTCONFIGNAME') { // save and strip out the profile name\n $profile = $value;\n continue;\n }\n $str .= \"define(\\\"$directive\\\",\";\n $value = stripslashes($value); // slashes added by POST\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities($value, ENT_QUOTES, LANG_CHARSET);\n// $value = str_replace(array(\"\\r\\n\",\"\\r\",\"\\n\"),\"<br />\",$value);\n $value = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"\", $value);\n// $value = str_replace(array('\\r\\n', '\\r', '\\n'), \"\", $value);\n $str .= \"exponent_unhtmlentities('$value')\";\n } elseif (is_int($value)) {",
" $str .= \"'\" . intval($value) . \"'\";",
" } else {\n if ($directive != 'SESSION_TIMEOUT') {",
" $str .= \"'\" . expString::escape(str_replace(\"'\", \"\\'\", $value)) . \"'\"; //FIXME is this still necessary since we stripslashes above???",
" } // $str .= \"'\".$value.\"'\";\n else {",
" $str .= \"'\" . expString::escape(str_replace(\"'\", '', $value)) . \"'\";",
" }\n }\n $str .= \");\\n\";\n }",
" $str .= '?>';\n//\t\t$configname = empty($values['CURRENTCONFIGNAME']) ? '' : $values['CURRENTCONFIGNAME'];\n if ($configname == '') {\n $str .= \"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$profile\\\");\\n?>\"; // add profile name to end of active profile\n }\n self::writeFile($str, $configname);\n }",
" /**\n * Update/Add a single configuration setting to the current/active site configuration\n *\n * @param $var\n * @param $val\n */\n public static function change($var, $val)\n {\n $conf = self::parseFile(BASE . 'framework/conf/config.php');\n $conf[$var] = $val;\n self::saveValues($conf);\n }",
" public static function writeFile($str, $configname = '')\n {\n // if ($configname != \"\") {\n // // Wishing to save\n // if ((file_exists(BASE.\"framework/conf/profiles/$configname.php\") && expUtil::isReallyWritable(BASE.\"framework/conf/profiles/$configname.php\")) ||\n // expUtil::isReallyWritable($BASE.\"framework/conf/profiles\")) {\n //\n // $fh = fopen(BASE.\"framework/conf/profiles/$configname.php\",\"w\");\n // fwrite($fh,$str);\n // fclose($fh);\n // } else {\n // echo gt('Unable to write profile configuration').'<br />';\n // }\n // }",
" //if (isset($values['activate']) || $configname == \"\") {\n if ($configname == \"\") {\n $configname = BASE . \"framework/conf/config.php\";\n }\n//\t\tif ((file_exists(BASE.\"framework/conf/config.php\") && expUtil::isReallyWritable(BASE.\"framework/conf/config.php\")) || expUtil::isReallyWritable(BASE.\"framework/conf\")) {\n $conffolder = pathinfo($configname);\n if ((file_exists($configname) && expUtil::isReallyWritable($configname)) || expUtil::isReallyWritable(\n $conffolder['dirname']\n )\n ) {\n $fh = fopen($configname, \"w\");\n fwrite($fh, $str);\n /*fwrite($fh,\"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$configname\\\");\\n?>\\n\");*/\n fclose($fh);\n } else {\n echo gt('Unable to write configuration') . '<br />';\n }\n //}\n }",
" /** exdoc\n * Processes the POSTed data from the configuration form\n * object generated by self::configurationForm, and writes\n * a bunch of define() statements to the profiles config file.\n *\n * @param array $values The _POST array to pull configuration data from.\n * @param null $site_root\n *\n * @node Subsystems:Config\n */\n public static function saveConfiguration($values, $site_root = null) //FIXME this method is only used in install, and doesn't deal with profiles\n {\n if ($site_root == null) {\n $site_root = BASE;\n }",
" if (empty($values['configname']) || $values['configname'] == 'Default') {\n $configname = '';\n } else {\n //\t\t$configname = str_replace(\" \",\"_\",$values['configname']);\n $configname = expFile::fixName($values['configname']);\n }",
" $original_config = self::parse($configname, $site_root);",
" $str = \"<?php\\n\\n\";\n foreach ($values['c'] as $directive => $value) {\n $directive = strtoupper($directive);",
" // Because we may not have all config options in the POST,\n // we need to unset the ones we do have from the original config.\n unset($original_config[$directive]);",
" $str .= \"define(\\\"$directive\\\",\";\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities(stripslashes($value), ENT_QUOTES, LANG_CHARSET); // slashes added by POST\n $value = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"<br />\", $value);\n $str .= \"exponent_unhtmlentities('$value')\";\n } elseif (is_int($value)) {\n $str .= $value;\n } else {\n if ($directive != 'SESSION_TIMEOUT') {\n $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n } else {\n $str .= str_replace(\"'\", '', $value);\n }\n }\n $str .= \");\\n\";\n }\n foreach ($values['opts'] as $directive => $val) {\n $directive = strtoupper($directive);",
" // Because we may not have all config options in the POST,\n // we need to unset the ones we do have from the original config.\n unset($original_config[$directive]);",
" $str .= \"define(\\\"$directive\\\",\" . (isset($values['o'][$directive]) ? 1 : 0) . \");\\n\";\n }\n // Now pick up all of the unspecified values\n // THIS MAY SCREW UP on checkboxes.\n foreach ($original_config as $directive => $value) {\n $str .= \"define(\\\"$directive\\\",\";\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities(stripslashes($value), ENT_QUOTES, LANG_CHARSET); // slashes added by POST\n $str .= \"exponent_unhtmlentities('$value')\";\n } else {\n if (is_int($value)) {\n $str .= $value;\n } else {\n $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n }\n }\n $str .= \");\\n\";\n }\n $str .= \"\\n?>\";",
" // if ($configname != \"\") {\n // // Wishing to save\n // if ( (file_exists($site_root.\"framework/conf/profiles/$configname.php\") && expUtil::isReallyWritable($site_root.\"framework/conf/profiles/$configname.php\")) ||\n // expUtil::isReallyWritable($site_root.\"framework/conf/profiles\")) {\n //\n // $fh = fopen($site_root.\"framework/conf/profiles/$configname.php\",\"w\");\n // fwrite($fh,$str);\n // fclose($fh);\n // } else {\n // echo gt('Unable to write profile configuration').'<br />';\n // }\n // }",
"//\t\tif (isset($values['activate']) || $configname == \"\") {\n//\t\t\tif ((file_exists($site_root.\"framework/conf/config.php\") && expUtil::isReallyWritable($site_root.\"framework/conf/config.php\")) ||\n//\t\t\t\t expUtil::isReallyWritable($site_root.\"framework/conf\")) {\n//\t\t\t\t$fh = fopen($site_root.\"framework/conf/config.php\",\"w\");\n//\t\t\t\tfwrite($fh,$str);\n//\n /*\t\t\t\t/*fwrite($fh,\"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$configname\\\");\\n?>\\n\");*/\n//\t\t\t\tfclose($fh);\n//\t\t\t} else {\n//\t\t\t\techo gt('Unable to write profile configuration').'<br />';\n//\t\t\t}\n//\t\t}\n self::writeFile($str);\n }",
" /** exdoc\n * This function looks through all of the available configuration\n * extensions, and generates a form object consisting of each\n * extension's form part. This can then be used to edit the full\n * site configuration. Returns a form object intended for editing the profile.\n *\n * @param string $configname The name of the configuration profile,\n * for filling in default values.\n * @param bool $database\n *\n * @return \\form\n * @node Subsystems:Config\n */\n public static function configurationForm($configname, $database = false) //FIXME this method is never used\n {\n // $configname = \"\" for active config\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n global $user;\n $options = self::parse($configname);",
" $form = new form();",
" $form->register(null, '', new htmlcontrol('<h3 id=\"config_top\">' . gt('Configuration Options') . '</h3>'));\n $form->register('configname', gt('Profile Name'), new textcontrol($configname));\n $form->register(\n 'activate',\n gt('Activate'),\n new checkboxcontrol((!defined('CURRENTCONFIGNAME') || CURRENTCONFIGNAME == $configname))\n );",
" $sections = array();",
" $dh = opendir(BASE . 'framework/conf/extensions');\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . 'framework/conf/extensions/' . $file) && substr(\n $file,\n -14,\n 14\n ) == '.structure.php'\n ) {\n $arr = include(BASE . 'framework/conf/extensions/' . $file);\n // Check to see if the current user is a super admin, and only include database if so\n if (substr($file, 0, -14) != 'database' || $user->is_admin == 1) {\n $form->register(\n null,\n '',\n new htmlcontrol('<div id=\"config_' . count(\n $sections\n ) . '\" style=\"font-weight: bold; margin-top: 1.5em; border-top: 1px solid black; border-bottom: 1px solid black; background-color: #ccc; font-size: 12pt;\">' . $arr[0] . '</div><a href=\"#config_top\">Top</a>')\n );\n $sections[] = '<a href=\"#config_' . count($sections) . '\">' . $arr[0] . '</a>';\n foreach ($arr[1] as $directive => $info) {",
" if ($info['description'] != '') {\n $form->register(\n null,\n '',\n new htmlcontrol('<br /><br />' . $info['description'], false)\n );\n }\n if (is_a($info['control'], \"checkboxcontrol\")) {\n $form->meta(\"opts[$directive]\", 1);\n $info['control']->default = $options[$directive];\n $info['control']->flip = true;\n $form->register(\n \"o[$directive]\",\n '<strong>' . $info['title'] . '</strong>',\n $info['control']\n );\n } else {\n if (isset($options[$directive])) {\n $info[\"control\"]->default = $options[$directive];\n }\n $form->register(\n \"c[$directive]\",\n '<strong>' . $info['title'] . '</strong>',\n $info['control'],\n $info['description']\n );\n }\n }\n //$form->register(null,'',new buttongroupcontrol(gt('Save'),'',gt('Cancel')));\n }\n }\n }\n// $form->registerAfter('activate',null,'',new htmlcontrol('<hr size=\"1\" />'.implode('  |  ')));\n $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel')));",
" return $form;\n }\n return null;\n }",
" /** exdoc\n * Takes care of setting the appropriate template variables\n * to be used when viewing a profile or set of profiles.\n * Returns the initializes template.\n *\n * @param template $template The template object to assign to.\n * @param string $configname The name of the configuration profile.\n *\n * @return \\template\n * @node Subsystems:Config\n */\n public static function outputConfigurationTemplate($template, $configname) //FIXME this method is never used\n {\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n $categorized = array();\n $options = self::parse($configname);",
" $dh = opendir(BASE . \"framework/conf/extensions\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/extensions/$file\") && substr(\n $file,\n -14,\n 14\n ) == \".structure.php\"\n ) {\n $arr = include(BASE . \"framework/conf/extensions/$file\");\n $categorized[$arr[0]] = array();\n foreach ($arr[1] as $directive => $info) {\n if (is_a($info[\"control\"], \"passwordcontrol\")) {\n $info[\"value\"] = '<' . gt('hidden') . '>';\n } else {\n if (is_a($info[\"control\"], \"checkboxcontrol\")) {\n $info[\"value\"] = (isset($options[$directive]) ? ($options[$directive] ? \"yes\" : \"no\") : \"no\");\n } else {\n if (is_a($info[\"control\"], \"dropdowncontrol\") && isset($options[$directive])) {\n $info[\"value\"] = @$info[\"control\"]->items[$options[$directive]];\n } else {\n $info[\"value\"] = (isset($options[$directive]) ? $options[$directive] : \"\");\n }\n }\n }\n unset($info[\"control\"]);",
" $categorized[$arr[0]][$directive] = $info;\n }\n }\n }\n $template->assign(\"configuration\", $categorized);\n }\n return $template;\n }",
" /** exdoc\n * Looks through the framework/conf/profiles directory, and finds all of\n * the configuration profiles in existence. This function also\n * performs some minor name-mangling, to make the Profile Names\n * more user friendly. Returns an array of Profile names.\n *\n * @node Subsystems:Config\n * @return array\n */\n public static function profiles()\n {\n $profiles = array();\n if (is_readable(BASE . \"framework/conf/profiles\")) {\n $dh = opendir(BASE . \"framework/conf/profiles\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/profiles/$file\") && substr($file, -4, 4) == \".php\") {\n $name = substr($file, 0, -4);\n $profiles[$name] = str_replace(\"_\", \" \", $name);\n }\n }\n }\n return $profiles;\n }",
" /** exdoc\n * Creates a configuration profile from the current configuration\n *\n * @param string $profile The name of the Profile to remove.\n *\n * @return string\n *\n * @node Subsystems:Config\n */\n public static function createProfile($profile)\n {\n if (!file_exists(BASE . \"framework/conf/profiles\")) {\n @mkdir(\n BASE . \"framework/conf/profiles\",\n DIR_DEFAULT_MODE_STR,\n true\n );\n }\n //FIXME do we need to delete an existing profile first??\n $profile = expFile::fixName($profile);\n// copy(BASE.\"framework/conf/config.php\",BASE.\"framework/conf/profiles/\".$profile.\".php\");\n// $baseprofile = self::parseFile(BASE . \"framework/conf/config.php\");\n $baseprofile = self::parse(); // get current configuration plus missing defaults\n unset($baseprofile['CURRENTCONFIGNAME']); // don't save profile name within actual profile\n self::saveValues($baseprofile, BASE . \"framework/conf/profiles/\" . $profile . \".php\");\n return $profile;\n }",
" /** exdoc\n * Deletes a configuration profile from the framework/conf/profiles\n * directory.\n *\n * @param string $profile The name of the Profile to remove.\n *\n * @node Subsystems:Config\n */\n public static function deleteProfile($profile) //FIXME this method is never used\n {\n if (file_exists(BASE . \"framework/conf/profiles/$profile.php\")) {\n unlink(BASE . \"framework/conf/profiles/$profile.php\");\n }\n }",
" /** exdoc\n * Activates a Configuration Profile.\n *\n * @param string $profile The name of the Profile to activate.\n *\n * @node Subsystems:Config\n */\n public static function activateProfile($profile)\n {",
" if (!empty($profile) && (strpos($profile, '..') !== false || strpos($profile, '/') !== false)) {\n header('Location: ' . URL_FULL);\n exit(); // attempt to hack the site\n }",
" if (is_readable(BASE . \"framework/conf/profiles/$profile.php\") && expUtil::isReallyWritable(\n BASE . \"framework/conf\"\n )\n ) {\n //FIXME do we need to delete current config first??\n copy(BASE . \"framework/conf/profiles/$profile.php\", BASE . \"framework/conf/config.php\");\n // tag it with the profile name\n $fh = fopen(BASE . \"framework/conf/config.php\", \"a\");\n fwrite(\n $fh,\n \"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$profile\\\");\\n?>\"\n ); // add activated profile name to end of profile\n fclose($fh);\n }\n }",
" /** exdoc\n * Parse Drop Down options from a file.\n *\n * @param string $dropdown_name The name of the dropdown type. The name of the\n * file will be retrieved by adding .dropdown as a suffix, and searching the framework/conf/data directory.\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function dropdownData($dropdown_name)\n {\n $array = array();\n if (is_readable(BASE . \"framework/conf/data/$dropdown_name.dropdown\")) {\n $t = array();\n foreach (file(BASE . \"framework/conf/data/$dropdown_name.dropdown\") as $l) {\n $l = trim($l);\n if ($l != \"\" && substr($l, 0, 1) != \"#\") {\n $go = count($t);",
" $t[] = trim($l);",
" if ($go) {\n $array[$t[0]] = gt($t[1]);\n $t = array();\n }\n }\n }\n }\n return $array;\n }",
"}",
"expSettings::initialize(); // auto-initialize when loaded",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expString\n *\n * @package Subsystems\n * @subpackage Subsystems\n */\n/** @define \"BASE\" \"../../..\" */",
"class expString {",
" /**\n * Routine to convert string to UTF\n *\n * @static\n * @param string $string\n * @return string\n */\n\tstatic function convertUTF($string) {\n\t\treturn $string = str_replace('?', '', htmlspecialchars($string, ENT_IGNORE, 'UTF-8'));",
"\t} ",
"\n /**\n * Routine to check if string is valid UTF string\n *\n * @static\n * @param string $string\n * @return bool\n */\n\tstatic function validUTF($string) {\n\t\tif(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {\n\t\t\treturn false;",
"\t\t}\t\t",
"\t\treturn true;\n\t}",
" /**\n * Routine to strip unreadable characters from string - ascii 32 to 126\n *\n * @static\n * @param string $string\n * @return string\n */\n\tstatic function onlyReadables($string) {\n for ($i = 0, $iMax = strlen($string); $i < $iMax; $i++) {\n\t\t\t$chr = $string{$i};\n\t\t\t$ord = ord($chr);\n\t\t\tif ($ord<32 or $ord>126) {\n\t\t\t$chr = \"~\";\n\t\t\t$string{$i} = $chr;\n\t\t\t}\n\t\t}\n\t\treturn str_replace(\"~\", \"\", $string);\n\t}",
" /**\n * Routine to\n *\n * @static\n * @param string $str\n * @param bool $unescape should the string also be unescaped?\n * @return mixed|string\n */\n\tstatic function parseAndTrim($str, $unescape=false) {\n if (is_array($str)) {\n $rst = array();\n foreach ($str as $key=>$st) {\n $rst[$key] = self::parseAndTrim($st, $unescape);\n }\n return $rst;\n }",
" $str = str_replace(\"<br>\",\" \",$str);\n $str = str_replace(\"</br>\",\" \",$str);\n $str = str_replace(\"<br/>\",\" \",$str);\n $str = str_replace(\"<br />\",\" \",$str);\n $str = str_replace(\"\\r\\n\",\" \",$str);\n $str = str_replace('\"',\""\",$str);\n $str = str_replace(\"'\",\"'\",$str);\n $str = str_replace(\"’\",\"’\",$str);\n $str = str_replace(\"‘\",\"‘\",$str);\n $str = str_replace(\"®\",\"®\",$str);\n $str = str_replace(\"–\",\"-\", $str);\n $str = str_replace(\"—\",\"—\", $str);\n $str = str_replace(\"”\",\"”\", $str);\n $str = str_replace(\"“\",\"“\", $str);\n $str = str_replace(\"¼\",\"¼\",$str);\n $str = str_replace(\"½\",\"½\",$str);\n $str = str_replace(\"¾\",\"¾\",$str);\n\t\t$str = str_replace(\"™\",\"™\", $str);\n\t\t$str = trim($str);",
"\t\t",
" if ($unescape) {",
"\t\t\t$str = stripcslashes($str); ",
"\t\t} else {\n\t $str = addslashes($str);\n }",
" return $str;\n }",
" /**\n * Routine to convert string to an XML safe string\n *\n * @static\n * @param string $str\n * @return string\n */\n\tstatic function convertXMLFeedSafeChar($str) {\n\t\t$str = str_replace(\"<br>\",\"\",$str);\n $str = str_replace(\"</br>\",\"\",$str);\n $str = str_replace(\"<br/>\",\"\",$str);\n $str = str_replace(\"<br />\",\"\",$str);\n $str = str_replace(\""\",'\"',$str);\n $str = str_replace(\"'\",\"'\",$str);\n $str = str_replace(\"’\",\"'\",$str);",
" $str = str_replace(\"‘\",\"'\",$str); ",
" $str = str_replace(\"®\",\"\",$str);\n $str = str_replace(\"�\",\"-\", $str);",
" $str = str_replace(\"�\",\"-\", $str); ",
" $str = str_replace(\"�\", '\"', $str);\n $str = str_replace(\"”\",'\"', $str);\n $str = str_replace(\"�\", '\"', $str);\n $str = str_replace(\"“\",'\"', $str);",
" $str = str_replace(\"\\r\\n\",\" \",$str); ",
" $str = str_replace(\"�\",\" 1/4\",$str);\n $str = str_replace(\"¼\",\" 1/4\", $str);\n $str = str_replace(\"�\",\" 1/2\",$str);\n $str = str_replace(\"½\",\" 1/2\",$str);\n $str = str_replace(\"�\",\" 3/4\",$str);\n $str = str_replace(\"¾\",\" 3/4\",$str);\n $str = str_replace(\"�\", \"(TM)\", $str);\n $str = str_replace(\"™\",\"(TM)\", $str);\n $str = str_replace(\"®\",\"(R)\", $str);",
" $str = str_replace(\"�\",\"(R)\",$str); \n $str = str_replace(\"&\",\"&\",$str); \n\t\t$str = str_replace(\">\",\">\",$str); \t\t",
" return trim($str);\n\t}",
" /**\n * Routine to convert any smart quotes into normal quotes\n *\n * @param string $str\n * @return string\n */\n public static function convertSmartQuotes($str) {\n \t$find[] = '�'; // left side double smart quote\n \t$find[] = '�'; // right side double smart quote\n \t$find[] = '�'; // left side single smart quote\n \t$find[] = '�'; // right side single smart quote\n \t$find[] = '�'; // elipsis\n \t$find[] = '�'; // em dash\n \t$find[] = '�'; // en dash",
" $replace[] = '\"';\n \t$replace[] = '\"';\n \t$replace[] = \"'\";\n \t$replace[] = \"'\";\n \t$replace[] = \"...\";\n \t$replace[] = \"-\";\n \t$replace[] = \"-\";",
" $find[] = '“'; // left side double smart quote\n $find[] = '”'; // right side double smart quote\n $find[] = '‘'; // left side single smart quote\n $find[] = '’'; // right side single smart quote\n $find[] = '…'; // ellipsis\n $find[] = '—'; // em dash\n $find[] = '–'; // en dash",
" $replace[] = '\"';\n $replace[] = '\"';\n $replace[] = \"'\";\n $replace[] = \"'\";\n $replace[] = \"...\";\n $replace[] = \"-\";\n $replace[] = \"-\";",
"// $find[] = chr(145);\n// $find[] = chr(146);\n// $find[] = chr(147);\n// $find[] = chr(148);\n// $find[] = chr(150);\n// $find[] = chr(151);\n// $find[] = chr(133);\n// $find[] = chr(149);\n// $find[] = chr(11);\n//\n// $replace[] = \"'\";\n// $replace[] = \"'\";\n// $replace[] = \"\\\"\";\n// $replace[] = \"\\\"\";\n// $replace[] = \"-\";\n// $replace[] = \"-\";\n// $replace[] = \"...\";\n// $replace[] = \"•\";\n// $replace[] = \"\\n\";",
" \treturn str_replace($find, $replace, $str);\n }",
" /**\n * Enhanced variation of strip_tags with 'invert' option to remove specific tags\n *\n * @param $text\n * @param string $tags\n * @param bool $invert\n * @return mixed\n */\n public static function strip_tags_content($text, $tags = '', $invert = false)\n {\n preg_match_all('/<(.+?)[\\s]*\\/?[\\s]*>/si', trim($tags), $tags);\n $tags = array_unique($tags[1]);",
" if (is_array($tags) AND count($tags) > 0) {\n if ($invert == false) {\n return preg_replace('@<(?!(?:' . implode('|', $tags) . ')\\b)(\\w+)\\b.*?>.*?</\\1>@si', '', $text);\n } else {\n return preg_replace('@<(' . implode('|', $tags) . ')\\b.*?>.*?</\\1>@si', '', $text);\n }\n } elseif ($invert == false) {\n return preg_replace('@<(\\w+)\\b.*?>.*?</\\1>@si', '', $text);\n }\n return $text;\n }",
" /**\\\n * Replace any non-ascii character with its hex code with NO active db connection\n */\n public static function escape($value) {\n global $db;",
" if ($db->havedb) {\n return $db->escapeString($value);\n }",
" $return = '';\n for ($i = 0, $iMax = strlen($value); $i < $iMax; $i++) {\n $char = $value[$i];\n $ord = ord($char);\n if($char !== \"'\" && $char !== \"\\\"\" && $char !== '\\\\' && $ord >= 32 && $ord <= 126)\n $return .= $char;\n else\n $return .= '\\\\x' . dechex($ord);\n }\n return $return;\n }",
" /**\n * Summarize or short a long string\n *\n * @param $string\n * @param string $strtype\n * @param string $type\n *\n * @return string\n */\n public static function summarize($string, $strtype='html', $type='para', $more='...') {\n $sep = ($strtype == \"html\" ? array(\"</p>\", \"</div>\") : array(\"\\r\\n\", \"\\n\", \"\\r\"));\n $origstring = $string;",
" switch ($type) {\n case \"para\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&#160;\",\" \",htmlentities(expString::convertSmartQuotes(strip_tags($string)),ENT_QUOTES));\n return expString::convertSmartQuotes(strip_tags($string));\n break;\n case \"paralinks\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\" \",\" \",htmlspecialchars_decode(htmlentities(expString::convertSmartQuotes(strip_tags($string,'<a>')),ENT_QUOTES)));\n return expString::convertSmartQuotes(strip_tags($string, '<a>'));\n break;\n case \"parapaged\":\n// $s = '<div style=\"page-break-after: always;\"><span style=\"display: none;\"> </span></div>';\n $s = '<div style=\"page-break-after: always';\n $para = explode($s, $string);\n $string = $para[0];\n return expString::convertSmartQuotes($string);\n break;\n case \"parahtml\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n if (!empty($string)) {\n $isText = true;\n $ret = \"\";\n $i = 0;\n // $currentChar = \"\";\n // $lastSpacePosition = -1;\n // $lastChar = \"\";\n $tagsArray = array();\n $currentTag = \"\";\n // $tagLevel = 0;\n // $noTagLength = strlen(strip_tags($string));",
" // Parser loop\n for ($j = 0, $jMax = strlen($string); $j < $jMax; $j++) {",
" $currentChar = substr($string, $j, 1);\n $ret .= $currentChar;",
" // Lesser than event\n if ($currentChar == \"<\") $isText = false;",
" // Character handler\n if ($isText) {",
" // Memorize last space position\n if ($currentChar == \" \") {\n $lastSpacePosition = $j;\n } else {\n $lastChar = $currentChar;\n }",
" $i++;\n } else {\n $currentTag .= $currentChar;\n }",
" // Greater than event\n if ($currentChar == \">\") {\n $isText = true;",
" // Opening tag handler\n if ((strpos($currentTag, \"<\") !== FALSE) &&\n (strpos($currentTag, \"/>\") === FALSE) &&\n (strpos($currentTag, \"</\") === FALSE)\n ) {",
" // Tag has attribute(s)\n if (strpos($currentTag, \" \") !== FALSE) {\n $currentTag = substr($currentTag, 1, strpos($currentTag, \" \") - 1);\n } else {\n // Tag doesn't have attribute(s)\n $currentTag = substr($currentTag, 1, -1);\n }",
" array_push($tagsArray, $currentTag);",
" } else if (strpos($currentTag, \"</\") !== FALSE) {\n array_pop($tagsArray);\n }",
" $currentTag = \"\";\n }\n }\n // Cut HTML string at last space position\n // if ($length < $noTagLength) {\n // if ($lastSpacePosition != -1) {\n // $ret = substr($string, 0, $lastSpacePosition);\n // } else {\n // $ret = substr($string, $j);\n // }\n // }\n if (sizeof($tagsArray) != 0) {\n // Close broken XHTML elements\n while (sizeof($tagsArray) != 0) {\n if (sizeof($tagsArray) > 1) {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n } // You may add more tags here to put the link and added text before the closing tag\n elseif ($aTag == 'p' || 'div') {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n } else {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n }\n }\n }\n }\n return expString::convertSmartQuotes($string);\n break;\n default:\n $words = explode(\" \", strip_tags($string));\n $string = implode(\" \", array_slice($words, 0, $type + 0));\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&#160;\",\" \",htmlentities(expString::convertSmartQuotes($string),ENT_QUOTES));\n return expString::convertSmartQuotes($string);\n break;\n }\n }",
" public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);",
" $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\t\", \" \", $str);\n $str = str_replace(\",\", \"\\,\", $str);\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);",
" if (!$isHTML) {\n $str = str_replace('\\\"', \""\", $str);\n $str = str_replace('\"', \""\", $str);\n } else {\n $str = str_replace('\"', '\"\"', $str);\n }",
" //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n $str = trim(str_replace(\"�\", \"™\", $str));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);",
" global $db;",
"\n $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\,\", \",\", $str);\n $str = str_replace('\"\"', '\"', $str); //do this no matter what...in case someone added a quote in a non HTML field\n if (!$isHTML) {\n //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char\n $str = str_replace('\"', \""\", $str);\n }\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);\n //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n// if (DB_ENGINE=='mysqli') {",
"//\t $str = @mysqli_real_escape_string($db->connection,trim(str_replace(\"�\", \"™\", $str)));",
"// } elseif(DB_ENGINE=='mysql') {",
"// $str = @mysql_real_escape_string(trim(str_replace(\"�\", \"™\", $str)),$db->connection);",
"// } else {\n//\t $str = trim(str_replace(\"�\", \"™\", $str));\n// }",
" $str = @$db->escapeString($db->connection, trim(str_replace(\"�\", \"™\", $str)));",
" //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" public static function outputField($val, $eof = ',', $isHTML = false) {\n $newVal = self::parseAndTrimExport($val, $isHTML);\n if ($newVal != '') return '\"' . $newVal . '\"' . $eof;\n else return $eof;\n }",
" public static function stripLineEndings($val) {\n return preg_replace('/\\r\\n/', ' ', trim($val));\n }",
" /**\n * Scrub input string for possible security issues.\n *\n * @static\n * @param $data string\n * @return string\n */\n public static function sanitize(&$data) {\n// return $data;",
" if (is_array($data)) {\n $saved_params = array();\n if (!empty($data['controller']) && $data['controller'] == 'snippet') {\n $saved_params['body'] = $data['body']; // store snippet body\n }\n foreach ($data as $var=>$val) {\n// $data[$var] = self::sanitize($val);\n $data[$var] = self::xss_clean($val);\n }\n if (!empty($saved_params)) {\n $data = array_merge($data, $saved_params); // add stored snippet body\n }\n } else {\n if (empty($data)) {\n return $data;\n }",
" $data = self::xss_clean($data);",
" //fixme orig exp method\n// if(0) {\n// // remove whitespaces and tags\n//// $data = strip_tags(trim($data));\n// // remove whitespaces and script tags\n// $data = self::strip_tags_content(trim($data), '<script>', true);\n//// $data = self::strip_tags_content(trim($data), '<iframe>', true);\n//\n// // apply stripslashes if magic_quotes_gpc is enabled\n// if (get_magic_quotes_gpc()) {\n// $data = stripslashes($data);\n// }\n//\n// $data = self::escape($data);\n//\n// // re-escape newlines\n// $data = str_replace(array('\\r', '\\n'), array(\"\\r\", \"\\n\"), $data);\n// }\n }\n return $data;\n }",
" // xss_clean //",
" /**\n \t * Character set\n \t *\n \t * Will be overridden by the constructor.\n \t *\n \t * @var\tstring\n \t */\n \tpublic static $charset = 'UTF-8';",
" /**\n \t * XSS Hash\n \t *\n \t * Random Hash for protecting URLs.\n \t *\n \t * @var\tstring\n \t */\n \tprotected static $_xss_hash;",
" /**\n \t * List of never allowed strings\n \t *\n \t * @var\tarray\n \t */\n protected static $_never_allowed_str =\tarray(\n \t\t'document.cookie'\t=> '[removed]',\n \t\t'document.write'\t=> '[removed]',\n \t\t'.parentNode'\t\t=> '[removed]',\n \t\t'.innerHTML'\t\t=> '[removed]',\n \t\t'-moz-binding'\t\t=> '[removed]',\n \t\t'<!--'\t\t\t\t=> '<!--',\n \t\t'-->'\t\t\t\t=> '-->',\n \t\t'<![CDATA['\t\t\t=> '<![CDATA[',\n \t\t'<comment>'\t\t\t=> '<comment>'\n \t);",
" \t/**\n \t * List of never allowed regex replacements\n \t *\n \t * @var\tarray\n \t */\n protected static $_never_allowed_regex = array(\n \t\t'javascript\\s*:',\n \t\t'(document|(document\\.)?window)\\.(location|on\\w*)',\n \t\t'expression\\s*(\\(|&\\#40;)', // CSS and IE\n \t\t'vbscript\\s*:', // IE, surprise!\n \t\t'wscript\\s*:', // IE\n \t\t'jscript\\s*:', // IE\n \t\t'vbs\\s*:', // IE\n \t\t'Redirect\\s+30\\d',\n \t\t\"([\\\"'])?data\\s*:[^\\\\1]*?base64[^\\\\1]*?,[^\\\\1]*?\\\\1?\"\n \t);",
" /**\n \t * XSS Clean\n \t *\n \t * Sanitizes data so that Cross Site Scripting Hacks can be\n \t * prevented. This method does a fair amount of work but\n \t * it is extremely thorough, designed to prevent even the\n \t * most obscure XSS attempts. Nothing is ever 100% foolproof,\n \t * of course, but I haven't been able to get anything passed\n \t * the filter.\n \t *\n \t * Note: Should only be used to deal with data upon submission.\n \t *\t It's not something that should be used for general\n \t *\t runtime processing.\n \t *\n \t * @link\thttp://channel.bitflux.ch/wiki/XSS_Prevention\n \t * \t\tBased in part on some code and ideas from Bitflux.\n \t *\n \t * @link\thttp://ha.ckers.org/xss.html\n \t * \t\tTo help develop this script I used this great list of\n \t *\t\tvulnerabilities along with a few other hacks I've\n \t *\t\tharvested from examining vulnerabilities in other programs.\n \t *\n \t * @param\tstring|string[]\t$str\t\tInput data\n \t * @param \tbool\t\t$is_image\tWhether the input is an image\n \t * @return\tstring\n \t */\n \tpublic static function xss_clean($str, $is_image = FALSE)\n \t{\n \t\t// Is the string an array?\n \t\tif (is_array($str))\n \t\t{\n \t\t\twhile (list($key) = each($str))\n \t\t\t{\n if (preg_match('/^[a-zA-Z0-9_\\x7f-\\xff]*$/', $key)) { // check for valid array name\n $str[$key] = self::xss_clean($str[$key]);\n } else {\n return null;\n }\n \t\t\t}",
" \t\t\treturn $str;\n \t\t}",
" \t\t// Remove Invisible Characters\n \t\t$str = self::remove_invisible_characters($str);",
" \t\t/*\n \t\t * URL Decode\n \t\t *\n \t\t * Just in case stuff like this is submitted:\n \t\t *\n \t\t * <a href=\"http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D\">Google</a>\n \t\t *\n \t\t * Note: Use rawurldecode() so it does not remove plus signs\n \t\t */\n \t\tdo\n \t\t{\n \t\t\t$str = rawurldecode($str);\n \t\t}\n \t\twhile (preg_match('/%[0-9a-f]{2,}/i', $str));",
" \t\t/*\n \t\t * Convert character entities to ASCII\n \t\t *\n \t\t * This permits our tests below to work reliably.\n \t\t * We only convert entities that are within tags since\n \t\t * these are the ones that will pose security problems.\n \t\t */\n \t\t$str = preg_replace_callback(\"/[^a-z0-9>]+[a-z0-9]+=([\\'\\\"]).*?\\\\1/si\", array('self', '_convert_attribute'), $str);\n \t\t$str = preg_replace_callback('/<\\w+.*/si', array('self', '_decode_entity'), $str);",
" \t\t// Remove Invisible Characters Again!\n \t\t$str = self::remove_invisible_characters($str);",
" \t\t/*\n \t\t * Convert all tabs to spaces\n \t\t *\n \t\t * This prevents strings like this: ja\tvascript\n \t\t * NOTE: we deal with spaces between characters later.\n \t\t * NOTE: preg_replace was found to be amazingly slow here on\n \t\t * large blocks of data, so we use str_replace.\n \t\t */\n \t\t$str = str_replace(\"\\t\", ' ', $str);",
" \t\t// Capture converted string for later comparison\n \t\t$converted_string = $str;",
" \t\t// Remove Strings that are never allowed\n \t\t$str = self::_do_never_allowed($str);",
" \t\t/*\n \t\t * Makes PHP tags safe\n \t\t *\n \t\t * Note: XML tags are inadvertently replaced too:\n \t\t *\n \t\t * <?xml\n \t\t *\n \t\t * But it doesn't seem to pose a problem.\n \t\t */\n \t\tif ($is_image === TRUE)\n \t\t{\n \t\t\t// Images have a tendency to have the PHP short opening and\n \t\t\t// closing tags every so often so we skip those and only\n \t\t\t// do the long opening tags.\n \t\t\t$str = preg_replace('/<\\?(php)/i', '<?\\\\1', $str);\n \t\t}\n \t\telse\n \t\t{\n \t\t\t$str = str_replace(array('<?', '?'.'>'), array('<?', '?>'), $str);\n \t\t}",
" \t\t/*\n \t\t * Compact any exploded words\n \t\t *\n \t\t * This corrects words like: j a v a s c r i p t\n \t\t * These words are compacted back to their correct state.\n \t\t */\n \t\t$words = array(\n \t\t\t'javascript', 'expression', 'vbscript', 'jscript', 'wscript',\n \t\t\t'vbs', 'script', 'base64', 'applet', 'alert', 'document',\n \t\t\t'write', 'cookie', 'window', 'confirm', 'prompt', 'eval'\n \t\t);",
" \t\tforeach ($words as $word)\n \t\t{\n \t\t\t$word = implode('\\s*', str_split($word)).'\\s*';",
" \t\t\t// We only want to do this when it is followed by a non-word character\n \t\t\t// That way valid stuff like \"dealer to\" does not become \"dealerto\"\n \t\t\t$str = preg_replace_callback('#('.substr($word, 0, -3).')(\\W)#is', array('self', '_compact_exploded_words'), $str);\n \t\t}",
" \t\t/*\n \t\t * Remove disallowed Javascript in links or img tags\n \t\t * We used to do some version comparisons and use of stripos(),\n \t\t * but it is dog slow compared to these simplified non-capturing\n \t\t * preg_match(), especially if the pattern exists in the string\n \t\t *\n \t\t * Note: It was reported that not only space characters, but all in\n \t\t * the following pattern can be parsed as separators between a tag name\n \t\t * and its attributes: [\\d\\s\"\\'`;,\\/\\=\\(\\x00\\x0B\\x09\\x0C]\n \t\t * ... however, remove_invisible_characters() above already strips the\n \t\t * hex-encoded ones, so we'll skip them below.\n \t\t */\n \t\tdo\n \t\t{\n \t\t\t$original = $str;",
" \t\t\tif (preg_match('/<a/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace_callback('#<a[^a-z0-9>]+([^>]*?)(?:>|$)#si', array('self', '_js_link_removal'), $str);\n \t\t\t}",
" \t\t\tif (preg_match('/<img/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace_callback('#<img[^a-z0-9]+([^>]*?)(?:\\s?/?>|$)#si', array('self', '_js_img_removal'), $str);\n \t\t\t}",
" \t\t\tif (preg_match('/script|xss/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace('#</*(?:script|xss).*?>#si', '[removed]', $str);\n \t\t\t}\n \t\t}\n \t\twhile ($original !== $str);\n \t\tunset($original);",
" \t\t/*\n \t\t * Sanitize naughty HTML elements\n \t\t *\n \t\t * If a tag containing any of the words in the list\n \t\t * below is found, the tag gets converted to entities.\n \t\t *\n \t\t * So this: <blink>\n \t\t * Becomes: <blink>\n \t\t */\n \t\t$pattern = '#'\n \t\t\t.'<((?<slash>/*\\s*)(?<tagName>[a-z0-9]+)(?=[^a-z0-9]|$)' // tag start and name, followed by a non-tag character\n \t\t\t.'[^\\s\\042\\047a-z0-9>/=]*' // a valid attribute character immediately after the tag would count as a separator\n \t\t\t// optional attributes\n \t\t\t.'(?<attributes>(?:[\\s\\042\\047/=]*' // non-attribute characters, excluding > (tag close) for obvious reasons\n \t\t\t.'[^\\s\\042\\047>/=]+' // attribute characters\n \t\t\t// optional attribute-value\n \t\t\t\t.'(?:\\s*=' // attribute-value separator\n \t\t\t\t\t.'(?:[^\\s\\042\\047=><`]+|\\s*\\042[^\\042]*\\042|\\s*\\047[^\\047]*\\047|\\s*(?U:[^\\s\\042\\047=><`]*))' // single, double or non-quoted value\n \t\t\t\t.')?' // end optional attribute-value group\n \t\t\t.')*)' // end optional attributes group\n \t\t\t.'[^>]*)(?<closeTag>\\>)?#isS';",
" \t\t// Note: It would be nice to optimize this for speed, BUT\n \t\t// only matching the naughty elements here results in\n \t\t// false positives and in turn - vulnerabilities!\n \t\tdo\n \t\t{\n \t\t\t$old_str = $str;\n \t\t\t$str = preg_replace_callback($pattern, array('self', '_sanitize_naughty_html'), $str);\n \t\t}\n \t\twhile ($old_str !== $str);\n \t\tunset($old_str);",
" \t\t/*\n \t\t * Sanitize naughty scripting elements\n \t\t *\n \t\t * Similar to above, only instead of looking for\n \t\t * tags it looks for PHP and JavaScript commands\n \t\t * that are disallowed. Rather than removing the\n \t\t * code, it simply converts the parenthesis to entities\n \t\t * rendering the code un-executable.\n \t\t *\n \t\t * For example:\teval('some code')\n \t\t * Becomes:\teval('some code')\n \t\t */\n \t\t$str = preg_replace(\n \t\t\t'#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\\s*)\\((.*?)\\)#si',\n \t\t\t'\\\\1\\\\2(\\\\3)',\n \t\t\t$str\n \t\t);",
" \t\t// Final clean up\n \t\t// This adds a bit of extra precaution in case\n \t\t// something got through the above filters\n \t\t$str = self::_do_never_allowed($str);",
" \t\t/*\n \t\t * Images are Handled in a Special Way\n \t\t * - Essentially, we want to know that after all of the character\n \t\t * conversion is done whether any unwanted, likely XSS, code was found.\n \t\t * If not, we return TRUE, as the image is clean.\n \t\t * However, if the string post-conversion does not matched the\n \t\t * string post-removal of XSS, then it fails, as there was unwanted XSS\n \t\t * code found and removed/changed during processing.\n \t\t */\n \t\tif ($is_image === TRUE)\n \t\t{\n \t\t\treturn ($str === $converted_string);\n \t\t}",
" \t\treturn $str;\n \t}",
" /**\n \t * Do Never Allowed\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param \tstring\n \t * @return \tstring\n \t */\n \tprotected static function _do_never_allowed($str)\n \t{\n \t\t$str = str_replace(array_keys(self::$_never_allowed_str), self::$_never_allowed_str, $str);",
" \t\tforeach (self::$_never_allowed_regex as $regex)\n \t\t{\n \t\t\t$str = preg_replace('#'.$regex.'#is', '[removed]', $str);\n \t\t}",
" \t\treturn $str;\n \t}",
"\t/**\n\t * Remove Invisible Characters\n\t *\n\t * This prevents sandwiching null characters\n\t * between ascii characters, like Java\\0script.\n\t *\n\t * @param\tstring\n\t * @param\tbool\n\t * @return\tstring\n\t */\n\tpublic static function remove_invisible_characters($str, $url_encoded = TRUE)\n\t{\n\t\t$non_displayables = array();",
"\t\t// every control character except newline (dec 10),\n\t\t// carriage return (dec 13) and horizontal tab (dec 09)\n\t\tif ($url_encoded)\n\t\t{\n\t\t\t$non_displayables[] = '/%0[0-8bcef]/';\t// url encoded 00-08, 11, 12, 14, 15\n\t\t\t$non_displayables[] = '/%1[0-9a-f]/';\t// url encoded 16-31\n\t\t}",
"\t\t$non_displayables[] = '/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]+/S';\t// 00-08, 11, 12, 14-31, 127",
"\t\tdo\n\t\t{\n\t\t\t$str = preg_replace($non_displayables, '', $str, -1, $count);\n\t\t}\n\t\twhile ($count);",
"\t\treturn $str;\n\t}",
" /**\n \t * HTML Entity Decode Callback\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _decode_entity($match)\n \t{\n \t\t// Protect GET variables in URLs\n \t\t// 901119URL5918AMP18930PROTECT8198\n \t\t$match = preg_replace('|\\&([a-z\\_0-9\\-]+)\\=([a-z\\_0-9\\-/]+)|i', self::xss_hash().'\\\\1=\\\\2', $match[0]);",
" \t\t// Decode, then un-protect URL GET vars\n \t\treturn str_replace(\n self::xss_hash(),\n \t\t\t'&',\n self::entity_decode($match, self::$charset)\n \t\t);\n \t}",
" /**\n \t * XSS Hash\n \t *\n \t * Generates the XSS hash if needed and returns it.\n \t *\n \t * @see\t\tCI_Security::$_xss_hash\n \t * @return\tstring\tXSS hash\n \t */\n \tpublic static function xss_hash()\n \t{\n \t\tif (self::$_xss_hash === NULL)\n \t\t{\n \t\t\t$rand = self::get_random_bytes(16);\n self::$_xss_hash = ($rand === FALSE)\n \t\t\t\t? md5(uniqid(mt_rand(), TRUE))\n \t\t\t\t: bin2hex($rand);\n \t\t}",
" \t\treturn self::$_xss_hash;\n \t}",
" /**\n \t * HTML Entities Decode\n \t *\n \t * A replacement for html_entity_decode()\n \t *\n \t * The reason we are not using html_entity_decode() by itself is because\n \t * while it is not technically correct to leave out the semicolon\n \t * at the end of an entity most browsers will still interpret the entity\n \t * correctly. html_entity_decode() does not convert entities without\n \t * semicolons, so we are left with our own little solution here. Bummer.\n \t *\n \t * @link\thttp://php.net/html-entity-decode\n \t *\n \t * @param\tstring\t$str\t\tInput\n \t * @param\tstring\t$charset\tCharacter set\n \t * @return\tstring\n \t */\n \tpublic static function entity_decode($str, $charset = NULL)\n \t{\n \t\tif (strpos($str, '&') === FALSE)\n \t\t{\n \t\t\treturn $str;\n \t\t}",
" \t\tstatic $_entities;",
" \t\tisset($charset) OR $charset = self::$charset;\n \t\t$flag = expCore::is_php('5.4')\n \t\t\t? ENT_COMPAT | ENT_HTML5\n \t\t\t: ENT_COMPAT;",
" \t\tdo\n \t\t{\n \t\t\t$str_compare = $str;",
" \t\t\t// Decode standard entities, avoiding false positives\n \t\t\tif (preg_match_all('/&[a-z]{2,}(?![a-z;])/i', $str, $matches))\n \t\t\t{\n \t\t\t\tif ( ! isset($_entities))\n \t\t\t\t{\n \t\t\t\t\t$_entities = array_map(\n \t\t\t\t\t\t'strtolower',\n expCore::is_php('5.3.4')\n \t\t\t\t\t\t\t? get_html_translation_table(HTML_ENTITIES, $flag, $charset)\n \t\t\t\t\t\t\t: get_html_translation_table(HTML_ENTITIES, $flag)\n \t\t\t\t\t);",
" \t\t\t\t\t// If we're not on PHP 5.4+, add the possibly dangerous HTML 5\n \t\t\t\t\t// entities to the array manually\n \t\t\t\t\tif ($flag === ENT_COMPAT)\n \t\t\t\t\t{\n \t\t\t\t\t\t$_entities[':'] = ':';\n \t\t\t\t\t\t$_entities['('] = '(';\n \t\t\t\t\t\t$_entities[')'] = ')';\n \t\t\t\t\t\t$_entities[\"\\n\"] = '&newline;';\n \t\t\t\t\t\t$_entities[\"\\t\"] = '&tab;';\n \t\t\t\t\t}\n \t\t\t\t}",
" \t\t\t\t$replace = array();\n \t\t\t\t$matches = array_unique(array_map('strtolower', $matches[0]));\n \t\t\t\tforeach ($matches as &$match)\n \t\t\t\t{\n \t\t\t\t\tif (($char = array_search($match.';', $_entities, TRUE)) !== FALSE)\n \t\t\t\t\t{\n \t\t\t\t\t\t$replace[$match] = $char;\n \t\t\t\t\t}\n \t\t\t\t}",
" \t\t\t\t$str = str_ireplace(array_keys($replace), array_values($replace), $str);\n \t\t\t}",
" \t\t\t// Decode numeric & UTF16 two byte entities\n \t\t\t$str = html_entity_decode(\n \t\t\t\tpreg_replace('/(&#(?:x0*[0-9a-f]{2,5}(?![0-9a-f;])|(?:0*\\d{2,4}(?![0-9;]))))/iS', '$1;', $str),\n \t\t\t\t$flag,\n \t\t\t\t$charset\n \t\t\t);\n \t\t}\n \t\twhile ($str_compare !== $str);\n \t\treturn $str;\n \t}",
" /**\n \t * Get random bytes\n \t *\n \t * @param\tint\t$length\tOutput length\n \t * @return\tstring\n \t */\n \tpublic static function get_random_bytes($length)\n \t{\n \t\tif (empty($length) OR ! ctype_digit((string) $length))\n \t\t{\n \t\t\treturn FALSE;\n \t\t}",
" if (function_exists('random_bytes'))\n {\n try\n {\n // The cast is required to avoid TypeError\n return random_bytes((int) $length);\n }\n catch (Exception $e)\n {\n // If random_bytes() can't do the job, we can't either ...\n // There's no point in using fallbacks.\n log_message('error', $e->getMessage());\n return FALSE;\n }\n }",
" \t\t// Unfortunately, none of the following PRNGs is guaranteed to exist ...\n \t\tif (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE)\n \t\t{\n \t\t\treturn $output;\n \t\t}",
"\n \t\tif (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE)\n \t\t{\n \t\t\t// Try not to waste entropy ...\n expCore::is_php('5.4') && stream_set_chunk_size($fp, $length);\n \t\t\t$output = fread($fp, $length);\n \t\t\tfclose($fp);\n \t\t\tif ($output !== FALSE)\n \t\t\t{\n \t\t\t\treturn $output;\n \t\t\t}\n \t\t}",
" \t\tif (function_exists('openssl_random_pseudo_bytes'))\n \t\t{\n \t\t\treturn openssl_random_pseudo_bytes($length);\n \t\t}",
" \t\treturn FALSE;\n \t}",
" /**\n \t * Attribute Conversion\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _convert_attribute($match)\n \t{\n \t\treturn str_replace(array('>', '<', '\\\\'), array('>', '<', '\\\\\\\\'), $match[0]);\n \t}",
" /**\n \t * Compact Exploded Words\n \t *\n \t * Callback method for xss_clean() to remove whitespace from\n \t * things like 'j a v a s c r i p t'.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$matches\n \t * @return\tstring\n \t */\n \tprotected static function _compact_exploded_words($matches)\n \t{\n \t\treturn preg_replace('/\\s+/s', '', $matches[1]).$matches[2];\n \t}",
" /**\n \t * JS Link Removal\n \t *\n \t * Callback method for xss_clean() to sanitize links.\n \t *\n \t * This limits the PCRE backtracks, making it more performance friendly\n \t * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in\n \t * PHP 5.2+ on link-heavy strings.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _js_link_removal($match)\n \t{\n \t\treturn str_replace(\n \t\t\t$match[1],\n \t\t\tpreg_replace(\n \t\t\t\t'#href=.*?(?:(?:alert|prompt|confirm)(?:\\(|&\\#40;)|javascript:|livescript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|data\\s*:)#si',\n \t\t\t\t'',\n \t\t\t\tself::_filter_attributes($match[1])\n \t\t\t),\n \t\t\t$match[0]\n \t\t);\n \t}",
" /**\n \t * JS Image Removal\n \t *\n \t * Callback method for xss_clean() to sanitize image tags.\n \t *\n \t * This limits the PCRE backtracks, making it more performance friendly\n \t * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in\n \t * PHP 5.2+ on image tag heavy strings.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _js_img_removal($match)\n \t{\n \t\treturn str_replace(\n \t\t\t$match[1],\n \t\t\tpreg_replace(\n \t\t\t\t'#src=.*?(?:(?:alert|prompt|confirm|eval)(?:\\(|&\\#40;)|javascript:|livescript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|base64\\s*,)#si',\n \t\t\t\t'',\n \t\t\t\tself::_filter_attributes($match[1])\n \t\t\t),\n \t\t\t$match[0]\n \t\t);\n \t}",
" /**\n \t * Filter Attributes\n \t *\n \t * Filters tag attributes for consistency and safety.\n \t *\n \t * @used-by\tCI_Security::_js_img_removal()\n \t * @used-by\tCI_Security::_js_link_removal()\n \t * @param\tstring\t$str\n \t * @return\tstring\n \t */\n \tprotected static function _filter_attributes($str)\n \t{\n \t\t$out = '';\n \t\tif (preg_match_all('#\\s*[a-z\\-]+\\s*=\\s*(\\042|\\047)([^\\\\1]*?)\\\\1#is', $str, $matches))\n \t\t{\n \t\t\tforeach ($matches[0] as $match)\n \t\t\t{\n \t\t\t\t$out .= preg_replace('#/\\*.*?\\*/#s', '', $match);\n \t\t\t}\n \t\t}",
" \t\treturn $out;\n \t}",
" /**\n \t * Sanitize Naughty HTML\n \t *\n \t * Callback method for xss_clean() to remove naughty HTML elements.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$matches\n \t * @return\tstring\n \t */\n \tprotected static function _sanitize_naughty_html($matches)\n \t{\n \t\tstatic $naughty_tags = array(\n \t\t\t'alert', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound',\n \t\t\t'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer',\n \t\t\t'input', 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object',\n \t\t\t'plaintext', 'script', 'textarea', 'title', 'math', 'video', 'svg', 'xml', 'xss'\n //,'style', 'iframe'\n \t\t);",
" \t\tstatic $evil_attributes = array(\n \t\t\t'on\\w+', 'xmlns', 'formaction', 'form', 'xlink:href', 'FSCommand', 'seekSegmentTime'\n //, 'style'\n \t\t);",
" \t\t// First, escape unclosed tags\n \t\tif (empty($matches['closeTag']))\n \t\t{\n \t\t\treturn '<'.$matches[1];\n \t\t}\n \t\t// Is the element that we caught naughty? If so, escape it\n \t\telseif (in_array(strtolower($matches['tagName']), $naughty_tags, TRUE))\n \t\t{\n \t\t\treturn '<'.$matches[1].'>';\n \t\t}\n \t\t// For other tags, see if their attributes are \"evil\" and strip those\n \t\telseif (isset($matches['attributes']))\n \t\t{\n \t\t\t// We'll store the already fitlered attributes here\n \t\t\t$attributes = array();",
" \t\t\t// Attribute-catching pattern\n \t\t\t$attributes_pattern = '#'\n \t\t\t\t.'(?<name>[^\\s\\042\\047>/=]+)' // attribute characters\n \t\t\t\t// optional attribute-value\n \t\t\t\t.'(?:\\s*=(?<value>[^\\s\\042\\047=><`]+|\\s*\\042[^\\042]*\\042|\\s*\\047[^\\047]*\\047|\\s*(?U:[^\\s\\042\\047=><`]*)))' // attribute-value separator\n \t\t\t\t.'#i';",
" \t\t\t// Blacklist pattern for evil attribute names\n \t\t\t$is_evil_pattern = '#^('.implode('|', $evil_attributes).')$#i';",
" \t\t\t// Each iteration filters a single attribute\n \t\t\tdo\n \t\t\t{\n \t\t\t\t// Strip any non-alpha characters that may preceed an attribute.\n \t\t\t\t// Browsers often parse these incorrectly and that has been a\n \t\t\t\t// of numerous XSS issues we've had.\n \t\t\t\t$matches['attributes'] = preg_replace('#^[^a-z]+#i', '', $matches['attributes']);",
" \t\t\t\tif ( ! preg_match($attributes_pattern, $matches['attributes'], $attribute, PREG_OFFSET_CAPTURE))\n \t\t\t\t{\n \t\t\t\t\t// No (valid) attribute found? Discard everything else inside the tag\n \t\t\t\t\tbreak;\n \t\t\t\t}",
" \t\t\t\tif (\n \t\t\t\t\t// Is it indeed an \"evil\" attribute?\n \t\t\t\t\tpreg_match($is_evil_pattern, $attribute['name'][0])\n \t\t\t\t\t// Or does it have an equals sign, but no value and not quoted? Strip that too!\n \t\t\t\t\tOR (trim($attribute['value'][0]) === '')\n \t\t\t\t)\n \t\t\t\t{\n \t\t\t\t\t$attributes[] = 'xss=removed';\n \t\t\t\t}\n \t\t\t\telse\n \t\t\t\t{\n \t\t\t\t\t$attributes[] = $attribute[0][0];\n \t\t\t\t}",
" \t\t\t\t$matches['attributes'] = substr($matches['attributes'], $attribute[0][1] + strlen($attribute[0][0]));\n \t\t\t}\n \t\t\twhile ($matches['attributes'] !== '');",
" \t\t\t$attributes = empty($attributes)\n \t\t\t\t? ''\n \t\t\t\t: ' '.implode(' ', $attributes);\n \t\t\treturn '<'.$matches['slash'].$matches['tagName'].$attributes.'>';\n \t\t}",
" \t\treturn $matches[0];\n \t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expString\n *\n * @package Subsystems\n * @subpackage Subsystems\n */\n/** @define \"BASE\" \"../../..\" */",
"class expString {",
" /**\n * Routine to convert string to UTF\n *\n * @static\n * @param string $string\n * @return string\n */\n\tstatic function convertUTF($string) {\n\t\treturn $string = str_replace('?', '', htmlspecialchars($string, ENT_IGNORE, 'UTF-8'));",
"\t}",
"\n /**\n * Routine to check if string is valid UTF string\n *\n * @static\n * @param string $string\n * @return bool\n */\n\tstatic function validUTF($string) {\n\t\tif(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {\n\t\t\treturn false;",
"\t\t}",
"\t\treturn true;\n\t}",
" /**\n * Routine to strip unreadable characters from string - ascii 32 to 126\n *\n * @static\n * @param string $string\n * @return string\n */\n\tstatic function onlyReadables($string) {\n for ($i = 0, $iMax = strlen($string); $i < $iMax; $i++) {\n\t\t\t$chr = $string{$i};\n\t\t\t$ord = ord($chr);\n\t\t\tif ($ord<32 or $ord>126) {\n\t\t\t$chr = \"~\";\n\t\t\t$string{$i} = $chr;\n\t\t\t}\n\t\t}\n\t\treturn str_replace(\"~\", \"\", $string);\n\t}",
" /**\n * Routine to\n *\n * @static\n * @param string $str\n * @param bool $unescape should the string also be unescaped?\n * @return mixed|string\n */\n\tstatic function parseAndTrim($str, $unescape=false) {\n if (is_array($str)) {\n $rst = array();\n foreach ($str as $key=>$st) {\n $rst[$key] = self::parseAndTrim($st, $unescape);\n }\n return $rst;\n }",
" $str = str_replace(\"<br>\",\" \",$str);\n $str = str_replace(\"</br>\",\" \",$str);\n $str = str_replace(\"<br/>\",\" \",$str);\n $str = str_replace(\"<br />\",\" \",$str);\n $str = str_replace(\"\\r\\n\",\" \",$str);\n $str = str_replace('\"',\""\",$str);\n $str = str_replace(\"'\",\"'\",$str);\n $str = str_replace(\"’\",\"’\",$str);\n $str = str_replace(\"‘\",\"‘\",$str);\n $str = str_replace(\"®\",\"®\",$str);\n $str = str_replace(\"–\",\"-\", $str);\n $str = str_replace(\"—\",\"—\", $str);\n $str = str_replace(\"”\",\"”\", $str);\n $str = str_replace(\"“\",\"“\", $str);\n $str = str_replace(\"¼\",\"¼\",$str);\n $str = str_replace(\"½\",\"½\",$str);\n $str = str_replace(\"¾\",\"¾\",$str);\n\t\t$str = str_replace(\"™\",\"™\", $str);\n\t\t$str = trim($str);",
"",
" if ($unescape) {",
"\t\t\t$str = stripcslashes($str);",
"\t\t} else {\n\t $str = addslashes($str);\n }",
" return $str;\n }",
" /**\n * Routine to convert string to an XML safe string\n *\n * @static\n * @param string $str\n * @return string\n */\n\tstatic function convertXMLFeedSafeChar($str) {\n\t\t$str = str_replace(\"<br>\",\"\",$str);\n $str = str_replace(\"</br>\",\"\",$str);\n $str = str_replace(\"<br/>\",\"\",$str);\n $str = str_replace(\"<br />\",\"\",$str);\n $str = str_replace(\""\",'\"',$str);\n $str = str_replace(\"'\",\"'\",$str);\n $str = str_replace(\"’\",\"'\",$str);",
" $str = str_replace(\"‘\",\"'\",$str);",
" $str = str_replace(\"®\",\"\",$str);\n $str = str_replace(\"�\",\"-\", $str);",
" $str = str_replace(\"�\",\"-\", $str);",
" $str = str_replace(\"�\", '\"', $str);\n $str = str_replace(\"”\",'\"', $str);\n $str = str_replace(\"�\", '\"', $str);\n $str = str_replace(\"“\",'\"', $str);",
" $str = str_replace(\"\\r\\n\",\" \",$str);",
" $str = str_replace(\"�\",\" 1/4\",$str);\n $str = str_replace(\"¼\",\" 1/4\", $str);\n $str = str_replace(\"�\",\" 1/2\",$str);\n $str = str_replace(\"½\",\" 1/2\",$str);\n $str = str_replace(\"�\",\" 3/4\",$str);\n $str = str_replace(\"¾\",\" 3/4\",$str);\n $str = str_replace(\"�\", \"(TM)\", $str);\n $str = str_replace(\"™\",\"(TM)\", $str);\n $str = str_replace(\"®\",\"(R)\", $str);",
" $str = str_replace(\"�\",\"(R)\",$str);\n $str = str_replace(\"&\",\"&\",$str);\n\t\t$str = str_replace(\">\",\">\",$str);",
" return trim($str);\n\t}",
" /**\n * Routine to convert any smart quotes into normal quotes\n *\n * @param string $str\n * @return string\n */\n public static function convertSmartQuotes($str) {\n \t$find[] = '�'; // left side double smart quote\n \t$find[] = '�'; // right side double smart quote\n \t$find[] = '�'; // left side single smart quote\n \t$find[] = '�'; // right side single smart quote\n \t$find[] = '�'; // elipsis\n \t$find[] = '�'; // em dash\n \t$find[] = '�'; // en dash",
" $replace[] = '\"';\n \t$replace[] = '\"';\n \t$replace[] = \"'\";\n \t$replace[] = \"'\";\n \t$replace[] = \"...\";\n \t$replace[] = \"-\";\n \t$replace[] = \"-\";",
" $find[] = '“'; // left side double smart quote\n $find[] = '”'; // right side double smart quote\n $find[] = '‘'; // left side single smart quote\n $find[] = '’'; // right side single smart quote\n $find[] = '…'; // ellipsis\n $find[] = '—'; // em dash\n $find[] = '–'; // en dash",
" $replace[] = '\"';\n $replace[] = '\"';\n $replace[] = \"'\";\n $replace[] = \"'\";\n $replace[] = \"...\";\n $replace[] = \"-\";\n $replace[] = \"-\";",
"// $find[] = chr(145);\n// $find[] = chr(146);\n// $find[] = chr(147);\n// $find[] = chr(148);\n// $find[] = chr(150);\n// $find[] = chr(151);\n// $find[] = chr(133);\n// $find[] = chr(149);\n// $find[] = chr(11);\n//\n// $replace[] = \"'\";\n// $replace[] = \"'\";\n// $replace[] = \"\\\"\";\n// $replace[] = \"\\\"\";\n// $replace[] = \"-\";\n// $replace[] = \"-\";\n// $replace[] = \"...\";\n// $replace[] = \"•\";\n// $replace[] = \"\\n\";",
" \treturn str_replace($find, $replace, $str);\n }",
" /**\n * Enhanced variation of strip_tags with 'invert' option to remove specific tags\n *\n * @param $text\n * @param string $tags\n * @param bool $invert\n * @return mixed\n */\n public static function strip_tags_content($text, $tags = '', $invert = false)\n {\n preg_match_all('/<(.+?)[\\s]*\\/?[\\s]*>/si', trim($tags), $tags);\n $tags = array_unique($tags[1]);",
" if (is_array($tags) AND count($tags) > 0) {\n if ($invert == false) {\n return preg_replace('@<(?!(?:' . implode('|', $tags) . ')\\b)(\\w+)\\b.*?>.*?</\\1>@si', '', $text);\n } else {\n return preg_replace('@<(' . implode('|', $tags) . ')\\b.*?>.*?</\\1>@si', '', $text);\n }\n } elseif ($invert == false) {\n return preg_replace('@<(\\w+)\\b.*?>.*?</\\1>@si', '', $text);\n }\n return $text;\n }",
" /**\\\n * Replace any non-ascii character with its hex code with NO active db connection\n */\n public static function escape($value) {\n global $db;",
" if ($db->havedb) {\n return $db->escapeString($value);\n }",
" $return = '';\n for ($i = 0, $iMax = strlen($value); $i < $iMax; $i++) {\n $char = $value[$i];\n $ord = ord($char);\n if($char !== \"'\" && $char !== \"\\\"\" && $char !== '\\\\' && $ord >= 32 && $ord <= 126)\n $return .= $char;\n else\n $return .= '\\\\x' . dechex($ord);\n }\n return $return;\n }",
" /**\n * Summarize or short a long string\n *\n * @param $string\n * @param string $strtype\n * @param string $type\n *\n * @return string\n */\n public static function summarize($string, $strtype='html', $type='para', $more='...') {\n $sep = ($strtype == \"html\" ? array(\"</p>\", \"</div>\") : array(\"\\r\\n\", \"\\n\", \"\\r\"));\n $origstring = $string;",
" switch ($type) {\n case \"para\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&#160;\",\" \",htmlentities(expString::convertSmartQuotes(strip_tags($string)),ENT_QUOTES));\n return expString::convertSmartQuotes(strip_tags($string));\n break;\n case \"paralinks\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\" \",\" \",htmlspecialchars_decode(htmlentities(expString::convertSmartQuotes(strip_tags($string,'<a>')),ENT_QUOTES)));\n return expString::convertSmartQuotes(strip_tags($string, '<a>'));\n break;\n case \"parapaged\":\n// $s = '<div style=\"page-break-after: always;\"><span style=\"display: none;\"> </span></div>';\n $s = '<div style=\"page-break-after: always';\n $para = explode($s, $string);\n $string = $para[0];\n return expString::convertSmartQuotes($string);\n break;\n case \"parahtml\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n if (!empty($string)) {\n $isText = true;\n $ret = \"\";\n $i = 0;\n // $currentChar = \"\";\n // $lastSpacePosition = -1;\n // $lastChar = \"\";\n $tagsArray = array();\n $currentTag = \"\";\n // $tagLevel = 0;\n // $noTagLength = strlen(strip_tags($string));",
" // Parser loop\n for ($j = 0, $jMax = strlen($string); $j < $jMax; $j++) {",
" $currentChar = substr($string, $j, 1);\n $ret .= $currentChar;",
" // Lesser than event\n if ($currentChar == \"<\") $isText = false;",
" // Character handler\n if ($isText) {",
" // Memorize last space position\n if ($currentChar == \" \") {\n $lastSpacePosition = $j;\n } else {\n $lastChar = $currentChar;\n }",
" $i++;\n } else {\n $currentTag .= $currentChar;\n }",
" // Greater than event\n if ($currentChar == \">\") {\n $isText = true;",
" // Opening tag handler\n if ((strpos($currentTag, \"<\") !== FALSE) &&\n (strpos($currentTag, \"/>\") === FALSE) &&\n (strpos($currentTag, \"</\") === FALSE)\n ) {",
" // Tag has attribute(s)\n if (strpos($currentTag, \" \") !== FALSE) {\n $currentTag = substr($currentTag, 1, strpos($currentTag, \" \") - 1);\n } else {\n // Tag doesn't have attribute(s)\n $currentTag = substr($currentTag, 1, -1);\n }",
" array_push($tagsArray, $currentTag);",
" } else if (strpos($currentTag, \"</\") !== FALSE) {\n array_pop($tagsArray);\n }",
" $currentTag = \"\";\n }\n }\n // Cut HTML string at last space position\n // if ($length < $noTagLength) {\n // if ($lastSpacePosition != -1) {\n // $ret = substr($string, 0, $lastSpacePosition);\n // } else {\n // $ret = substr($string, $j);\n // }\n // }\n if (sizeof($tagsArray) != 0) {\n // Close broken XHTML elements\n while (sizeof($tagsArray) != 0) {\n if (sizeof($tagsArray) > 1) {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n } // You may add more tags here to put the link and added text before the closing tag\n elseif ($aTag == 'p' || 'div') {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n } else {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n }\n }\n }\n }\n return expString::convertSmartQuotes($string);\n break;\n default:\n $words = explode(\" \", strip_tags($string));\n $string = implode(\" \", array_slice($words, 0, $type + 0));\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&#160;\",\" \",htmlentities(expString::convertSmartQuotes($string),ENT_QUOTES));\n return expString::convertSmartQuotes($string);\n break;\n }\n }",
" public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);",
" $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\t\", \" \", $str);\n $str = str_replace(\",\", \"\\,\", $str);\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);",
" if (!$isHTML) {\n $str = str_replace('\\\"', \""\", $str);\n $str = str_replace('\"', \""\", $str);\n } else {\n $str = str_replace('\"', '\"\"', $str);\n }",
" //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n $str = trim(str_replace(\"�\", \"™\", $str));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);",
"// global $db;",
"\n $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\,\", \",\", $str);\n $str = str_replace('\"\"', '\"', $str); //do this no matter what...in case someone added a quote in a non HTML field\n if (!$isHTML) {\n //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char\n $str = str_replace('\"', \""\", $str);\n }\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);\n //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n// if (DB_ENGINE=='mysqli') {",
"//\t $str = self::escape(trim(str_replace(\"�\", \"™\", $str)));",
"// } elseif(DB_ENGINE=='mysql') {",
"// $str = self::escape(trim(str_replace(\"�\", \"™\", $str)));",
"// } else {\n//\t $str = trim(str_replace(\"�\", \"™\", $str));\n// }",
" $str = self::escape(trim(str_replace(\"�\", \"™\", $str)));",
" //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" public static function outputField($val, $eof = ',', $isHTML = false) {\n $newVal = self::parseAndTrimExport($val, $isHTML);\n if ($newVal != '') return '\"' . $newVal . '\"' . $eof;\n else return $eof;\n }",
" public static function stripLineEndings($val) {\n return preg_replace('/\\r\\n/', ' ', trim($val));\n }",
" /**\n * Scrub input string for possible security issues.\n *\n * @static\n * @param $data string\n * @return string\n */\n public static function sanitize(&$data) {\n// return $data;",
" if (is_array($data)) {\n $saved_params = array();\n if (!empty($data['controller']) && $data['controller'] == 'snippet') {\n $saved_params['body'] = $data['body']; // store snippet body\n }\n foreach ($data as $var=>$val) {\n// $data[$var] = self::sanitize($val);\n $data[$var] = self::xss_clean($val);\n }\n if (!empty($saved_params)) {\n $data = array_merge($data, $saved_params); // add stored snippet body\n }\n } else {\n if (empty($data)) {\n return $data;\n }",
" $data = self::xss_clean($data);",
" //fixme orig exp method\n// if(0) {\n// // remove whitespaces and tags\n//// $data = strip_tags(trim($data));\n// // remove whitespaces and script tags\n// $data = self::strip_tags_content(trim($data), '<script>', true);\n//// $data = self::strip_tags_content(trim($data), '<iframe>', true);\n//\n// // apply stripslashes if magic_quotes_gpc is enabled\n// if (get_magic_quotes_gpc()) {\n// $data = stripslashes($data);\n// }\n//\n// $data = self::escape($data);\n//\n// // re-escape newlines\n// $data = str_replace(array('\\r', '\\n'), array(\"\\r\", \"\\n\"), $data);\n// }\n }\n return $data;\n }",
" // xss_clean //",
" /**\n \t * Character set\n \t *\n \t * Will be overridden by the constructor.\n \t *\n \t * @var\tstring\n \t */\n \tpublic static $charset = 'UTF-8';",
" /**\n \t * XSS Hash\n \t *\n \t * Random Hash for protecting URLs.\n \t *\n \t * @var\tstring\n \t */\n \tprotected static $_xss_hash;",
" /**\n \t * List of never allowed strings\n \t *\n \t * @var\tarray\n \t */\n protected static $_never_allowed_str =\tarray(\n \t\t'document.cookie'\t=> '[removed]',\n \t\t'document.write'\t=> '[removed]',\n \t\t'.parentNode'\t\t=> '[removed]',\n \t\t'.innerHTML'\t\t=> '[removed]',\n \t\t'-moz-binding'\t\t=> '[removed]',\n \t\t'<!--'\t\t\t\t=> '<!--',\n \t\t'-->'\t\t\t\t=> '-->',\n \t\t'<![CDATA['\t\t\t=> '<![CDATA[',\n \t\t'<comment>'\t\t\t=> '<comment>'\n \t);",
" \t/**\n \t * List of never allowed regex replacements\n \t *\n \t * @var\tarray\n \t */\n protected static $_never_allowed_regex = array(\n \t\t'javascript\\s*:',\n \t\t'(document|(document\\.)?window)\\.(location|on\\w*)',\n \t\t'expression\\s*(\\(|&\\#40;)', // CSS and IE\n \t\t'vbscript\\s*:', // IE, surprise!\n \t\t'wscript\\s*:', // IE\n \t\t'jscript\\s*:', // IE\n \t\t'vbs\\s*:', // IE\n \t\t'Redirect\\s+30\\d',\n \t\t\"([\\\"'])?data\\s*:[^\\\\1]*?base64[^\\\\1]*?,[^\\\\1]*?\\\\1?\"\n \t);",
" /**\n \t * XSS Clean\n \t *\n \t * Sanitizes data so that Cross Site Scripting Hacks can be\n \t * prevented. This method does a fair amount of work but\n \t * it is extremely thorough, designed to prevent even the\n \t * most obscure XSS attempts. Nothing is ever 100% foolproof,\n \t * of course, but I haven't been able to get anything passed\n \t * the filter.\n \t *\n \t * Note: Should only be used to deal with data upon submission.\n \t *\t It's not something that should be used for general\n \t *\t runtime processing.\n \t *\n \t * @link\thttp://channel.bitflux.ch/wiki/XSS_Prevention\n \t * \t\tBased in part on some code and ideas from Bitflux.\n \t *\n \t * @link\thttp://ha.ckers.org/xss.html\n \t * \t\tTo help develop this script I used this great list of\n \t *\t\tvulnerabilities along with a few other hacks I've\n \t *\t\tharvested from examining vulnerabilities in other programs.\n \t *\n \t * @param\tstring|string[]\t$str\t\tInput data\n \t * @param \tbool\t\t$is_image\tWhether the input is an image\n \t * @return\tstring\n \t */\n \tpublic static function xss_clean($str, $is_image = FALSE)\n \t{\n \t\t// Is the string an array?\n \t\tif (is_array($str))\n \t\t{\n \t\t\twhile (list($key) = each($str))\n \t\t\t{\n if (preg_match('/^[a-zA-Z0-9_\\x7f-\\xff]*$/', $key)) { // check for valid array name\n $str[$key] = self::xss_clean($str[$key]);\n } else {\n return null;\n }\n \t\t\t}",
" \t\t\treturn $str;\n \t\t}",
" \t\t// Remove Invisible Characters\n \t\t$str = self::remove_invisible_characters($str);",
" \t\t/*\n \t\t * URL Decode\n \t\t *\n \t\t * Just in case stuff like this is submitted:\n \t\t *\n \t\t * <a href=\"http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D\">Google</a>\n \t\t *\n \t\t * Note: Use rawurldecode() so it does not remove plus signs\n \t\t */\n \t\tdo\n \t\t{\n \t\t\t$str = rawurldecode($str);\n \t\t}\n \t\twhile (preg_match('/%[0-9a-f]{2,}/i', $str));",
" \t\t/*\n \t\t * Convert character entities to ASCII\n \t\t *\n \t\t * This permits our tests below to work reliably.\n \t\t * We only convert entities that are within tags since\n \t\t * these are the ones that will pose security problems.\n \t\t */\n \t\t$str = preg_replace_callback(\"/[^a-z0-9>]+[a-z0-9]+=([\\'\\\"]).*?\\\\1/si\", array('self', '_convert_attribute'), $str);\n \t\t$str = preg_replace_callback('/<\\w+.*/si', array('self', '_decode_entity'), $str);",
" \t\t// Remove Invisible Characters Again!\n \t\t$str = self::remove_invisible_characters($str);",
" \t\t/*\n \t\t * Convert all tabs to spaces\n \t\t *\n \t\t * This prevents strings like this: ja\tvascript\n \t\t * NOTE: we deal with spaces between characters later.\n \t\t * NOTE: preg_replace was found to be amazingly slow here on\n \t\t * large blocks of data, so we use str_replace.\n \t\t */\n \t\t$str = str_replace(\"\\t\", ' ', $str);",
" \t\t// Capture converted string for later comparison\n \t\t$converted_string = $str;",
" \t\t// Remove Strings that are never allowed\n \t\t$str = self::_do_never_allowed($str);",
" \t\t/*\n \t\t * Makes PHP tags safe\n \t\t *\n \t\t * Note: XML tags are inadvertently replaced too:\n \t\t *\n \t\t * <?xml\n \t\t *\n \t\t * But it doesn't seem to pose a problem.\n \t\t */\n \t\tif ($is_image === TRUE)\n \t\t{\n \t\t\t// Images have a tendency to have the PHP short opening and\n \t\t\t// closing tags every so often so we skip those and only\n \t\t\t// do the long opening tags.\n \t\t\t$str = preg_replace('/<\\?(php)/i', '<?\\\\1', $str);\n \t\t}\n \t\telse\n \t\t{\n \t\t\t$str = str_replace(array('<?', '?'.'>'), array('<?', '?>'), $str);\n \t\t}",
" \t\t/*\n \t\t * Compact any exploded words\n \t\t *\n \t\t * This corrects words like: j a v a s c r i p t\n \t\t * These words are compacted back to their correct state.\n \t\t */\n \t\t$words = array(\n \t\t\t'javascript', 'expression', 'vbscript', 'jscript', 'wscript',\n \t\t\t'vbs', 'script', 'base64', 'applet', 'alert', 'document',\n \t\t\t'write', 'cookie', 'window', 'confirm', 'prompt', 'eval'\n \t\t);",
" \t\tforeach ($words as $word)\n \t\t{\n \t\t\t$word = implode('\\s*', str_split($word)).'\\s*';",
" \t\t\t// We only want to do this when it is followed by a non-word character\n \t\t\t// That way valid stuff like \"dealer to\" does not become \"dealerto\"\n \t\t\t$str = preg_replace_callback('#('.substr($word, 0, -3).')(\\W)#is', array('self', '_compact_exploded_words'), $str);\n \t\t}",
" \t\t/*\n \t\t * Remove disallowed Javascript in links or img tags\n \t\t * We used to do some version comparisons and use of stripos(),\n \t\t * but it is dog slow compared to these simplified non-capturing\n \t\t * preg_match(), especially if the pattern exists in the string\n \t\t *\n \t\t * Note: It was reported that not only space characters, but all in\n \t\t * the following pattern can be parsed as separators between a tag name\n \t\t * and its attributes: [\\d\\s\"\\'`;,\\/\\=\\(\\x00\\x0B\\x09\\x0C]\n \t\t * ... however, remove_invisible_characters() above already strips the\n \t\t * hex-encoded ones, so we'll skip them below.\n \t\t */\n \t\tdo\n \t\t{\n \t\t\t$original = $str;",
" \t\t\tif (preg_match('/<a/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace_callback('#<a[^a-z0-9>]+([^>]*?)(?:>|$)#si', array('self', '_js_link_removal'), $str);\n \t\t\t}",
" \t\t\tif (preg_match('/<img/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace_callback('#<img[^a-z0-9]+([^>]*?)(?:\\s?/?>|$)#si', array('self', '_js_img_removal'), $str);\n \t\t\t}",
" \t\t\tif (preg_match('/script|xss/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace('#</*(?:script|xss).*?>#si', '[removed]', $str);\n \t\t\t}\n \t\t}\n \t\twhile ($original !== $str);\n \t\tunset($original);",
" \t\t/*\n \t\t * Sanitize naughty HTML elements\n \t\t *\n \t\t * If a tag containing any of the words in the list\n \t\t * below is found, the tag gets converted to entities.\n \t\t *\n \t\t * So this: <blink>\n \t\t * Becomes: <blink>\n \t\t */\n \t\t$pattern = '#'\n \t\t\t.'<((?<slash>/*\\s*)(?<tagName>[a-z0-9]+)(?=[^a-z0-9]|$)' // tag start and name, followed by a non-tag character\n \t\t\t.'[^\\s\\042\\047a-z0-9>/=]*' // a valid attribute character immediately after the tag would count as a separator\n \t\t\t// optional attributes\n \t\t\t.'(?<attributes>(?:[\\s\\042\\047/=]*' // non-attribute characters, excluding > (tag close) for obvious reasons\n \t\t\t.'[^\\s\\042\\047>/=]+' // attribute characters\n \t\t\t// optional attribute-value\n \t\t\t\t.'(?:\\s*=' // attribute-value separator\n \t\t\t\t\t.'(?:[^\\s\\042\\047=><`]+|\\s*\\042[^\\042]*\\042|\\s*\\047[^\\047]*\\047|\\s*(?U:[^\\s\\042\\047=><`]*))' // single, double or non-quoted value\n \t\t\t\t.')?' // end optional attribute-value group\n \t\t\t.')*)' // end optional attributes group\n \t\t\t.'[^>]*)(?<closeTag>\\>)?#isS';",
" \t\t// Note: It would be nice to optimize this for speed, BUT\n \t\t// only matching the naughty elements here results in\n \t\t// false positives and in turn - vulnerabilities!\n \t\tdo\n \t\t{\n \t\t\t$old_str = $str;\n \t\t\t$str = preg_replace_callback($pattern, array('self', '_sanitize_naughty_html'), $str);\n \t\t}\n \t\twhile ($old_str !== $str);\n \t\tunset($old_str);",
" \t\t/*\n \t\t * Sanitize naughty scripting elements\n \t\t *\n \t\t * Similar to above, only instead of looking for\n \t\t * tags it looks for PHP and JavaScript commands\n \t\t * that are disallowed. Rather than removing the\n \t\t * code, it simply converts the parenthesis to entities\n \t\t * rendering the code un-executable.\n \t\t *\n \t\t * For example:\teval('some code')\n \t\t * Becomes:\teval('some code')\n \t\t */\n \t\t$str = preg_replace(\n \t\t\t'#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\\s*)\\((.*?)\\)#si',\n \t\t\t'\\\\1\\\\2(\\\\3)',\n \t\t\t$str\n \t\t);",
" \t\t// Final clean up\n \t\t// This adds a bit of extra precaution in case\n \t\t// something got through the above filters\n \t\t$str = self::_do_never_allowed($str);",
" \t\t/*\n \t\t * Images are Handled in a Special Way\n \t\t * - Essentially, we want to know that after all of the character\n \t\t * conversion is done whether any unwanted, likely XSS, code was found.\n \t\t * If not, we return TRUE, as the image is clean.\n \t\t * However, if the string post-conversion does not matched the\n \t\t * string post-removal of XSS, then it fails, as there was unwanted XSS\n \t\t * code found and removed/changed during processing.\n \t\t */\n \t\tif ($is_image === TRUE)\n \t\t{\n \t\t\treturn ($str === $converted_string);\n \t\t}",
" \t\treturn $str;\n \t}",
" /**\n \t * Do Never Allowed\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param \tstring\n \t * @return \tstring\n \t */\n \tprotected static function _do_never_allowed($str)\n \t{\n \t\t$str = str_replace(array_keys(self::$_never_allowed_str), self::$_never_allowed_str, $str);",
" \t\tforeach (self::$_never_allowed_regex as $regex)\n \t\t{\n \t\t\t$str = preg_replace('#'.$regex.'#is', '[removed]', $str);\n \t\t}",
" \t\treturn $str;\n \t}",
"\t/**\n\t * Remove Invisible Characters\n\t *\n\t * This prevents sandwiching null characters\n\t * between ascii characters, like Java\\0script.\n\t *\n\t * @param\tstring\n\t * @param\tbool\n\t * @return\tstring\n\t */\n\tpublic static function remove_invisible_characters($str, $url_encoded = TRUE)\n\t{\n\t\t$non_displayables = array();",
"\t\t// every control character except newline (dec 10),\n\t\t// carriage return (dec 13) and horizontal tab (dec 09)\n\t\tif ($url_encoded)\n\t\t{\n\t\t\t$non_displayables[] = '/%0[0-8bcef]/';\t// url encoded 00-08, 11, 12, 14, 15\n\t\t\t$non_displayables[] = '/%1[0-9a-f]/';\t// url encoded 16-31\n\t\t}",
"\t\t$non_displayables[] = '/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]+/S';\t// 00-08, 11, 12, 14-31, 127",
"\t\tdo\n\t\t{\n\t\t\t$str = preg_replace($non_displayables, '', $str, -1, $count);\n\t\t}\n\t\twhile ($count);",
"\t\treturn $str;\n\t}",
" /**\n \t * HTML Entity Decode Callback\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _decode_entity($match)\n \t{\n \t\t// Protect GET variables in URLs\n \t\t// 901119URL5918AMP18930PROTECT8198\n \t\t$match = preg_replace('|\\&([a-z\\_0-9\\-]+)\\=([a-z\\_0-9\\-/]+)|i', self::xss_hash().'\\\\1=\\\\2', $match[0]);",
" \t\t// Decode, then un-protect URL GET vars\n \t\treturn str_replace(\n self::xss_hash(),\n \t\t\t'&',\n self::entity_decode($match, self::$charset)\n \t\t);\n \t}",
" /**\n \t * XSS Hash\n \t *\n \t * Generates the XSS hash if needed and returns it.\n \t *\n \t * @see\t\tCI_Security::$_xss_hash\n \t * @return\tstring\tXSS hash\n \t */\n \tpublic static function xss_hash()\n \t{\n \t\tif (self::$_xss_hash === NULL)\n \t\t{\n \t\t\t$rand = self::get_random_bytes(16);\n self::$_xss_hash = ($rand === FALSE)\n \t\t\t\t? md5(uniqid(mt_rand(), TRUE))\n \t\t\t\t: bin2hex($rand);\n \t\t}",
" \t\treturn self::$_xss_hash;\n \t}",
" /**\n \t * HTML Entities Decode\n \t *\n \t * A replacement for html_entity_decode()\n \t *\n \t * The reason we are not using html_entity_decode() by itself is because\n \t * while it is not technically correct to leave out the semicolon\n \t * at the end of an entity most browsers will still interpret the entity\n \t * correctly. html_entity_decode() does not convert entities without\n \t * semicolons, so we are left with our own little solution here. Bummer.\n \t *\n \t * @link\thttp://php.net/html-entity-decode\n \t *\n \t * @param\tstring\t$str\t\tInput\n \t * @param\tstring\t$charset\tCharacter set\n \t * @return\tstring\n \t */\n \tpublic static function entity_decode($str, $charset = NULL)\n \t{\n \t\tif (strpos($str, '&') === FALSE)\n \t\t{\n \t\t\treturn $str;\n \t\t}",
" \t\tstatic $_entities;",
" \t\tisset($charset) OR $charset = self::$charset;\n \t\t$flag = expCore::is_php('5.4')\n \t\t\t? ENT_COMPAT | ENT_HTML5\n \t\t\t: ENT_COMPAT;",
" \t\tdo\n \t\t{\n \t\t\t$str_compare = $str;",
" \t\t\t// Decode standard entities, avoiding false positives\n \t\t\tif (preg_match_all('/&[a-z]{2,}(?![a-z;])/i', $str, $matches))\n \t\t\t{\n \t\t\t\tif ( ! isset($_entities))\n \t\t\t\t{\n \t\t\t\t\t$_entities = array_map(\n \t\t\t\t\t\t'strtolower',\n expCore::is_php('5.3.4')\n \t\t\t\t\t\t\t? get_html_translation_table(HTML_ENTITIES, $flag, $charset)\n \t\t\t\t\t\t\t: get_html_translation_table(HTML_ENTITIES, $flag)\n \t\t\t\t\t);",
" \t\t\t\t\t// If we're not on PHP 5.4+, add the possibly dangerous HTML 5\n \t\t\t\t\t// entities to the array manually\n \t\t\t\t\tif ($flag === ENT_COMPAT)\n \t\t\t\t\t{\n \t\t\t\t\t\t$_entities[':'] = ':';\n \t\t\t\t\t\t$_entities['('] = '(';\n \t\t\t\t\t\t$_entities[')'] = ')';\n \t\t\t\t\t\t$_entities[\"\\n\"] = '&newline;';\n \t\t\t\t\t\t$_entities[\"\\t\"] = '&tab;';\n \t\t\t\t\t}\n \t\t\t\t}",
" \t\t\t\t$replace = array();\n \t\t\t\t$matches = array_unique(array_map('strtolower', $matches[0]));\n \t\t\t\tforeach ($matches as &$match)\n \t\t\t\t{\n \t\t\t\t\tif (($char = array_search($match.';', $_entities, TRUE)) !== FALSE)\n \t\t\t\t\t{\n \t\t\t\t\t\t$replace[$match] = $char;\n \t\t\t\t\t}\n \t\t\t\t}",
" \t\t\t\t$str = str_ireplace(array_keys($replace), array_values($replace), $str);\n \t\t\t}",
" \t\t\t// Decode numeric & UTF16 two byte entities\n \t\t\t$str = html_entity_decode(\n \t\t\t\tpreg_replace('/(&#(?:x0*[0-9a-f]{2,5}(?![0-9a-f;])|(?:0*\\d{2,4}(?![0-9;]))))/iS', '$1;', $str),\n \t\t\t\t$flag,\n \t\t\t\t$charset\n \t\t\t);\n \t\t}\n \t\twhile ($str_compare !== $str);\n \t\treturn $str;\n \t}",
" /**\n \t * Get random bytes\n \t *\n \t * @param\tint\t$length\tOutput length\n \t * @return\tstring\n \t */\n \tpublic static function get_random_bytes($length)\n \t{\n \t\tif (empty($length) OR ! ctype_digit((string) $length))\n \t\t{\n \t\t\treturn FALSE;\n \t\t}",
" if (function_exists('random_bytes'))\n {\n try\n {\n // The cast is required to avoid TypeError\n return random_bytes((int) $length);\n }\n catch (Exception $e)\n {\n // If random_bytes() can't do the job, we can't either ...\n // There's no point in using fallbacks.\n log_message('error', $e->getMessage());\n return FALSE;\n }\n }",
" \t\t// Unfortunately, none of the following PRNGs is guaranteed to exist ...\n \t\tif (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE)\n \t\t{\n \t\t\treturn $output;\n \t\t}",
"\n \t\tif (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE)\n \t\t{\n \t\t\t// Try not to waste entropy ...\n expCore::is_php('5.4') && stream_set_chunk_size($fp, $length);\n \t\t\t$output = fread($fp, $length);\n \t\t\tfclose($fp);\n \t\t\tif ($output !== FALSE)\n \t\t\t{\n \t\t\t\treturn $output;\n \t\t\t}\n \t\t}",
" \t\tif (function_exists('openssl_random_pseudo_bytes'))\n \t\t{\n \t\t\treturn openssl_random_pseudo_bytes($length);\n \t\t}",
" \t\treturn FALSE;\n \t}",
" /**\n \t * Attribute Conversion\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _convert_attribute($match)\n \t{\n \t\treturn str_replace(array('>', '<', '\\\\'), array('>', '<', '\\\\\\\\'), $match[0]);\n \t}",
" /**\n \t * Compact Exploded Words\n \t *\n \t * Callback method for xss_clean() to remove whitespace from\n \t * things like 'j a v a s c r i p t'.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$matches\n \t * @return\tstring\n \t */\n \tprotected static function _compact_exploded_words($matches)\n \t{\n \t\treturn preg_replace('/\\s+/s', '', $matches[1]).$matches[2];\n \t}",
" /**\n \t * JS Link Removal\n \t *\n \t * Callback method for xss_clean() to sanitize links.\n \t *\n \t * This limits the PCRE backtracks, making it more performance friendly\n \t * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in\n \t * PHP 5.2+ on link-heavy strings.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _js_link_removal($match)\n \t{\n \t\treturn str_replace(\n \t\t\t$match[1],\n \t\t\tpreg_replace(\n \t\t\t\t'#href=.*?(?:(?:alert|prompt|confirm)(?:\\(|&\\#40;)|javascript:|livescript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|data\\s*:)#si',\n \t\t\t\t'',\n \t\t\t\tself::_filter_attributes($match[1])\n \t\t\t),\n \t\t\t$match[0]\n \t\t);\n \t}",
" /**\n \t * JS Image Removal\n \t *\n \t * Callback method for xss_clean() to sanitize image tags.\n \t *\n \t * This limits the PCRE backtracks, making it more performance friendly\n \t * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in\n \t * PHP 5.2+ on image tag heavy strings.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _js_img_removal($match)\n \t{\n \t\treturn str_replace(\n \t\t\t$match[1],\n \t\t\tpreg_replace(\n \t\t\t\t'#src=.*?(?:(?:alert|prompt|confirm|eval)(?:\\(|&\\#40;)|javascript:|livescript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|base64\\s*,)#si',\n \t\t\t\t'',\n \t\t\t\tself::_filter_attributes($match[1])\n \t\t\t),\n \t\t\t$match[0]\n \t\t);\n \t}",
" /**\n \t * Filter Attributes\n \t *\n \t * Filters tag attributes for consistency and safety.\n \t *\n \t * @used-by\tCI_Security::_js_img_removal()\n \t * @used-by\tCI_Security::_js_link_removal()\n \t * @param\tstring\t$str\n \t * @return\tstring\n \t */\n \tprotected static function _filter_attributes($str)\n \t{\n \t\t$out = '';\n \t\tif (preg_match_all('#\\s*[a-z\\-]+\\s*=\\s*(\\042|\\047)([^\\\\1]*?)\\\\1#is', $str, $matches))\n \t\t{\n \t\t\tforeach ($matches[0] as $match)\n \t\t\t{\n \t\t\t\t$out .= preg_replace('#/\\*.*?\\*/#s', '', $match);\n \t\t\t}\n \t\t}",
" \t\treturn $out;\n \t}",
" /**\n \t * Sanitize Naughty HTML\n \t *\n \t * Callback method for xss_clean() to remove naughty HTML elements.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$matches\n \t * @return\tstring\n \t */\n \tprotected static function _sanitize_naughty_html($matches)\n \t{\n \t\tstatic $naughty_tags = array(\n \t\t\t'alert', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound',\n \t\t\t'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer',\n \t\t\t'input', 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object',\n \t\t\t'plaintext', 'script', 'textarea', 'title', 'math', 'video', 'svg', 'xml', 'xss'\n //,'style', 'iframe'\n \t\t);",
" \t\tstatic $evil_attributes = array(\n \t\t\t'on\\w+', 'xmlns', 'formaction', 'form', 'xlink:href', 'FSCommand', 'seekSegmentTime'\n //, 'style'\n \t\t);",
" \t\t// First, escape unclosed tags\n \t\tif (empty($matches['closeTag']))\n \t\t{\n \t\t\treturn '<'.$matches[1];\n \t\t}\n \t\t// Is the element that we caught naughty? If so, escape it\n \t\telseif (in_array(strtolower($matches['tagName']), $naughty_tags, TRUE))\n \t\t{\n \t\t\treturn '<'.$matches[1].'>';\n \t\t}\n \t\t// For other tags, see if their attributes are \"evil\" and strip those\n \t\telseif (isset($matches['attributes']))\n \t\t{\n \t\t\t// We'll store the already fitlered attributes here\n \t\t\t$attributes = array();",
" \t\t\t// Attribute-catching pattern\n \t\t\t$attributes_pattern = '#'\n \t\t\t\t.'(?<name>[^\\s\\042\\047>/=]+)' // attribute characters\n \t\t\t\t// optional attribute-value\n \t\t\t\t.'(?:\\s*=(?<value>[^\\s\\042\\047=><`]+|\\s*\\042[^\\042]*\\042|\\s*\\047[^\\047]*\\047|\\s*(?U:[^\\s\\042\\047=><`]*)))' // attribute-value separator\n \t\t\t\t.'#i';",
" \t\t\t// Blacklist pattern for evil attribute names\n \t\t\t$is_evil_pattern = '#^('.implode('|', $evil_attributes).')$#i';",
" \t\t\t// Each iteration filters a single attribute\n \t\t\tdo\n \t\t\t{\n \t\t\t\t// Strip any non-alpha characters that may preceed an attribute.\n \t\t\t\t// Browsers often parse these incorrectly and that has been a\n \t\t\t\t// of numerous XSS issues we've had.\n \t\t\t\t$matches['attributes'] = preg_replace('#^[^a-z]+#i', '', $matches['attributes']);",
" \t\t\t\tif ( ! preg_match($attributes_pattern, $matches['attributes'], $attribute, PREG_OFFSET_CAPTURE))\n \t\t\t\t{\n \t\t\t\t\t// No (valid) attribute found? Discard everything else inside the tag\n \t\t\t\t\tbreak;\n \t\t\t\t}",
" \t\t\t\tif (\n \t\t\t\t\t// Is it indeed an \"evil\" attribute?\n \t\t\t\t\tpreg_match($is_evil_pattern, $attribute['name'][0])\n \t\t\t\t\t// Or does it have an equals sign, but no value and not quoted? Strip that too!\n \t\t\t\t\tOR (trim($attribute['value'][0]) === '')\n \t\t\t\t)\n \t\t\t\t{\n \t\t\t\t\t$attributes[] = 'xss=removed';\n \t\t\t\t}\n \t\t\t\telse\n \t\t\t\t{\n \t\t\t\t\t$attributes[] = $attribute[0][0];\n \t\t\t\t}",
" \t\t\t\t$matches['attributes'] = substr($matches['attributes'], $attribute[0][1] + strlen($attribute[0][0]));\n \t\t\t}\n \t\t\twhile ($matches['attributes'] !== '');",
" \t\t\t$attributes = empty($attributes)\n \t\t\t\t? ''\n \t\t\t\t: ' '.implode(' ', $attributes);\n \t\t\treturn '<'.$matches['slash'].$matches['tagName'].$attributes.'>';\n \t\t}",
" \t\treturn $matches[0];\n \t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expTheme\n *\n * @package Subsystems\n * @subpackage Subsystems\n */",
"/** @define \"BASE\" \"../../..\" */\nclass expTheme\n{",
" public static function initialize()\n {\n global $auto_dirs2;",
" // Initialize the theme subsystem 1.0 compatibility layer if requested\n\t\tif (defined('OLD_THEME_COMPATIBLE') && OLD_THEME_COMPATIBLE)\n require_once(BASE.'framework/core/compat/theme.php');",
" if (!defined('DISPLAY_THEME')) {\n /* exdoc\n * The directory and class name of the current active theme. This may be different\n * than the configured theme (DISPLAY_THEME_REAL) due to previewing.\n */\n define('DISPLAY_THEME', DISPLAY_THEME_REAL);\n }",
" if (!defined('THEME_ABSOLUTE')) {\n /* exdoc\n * The absolute path to the current active theme's files. This is similar to the BASE constant\n */\n define('THEME_ABSOLUTE', BASE . 'themes/' . DISPLAY_THEME . '/'); // This is the recommended way\n }",
" if (!defined('THEME_RELATIVE')) {\n /* exdoc\n * The relative web path to the current active theme. This is similar to the PATH_RELATIVE constant.\n */\n define('THEME_RELATIVE', PATH_RELATIVE . 'themes/' . DISPLAY_THEME . '/');\n }\n if (!defined('THEME_STYLE')) {\n /* exdoc\n * The name of the current active theme style.\n */\n define('THEME_STYLE', THEME_STYLE_REAL);\n }\n if (THEME_STYLE != '' && file_exists(BASE . 'themes/' . DISPLAY_THEME . '/config_' . THEME_STYLE . '.php')) {\n @include_once(BASE . 'themes/' . DISPLAY_THEME . '/config_' . THEME_STYLE . '.php');\n } elseif (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/config.php')) {\n @include_once(BASE . 'themes/' . DISPLAY_THEME . '/config.php');\n }\n if (!defined('BTN_SIZE')) {\n define('BTN_SIZE', 'medium');\n } // Awesome Button theme\n if (!defined('BTN_COLOR')) {\n define('BTN_COLOR', 'black');\n } // Awesome Button theme\n if (!defined('SWATCH')) {\n define('SWATCH', \"''\");\n } // Twitter Bootstrap theme",
" // add our theme folder into autoload to prioritize custom (theme) modules\n array_unshift($auto_dirs2, BASE . 'themes/' . DISPLAY_THEME . '/modules');\n }",
" public static function head($config = array())\n {\n echo self::headerInfo($config);\n self::advertiseRSS();\n }",
" public static function headerInfo($config)\n {\n global $sectionObj, $validateTheme, $head_config, $auto_dirs, $less_vars, $framework;",
" $validateTheme['headerinfo'] = true;\n // end checking for headerInfo",
" // globalize header configuration\n $head_config = $config;",
" // set theme framework type\n $framework = !empty($head_config['framework']) ? $head_config['framework'] : '';\n if (empty($framework)) {\n if (NEWUI) {\n $framework = 'newui';\n } else {\n $framework = 'yui'; // yui is the 2.x default framework\n }\n }\n expSession::set('framework', $framework);",
" // set the global less variables from the head config\n if (!empty($config['lessvars'])) {\n $less_vars = $config['lessvars'];\n } else {\n $less_vars = array();\n }",
" // check to see if we're in XHTML or HTML mode\n if (isset($config['xhtml']) && $config['xhtml'] == true) {\n define('XHTML', 1);\n define('XHTML_CLOSING', \"/\"); //default\n } else {\n define('XHTML', 0);\n define('XHTML_CLOSING', \"\");\n }",
" // load primer, lessprimer, link (css) and lesscss & normalize CSS files\n if (!empty($config['css_primer']) || !empty($config['lessprimer']) || !empty($config['link']) || !empty($config['lesscss']) || !empty($config['normalize'])) {\n expCSS::pushToHead($config);\n };",
" // default loading of primer CSS files to true if not set\n if (empty($config['css_primer']) && empty($config['lessprimer'])) {\n $head_config = array('css_primer' => true) + $head_config;\n }",
" // parse & load core css files\n if (isset($config['css_core'])) {\n if (is_array($config['css_core'])) {\n $corecss = implode(\",\", $config['css_core']);\n expCSS::pushToHead(\n array(\n \"corecss\" => $corecss\n )\n );\n }\n } else {\n $head_config['css_core'] = false;\n };",
" // default loading of view based CSS inclusion is true if not set\n if (!empty($config['css_links']) || !isset($config['css_links'])) {\n $head_config['css_links'] = true;\n }",
" // default theme css collecting is true if not set\n if (!empty($config['css_theme']) || !isset($config['css_theme'])) {\n $head_config['css_theme'] = true;\n }",
" if (empty($sectionObj)) {\n return false;\n }",
" // set up controls search order based on framework\n if (empty($head_config['framework'])) {\n $head_config['framework'] = '';\n }\n if (bs() || $framework == 'jquery') {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/jquery'\n );\n }\n if (bs(true)) {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/bootstrap'\n );\n }\n if (bs3(true)) {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/bootstrap3'\n );\n }\n if (newui()) {\n expCSS::pushToHead(array(\n \"lessprimer\"=>\"external/bootstrap3/less/newui.less\",\n// \"lessvars\"=>array(\n// 'swatch'=>'cerulean', // newui uses this swatch\n// 'themepath'=>'cerulean', // hack to prevent crash\n// ),\n ));\n if (!defined(\"BTN_SIZE\")) define(\"BTN_SIZE\", 'small');\n array_unshift($auto_dirs, BASE . 'framework/core/forms/controls/newui');\n }\n array_unshift($auto_dirs, BASE . 'themes/' . DISPLAY_THEME . '/controls');",
"// if (!expSession::is_set('framework') || expSession::get(\n// 'framework'\n// ) != $head_config['framework']\n// ) {\n// expSession::set('framework', $head_config['framework']);\n// }\n // mark the theme framework",
" $metainfo = self::pageMetaInfo();",
" // default to showing all meta tags unless specifically set to false\n if (!isset($config['meta']['content_type'])) {\n $config['meta']['content_type'] = true;\n }\n if (!isset($config['meta']['content_language'])) {\n $config['meta']['content_language'] = true;\n }\n if (!isset($config['meta']['generator'])) {\n $config['meta']['generator'] = true;\n }\n if (!isset($config['meta']['keywords'])) {\n $config['meta']['keywords'] = true;\n }\n if (!isset($config['meta']['description'])) {\n $config['meta']['description'] = true;\n }\n if (!isset($config['meta']['canonical'])) {\n $config['meta']['canonical'] = true;\n }\n if (!isset($config['meta']['rich'])) {\n $config['meta']['rich'] = true;\n }\n if (!isset($config['meta']['fb'])) {\n $config['meta']['fb'] = true;\n }\n if (!isset($config['meta']['tw'])) {\n $config['meta']['tw'] = true;\n }\n if (!isset($config['meta']['viewport'])) {\n $config['meta']['viewport'] = true;\n }\n if (!isset($config['meta']['ie_compat'])) {\n $config['meta']['ie_compat'] = true;\n }\n",
" $str = '<title>' . $metainfo['title'] . \"</title>\\n\";",
" if ($config['meta']['content_type']) {",
" $str .= \"\\t\" . '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=' . LANG_CHARSET . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" $locale = strtolower(str_replace('_', '-', LOCALE));\n if ($config['meta']['content_language']) {",
" $str .= \"\\t\" . '<meta content=\"' . $locale . '\" http-equiv=\"Content-Language\" ' . XHTML_CLOSING . '>' . \"\\n\";",
" }\n if ($config['meta']['generator']) {\n $str .= \"\\t\" . '<meta name=\"Generator\" content=\"Exponent Content Management System - v' . expVersion::getVersion(\n true\n ) . self::getThemeDetails() . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['keywords']) {\n $str .= \"\\t\" . '<meta name=\"Keywords\" content=\"' . $metainfo['keywords'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['description']) {\n $str .= \"\\t\" . '<meta name=\"Description\" content=\"' . $metainfo['description'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['canonical'] && !empty($metainfo['canonical'])) {\n $str .= \"\\t\" . '<link rel=\"canonical\" href=\"' . $metainfo['canonical'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['rich'] && !empty($metainfo['rich'])) {\n $str .= \"\\t\" . $metainfo['rich'] . \"\\n\";\n }\n if ($config['meta']['fb'] && !empty($metainfo['fb'])) {\n foreach ($metainfo['fb'] as $key => $value) {\n if (!empty($value)) {\n $str .= \"\\t\" . '<meta property=\"og:' . $key . '\" content=\"' . $value . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n }\n }\n if ($config['meta']['tw'] && !empty($metainfo['tw'])) {\n foreach ($metainfo['tw'] as $key => $value) {\n if (!empty($value)) {\n $str .= \"\\t\" . '<meta name=\"twitter:' . $key . '\" content=\"' . $value . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n }\n }",
" if ($metainfo['noindex'] || $metainfo['nofollow']) {\n $str .= \"\\t\" . '<meta name=\"robots\" content=\"' . (!empty($metainfo['noindex']) ? 'noindex' : '') . ' ' . ($metainfo['nofollow'] ? 'nofollow' : '') . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" if (empty($config['viewport'])) {\n $viewport = 'width=device-width, user-scalable=yes';\n } else {\n if (!empty($config['viewport']['width'])) {\n $viewport = 'width=' . $config['viewport']['width'];\n } else {\n $viewport = 'width=device-width';\n }\n if (!empty($config['viewport']['height'])) {\n $viewport .= ', height=' . $config['viewport']['height'];\n }\n if (!empty($config['viewport']['initial_scale'])) {\n $viewport .= ' initial-scale=' . $config['viewport']['initial_scale'];\n// } else {\n// $viewport .= ', initial-scale=1.0';\n }\n if (!empty($config['viewport']['minimum_scale'])) {\n $viewport .= ', minimum-scale=' . $config['viewport']['minimum_scale'];\n }\n if (!empty($config['viewport']['maximum_scale'])) {\n $viewport .= ', maximum-scale=' . $config['viewport']['maximum_scale'];\n }\n if (!empty($config['viewport']['user_scalable'])) {\n $viewport .= ', user-scalable=' . ($config['viewport']['user_scalable'] ? \"yes\" : \"no\");\n } else {\n $viewport .= ', user-scalable=yes';\n }\n }\n if ($config['meta']['viewport']) {\n $str .= \"\\t\" . '<meta name=\"viewport\" content=\"' . $viewport . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" // favicon\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/favicon.png')) {\n $str .= \"\\t\" . '<link rel=\"icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/favicon.png\" type=\"image/png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n } elseif (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/favicon.ico')) {\n $str .= \"\\t\" . '<link rel=\"icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/favicon.ico\" type=\"image/x-icon\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n // touch icons\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/apple-touch-icon.png')) {\n $str .= \"\\t\" . '<link rel=\"apple-touch-icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/apple-touch-icon.png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/apple-touch-icon-precomposed.png')) {\n $str .= \"\\t\" . '<link rel=\"apple-touch-icon-precomposed\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/apple-touch-icon-precomposed.png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" // support for xmlrpc blog editors like Windows Live Writer, etc...\n if (USE_XMLRPC) {\n if (file_exists(BASE . 'rsd.xml')) {\n $str .= \"\\t\" . '<link rel=\"EditURI\" href=\"' . URL_FULL . 'rsd.xml\" type=\"application/rsd+xml\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n $str .= \"\\t\" . '<link rel=\"wlwmanifest\" href=\"' . URL_FULL . 'wlwmanifest.xml\" type=\"application/wlwmanifest+xml\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" // when minification is used, the comment below gets replaced when the buffer is dumped\n $str .= '<!-- MINIFY REPLACE -->';",
" if ($config['meta']['ie_compat']) {\n // some IE 6 support\n $str .= \"\\t\" . '<!--[if IE 6]><style type=\"text/css\"> body { behavior: url(' . PATH_RELATIVE . 'external/csshover.htc); }</style><![endif]-->' . \"\\n\";",
" // css3 transform support for IE 6-8\n// $str .= \"\\t\" . '<!--[if lt IE 9]><style type=\"text/css\"> body { behavior: url(' . PATH_RELATIVE . 'external/ms-transform.htc); }</style><![endif]-->' . \"\\n\";",
" // html5 support for IE 6-8\n $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/html5shiv/html5shiv-shiv.js\"></script><![endif]-->' . \"\\n\";",
" // media css support for IE 6-8\n $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/Respond-1.4.2/dest/respond.min.js\"></script><![endif]-->' . \"\\n\";",
" // canvas support for IE 6-8 - now done by webshims\n// $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/excanvas.js\"></script><![endif]-->' . \"\\n\";",
" //Win 8/IE 10 work around\n $str .= \"\\t\" . '<!--[if IE 10]><link rel=\"stylesheet\" href=\"' . PATH_RELATIVE . 'external/ie10-viewport-bug-workaround.css\" type=\"text/css\"' . XHTML_CLOSING . '><![endif]-->' . \"\\n\";\n $str .= \"\\t\" . '<!--[if IE 10]><script src=\"' . PATH_RELATIVE . 'external/ie10-viewport-bug-workaround.js\"></script><![endif]-->' . \"\\n\";",
"\n // turn off ie compatibility mode which will break the display\n $str .= \"\\t\" . '<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"' . XHTML_CLOSING . '>' . \"\\n\";",
" }",
" return $str;\n }",
" public static function foot($params = array())\n {\n self::footerInfo($params);\n }",
" public static function footerInfo($params = array())\n {\n // checks to see if the theme is calling footerInfo.\n global $validateTheme, $user, $jsForHead;",
" $validateTheme['footerinfo'] = true;",
" if (!empty($user->getsToolbar) && PRINTER_FRIENDLY != 1 && EXPORT_AS_PDF != 1 && !defined(\n 'SOURCE_SELECTOR'\n ) && empty($params['hide-slingbar'])\n ) {\n self::module(array(\"controller\" => \"administration\", \"action\" => \"toolbar\", \"source\" => \"admin\"));\n }",
" if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n echo '<div style=\"text-align:center\"><a href=\"', makeLink(\n array('module' => 'administration', 'action' => 'togglemobile')\n ), '\">', gt('View site in'), ' ', (MOBILE ? \"Classic\" : \"Mobile\"), ' ', gt('mode'), '</a></div>';\n }\n // load primer, lessprimer, & normalize CSS files",
" if (!empty($params['src']) || !empty($params['content']) || !empty($params['yui3mods']) || !empty($params['jquery']) || !empty($params['bootstrap'])) {\n expJavascript::pushToFoot($params);\n }\n self::processCSSandJS();\n echo expJavascript::footJavascriptOutput();",
" expSession::deleteVar(\n \"last_POST\"\n ); //ADK - putting this here so one form doesn't unset it before another form needs it.\n expSession::deleteVar(\n 'last_post_errors'\n );\n }",
" public static function pageMetaInfo()\n {\n global $sectionObj, $router;",
" $metainfo = array();\n if (self::inAction() && (!empty($router->url_parts[0]) && expModules::controllerExists(\n $router->url_parts[0]\n ))\n ) {\n// $classname = expModules::getControllerClassName($router->url_parts[0]);\n// $controller = new $classname();\n $controller = expModules::getController($router->url_parts[0]);\n $metainfo = $controller->metainfo();\n }\n if (empty($metainfo)) {\n $metainfo['title'] = empty($sectionObj->page_title) ? SITE_TITLE : $sectionObj->page_title;\n $metainfo['keywords'] = empty($sectionObj->keywords) ? SITE_KEYWORDS : $sectionObj->keywords;\n $metainfo['description'] = empty($sectionObj->description) ? SITE_DESCRIPTION : $sectionObj->description;\n $metainfo['canonical'] = empty($sectionObj->canonical) ? URL_FULL . $sectionObj->sef_name : $sectionObj->canonical;\n $metainfo['noindex'] = empty($sectionObj->noindex) ? false : $sectionObj->noindex;\n $metainfo['nofollow'] = empty($sectionObj->nofollow) ? false : $sectionObj->nofollow;\n }",
" // clean up meta tag output\n foreach ($metainfo as $key=>$value) {\n $metainfo[$key] = expString::parseAndTrim($value, true);\n }\n return $metainfo;\n }",
" public static function grabView($path, $filename)\n { //FIXME Not used\n $dirs = array(\n BASE . 'themes/' . DISPLAY_THEME . '/' . $path,\n BASE . 'framework/' . $path,\n );",
" foreach ($dirs as $dir) {\n if (file_exists($dir . $filename . '.tpl')) {\n return $dir . $form . '.tpl';\n } //FIXME $form is not set??\n }",
" return false;\n }",
" public static function grabViews($path, $filter = '')\n { //FIXME Not used\n $dirs = array(\n BASE . 'framework/' . $path,\n BASE . 'themes/' . DISPLAY_THEME . '/' . $path,\n );",
" $files = array();\n foreach ($dirs as $dir) {\n if (is_dir($dir) && is_readable($dir)) {\n $dh = opendir($dir);\n while (($filename = readdir($dh)) !== false) {\n $file = $dir . $filename;\n if (is_file($file)) { //FIXME this should be $file instead of $filename?\n $files[$filename] = $file;\n }\n }\n }\n }",
" return $files;\n }",
" public static function processCSSandJS()\n {\n global $jsForHead, $cssForHead;",
" // returns string, either minified combo url or multiple link and script tags\n $jsForHead = expJavascript::parseJSFiles();\n $cssForHead = expCSS::parseCSSFiles();\n }",
" public static function removeCss()\n {\n expFile::removeFilesInDirectory(BASE . 'tmp/minify'); // also clear the minify engine's cache\n return expFile::removeFilesInDirectory(BASE . 'tmp/css');\n }",
" public static function clearSmartyCache()\n {\n self::removeSmartyCache();\n flash('message', gt(\"Smarty Cache has been cleared\"));\n expHistory::back();\n }",
" public static function removeSmartyCache()\n {\n expFile::removeFilesInDirectory(BASE . 'tmp/cache'); // alt location for cache\n return expFile::removeFilesInDirectory(BASE . 'tmp/views_c');\n }",
" /** exdoc\n * Output <link /> elements for each RSS feed on the site\n *\n * @node Subsystems:Theme\n */\n public static function advertiseRSS()\n {\n if (defined('ADVERTISE_RSS') && ADVERTISE_RSS == 1) {\n echo \"\\t<!-- RSS Feeds -->\\r\\n\";\n $rss = new expRss();\n $feeds = $rss->getFeeds('advertise=1');\n foreach ($feeds as $feed) {\n if ($feed->enable_rss) {\n//\t\t\t\t\t$title = empty($feed->feed_title) ? 'RSS' : htmlspecialchars($feed->feed_title, ENT_QUOTES);\n $title = empty($feed->title) ? 'RSS - ' . ORGANIZATION_NAME : htmlspecialchars(\n $feed->title,\n ENT_QUOTES\n );\n $params['module'] = $feed->module;\n $params['src'] = $feed->src;\n//\t\t\t\t\techo \"\\t\".'<link rel=\"alternate\" type=\"application/rss+xml\" title=\"' . $title . '\" href=\"' . expCore::makeRSSLink($params) . \"\\\" />\\n\";\n //FIXME need to use $feed instead of $params\n echo \"\\t\" . '<link rel=\"alternate\" type=\"application/rss+xml\" title=\"', $title, '\" href=\"', expCore::makeLink(\n array('controller' => 'rss', 'action' => 'feed', 'title' => $feed->sef_url)\n ), \"\\\" />\\r\\n\";\n }\n }\n }\n }",
" public static function loadActionMaps()\n {\n if (is_readable(BASE . 'themes/' . DISPLAY_THEME . '/action_maps.php')) {\n return include(BASE . 'themes/' . DISPLAY_THEME . '/action_maps.php');\n } else {\n return array();\n }\n }",
" public static function satisfyThemeRequirements()\n {\n global $validateTheme;",
" if ($validateTheme['headerinfo'] == false) {\n echo \"<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>expTheme::head() is a required function in your theme. Please refer to the Exponent documentation for details:<br />\n\t\t\t<a href=\\\"http://docs.exponentcms.org/docs/current/header-info\\\" target=\\\"_blank\\\">http://docs.exponentcms.org/</a>\n\t\t\t</h1>\";\n die();\n }",
" if ($validateTheme['footerinfo'] == false) {\n echo \"<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>expTheme::foot() is a required function in your theme. Please refer to the Exponent documentation for details:<br />\n\t\t\t<a href=\\\"http://docs.exponentcms.org/docs/current/footer-info\\\" target=\\\"_blank\\\">http://docs.exponentcms.org/</a>\n\t\t\t</h1>\";\n die();\n }\n }",
" public static function getTheme()\n {\n global $sectionObj, $router;",
" // Grabs the action maps files for theme overrides\n $action_maps = self::loadActionMaps();",
"//\t\t$mobile = self::is_mobile();",
" // if we are in an action, get the particulars for the module\n if (self::inAction()) {\n// $module = isset($_REQUEST['module']) ? expString::sanitize(\n// $_REQUEST['module']\n// ) : expString::sanitize($_REQUEST['controller']);\n $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : $_REQUEST['controller'];\n }",
" // if we are in an action and have action maps to work with...\n if (self::inAction() && (!empty($action_maps[$module]) && (array_key_exists(\n $_REQUEST['action'],\n $action_maps[$module]\n ) || array_key_exists('*', $action_maps[$module])))\n ) {\n $actionname = array_key_exists($_REQUEST['action'], $action_maps[$module]) ? $_REQUEST['action'] : '*';\n $actiontheme = explode(\":\", $action_maps[$module][$actionname]);",
" // this resets the section object. we're suppressing notices with @ because getSectionObj sets constants, which cannot be changed\n // since this will be the second time Exponent calls this function on the page load.\n if (!empty($actiontheme[1])) {\n $sectionObj = @$router->getSectionObj($actiontheme[1]);\n }",
" if ($actiontheme[0] == \"default\" || $actiontheme[0] == \"Default\" || $actiontheme[0] == \"index\") {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n } elseif (is_readable(BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $actiontheme[0] . '.php')) {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $actiontheme[0] . '.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $actiontheme[0] . '.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $actiontheme[0] . '.php';\n }\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n } elseif ($sectionObj->subtheme != '' && is_readable(\n BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $sectionObj->subtheme . '.php'\n )\n ) {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $sectionObj->subtheme . '.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $sectionObj->subtheme . '.php';\n } elseif (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $sectionObj->subtheme . '.php';\n }\n } else {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n }\n if (!is_readable($theme)) {\n if (is_readable(BASE . 'framework/core/index.php')) {\n $theme = BASE . 'framework/core/index.php'; // use the fallback bare essentials theme\n }\n }\n return $theme;\n }",
" /** exdoc\n * @state <b>UNDOCUMENTED</b>\n *\n * @node Undocumented\n *\n * @param bool $include_default\n * @param string $theme\n *\n * @return array\n */\n public static function getSubthemes($include_default = true, $theme = DISPLAY_THEME)\n {\n $base = BASE . \"themes/$theme/subthemes\";\n // The array of subthemes. If the theme has no subthemes directory,\n // or the directory is not readable by the web server, this empty array\n // will be returned (Unless the caller wanted us to include the default layout)\n $subs = array();\n if ($include_default == true) {\n // Caller wants us to include the default layout.\n $subs[''] = DEFAULT_VIEW; // Not really its intended use, but it works.\n }",
" if (is_readable($base)) {\n // subthemes directory exists and is readable by the web server. Continue on.\n $dh = opendir($base);\n // Read out all entries in the THEMEDIR/subthemes directory\n while (($s = readdir($dh)) !== false) {\n if (substr($s, -4, 4) == '.php' && substr($s, 0, 1) != '_' && is_file($base . \"/$s\") && is_readable(\n $base . \"/$s\"\n )\n ) {\n // Only readable .php files are allowed to be subtheme files.\n $subs[substr($s, 0, -4)] = substr($s, 0, -4);\n }\n }\n // Sort the subthemes by their keys (which are the same as the values)\n // using a natural string comparison function (PHP built-in)\n uksort($subs, 'strnatcmp');\n }\n return $subs;\n }",
" public static function getPrinterFriendlyTheme()\n {\n global $framework;",
" $common = 'framework/core/printer-friendly.php';\n $theme = 'themes/' . DISPLAY_THEME . '/printer-friendly.php';\n if (empty($framework)) {\n $fw = expSession::get('framework');\n $fwprint = 'framework/core/printer-friendly.' . $fw . '.php';\n } else {\n $fwprint = 'framework/core/printer-friendly.' . $framework . '.php';\n }",
" if (is_readable($theme)) {\n return $theme;\n } elseif (is_readable($fwprint)) {\n return $fwprint;\n } elseif (is_readable($common)) {\n return $common;\n } else {\n return null;\n }\n }",
" /** exdoc\n * Checks to see if the page is currently in an action. Useful only if the theme does not use the self::main() function\n * Returns whether or not an action should be run.\n *\n * @node Subsystems:Theme\n * @return boolean\n */\n public static function inPreview()\n {\n $level = 99;\n if (expSession::is_set('uilevel')) {\n $level = expSession::get('uilevel');\n }\n return ($level == UILEVEL_PREVIEW);\n }",
" public static function inAction($action=null)\n {\n return (isset($_REQUEST['action']) && (isset($_REQUEST['module']) || isset($_REQUEST['controller'])) && (!isset($action) || ($action == $_REQUEST['action'])));\n }",
" public static function reRoutActionTo($theme = \"\")\n {\n if (empty($theme)) {\n return false;\n }\n if (self::inAction()) {\n include_once(BASE . \"themes/\" . DISPLAY_THEME . \"/\" . $theme);\n exit;\n }\n return false;\n }",
" /** exdoc\n * Runs the appropriate action, by looking at the $_REQUEST variable.\n *\n * @node Subsystems:Theme\n * @return bool\n */\n public static function runAction()\n {\n global $user;",
" if (self::inAction()) {\n if (!AUTHORIZED_SECTION && !expJavascript::inAjaxAction())\n notfoundController::handle_not_authorized();\n//\t\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\t\techo \"<a href='\".$config['mainpage'].\"'>\".$config['backlinktext'].\"</a><br /><br />\";\n//\t\t\t}",
" //FIXME clean our passed parameters\n// foreach ($_REQUEST as $key=>$param) { //FIXME need array sanitizer\n// $_REQUEST[$key] = expString::sanitize($param);\n// }\n// if (empty($_REQUEST['route_sanitized'])) {\n if (!$user->isAdmin())\n expString::sanitize($_REQUEST);\n// } elseif (empty($_REQUEST['array_sanitized'])) {\n// $tmp =1; //FIXME we've already sanitized at this point\n// } else {\n// $tmp =1; //FIXME we've already sanitized at this point\n// }",
" //FIXME: module/controller glue code..remove ASAP\n $module = empty($_REQUEST['controller']) ? $_REQUEST['module'] : $_REQUEST['controller'];\n//\t\t\t$isController = expModules::controllerExists($module);",
"//\t\t\tif ($isController && !isset($_REQUEST['_common'])) {\n if (expModules::controllerExists($module)) {\n // this is being set just in case the url said module=modname instead of controller=modname\n // with SEF URls turned on its not really an issue, but with them off some of the links\n // aren't being made correctly...depending on how the {link} plugin was used in the view.\n $_REQUEST['controller'] = $module;",
"// if (!isset($_REQUEST['action'])) $_REQUEST['action'] = 'showall';\n// if (isset($_REQUEST['view']) && $_REQUEST['view'] != $_REQUEST['action']) {\n// $test = explode('_',$_REQUEST['view']);\n// if ($test[0] != $_REQUEST['action']) {\n// $_REQUEST['view'] = $_REQUEST['action'].'_'.$_REQUEST['view'];\n// }\n// } elseif (!empty($_REQUEST['action'])) {\n// $_REQUEST['view'] = $_REQUEST['action'];\n// } else {\n// $_REQUEST['view'] = 'showall';\n// }",
" echo renderAction($_REQUEST);\n//\t\t\t} else {\n//\t\t\t\tif ($_REQUEST['action'] == 'index') {\n//\t\t\t\t\t$view = empty($_REQUEST['view']) ? 'Default' : $_REQUEST['view'];\n//\t\t\t\t\t$title = empty($_REQUEST['title']) ? '' : expString::sanitize($_REQUEST['title']);\n//\t\t\t\t\t$src = empty($_REQUEST['src']) ? null : expString::sanitize($_REQUEST['src']);\n//\t\t\t\t\tself::showModule($module, $view, $title, $src);\n//\t\t\t\t\treturn true;\n//\t\t\t\t}\n//\n//\t\t\t\tglobal $db, $user; // these globals are needed for the old school actions which are loaded\n//\n//\t\t\t\t// the only reason we should have a controller down in this section is if we are hitting a common action like\n//\t\t\t\t// userperms or groupperms...deal with it.\n////\t\t\t\t$loc = new stdClass();\n////\t\t\t\t$loc->mod = $module;\n////\t\t\t\t$loc->src = (isset($_REQUEST['src']) ? expString::sanitize($_REQUEST['src']) : \"\");\n////\t\t\t\t$loc->int = (!empty($_REQUEST['int']) ? strval(intval($_REQUEST['int'])) : \"\");\n// $loc = expCore::makeLocation($module,(isset($_REQUEST['src']) ? expString::sanitize($_REQUEST['src']) : \"\"),(!empty($_REQUEST['int']) ? strval(intval($_REQUEST['int'])) : \"\"));\n//\t\t\t\t//if (isset($_REQUEST['act'])) $loc->act = $_REQUEST['act'];\n//\n//\t\t\t\tif (isset($_REQUEST['_common'])) {\n//\t\t\t\t\t$actfile = \"/common/actions/\" . $_REQUEST['action'] . \".php\";\n//\t\t\t\t} else {\n//\t\t\t\t\t$actfile = \"/\" . $module . \"/actions/\" . $_REQUEST['action'] . \".php\";\n//\t\t\t\t}\n//\n//\t\t\t\tif (is_readable(BASE.\"themes/\".DISPLAY_THEME.\"/modules\".$actfile)) {\n// include_once(BASE.\"themes/\".DISPLAY_THEME.\"/modules\".$actfile);\n////\t\t\t\t} elseif (is_readable(BASE.'framework/modules-1/'.$actfile)) {\n////\t\t\t\t\tinclude_once(BASE.'framework/modules-1/'.$actfile);\n//\t\t\t\t} else {\n//\t\t\t\t\techo SITE_404_HTML . '<br /><br /><hr size=\"1\" />';\n//\t\t\t\t\techo sprintf(gt('No such module action').' : %1 : %2',strip_tags($module),strip_tags($_REQUEST['action']));\n//\t\t\t\t\techo '<br />';\n//\t\t\t\t}\n }\n }\n return false;\n }",
" public static function showAction($module, $action, $src = \"\", $params = array())\n { //FIXME only used by smarty functions, old school?\n global $user;",
" $loc = expCore::makeLocation($module, (isset($src) ? $src : \"\"), (isset($int) ? $int : \"\"));",
" $actfile = \"/\" . $module . \"/actions/\" . $action . \".php\";\n if (isset($params)) {\n// foreach ($params as $key => $value) { //FIXME need array sanitizer\n//// $_GET[$key] = $value;\n// $_GET[$key] = expString::sanitize($value);\n// }\n if (!$user->isAdmin())\n expString::sanitize($_GET);\n }\n //if (isset($['_common'])) $actfile = \"/common/actions/\" . $_REQUEST['action'] . \".php\";",
" if (is_readable(BASE . \"themes/\" . DISPLAY_THEME . \"/modules\" . $actfile)) {\n include(BASE . \"themes/\" . DISPLAY_THEME . \"/modules\" . $actfile);\n// \t\t} elseif (is_readable(BASE.'framework/modules-1/'.$actfile)) {\n// \t\t\tinclude(BASE.'framework/modules-1/'.$actfile);\n } else {\n notfoundController::handle_not_found();\n echo '<br /><hr size=\"1\" />';\n echo sprintf(\n gt('No such module action') . ' : %1 : %2',\n strip_tags($_REQUEST['module']),\n strip_tags($_REQUEST['action'])\n );\n echo '<br />';\n }\n }",
" /** exdoc\n * Redirect User to Default Section\n *\n * @node Subsystems:Theme\n */\n public static function goDefaultSection()\n {\n $last_section = expSession::get(\"last_section\");\n if (defined('SITE_DEFAULT_SECTION') && SITE_DEFAULT_SECTION != $last_section) {\n header(\"Location: \" . URL_FULL . \"index.php?section=\" . SITE_DEFAULT_SECTION);\n exit();\n } else {\n global $db;",
" $section = $db->selectObject(\"section\", \"public = 1 AND active = 1\"); // grab first section, go there\n if ($section) {\n header(\"Location: \" . URL_FULL . \"index.php?section=\" . $section->id);\n exit();\n } else {\n notfoundController::handle_not_found();\n }\n }\n }",
" /** exdoc\n * Takes care of all the specifics of either showing a sectional container or running an action.\n *\n * @node Subsystems:Theme\n */\n public static function main()\n {\n global $db;",
" if ((!defined('SOURCE_SELECTOR') || SOURCE_SELECTOR == 1)) {\n $last_section = expSession::get(\"last_section\");\n $section = $db->selectObject(\"section\", \"id=\" . $last_section);\n // View authorization will be taken care of by the runAction and mainContainer functions\n if (self::inAction()) {\n if (!PRINTER_FRIENDLY && !EXPORT_AS_PDF)\n echo show_msg_queue();\n self::runAction();\n } else {\n if ($section == null) {\n self::goDefaultSection();\n } else {\n if (!PRINTER_FRIENDLY && !EXPORT_AS_PDF)\n echo show_msg_queue();\n self::mainContainer();\n }\n }\n// } else {\n// if (isset($_REQUEST['module'])) {\n// include_once(BASE.\"framework/modules/container/orphans_content.php\"); //FIXME not sure how to convert this yet\n// } else {\n// echo gt('Select a module');\n// }\n }\n }",
" /** exdoc\n * Useful only if theme does not use self::main\n *\n * @return void\n * @internal param bool $public Whether or not the page is public.\n * @node Subsystems:Theme\n */\n public static function mainContainer()\n {\n global $router;",
" if (!AUTHORIZED_SECTION) {\n // Set this so that a login on an Auth Denied page takes them back to the previously Auth-Denied page\n //\t\t\texpHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);\n expHistory::set('manageable', $router->params);\n notfoundController::handle_not_authorized();\n return;\n }",
" if (PUBLIC_SECTION) {\n //\t\t\texpHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);\n expHistory::set('viewable', $router->params);\n } else {\n //\t\t\texpHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);\n expHistory::set('manageable', $router->params);\n }",
" # if (expSession::is_set(\"themeopt_override\")) {\n # $config = expSession::get(\"themeopt_override\");\n// \t\t\tself::showSectionalModule(\"containermodule\",\"Default\",\"\",\"@section\",false,true); //FIXME change to showModule call\n self::module(\n array(\n \"controller\" => \"container\",\n \"action\" => \"showall\",\n \"view\" => \"showall\",\n \"source\" => \"@section\",\n \"scope\" => \"sectional\"\n )\n );",
" # } else {\n # self::showSectionalModule(\"containermodule\",\"Default\",\"\",\"@section\");\n # }\n }",
" /** exdoc\n * Calls the necessary methods to show a specific module, in a section-sensitive way.\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param bool $hide_menu\n *\n * @return void\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showSectionalModule(\n $module,\n $view,\n $title,\n $prefix = null,\n $pickable = false,\n $hide_menu = false\n ) {\n global $module_scope;",
" self::deprecated('expTheme::module()', $module, $view);\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if ($prefix == null) {\n $prefix = \"@section\";\n }",
" $src = $prefix;",
"//\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\tif (in_array($module,$config['ignore_mods'])) return;\n//\t\t\t$src = $config['src_prefix'].$prefix; //FIXME there is no such config index\n//\t\t\t$section = null;\n//\t\t} else {\n global $sectionObj;",
" //$last_section = expSession::get(\"last_section\");\n //$section = $db->selectObject(\"section\",\"id=\".$last_section);\n $src .= $sectionObj->id;\n//\t\t}\n $module_scope[$src][$module] = new stdClass();\n $module_scope[$src][$module]->scope = 'sectional';",
" self::showModule($module, $view, $title, $src, false, null, $hide_menu);\n }",
" /** exdoc\n * Calls the necessary methods to show a specific module in such a way that the current\n * section displays the same content as its top-level parent and all of the top-level parent's\n * children, grand-children, grand-grand-children, etc.\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param bool $hide_menu\n *\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showTopSectionalModule(\n $module,\n $view,\n $title,\n $prefix = null,\n $pickable = false,\n $hide_menu = false\n ) {\n global $db, $module_scope, $sectionObj;",
" self::deprecated('expTheme::module()', $module, $view);\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if ($prefix == null) {\n $prefix = \"@section\";\n }\n//\t\t$last_section = expSession::get(\"last_section\");\n//\t\t$section = $db->selectObject(\"section\",\"id=\".$last_section);\n $section = $sectionObj; //FIXME let's try $sectionObj instead of last_section\n// $module_scope[$prefix.$section->id][$module] = new stdClass();\n $module_scope[$prefix . $section->id][$module]->scope = 'top-sectional';\n // Loop until we find the top level parent.\n while ($section->parent != 0) {\n $section = $db->selectObject(\"section\", \"id=\" . $section->parent);\n }",
" self::showModule($module, $view, $title, $prefix . $section->id, false, null, $hide_menu);\n }",
" /** exdoc\n * Calls the necessary methods to show a specific controller, in a section-sensitive way.\n *\n * @param array $params\n *\n * @internal param string $module The classname of the module to display\n * @internal param string $view The name of the view to display the module with\n * @internal param string $title The title of the module (support is view-dependent)\n * @internal param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @internal param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @internal param bool $hide_menu\n * @return void\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showSectionalController($params = array())\n { //FIXME not used in base system (custom themes?)\n global $sectionObj, $module_scope;",
" $src = \"@section\" . $sectionObj->id;\n $params['source'] = $src;\n// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])] = new stdClass();\n $module_scope[$params['source']][(isset($params['module']) ? $params['module'] : $params['controller'])]->scope = 'sectional';\n $module = !empty($params['module']) ? $params['module'] : $params['controller'];\n $view = !empty($params['action']) ? $params['action'] : $params['view'];\n self::deprecated('expTheme::module()', $module, $view);\n self::module($params);\n }",
" /**\n * @deprecated 2.2.1\n */\n public static function showController($params = array())\n {\n $module = !empty($params['module']) ? $params['module'] : $params['controller'];\n $view = !empty($params['action']) ? $params['action'] : $params['view'];\n self::deprecated('expTheme::module()', $module, $view);\n self::module($params);\n// global $sectionObj, $db, $module_scope;\n// if (empty($params)) {\n//\t return false;\n// } elseif (isset($params['module'])) {\n// self::module($params);\n// } else if (isset($params['controller'])) {\n//\t\t\t$params['view'] = isset($params['view']) ? $params['view'] : $params['action'];\n//\t\t\t$params['title'] = isset($params['moduletitle']) ? $params['moduletitle'] : '';\n//\t\t\t$params['chrome'] = (!isset($params['chrome']) || (isset($params['chrome'])&&empty($params['chrome']))) ? true : false;\n//\t\t\t$params['scope'] = isset($params['scope']) ? $params['scope'] : 'global';\n//\n//\t\t\t// set the controller and action to the one called via the function params\n//\t\t\t$requestvars = isset($params['params']) ? $params['params'] : array();\n//\t\t\t$requestvars['controller'] = $params['controller'];\n//\t\t\t$requestvars['action'] = isset($params['action']) ? $params['action'] : null;\n//\t\t\t$requestvars['view'] = isset($params['view']) ? $params['view'] : null;\n//\n//\t\t\t// figure out the scope of the module and set the source accordingly\n//\t\t\tif ($params['scope'] == 'global') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : null;\n//\t\t\t} elseif ($params['scope'] == 'sectional') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : '@section';\n//\t\t\t\t$params['source'] .= $sectionObj->id;\n//\t\t\t} elseif ($params['scope'] == 'top-sectional') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : '@section';\n//\t\t\t\t$section = $sectionObj;\n//\t\t\t\twhile ($section->parent > 0) $section = $db->selectObject(\"section\",\"id=\".$section->parent);\n//\t\t\t\t$params['source'] .= $section->id;\n//\t\t\t}\n//// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])] = new stdClass();\n// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])]->scope = $params['scope'];\n//\t\t\tself::showModule(expModules::getControllerClassName($params['controller']),$params['view'],$params['title'],$params['source'],false,null,$params['chrome'],$requestvars);\n// }\n// return false;\n }",
" /**\n * Entry point for displaying modules\n * Packages $params for calling showModule method\n *\n * @param array $params list of module parameters\n *\n * @return bool\n */\n public static function module($params)\n {\n global $db, $module_scope, $sectionObj;",
" if (empty($params)) {\n return false;\n } elseif (isset($params['module']) && expModules::controllerExists($params['module'])) {\n // hack to add compatibility for modules converted to controllers, but still hard-coded the old way\n $params['controller'] = $params['module'];\n unset($params['module']);\n }\n if (!isset($params['action'])) {\n $params['action'] = 'showall';\n }\n if (isset($params['view']) && $params['view'] != $params['action']) {\n $test = explode('_', $params['view']);\n if ($test[0] != $params['action']) {\n $params['view'] = $params['action'] . '_' . $params['view'];\n }\n } elseif (!empty($params['action'])) {\n $params['view'] = $params['action'];\n } else {\n $params['view'] = 'showall';\n }\n//\t if (isset($params['controller'])) {\n $controller = expModules::getModuleName($params['controller']);\n// $params['view'] = isset($params['view']) ? $params['view'] : $params['action'];\n $params['title'] = isset($params['moduletitle']) ? $params['moduletitle'] : '';\n $params['chrome'] = (!isset($params['chrome']) || (isset($params['chrome']) && empty($params['chrome']))) ? true : false;\n $params['scope'] = isset($params['scope']) ? $params['scope'] : 'global';",
" // set the controller and action to the one called via the function params\n $requestvars = isset($params['params']) ? $params['params'] : array();\n $requestvars['controller'] = $controller;\n $requestvars['action'] = isset($params['action']) ? $params['action'] : null;\n $requestvars['view'] = isset($params['view']) ? $params['view'] : null;",
" // figure out the scope of the module and set the source accordingly\n if ($params['scope'] == 'global') {\n $params['source'] = isset($params['source']) ? $params['source'] : null;\n } elseif ($params['scope'] == 'sectional') {\n $params['source'] = isset($params['source']) ? $params['source'] : '@section';\n $params['source'] .= $sectionObj->id;\n } elseif ($params['scope'] == 'top-sectional') {\n $params['source'] = isset($params['source']) ? $params['source'] : '@section';\n $section = $sectionObj;\n while ($section->parent > 0) {\n $section = $db->selectObject(\"section\", \"id=\" . $section->parent);\n }\n $params['source'] .= $section->id;\n }\n $module_scope[$params['source']][$controller] = new stdClass();\n $module_scope[$params['source']][$controller]->scope = $params['scope'];\n// self::showModule(expModules::getControllerClassName($params['controller']),$params['view'],$params['title'],$params['source'],false,null,$params['chrome'],$requestvars);\n return self::showModule(\n $controller,\n $params['view'],\n $params['title'],\n $params['source'],\n false,\n null,\n $params['chrome'],\n $requestvars\n );\n// } elseif (isset($params['module'])) {\n// $module = expModules::getModuleClassName($params['module']);\n// $moduletitle = (isset($params['moduletitle'])) ? $params['moduletitle'] : \"\";\n// $source = (isset($params['source'])) ? $params['source'] : \"\";\n// $chrome = (isset($params['chrome'])) ? $params['chrome'] : false;\n// $scope = (isset($params['scope'])) ? $params['scope'] : \"global\";\n//\n// if ($scope==\"global\") {\n// self::showModule($module,$params['view'],$moduletitle,$source,false,null,$chrome);\n// }\n// if ($scope==\"top-sectional\") {\n//// self::showTopSectionalModule($params['module'].\"module\", //module\n//// $params['view'], //view\n//// $moduletitle, // Title\n//// $source, // source\n//// false, // used to apply to source picker. does nothing now.\n//// $chrome // Show chrome\n//// );\n// if ($source == null) $source = \"@section\";\n// //FIXME - $section might be empty! We're getting it from last_section instead of sectionObj??\n//// $last_section = expSession::get(\"last_section\");\n//// $section = $db->selectObject(\"section\",\"id=\".$last_section);\n// $section = $sectionObj; //FIXME let's try $sectionObj instead of last_section\n// // Loop until we find the top level parent.\n// while ($section->parent != 0) $section = $db->selectObject(\"section\",\"id=\".$section->parent);\n// $module_scope[$source.$section->id][$module]= new stdClass();\n// $module_scope[$source.$section->id][$module]->scope = 'top-sectional';\n// self::showModule($module,$params['view'],$moduletitle,$source.$section->id,false,null,$chrome);\n// }\n// if ($scope==\"sectional\") {\n//// self::showSectionalModule($params['module'].\"module\", //module\n//// $params['view'], //view\n//// $moduletitle, // title\n//// $source, // source/prefix\n//// false, // used to apply to source picker. does nothing now.\n//// $chrome // Show chrome\n//// );\n// if ($source == null) $source = \"@section\";\n// $src = $source;\n// $src .= $sectionObj->id;\n// $module_scope[$src][$module] = new stdClass();\n// $module_scope[$src][$module]->scope = 'sectional';\n// self::showModule($module,$params['view'],$moduletitle,$src,false,null,$chrome);\n// }\n// }\n// return false;\n }",
" /** exdoc\n * Calls the necessary methods to show a specific module - NOT intended to be called directly from theme\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $source The source of the module.\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param null $section\n * @param bool $hide_menu\n * @param array $params\n *\n * @return void\n * @node Subsystems:Theme\n */\n public static function showModule(\n $module,\n $view = \"Default\",\n $title = \"\",\n $source = null,\n $pickable = false,\n $section = null,\n $hide_menu = false,\n $params = array()\n ) {\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if (!AUTHORIZED_SECTION && $module != 'navigation' && $module != 'login') {\n return;\n }",
" global $db, $sectionObj, $module_scope;",
" // Ensure that we have a section\n //FJD - changed to $sectionObj\n if ($sectionObj == null) {\n $section_id = expSession::get('last_section');\n if ($section_id == null) {\n $section_id = SITE_DEFAULT_SECTION;\n }\n $sectionObj = $db->selectObject('section', 'id=' . $section_id);\n //$section->id = $section_id;\n }\n if ($module == \"login\" && defined('PREVIEW_READONLY') && PREVIEW_READONLY == 1) {\n return;\n }",
"//\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\tif (in_array($module,$config['ignore_mods'])) return;\n//\t\t}\n if (empty($params['action'])) {\n $params['action'] = $view;\n }\n $loc = expCore::makeLocation($module, $source . \"\");",
" if (empty($module_scope[$source][$module]->scope)) {\n $module_scope[$source][$module] = new stdClass();\n $module_scope[$source][$module]->scope = 'global';\n }\n // make sure we've added this module to the sectionref table\n $secref = $db->selectObject(\"sectionref\", \"module='$module' AND source='\" . $loc->src . \"'\");\n if ($secref == null) {\n $secref = new stdClass();\n $secref->module = $module;\n $secref->source = $loc->src;\n $secref->internal = \"\";\n $secref->refcount = 1000; // only hard-coded modules should be missing\n if ($sectionObj != null) {\n $secref->section = $sectionObj->id;\n }\n//\t\t\t $secref->is_original = 1;\n $db->insertObject($secref, 'sectionref');\n// } elseif ($sectionObj != null && $secref->section != $sectionObj->id) {\n// $secref->section = $sectionObj->id;\n// $db->updateObject($secref, 'sectionref');\n }\n // add (hard-coded) modules to the container table, nested containers added in container showall method??\n $container = $db->selectObject('container', \"internal='\" . serialize($loc) . \"'\");\n if (empty($container->id)) {\n //if container isn't here already, then create it...hard-coded from theme template\n $newcontainer = new stdClass();\n $newcontainer->internal = serialize($loc);\n $newcontainer->external = serialize(null);\n $newcontainer->title = $title;\n $newcontainer->view = $view;\n $newcontainer->action = $params['action'];\n $newcontainer->id = $db->insertObject($newcontainer, 'container');\n }\n if (empty($title) && !empty($container->title)) {\n $title = $container->title;\n }\n//\t\t$iscontroller = expModules::controllerExists($module);",
" if (defined('SELECTOR') && call_user_func(array(expModules::getModuleClassName($module), \"hasSources\"))) {\n containerController::wrapOutput($module, $view, $loc, $title);\n } else {\n//\t\t\tif (is_callable(array($module,\"show\")) || $iscontroller) {\n if (expModules::controllerExists($module)) {\n // FIXME: we are checking here for a new MVC style controller or an old school module. We only need to perform\n // this check until we get the old modules all gone...until then we have the check and a lot of code duplication\n // in the if blocks below...oh well, that's life.\n//\t\t\t\tif (!$iscontroller) {\n////\t\t\t\t\tif ((!$hide_menu && $loc->mod != \"containermodule\" && (call_user_func(array($module,\"hasSources\")) || $db->tableExists($loc->mod.\"_config\")))) {\n// if ((!$hide_menu && (call_user_func(array($module,\"hasSources\")) || $db->tableExists($loc->mod.\"_config\")))) {\n// $container = new stdClass(); //php 5.4\n//\t\t\t\t\t\t$container->permissions = array(\n//\t\t\t\t\t\t\t'manage'=>(expPermissions::check('manage',$loc) ? 1 : 0),\n//\t\t\t\t\t\t\t'configure'=>(expPermissions::check('configure',$loc) ? 1 : 0)\n//\t\t\t\t\t\t);\n//\n//\t\t\t\t\t\tif ($container->permissions['manage'] || $container->permissions['configure']) {\n//\t\t\t\t\t\t\t$container->randomizer = mt_rand(1,ceil(microtime(1)));\n//\t\t\t\t\t\t\t$container->view = $view;\n//\t\t\t\t\t\t\t$container->info['class'] = expModules::getModuleClassName($loc->mod);\n//\t\t\t\t\t\t\t$container->info['module'] = call_user_func(array($module,\"name\"));\n//\t\t\t\t\t\t\t$container->info['source'] = $loc->src;\n// $container->info['scope'] = $module_scope[$source][$module]->scope;\n//\t\t\t\t\t\t\t$container->info['hasConfig'] = $db->tableExists($loc->mod.\"_config\");\n////\t\t\t\t\t\t\t$template = new template('containermodule','_hardcoded_module_menu',$loc);\n//// $template = new template('containerController','_hardcoded_module_menu',$loc,false,'controllers');\n// $c2 = new containerController();\n// $template = expTemplate::get_template_for_action($c2,'_hardcoded_module_menu');\n//\t\t\t\t\t\t\t$template->assign('container', $container);\n//\t\t\t\t\t\t\t$template->output();\n//\t\t\t\t\t\t}\n//\t\t\t\t\t}\n//\t\t\t\t} else {\n // if we hit here we're dealing with a hard-coded controller...not a module\n if (!$hide_menu && $loc->mod != \"container\") {\n $controller = expModules::getController($module);\n// $controller = expModules::getControllerClassName($module);\n $hccontainer = new stdClass(); //php 5.4\n $hccontainer->permissions = array(\n 'manage' => (expPermissions::check('manage', $loc) ? 1 : 0),\n 'configure' => (expPermissions::check('configure', $loc) ? 1 : 0)\n );",
" if ($hccontainer->permissions['manage'] || $hccontainer->permissions['configure']) {\n $hccontainer->randomizer = mt_rand(1, ceil(microtime(1)));\n $hccontainer->view = $view;\n $hccontainer->action = $params['action'];\n $hccontainer->info['class'] = expModules::getModuleClassName($loc->mod);\n $hccontainer->info['module'] = $controller->displayname();\n// $hccontainer->info['module'] = $controller::displayname();\n $hccontainer->info['source'] = $loc->src;\n $hccontainer->info['scope'] = $module_scope[$source][$module]->scope;\n//\t\t\t\t\t\t\t$hccontainer->info['hasConfig'] = true;\n//\t\t\t\t\t\t\t$template = new template('containermodule','_hardcoded_module_menu',$loc);\n//\t\t\t\t\t\t\t$template = new template('containerController','_hardcoded_module_menu',$loc,false,'controllers');\n $c2 = new containerController();\n $template = expTemplate::get_template_for_action($c2, '_hardcoded_module_menu');\n $template->assign('container', $hccontainer);\n $template->output();\n }\n }\n//\t\t\t\t}",
"//\t\t\t\tif ($iscontroller) {\n $params['src'] = $loc->src;\n $params['controller'] = $module;\n $params['view'] = $view;\n $params['moduletitle'] = $title;\n return renderAction($params);\n//\t\t\t\t} else {\n//\t\t\t\t\tcall_user_func(array($module,\"show\"),$view,$loc,$title);\n//\t\t\t\t}\n } else {\n echo sprintf(gt('The module \"%s\" was not found in the system.'), $module);\n return false;\n }\n }\n }",
" public static function getThemeDetails() {\n $theme_file = DISPLAY_THEME;\n if (is_readable(BASE.'themes/'.$theme_file.'/class.php')) {\n // Need to avoid the duplicate theme problem.\n if (!class_exists($theme_file)) {\n include_once(BASE.'themes/'.$theme_file.'/class.php');\n }",
" if (class_exists($theme_file)) {\n // Need to avoid instantiating non-existent classes.\n $theme = new $theme_file();\n return ' ' . gt('using') . ' ' . $theme->name() . ' ' . gt('by') . ' ' . $theme->author();\n }\n }\n return '';\n }",
" /**\n * Return the color style for the current framework\n *\n * @param $color\n *\n * @return mixed|string\n */\n public static function buttonColor($color = null)\n {\n $colors = array(\n 'green' => 'btn-success',\n 'blue' => 'btn-primary',\n 'red' => 'btn-danger',\n 'magenta' => 'btn-danger',\n 'orange' => 'btn-warning',\n 'yellow' => 'btn-warning',\n 'grey' => 'btn-default',\n 'purple' => 'btn-info',\n 'black' => 'btn-inverse',\n 'pink' => 'btn-danger',\n );\n if (bs()) {\n if (!empty($colors[$color])) { // awesome to bootstrap button conversion\n $found = $colors[$color];\n } else {\n $found = 'btn-default';\n }\n } else {\n $found = array_search($color, $colors); // bootstrap to awesome button conversion?\n if (empty($found)) {\n $found = $color;\n } else {\n $found = BTN_COLOR;\n }\n }\n return $found;\n }",
" /**\n * Return the button size for the current framework\n *\n * @param $size\n *\n * @return mixed|string\n */\n public static function buttonSize($size = null)\n {\n if (bs2()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $btn_size = ''; // actually default size, NOT true bootstrap large\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $btn_size = 'btn-mini';\n } else { // medium\n $btn_size = 'btn-small';\n }\n return $btn_size;\n } elseif (bs3()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $btn_size = 'btn-lg';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $btn_size = 'btn-sm';\n } elseif (BTN_SIZE == 'extrasmall' || (!empty($size) && $size == 'extrasmall')) {\n $btn_size = 'btn-xs';\n } else { // medium\n $btn_size = '';\n }\n return $btn_size;\n } else {\n if (empty($size)) {\n $size = BTN_SIZE;\n }\n return $size;\n }\n }",
" /**\n * Return the button color and size style for the current framework\n *\n * @param null $color\n * @param $size\n *\n * @return mixed|string\n */\n public static function buttonStyle($color = null, $size = null)\n {\n if (bs()) {\n $btn_class = 'btn ' . self::buttonColor($color) . ' ' . self::buttonSize($size);\n } else {\n $btn_size = !empty($size) ? $size : BTN_SIZE;\n $btn_color = !empty($color) ? $color : BTN_COLOR;\n $btn_class = \"awesome \" . $btn_size . \" \" . $btn_color;\n }\n return $btn_class;\n }",
" /**\n * Return the icon associated for the current frameowrk\n *\n * @param $class\n *\n * @return stdClass|string\n */\n public static function buttonIcon($class, $size=null)\n {\n $btn_type = '';\n if (bs2()) {\n switch ($class) {\n case 'delete' :\n case 'delete-title' :\n $class = \"remove-sign\";\n $btn_type = \"btn-danger\"; // red\n break;\n case 'add' :\n case 'add-title' :\n case 'add-body' :\n case 'switchtheme add' :\n $class = \"plus-sign\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'copy' :\n $class = \"copy\";\n break;\n case 'downloadfile' :\n case 'export' :\n $class = \"download-alt\";\n break;\n case 'uploadfile' :\n case 'import' :\n $class = \"upload-alt\";\n break;\n case 'manage' :\n $class = \"briefcase\";\n break;\n case 'merge' :\n case 'arrow_merge' :\n $class = \"signin\";\n break;\n case 'reranklink' :\n case 'alphasort' :\n $class = \"sort\";\n break;\n case 'configure' :\n $class = \"wrench\";\n break;\n case 'view' :\n $class = \"search\";\n break;\n case 'page_next' :\n $class = 'double-angle-right';\n break;\n case 'page_prev' :\n $class = 'double-angle-left';\n break;\n case 'password' :\n case 'change_password' :\n $class = 'key';\n break;\n case 'clean' :\n $class = 'check';\n break;\n case 'userperms' :\n $class = 'user';\n break;\n case 'groupperms' :\n $class = 'group';\n break;\n case 'monthviewlink' :\n case 'weekviewlink' :\n $class = 'calendar';\n break;\n case 'listviewlink' :\n $class = 'list';\n break;\n case 'adminviewlink' :\n $class = 'cogs';\n break;\n case 'approve' :\n $class = \"check\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'ajax' :\n $class = \"spinner icon-spin\";\n break;\n }\n $found = new stdClass();\n $found->type = $btn_type;\n $found->class = $class;\n $found->size = self::iconSize($size);\n $found->prefix = 'icon-';\n return $found;\n } elseif (bs3()) {\n switch ($class) {\n case 'delete' :\n case 'delete-title' :\n $class = \"times-circle\";\n $btn_type = \"btn-danger\"; // red\n break;\n case 'add' :\n case 'add-title' :\n case 'add-body' :\n case 'switchtheme add' :\n $class = \"plus-circle\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'copy' :\n $class = \"files-o\";\n break;\n case 'downloadfile' :\n case 'export' :\n $class = \"download\";\n break;\n case 'uploadfile' :\n case 'import' :\n $class = \"upload\";\n break;\n case 'manage' :\n $class = \"briefcase\";\n break;\n case 'merge' :\n case 'arrow_merge' :\n $class = \"sign-in\";\n break;\n case 'reranklink' :\n case 'alphasort' :\n $class = \"sort\";\n break;\n case 'configure' :\n $class = \"wrench\";\n break;\n case 'view' :\n $class = \"search\";\n break;\n case 'page_next' :\n $class ='angle-double-right';\n break;\n case 'page_prev' :\n $class = 'angle-double-left';\n break;\n case 'password' :\n case 'change_password' :\n $class = 'key';\n break;\n case 'clean' :\n $class = 'check-square-o';\n break;\n case 'trash' :\n $class = \"trash-o\";\n break;\n case 'userperms' :\n $class = 'user';\n break;\n case 'groupperms' :\n $class = 'group';\n break;\n case 'monthviewlink' :\n case 'weekviewlink' :\n $class = 'calendar';\n break;\n case 'listviewlink' :\n $class = 'list';\n break;\n case 'adminviewlink' :\n $class = 'cogs';\n break;\n case 'approve' :\n $class = \"check\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'ajax' :\n $class = \"spinner fa-spin\";\n break;\n }\n $found = new stdClass();\n $found->type = $btn_type;\n $found->class = $class;\n $found->size = self::iconSize($size);\n $found->prefix = 'fa fa-';\n return $found;\n } else {\n return $class;\n }\n }",
" /**\n * Return the full icon style string for the current framework\n *\n * @param $class\n *\n * @return string\n */\n public static function iconStyle($class, $text = null) {\n $style = self::buttonIcon($class);\n if (!empty($style->prefix)) {\n if ($text) {\n return '<i class=\"' .$style->prefix . $style->class . '\"></i> '. $text;\n } else {\n return $style->prefix . $style->class;\n }\n } else {\n return $style;\n }\n }",
" /**\n * Return the icon size for the current framework\n *\n * @param $size\n *\n * @return mixed|string\n */\n public static function iconSize($size = null)\n {\n if (bs2()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $icon_size = 'icon-large';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $icon_size = '';\n } else { // medium\n $icon_size = 'icon-large';\n }\n return $icon_size;\n } elseif (bs3()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $icon_size = 'fa-lg';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $icon_size = '';\n } else { // medium\n $icon_size = 'fa-lg';\n }\n return $icon_size;\n } else {\n return BTN_SIZE;\n }\n }",
" public static function is_mobile()\n {\n $tablet_browser = 0;\n $mobile_browser = 0;",
" if (preg_match(\n '/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i',\n strtolower($_SERVER['HTTP_USER_AGENT'])\n )\n ) {\n $tablet_browser++;\n }",
" if (preg_match(\n '/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android|iemobile)/i',\n strtolower($_SERVER['HTTP_USER_AGENT'])\n )\n ) {\n $mobile_browser++;\n }",
" if ((!empty($_SERVER['HTTP_ACCEPT']) && strpos(\n strtolower($_SERVER['HTTP_ACCEPT']),\n 'application/vnd.wap.xhtml+xml'\n ) > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))\n ) {\n $mobile_browser++;\n }",
" $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));\n $mobile_agents = array(\n 'w3c ',\n 'acs-',\n 'alav',\n 'alca',\n 'amoi',\n 'audi',\n 'avan',\n 'benq',\n 'bird',\n 'blac',\n 'blaz',\n 'brew',\n 'cell',\n 'cldc',\n 'cmd-',\n 'dang',\n 'doco',\n 'eric',\n 'hipt',\n 'inno',\n 'ipaq',\n 'java',\n 'jigs',\n 'kddi',\n 'keji',\n 'leno',\n 'lg-c',\n 'lg-d',\n 'lg-g',\n 'lge-',\n 'maui',\n 'maxo',\n 'midp',\n 'mits',\n 'mmef',\n 'mobi',\n 'mot-',\n 'moto',\n 'mwbp',\n 'nec-',\n 'newt',\n 'noki',\n 'palm',\n 'pana',\n 'pant',\n 'phil',\n 'play',\n 'port',\n 'prox',\n 'qwap',\n 'sage',\n 'sams',\n 'sany',\n 'sch-',\n 'sec-',\n 'send',\n 'seri',\n 'sgh-',\n 'shar',\n 'sie-',\n 'siem',\n 'smal',\n 'smar',\n 'sony',\n 'sph-',\n 'symb',\n 't-mo',\n 'teli',\n 'tim-',\n 'tosh',\n 'tsm-',\n 'upg1',\n 'upsi',\n 'vk-v',\n 'voda',\n 'wap-',\n 'wapa',\n 'wapi',\n 'wapp',\n 'wapr',\n 'webc',\n 'winw',\n 'winw',\n 'xda ',\n 'xda-'\n );",
" if (in_array($mobile_ua, $mobile_agents)) {\n $mobile_browser++;\n }",
" if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'opera mini') > 0) {\n $mobile_browser++;\n //Check for tablets on opera mini alternative headers\n $stock_ua = strtolower(\n isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) ? $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'] : (isset($_SERVER['HTTP_DEVICE_STOCK_UA']) ? $_SERVER['HTTP_DEVICE_STOCK_UA'] : '')\n );\n if (preg_match('/(tablet|ipad|playbook)|(android(?!.*mobile))/i', $stock_ua)) {\n $tablet_browser++;\n }\n }",
" if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') > 0) {\n $mobile_browser = 0;\n }",
" if ($tablet_browser > 0) {\n // do something for tablet devices\n// print 'is tablet';\n } elseif ($mobile_browser > 0) {\n // do something for mobile devices\n// print 'is mobile';\n } else {\n // do something for everything else\n// print 'is desktop';\n }",
" return $mobile_browser;\n }",
" /**\n * Warn admin of obsolete theme methods\n *\n * @param string $newcall\n * @param null $controller\n * @param null $actionview\n */\n public static function deprecated($newcall = \"expTheme::module()\", $controller = null, $actionview = null)\n {\n global $user;",
" if ($user->isAdmin() && DEVELOPMENT) {\n $trace = debug_backtrace();\n $caller = $trace[1];\n if (substr($caller['file'], -16, 6) == 'compat') {\n $caller = $trace[2];\n }\n $oldcall = $caller['function'];\n if ($caller['class'] == 'expTheme') {\n $oldcall = $caller['class'] . '::' . $oldcall;\n }\n $message = '<strong>' . $oldcall . '</strong> ' . gt(\n 'is deprecated and should be replaced by'\n ) . ' <strong>' . $newcall . '</strong>';\n if (!empty($controller)) {\n $message .= '<br>' . gt(\n 'for hard coded module'\n ) . ' - <strong>' . $controller . ' / ' . $actionview . '</strong>';\n }\n $message .= '<br>' . gt('line') . ' #' . $caller['line'] . ' ' . gt('of') . $caller['file'];\n $message .= ' <a class=\"helplink\" title=\"' . gt('Get Theme Update Help') . '\" href=\"' . help::makeHelpLink(\n 'theme_update'\n ) . '\" target=\"_blank\">' . gt('Help') . '</a>';\n flash('notice', $message);\n }\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expTheme\n *\n * @package Subsystems\n * @subpackage Subsystems\n */",
"/** @define \"BASE\" \"../../..\" */\nclass expTheme\n{",
" public static function initialize()\n {\n global $auto_dirs2;",
" // Initialize the theme subsystem 1.0 compatibility layer if requested\n\t\tif (defined('OLD_THEME_COMPATIBLE') && OLD_THEME_COMPATIBLE)\n require_once(BASE.'framework/core/compat/theme.php');",
" if (!defined('DISPLAY_THEME')) {\n /* exdoc\n * The directory and class name of the current active theme. This may be different\n * than the configured theme (DISPLAY_THEME_REAL) due to previewing.\n */\n define('DISPLAY_THEME', DISPLAY_THEME_REAL);\n }",
" if (!defined('THEME_ABSOLUTE')) {\n /* exdoc\n * The absolute path to the current active theme's files. This is similar to the BASE constant\n */\n define('THEME_ABSOLUTE', BASE . 'themes/' . DISPLAY_THEME . '/'); // This is the recommended way\n }",
" if (!defined('THEME_RELATIVE')) {\n /* exdoc\n * The relative web path to the current active theme. This is similar to the PATH_RELATIVE constant.\n */\n define('THEME_RELATIVE', PATH_RELATIVE . 'themes/' . DISPLAY_THEME . '/');\n }\n if (!defined('THEME_STYLE')) {\n /* exdoc\n * The name of the current active theme style.\n */\n define('THEME_STYLE', THEME_STYLE_REAL);\n }\n if (THEME_STYLE != '' && file_exists(BASE . 'themes/' . DISPLAY_THEME . '/config_' . THEME_STYLE . '.php')) {\n @include_once(BASE . 'themes/' . DISPLAY_THEME . '/config_' . THEME_STYLE . '.php');\n } elseif (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/config.php')) {\n @include_once(BASE . 'themes/' . DISPLAY_THEME . '/config.php');\n }\n if (!defined('BTN_SIZE')) {\n define('BTN_SIZE', 'medium');\n } // Awesome Button theme\n if (!defined('BTN_COLOR')) {\n define('BTN_COLOR', 'black');\n } // Awesome Button theme\n if (!defined('SWATCH')) {\n define('SWATCH', \"''\");\n } // Twitter Bootstrap theme",
" // add our theme folder into autoload to prioritize custom (theme) modules\n array_unshift($auto_dirs2, BASE . 'themes/' . DISPLAY_THEME . '/modules');\n }",
" public static function head($config = array())\n {\n echo self::headerInfo($config);\n self::advertiseRSS();\n }",
" public static function headerInfo($config)\n {\n global $sectionObj, $validateTheme, $head_config, $auto_dirs, $less_vars, $framework;",
" $validateTheme['headerinfo'] = true;\n // end checking for headerInfo",
" // globalize header configuration\n $head_config = $config;",
" // set theme framework type\n $framework = !empty($head_config['framework']) ? $head_config['framework'] : '';\n if (empty($framework)) {\n if (NEWUI) {\n $framework = 'newui';\n } else {\n $framework = 'yui'; // yui is the 2.x default framework\n }\n }\n expSession::set('framework', $framework);",
" // set the global less variables from the head config\n if (!empty($config['lessvars'])) {\n $less_vars = $config['lessvars'];\n } else {\n $less_vars = array();\n }",
" // check to see if we're in XHTML or HTML mode\n if (isset($config['xhtml']) && $config['xhtml'] == true) {\n define('XHTML', 1);\n define('XHTML_CLOSING', \"/\"); //default\n } else {\n define('XHTML', 0);\n define('XHTML_CLOSING', \"\");\n }",
" // load primer, lessprimer, link (css) and lesscss & normalize CSS files\n if (!empty($config['css_primer']) || !empty($config['lessprimer']) || !empty($config['link']) || !empty($config['lesscss']) || !empty($config['normalize'])) {\n expCSS::pushToHead($config);\n };",
" // default loading of primer CSS files to true if not set\n if (empty($config['css_primer']) && empty($config['lessprimer'])) {\n $head_config = array('css_primer' => true) + $head_config;\n }",
" // parse & load core css files\n if (isset($config['css_core'])) {\n if (is_array($config['css_core'])) {\n $corecss = implode(\",\", $config['css_core']);\n expCSS::pushToHead(\n array(\n \"corecss\" => $corecss\n )\n );\n }\n } else {\n $head_config['css_core'] = false;\n };",
" // default loading of view based CSS inclusion is true if not set\n if (!empty($config['css_links']) || !isset($config['css_links'])) {\n $head_config['css_links'] = true;\n }",
" // default theme css collecting is true if not set\n if (!empty($config['css_theme']) || !isset($config['css_theme'])) {\n $head_config['css_theme'] = true;\n }",
" if (empty($sectionObj)) {\n return false;\n }",
" // set up controls search order based on framework\n if (empty($head_config['framework'])) {\n $head_config['framework'] = '';\n }\n if (bs() || $framework == 'jquery') {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/jquery'\n );\n }\n if (bs(true)) {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/bootstrap'\n );\n }\n if (bs3(true)) {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/bootstrap3'\n );\n }\n if (newui()) {\n expCSS::pushToHead(array(\n \"lessprimer\"=>\"external/bootstrap3/less/newui.less\",\n// \"lessvars\"=>array(\n// 'swatch'=>'cerulean', // newui uses this swatch\n// 'themepath'=>'cerulean', // hack to prevent crash\n// ),\n ));\n if (!defined(\"BTN_SIZE\")) define(\"BTN_SIZE\", 'small');\n array_unshift($auto_dirs, BASE . 'framework/core/forms/controls/newui');\n }\n array_unshift($auto_dirs, BASE . 'themes/' . DISPLAY_THEME . '/controls');",
"// if (!expSession::is_set('framework') || expSession::get(\n// 'framework'\n// ) != $head_config['framework']\n// ) {\n// expSession::set('framework', $head_config['framework']);\n// }\n // mark the theme framework",
" $metainfo = self::pageMetaInfo();",
" // default to showing all meta tags unless specifically set to false\n if (!isset($config['meta']['content_type'])) {\n $config['meta']['content_type'] = true;\n }\n if (!isset($config['meta']['content_language'])) {\n $config['meta']['content_language'] = true;\n }\n if (!isset($config['meta']['generator'])) {\n $config['meta']['generator'] = true;\n }\n if (!isset($config['meta']['keywords'])) {\n $config['meta']['keywords'] = true;\n }\n if (!isset($config['meta']['description'])) {\n $config['meta']['description'] = true;\n }\n if (!isset($config['meta']['canonical'])) {\n $config['meta']['canonical'] = true;\n }\n if (!isset($config['meta']['rich'])) {\n $config['meta']['rich'] = true;\n }\n if (!isset($config['meta']['fb'])) {\n $config['meta']['fb'] = true;\n }\n if (!isset($config['meta']['tw'])) {\n $config['meta']['tw'] = true;\n }\n if (!isset($config['meta']['viewport'])) {\n $config['meta']['viewport'] = true;\n }\n if (!isset($config['meta']['ie_compat'])) {\n $config['meta']['ie_compat'] = true;\n }\n",
" $str = '';",
" if ($config['meta']['content_type']) {",
" $str .= '<meta charset=\"' . LANG_CHARSET . XHTML_CLOSING . '>' . \"\\n\"; // html5\n $str .= \"\\t\" . '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=' . LANG_CHARSET . '\" ' . XHTML_CLOSING . '>' . \"\\n\"; // html4 or xhtml?\n }\n if ($config['meta']['ie_compat']) {\n // turn off ie compatibility mode which will break the display\n $str .= \"\\t\" . '<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"' . XHTML_CLOSING . '>' . \"\\n\";\n }\n $str .= \"\\t\" . '<title>' . $metainfo['title'] . \"</title>\\n\";",
" $locale = strtolower(str_replace('_', '-', LOCALE));\n if ($config['meta']['content_language']) {",
" $str .= \"\\t\" . '<meta http-equiv=\"Content-Language\" content=\"' . $locale . '\" ' . XHTML_CLOSING . '>' . \"\\n\";",
" }\n if ($config['meta']['generator']) {\n $str .= \"\\t\" . '<meta name=\"Generator\" content=\"Exponent Content Management System - v' . expVersion::getVersion(\n true\n ) . self::getThemeDetails() . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['keywords']) {\n $str .= \"\\t\" . '<meta name=\"Keywords\" content=\"' . $metainfo['keywords'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['description']) {\n $str .= \"\\t\" . '<meta name=\"Description\" content=\"' . $metainfo['description'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['canonical'] && !empty($metainfo['canonical'])) {\n $str .= \"\\t\" . '<link rel=\"canonical\" href=\"' . $metainfo['canonical'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['rich'] && !empty($metainfo['rich'])) {\n $str .= \"\\t\" . $metainfo['rich'] . \"\\n\";\n }\n if ($config['meta']['fb'] && !empty($metainfo['fb'])) {\n foreach ($metainfo['fb'] as $key => $value) {\n if (!empty($value)) {\n $str .= \"\\t\" . '<meta property=\"og:' . $key . '\" content=\"' . $value . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n }\n }\n if ($config['meta']['tw'] && !empty($metainfo['tw'])) {\n foreach ($metainfo['tw'] as $key => $value) {\n if (!empty($value)) {\n $str .= \"\\t\" . '<meta name=\"twitter:' . $key . '\" content=\"' . $value . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n }\n }",
" if ($metainfo['noindex'] || $metainfo['nofollow']) {\n $str .= \"\\t\" . '<meta name=\"robots\" content=\"' . (!empty($metainfo['noindex']) ? 'noindex' : '') . ' ' . ($metainfo['nofollow'] ? 'nofollow' : '') . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" if (empty($config['viewport'])) {\n $viewport = 'width=device-width, user-scalable=yes';\n } else {\n if (!empty($config['viewport']['width'])) {\n $viewport = 'width=' . $config['viewport']['width'];\n } else {\n $viewport = 'width=device-width';\n }\n if (!empty($config['viewport']['height'])) {\n $viewport .= ', height=' . $config['viewport']['height'];\n }\n if (!empty($config['viewport']['initial_scale'])) {\n $viewport .= ' initial-scale=' . $config['viewport']['initial_scale'];\n// } else {\n// $viewport .= ', initial-scale=1.0';\n }\n if (!empty($config['viewport']['minimum_scale'])) {\n $viewport .= ', minimum-scale=' . $config['viewport']['minimum_scale'];\n }\n if (!empty($config['viewport']['maximum_scale'])) {\n $viewport .= ', maximum-scale=' . $config['viewport']['maximum_scale'];\n }\n if (!empty($config['viewport']['user_scalable'])) {\n $viewport .= ', user-scalable=' . ($config['viewport']['user_scalable'] ? \"yes\" : \"no\");\n } else {\n $viewport .= ', user-scalable=yes';\n }\n }\n if ($config['meta']['viewport']) {\n $str .= \"\\t\" . '<meta name=\"viewport\" content=\"' . $viewport . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" // favicon\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/favicon.png')) {\n $str .= \"\\t\" . '<link rel=\"icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/favicon.png\" type=\"image/png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n } elseif (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/favicon.ico')) {\n $str .= \"\\t\" . '<link rel=\"icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/favicon.ico\" type=\"image/x-icon\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n // touch icons\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/apple-touch-icon.png')) {\n $str .= \"\\t\" . '<link rel=\"apple-touch-icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/apple-touch-icon.png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/apple-touch-icon-precomposed.png')) {\n $str .= \"\\t\" . '<link rel=\"apple-touch-icon-precomposed\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/apple-touch-icon-precomposed.png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" // support for xmlrpc blog editors like Windows Live Writer, etc...\n if (USE_XMLRPC) {\n if (file_exists(BASE . 'rsd.xml')) {\n $str .= \"\\t\" . '<link rel=\"EditURI\" href=\"' . URL_FULL . 'rsd.xml\" type=\"application/rsd+xml\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n $str .= \"\\t\" . '<link rel=\"wlwmanifest\" href=\"' . URL_FULL . 'wlwmanifest.xml\" type=\"application/wlwmanifest+xml\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }",
" // when minification is used, the comment below gets replaced when the buffer is dumped\n $str .= '<!-- MINIFY REPLACE -->';",
" if ($config['meta']['ie_compat']) {\n // some IE 6 support\n $str .= \"\\t\" . '<!--[if IE 6]><style type=\"text/css\"> body { behavior: url(' . PATH_RELATIVE . 'external/csshover.htc); }</style><![endif]-->' . \"\\n\";",
" // css3 transform support for IE 6-8\n// $str .= \"\\t\" . '<!--[if lt IE 9]><style type=\"text/css\"> body { behavior: url(' . PATH_RELATIVE . 'external/ms-transform.htc); }</style><![endif]-->' . \"\\n\";",
" // html5 support for IE 6-8\n $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/html5shiv/html5shiv-shiv.js\"></script><![endif]-->' . \"\\n\";",
" // media css support for IE 6-8\n $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/Respond-1.4.2/dest/respond.min.js\"></script><![endif]-->' . \"\\n\";",
" // canvas support for IE 6-8 - now done by webshims\n// $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/excanvas.js\"></script><![endif]-->' . \"\\n\";",
" //Win 8/IE 10 work around\n $str .= \"\\t\" . '<!--[if IE 10]><link rel=\"stylesheet\" href=\"' . PATH_RELATIVE . 'external/ie10-viewport-bug-workaround.css\" type=\"text/css\"' . XHTML_CLOSING . '><![endif]-->' . \"\\n\";\n $str .= \"\\t\" . '<!--[if IE 10]><script src=\"' . PATH_RELATIVE . 'external/ie10-viewport-bug-workaround.js\"></script><![endif]-->' . \"\\n\";",
"",
" }",
" return $str;\n }",
" public static function foot($params = array())\n {\n self::footerInfo($params);\n }",
" public static function footerInfo($params = array())\n {\n // checks to see if the theme is calling footerInfo.\n global $validateTheme, $user, $jsForHead;",
" $validateTheme['footerinfo'] = true;",
" if (!empty($user->getsToolbar) && PRINTER_FRIENDLY != 1 && EXPORT_AS_PDF != 1 && !defined(\n 'SOURCE_SELECTOR'\n ) && empty($params['hide-slingbar'])\n ) {\n self::module(array(\"controller\" => \"administration\", \"action\" => \"toolbar\", \"source\" => \"admin\"));\n }",
" if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n echo '<div style=\"text-align:center\"><a href=\"', makeLink(\n array('module' => 'administration', 'action' => 'togglemobile')\n ), '\">', gt('View site in'), ' ', (MOBILE ? \"Classic\" : \"Mobile\"), ' ', gt('mode'), '</a></div>';\n }\n // load primer, lessprimer, & normalize CSS files",
" if (!empty($params['src']) || !empty($params['content']) || !empty($params['yui3mods']) || !empty($params['jquery']) || !empty($params['bootstrap'])) {\n expJavascript::pushToFoot($params);\n }\n self::processCSSandJS();\n echo expJavascript::footJavascriptOutput();",
" expSession::deleteVar(\n \"last_POST\"\n ); //ADK - putting this here so one form doesn't unset it before another form needs it.\n expSession::deleteVar(\n 'last_post_errors'\n );\n }",
" public static function pageMetaInfo()\n {\n global $sectionObj, $router;",
" $metainfo = array();\n if (self::inAction() && (!empty($router->url_parts[0]) && expModules::controllerExists(\n $router->url_parts[0]\n ))\n ) {\n// $classname = expModules::getControllerClassName($router->url_parts[0]);\n// $controller = new $classname();\n $controller = expModules::getController($router->url_parts[0]);\n $metainfo = $controller->metainfo();\n }\n if (empty($metainfo)) {\n $metainfo['title'] = empty($sectionObj->page_title) ? SITE_TITLE : $sectionObj->page_title;\n $metainfo['keywords'] = empty($sectionObj->keywords) ? SITE_KEYWORDS : $sectionObj->keywords;\n $metainfo['description'] = empty($sectionObj->description) ? SITE_DESCRIPTION : $sectionObj->description;\n $metainfo['canonical'] = empty($sectionObj->canonical) ? URL_FULL . $sectionObj->sef_name : $sectionObj->canonical;\n $metainfo['noindex'] = empty($sectionObj->noindex) ? false : $sectionObj->noindex;\n $metainfo['nofollow'] = empty($sectionObj->nofollow) ? false : $sectionObj->nofollow;\n }",
" // clean up meta tag output\n foreach ($metainfo as $key=>$value) {\n $metainfo[$key] = expString::parseAndTrim($value, true);\n }\n return $metainfo;\n }",
" public static function grabView($path, $filename)\n { //FIXME Not used\n $dirs = array(\n BASE . 'themes/' . DISPLAY_THEME . '/' . $path,\n BASE . 'framework/' . $path,\n );",
" foreach ($dirs as $dir) {\n if (file_exists($dir . $filename . '.tpl')) {\n return $dir . $form . '.tpl';\n } //FIXME $form is not set??\n }",
" return false;\n }",
" public static function grabViews($path, $filter = '')\n { //FIXME Not used\n $dirs = array(\n BASE . 'framework/' . $path,\n BASE . 'themes/' . DISPLAY_THEME . '/' . $path,\n );",
" $files = array();\n foreach ($dirs as $dir) {\n if (is_dir($dir) && is_readable($dir)) {\n $dh = opendir($dir);\n while (($filename = readdir($dh)) !== false) {\n $file = $dir . $filename;\n if (is_file($file)) { //FIXME this should be $file instead of $filename?\n $files[$filename] = $file;\n }\n }\n }\n }",
" return $files;\n }",
" public static function processCSSandJS()\n {\n global $jsForHead, $cssForHead;",
" // returns string, either minified combo url or multiple link and script tags\n $jsForHead = expJavascript::parseJSFiles();\n $cssForHead = expCSS::parseCSSFiles();\n }",
" public static function removeCss()\n {\n expFile::removeFilesInDirectory(BASE . 'tmp/minify'); // also clear the minify engine's cache\n return expFile::removeFilesInDirectory(BASE . 'tmp/css');\n }",
" public static function clearSmartyCache()\n {\n self::removeSmartyCache();\n flash('message', gt(\"Smarty Cache has been cleared\"));\n expHistory::back();\n }",
" public static function removeSmartyCache()\n {\n expFile::removeFilesInDirectory(BASE . 'tmp/cache'); // alt location for cache\n return expFile::removeFilesInDirectory(BASE . 'tmp/views_c');\n }",
" /** exdoc\n * Output <link /> elements for each RSS feed on the site\n *\n * @node Subsystems:Theme\n */\n public static function advertiseRSS()\n {\n if (defined('ADVERTISE_RSS') && ADVERTISE_RSS == 1) {\n echo \"\\t<!-- RSS Feeds -->\\r\\n\";\n $rss = new expRss();\n $feeds = $rss->getFeeds('advertise=1');\n foreach ($feeds as $feed) {\n if ($feed->enable_rss) {\n//\t\t\t\t\t$title = empty($feed->feed_title) ? 'RSS' : htmlspecialchars($feed->feed_title, ENT_QUOTES);\n $title = empty($feed->title) ? 'RSS - ' . ORGANIZATION_NAME : htmlspecialchars(\n $feed->title,\n ENT_QUOTES\n );\n $params['module'] = $feed->module;\n $params['src'] = $feed->src;\n//\t\t\t\t\techo \"\\t\".'<link rel=\"alternate\" type=\"application/rss+xml\" title=\"' . $title . '\" href=\"' . expCore::makeRSSLink($params) . \"\\\" />\\n\";\n //FIXME need to use $feed instead of $params\n echo \"\\t\" . '<link rel=\"alternate\" type=\"application/rss+xml\" title=\"', $title, '\" href=\"', expCore::makeLink(\n array('controller' => 'rss', 'action' => 'feed', 'title' => $feed->sef_url)\n ), \"\\\" />\\r\\n\";\n }\n }\n }\n }",
" public static function loadActionMaps()\n {\n if (is_readable(BASE . 'themes/' . DISPLAY_THEME . '/action_maps.php')) {\n return include(BASE . 'themes/' . DISPLAY_THEME . '/action_maps.php');\n } else {\n return array();\n }\n }",
" public static function satisfyThemeRequirements()\n {\n global $validateTheme;",
" if ($validateTheme['headerinfo'] == false) {\n echo \"<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>expTheme::head() is a required function in your theme. Please refer to the Exponent documentation for details:<br />\n\t\t\t<a href=\\\"http://docs.exponentcms.org/docs/current/header-info\\\" target=\\\"_blank\\\">http://docs.exponentcms.org/</a>\n\t\t\t</h1>\";\n die();\n }",
" if ($validateTheme['footerinfo'] == false) {\n echo \"<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>expTheme::foot() is a required function in your theme. Please refer to the Exponent documentation for details:<br />\n\t\t\t<a href=\\\"http://docs.exponentcms.org/docs/current/footer-info\\\" target=\\\"_blank\\\">http://docs.exponentcms.org/</a>\n\t\t\t</h1>\";\n die();\n }\n }",
" public static function getTheme()\n {\n global $sectionObj, $router;",
" // Grabs the action maps files for theme overrides\n $action_maps = self::loadActionMaps();",
"//\t\t$mobile = self::is_mobile();",
" // if we are in an action, get the particulars for the module\n if (self::inAction()) {\n// $module = isset($_REQUEST['module']) ? expString::sanitize(\n// $_REQUEST['module']\n// ) : expString::sanitize($_REQUEST['controller']);\n $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : $_REQUEST['controller'];\n }",
" // if we are in an action and have action maps to work with...\n if (self::inAction() && (!empty($action_maps[$module]) && (array_key_exists(\n $_REQUEST['action'],\n $action_maps[$module]\n ) || array_key_exists('*', $action_maps[$module])))\n ) {\n $actionname = array_key_exists($_REQUEST['action'], $action_maps[$module]) ? $_REQUEST['action'] : '*';\n $actiontheme = explode(\":\", $action_maps[$module][$actionname]);",
" // this resets the section object. we're suppressing notices with @ because getSectionObj sets constants, which cannot be changed\n // since this will be the second time Exponent calls this function on the page load.\n if (!empty($actiontheme[1])) {\n $sectionObj = @$router->getSectionObj($actiontheme[1]);\n }",
" if ($actiontheme[0] == \"default\" || $actiontheme[0] == \"Default\" || $actiontheme[0] == \"index\") {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n } elseif (is_readable(BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $actiontheme[0] . '.php')) {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $actiontheme[0] . '.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $actiontheme[0] . '.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $actiontheme[0] . '.php';\n }\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n } elseif ($sectionObj->subtheme != '' && is_readable(\n BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $sectionObj->subtheme . '.php'\n )\n ) {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $sectionObj->subtheme . '.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $sectionObj->subtheme . '.php';\n } elseif (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $sectionObj->subtheme . '.php';\n }\n } else {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n }\n if (!is_readable($theme)) {\n if (is_readable(BASE . 'framework/core/index.php')) {\n $theme = BASE . 'framework/core/index.php'; // use the fallback bare essentials theme\n }\n }\n return $theme;\n }",
" /** exdoc\n * @state <b>UNDOCUMENTED</b>\n *\n * @node Undocumented\n *\n * @param bool $include_default\n * @param string $theme\n *\n * @return array\n */\n public static function getSubthemes($include_default = true, $theme = DISPLAY_THEME)\n {\n $base = BASE . \"themes/$theme/subthemes\";\n // The array of subthemes. If the theme has no subthemes directory,\n // or the directory is not readable by the web server, this empty array\n // will be returned (Unless the caller wanted us to include the default layout)\n $subs = array();\n if ($include_default == true) {\n // Caller wants us to include the default layout.\n $subs[''] = DEFAULT_VIEW; // Not really its intended use, but it works.\n }",
" if (is_readable($base)) {\n // subthemes directory exists and is readable by the web server. Continue on.\n $dh = opendir($base);\n // Read out all entries in the THEMEDIR/subthemes directory\n while (($s = readdir($dh)) !== false) {\n if (substr($s, -4, 4) == '.php' && substr($s, 0, 1) != '_' && is_file($base . \"/$s\") && is_readable(\n $base . \"/$s\"\n )\n ) {\n // Only readable .php files are allowed to be subtheme files.\n $subs[substr($s, 0, -4)] = substr($s, 0, -4);\n }\n }\n // Sort the subthemes by their keys (which are the same as the values)\n // using a natural string comparison function (PHP built-in)\n uksort($subs, 'strnatcmp');\n }\n return $subs;\n }",
" public static function getPrinterFriendlyTheme()\n {\n global $framework;",
" $common = 'framework/core/printer-friendly.php';\n $theme = 'themes/' . DISPLAY_THEME . '/printer-friendly.php';\n if (empty($framework)) {\n $fw = expSession::get('framework');\n $fwprint = 'framework/core/printer-friendly.' . $fw . '.php';\n } else {\n $fwprint = 'framework/core/printer-friendly.' . $framework . '.php';\n }",
" if (is_readable($theme)) {\n return $theme;\n } elseif (is_readable($fwprint)) {\n return $fwprint;\n } elseif (is_readable($common)) {\n return $common;\n } else {\n return null;\n }\n }",
" /** exdoc\n * Checks to see if the page is currently in an action. Useful only if the theme does not use the self::main() function\n * Returns whether or not an action should be run.\n *\n * @node Subsystems:Theme\n * @return boolean\n */\n public static function inPreview()\n {\n $level = 99;\n if (expSession::is_set('uilevel')) {\n $level = expSession::get('uilevel');\n }\n return ($level == UILEVEL_PREVIEW);\n }",
" public static function inAction($action=null)\n {\n return (isset($_REQUEST['action']) && (isset($_REQUEST['module']) || isset($_REQUEST['controller'])) && (!isset($action) || ($action == $_REQUEST['action'])));\n }",
" public static function reRoutActionTo($theme = \"\")\n {\n if (empty($theme)) {\n return false;\n }\n if (self::inAction()) {\n include_once(BASE . \"themes/\" . DISPLAY_THEME . \"/\" . $theme);\n exit;\n }\n return false;\n }",
" /** exdoc\n * Runs the appropriate action, by looking at the $_REQUEST variable.\n *\n * @node Subsystems:Theme\n * @return bool\n */\n public static function runAction()\n {\n global $user;",
" if (self::inAction()) {\n if (!AUTHORIZED_SECTION && !expJavascript::inAjaxAction())\n notfoundController::handle_not_authorized();\n//\t\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\t\techo \"<a href='\".$config['mainpage'].\"'>\".$config['backlinktext'].\"</a><br /><br />\";\n//\t\t\t}",
" //FIXME clean our passed parameters\n// foreach ($_REQUEST as $key=>$param) { //FIXME need array sanitizer\n// $_REQUEST[$key] = expString::sanitize($param);\n// }\n// if (empty($_REQUEST['route_sanitized'])) {\n if (!$user->isAdmin())\n expString::sanitize($_REQUEST);\n// } elseif (empty($_REQUEST['array_sanitized'])) {\n// $tmp =1; //FIXME we've already sanitized at this point\n// } else {\n// $tmp =1; //FIXME we've already sanitized at this point\n// }",
" //FIXME: module/controller glue code..remove ASAP\n $module = empty($_REQUEST['controller']) ? $_REQUEST['module'] : $_REQUEST['controller'];\n//\t\t\t$isController = expModules::controllerExists($module);",
"//\t\t\tif ($isController && !isset($_REQUEST['_common'])) {\n if (expModules::controllerExists($module)) {\n // this is being set just in case the url said module=modname instead of controller=modname\n // with SEF URls turned on its not really an issue, but with them off some of the links\n // aren't being made correctly...depending on how the {link} plugin was used in the view.\n $_REQUEST['controller'] = $module;",
"// if (!isset($_REQUEST['action'])) $_REQUEST['action'] = 'showall';\n// if (isset($_REQUEST['view']) && $_REQUEST['view'] != $_REQUEST['action']) {\n// $test = explode('_',$_REQUEST['view']);\n// if ($test[0] != $_REQUEST['action']) {\n// $_REQUEST['view'] = $_REQUEST['action'].'_'.$_REQUEST['view'];\n// }\n// } elseif (!empty($_REQUEST['action'])) {\n// $_REQUEST['view'] = $_REQUEST['action'];\n// } else {\n// $_REQUEST['view'] = 'showall';\n// }",
" echo renderAction($_REQUEST);\n//\t\t\t} else {\n//\t\t\t\tif ($_REQUEST['action'] == 'index') {\n//\t\t\t\t\t$view = empty($_REQUEST['view']) ? 'Default' : $_REQUEST['view'];\n//\t\t\t\t\t$title = empty($_REQUEST['title']) ? '' : expString::sanitize($_REQUEST['title']);\n//\t\t\t\t\t$src = empty($_REQUEST['src']) ? null : expString::sanitize($_REQUEST['src']);\n//\t\t\t\t\tself::showModule($module, $view, $title, $src);\n//\t\t\t\t\treturn true;\n//\t\t\t\t}\n//\n//\t\t\t\tglobal $db, $user; // these globals are needed for the old school actions which are loaded\n//\n//\t\t\t\t// the only reason we should have a controller down in this section is if we are hitting a common action like\n//\t\t\t\t// userperms or groupperms...deal with it.\n////\t\t\t\t$loc = new stdClass();\n////\t\t\t\t$loc->mod = $module;\n////\t\t\t\t$loc->src = (isset($_REQUEST['src']) ? expString::sanitize($_REQUEST['src']) : \"\");\n////\t\t\t\t$loc->int = (!empty($_REQUEST['int']) ? strval(intval($_REQUEST['int'])) : \"\");\n// $loc = expCore::makeLocation($module,(isset($_REQUEST['src']) ? expString::sanitize($_REQUEST['src']) : \"\"),(!empty($_REQUEST['int']) ? strval(intval($_REQUEST['int'])) : \"\"));\n//\t\t\t\t//if (isset($_REQUEST['act'])) $loc->act = $_REQUEST['act'];\n//\n//\t\t\t\tif (isset($_REQUEST['_common'])) {\n//\t\t\t\t\t$actfile = \"/common/actions/\" . $_REQUEST['action'] . \".php\";\n//\t\t\t\t} else {\n//\t\t\t\t\t$actfile = \"/\" . $module . \"/actions/\" . $_REQUEST['action'] . \".php\";\n//\t\t\t\t}\n//\n//\t\t\t\tif (is_readable(BASE.\"themes/\".DISPLAY_THEME.\"/modules\".$actfile)) {\n// include_once(BASE.\"themes/\".DISPLAY_THEME.\"/modules\".$actfile);\n////\t\t\t\t} elseif (is_readable(BASE.'framework/modules-1/'.$actfile)) {\n////\t\t\t\t\tinclude_once(BASE.'framework/modules-1/'.$actfile);\n//\t\t\t\t} else {\n//\t\t\t\t\techo SITE_404_HTML . '<br /><br /><hr size=\"1\" />';\n//\t\t\t\t\techo sprintf(gt('No such module action').' : %1 : %2',strip_tags($module),strip_tags($_REQUEST['action']));\n//\t\t\t\t\techo '<br />';\n//\t\t\t\t}\n }\n }\n return false;\n }",
" public static function showAction($module, $action, $src = \"\", $params = array())\n { //FIXME only used by smarty functions, old school?\n global $user;",
" $loc = expCore::makeLocation($module, (isset($src) ? $src : \"\"), (isset($int) ? $int : \"\"));",
" $actfile = \"/\" . $module . \"/actions/\" . $action . \".php\";\n if (isset($params)) {\n// foreach ($params as $key => $value) { //FIXME need array sanitizer\n//// $_GET[$key] = $value;\n// $_GET[$key] = expString::sanitize($value);\n// }\n if (!$user->isAdmin())\n expString::sanitize($_GET);\n }\n //if (isset($['_common'])) $actfile = \"/common/actions/\" . $_REQUEST['action'] . \".php\";",
" if (is_readable(BASE . \"themes/\" . DISPLAY_THEME . \"/modules\" . $actfile)) {\n include(BASE . \"themes/\" . DISPLAY_THEME . \"/modules\" . $actfile);\n// \t\t} elseif (is_readable(BASE.'framework/modules-1/'.$actfile)) {\n// \t\t\tinclude(BASE.'framework/modules-1/'.$actfile);\n } else {\n notfoundController::handle_not_found();\n echo '<br /><hr size=\"1\" />';\n echo sprintf(\n gt('No such module action') . ' : %1 : %2',\n strip_tags($_REQUEST['module']),\n strip_tags($_REQUEST['action'])\n );\n echo '<br />';\n }\n }",
" /** exdoc\n * Redirect User to Default Section\n *\n * @node Subsystems:Theme\n */\n public static function goDefaultSection()\n {\n $last_section = expSession::get(\"last_section\");\n if (defined('SITE_DEFAULT_SECTION') && SITE_DEFAULT_SECTION != $last_section) {\n header(\"Location: \" . URL_FULL . \"index.php?section=\" . SITE_DEFAULT_SECTION);\n exit();\n } else {\n global $db;",
" $section = $db->selectObject(\"section\", \"public = 1 AND active = 1\"); // grab first section, go there\n if ($section) {\n header(\"Location: \" . URL_FULL . \"index.php?section=\" . $section->id);\n exit();\n } else {\n notfoundController::handle_not_found();\n }\n }\n }",
" /** exdoc\n * Takes care of all the specifics of either showing a sectional container or running an action.\n *\n * @node Subsystems:Theme\n */\n public static function main()\n {\n global $db;",
" if ((!defined('SOURCE_SELECTOR') || SOURCE_SELECTOR == 1)) {\n $last_section = expSession::get(\"last_section\");\n $section = $db->selectObject(\"section\", \"id=\" . $last_section);\n // View authorization will be taken care of by the runAction and mainContainer functions\n if (self::inAction()) {\n if (!PRINTER_FRIENDLY && !EXPORT_AS_PDF)\n echo show_msg_queue();\n self::runAction();\n } else {\n if ($section == null) {\n self::goDefaultSection();\n } else {\n if (!PRINTER_FRIENDLY && !EXPORT_AS_PDF)\n echo show_msg_queue();\n self::mainContainer();\n }\n }\n// } else {\n// if (isset($_REQUEST['module'])) {\n// include_once(BASE.\"framework/modules/container/orphans_content.php\"); //FIXME not sure how to convert this yet\n// } else {\n// echo gt('Select a module');\n// }\n }\n }",
" /** exdoc\n * Useful only if theme does not use self::main\n *\n * @return void\n * @internal param bool $public Whether or not the page is public.\n * @node Subsystems:Theme\n */\n public static function mainContainer()\n {\n global $router;",
" if (!AUTHORIZED_SECTION) {\n // Set this so that a login on an Auth Denied page takes them back to the previously Auth-Denied page\n //\t\t\texpHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);\n expHistory::set('manageable', $router->params);\n notfoundController::handle_not_authorized();\n return;\n }",
" if (PUBLIC_SECTION) {\n //\t\t\texpHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);\n expHistory::set('viewable', $router->params);\n } else {\n //\t\t\texpHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);\n expHistory::set('manageable', $router->params);\n }",
" # if (expSession::is_set(\"themeopt_override\")) {\n # $config = expSession::get(\"themeopt_override\");\n// \t\t\tself::showSectionalModule(\"containermodule\",\"Default\",\"\",\"@section\",false,true); //FIXME change to showModule call\n self::module(\n array(\n \"controller\" => \"container\",\n \"action\" => \"showall\",\n \"view\" => \"showall\",\n \"source\" => \"@section\",\n \"scope\" => \"sectional\"\n )\n );",
" # } else {\n # self::showSectionalModule(\"containermodule\",\"Default\",\"\",\"@section\");\n # }\n }",
" /** exdoc\n * Calls the necessary methods to show a specific module, in a section-sensitive way.\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param bool $hide_menu\n *\n * @return void\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showSectionalModule(\n $module,\n $view,\n $title,\n $prefix = null,\n $pickable = false,\n $hide_menu = false\n ) {\n global $module_scope;",
" self::deprecated('expTheme::module()', $module, $view);\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if ($prefix == null) {\n $prefix = \"@section\";\n }",
" $src = $prefix;",
"//\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\tif (in_array($module,$config['ignore_mods'])) return;\n//\t\t\t$src = $config['src_prefix'].$prefix; //FIXME there is no such config index\n//\t\t\t$section = null;\n//\t\t} else {\n global $sectionObj;",
" //$last_section = expSession::get(\"last_section\");\n //$section = $db->selectObject(\"section\",\"id=\".$last_section);\n $src .= $sectionObj->id;\n//\t\t}\n $module_scope[$src][$module] = new stdClass();\n $module_scope[$src][$module]->scope = 'sectional';",
" self::showModule($module, $view, $title, $src, false, null, $hide_menu);\n }",
" /** exdoc\n * Calls the necessary methods to show a specific module in such a way that the current\n * section displays the same content as its top-level parent and all of the top-level parent's\n * children, grand-children, grand-grand-children, etc.\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param bool $hide_menu\n *\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showTopSectionalModule(\n $module,\n $view,\n $title,\n $prefix = null,\n $pickable = false,\n $hide_menu = false\n ) {\n global $db, $module_scope, $sectionObj;",
" self::deprecated('expTheme::module()', $module, $view);\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if ($prefix == null) {\n $prefix = \"@section\";\n }\n//\t\t$last_section = expSession::get(\"last_section\");\n//\t\t$section = $db->selectObject(\"section\",\"id=\".$last_section);\n $section = $sectionObj; //FIXME let's try $sectionObj instead of last_section\n// $module_scope[$prefix.$section->id][$module] = new stdClass();\n $module_scope[$prefix . $section->id][$module]->scope = 'top-sectional';\n // Loop until we find the top level parent.\n while ($section->parent != 0) {\n $section = $db->selectObject(\"section\", \"id=\" . $section->parent);\n }",
" self::showModule($module, $view, $title, $prefix . $section->id, false, null, $hide_menu);\n }",
" /** exdoc\n * Calls the necessary methods to show a specific controller, in a section-sensitive way.\n *\n * @param array $params\n *\n * @internal param string $module The classname of the module to display\n * @internal param string $view The name of the view to display the module with\n * @internal param string $title The title of the module (support is view-dependent)\n * @internal param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @internal param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @internal param bool $hide_menu\n * @return void\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showSectionalController($params = array())\n { //FIXME not used in base system (custom themes?)\n global $sectionObj, $module_scope;",
" $src = \"@section\" . $sectionObj->id;\n $params['source'] = $src;\n// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])] = new stdClass();\n $module_scope[$params['source']][(isset($params['module']) ? $params['module'] : $params['controller'])]->scope = 'sectional';\n $module = !empty($params['module']) ? $params['module'] : $params['controller'];\n $view = !empty($params['action']) ? $params['action'] : $params['view'];\n self::deprecated('expTheme::module()', $module, $view);\n self::module($params);\n }",
" /**\n * @deprecated 2.2.1\n */\n public static function showController($params = array())\n {\n $module = !empty($params['module']) ? $params['module'] : $params['controller'];\n $view = !empty($params['action']) ? $params['action'] : $params['view'];\n self::deprecated('expTheme::module()', $module, $view);\n self::module($params);\n// global $sectionObj, $db, $module_scope;\n// if (empty($params)) {\n//\t return false;\n// } elseif (isset($params['module'])) {\n// self::module($params);\n// } else if (isset($params['controller'])) {\n//\t\t\t$params['view'] = isset($params['view']) ? $params['view'] : $params['action'];\n//\t\t\t$params['title'] = isset($params['moduletitle']) ? $params['moduletitle'] : '';\n//\t\t\t$params['chrome'] = (!isset($params['chrome']) || (isset($params['chrome'])&&empty($params['chrome']))) ? true : false;\n//\t\t\t$params['scope'] = isset($params['scope']) ? $params['scope'] : 'global';\n//\n//\t\t\t// set the controller and action to the one called via the function params\n//\t\t\t$requestvars = isset($params['params']) ? $params['params'] : array();\n//\t\t\t$requestvars['controller'] = $params['controller'];\n//\t\t\t$requestvars['action'] = isset($params['action']) ? $params['action'] : null;\n//\t\t\t$requestvars['view'] = isset($params['view']) ? $params['view'] : null;\n//\n//\t\t\t// figure out the scope of the module and set the source accordingly\n//\t\t\tif ($params['scope'] == 'global') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : null;\n//\t\t\t} elseif ($params['scope'] == 'sectional') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : '@section';\n//\t\t\t\t$params['source'] .= $sectionObj->id;\n//\t\t\t} elseif ($params['scope'] == 'top-sectional') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : '@section';\n//\t\t\t\t$section = $sectionObj;\n//\t\t\t\twhile ($section->parent > 0) $section = $db->selectObject(\"section\",\"id=\".$section->parent);\n//\t\t\t\t$params['source'] .= $section->id;\n//\t\t\t}\n//// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])] = new stdClass();\n// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])]->scope = $params['scope'];\n//\t\t\tself::showModule(expModules::getControllerClassName($params['controller']),$params['view'],$params['title'],$params['source'],false,null,$params['chrome'],$requestvars);\n// }\n// return false;\n }",
" /**\n * Entry point for displaying modules\n * Packages $params for calling showModule method\n *\n * @param array $params list of module parameters\n *\n * @return bool\n */\n public static function module($params)\n {\n global $db, $module_scope, $sectionObj;",
" if (empty($params)) {\n return false;\n } elseif (isset($params['module']) && expModules::controllerExists($params['module'])) {\n // hack to add compatibility for modules converted to controllers, but still hard-coded the old way\n $params['controller'] = $params['module'];\n unset($params['module']);\n }\n if (!isset($params['action'])) {\n $params['action'] = 'showall';\n }\n if (isset($params['view']) && $params['view'] != $params['action']) {\n $test = explode('_', $params['view']);\n if ($test[0] != $params['action']) {\n $params['view'] = $params['action'] . '_' . $params['view'];\n }\n } elseif (!empty($params['action'])) {\n $params['view'] = $params['action'];\n } else {\n $params['view'] = 'showall';\n }\n//\t if (isset($params['controller'])) {\n $controller = expModules::getModuleName($params['controller']);\n// $params['view'] = isset($params['view']) ? $params['view'] : $params['action'];\n $params['title'] = isset($params['moduletitle']) ? $params['moduletitle'] : '';\n $params['chrome'] = (!isset($params['chrome']) || (isset($params['chrome']) && empty($params['chrome']))) ? true : false;\n $params['scope'] = isset($params['scope']) ? $params['scope'] : 'global';",
" // set the controller and action to the one called via the function params\n $requestvars = isset($params['params']) ? $params['params'] : array();\n $requestvars['controller'] = $controller;\n $requestvars['action'] = isset($params['action']) ? $params['action'] : null;\n $requestvars['view'] = isset($params['view']) ? $params['view'] : null;",
" // figure out the scope of the module and set the source accordingly\n if ($params['scope'] == 'global') {\n $params['source'] = isset($params['source']) ? $params['source'] : null;\n } elseif ($params['scope'] == 'sectional') {\n $params['source'] = isset($params['source']) ? $params['source'] : '@section';\n $params['source'] .= $sectionObj->id;\n } elseif ($params['scope'] == 'top-sectional') {\n $params['source'] = isset($params['source']) ? $params['source'] : '@section';\n $section = $sectionObj;\n while ($section->parent > 0) {\n $section = $db->selectObject(\"section\", \"id=\" . $section->parent);\n }\n $params['source'] .= $section->id;\n }\n $module_scope[$params['source']][$controller] = new stdClass();\n $module_scope[$params['source']][$controller]->scope = $params['scope'];\n// self::showModule(expModules::getControllerClassName($params['controller']),$params['view'],$params['title'],$params['source'],false,null,$params['chrome'],$requestvars);\n return self::showModule(\n $controller,\n $params['view'],\n $params['title'],\n $params['source'],\n false,\n null,\n $params['chrome'],\n $requestvars\n );\n// } elseif (isset($params['module'])) {\n// $module = expModules::getModuleClassName($params['module']);\n// $moduletitle = (isset($params['moduletitle'])) ? $params['moduletitle'] : \"\";\n// $source = (isset($params['source'])) ? $params['source'] : \"\";\n// $chrome = (isset($params['chrome'])) ? $params['chrome'] : false;\n// $scope = (isset($params['scope'])) ? $params['scope'] : \"global\";\n//\n// if ($scope==\"global\") {\n// self::showModule($module,$params['view'],$moduletitle,$source,false,null,$chrome);\n// }\n// if ($scope==\"top-sectional\") {\n//// self::showTopSectionalModule($params['module'].\"module\", //module\n//// $params['view'], //view\n//// $moduletitle, // Title\n//// $source, // source\n//// false, // used to apply to source picker. does nothing now.\n//// $chrome // Show chrome\n//// );\n// if ($source == null) $source = \"@section\";\n// //FIXME - $section might be empty! We're getting it from last_section instead of sectionObj??\n//// $last_section = expSession::get(\"last_section\");\n//// $section = $db->selectObject(\"section\",\"id=\".$last_section);\n// $section = $sectionObj; //FIXME let's try $sectionObj instead of last_section\n// // Loop until we find the top level parent.\n// while ($section->parent != 0) $section = $db->selectObject(\"section\",\"id=\".$section->parent);\n// $module_scope[$source.$section->id][$module]= new stdClass();\n// $module_scope[$source.$section->id][$module]->scope = 'top-sectional';\n// self::showModule($module,$params['view'],$moduletitle,$source.$section->id,false,null,$chrome);\n// }\n// if ($scope==\"sectional\") {\n//// self::showSectionalModule($params['module'].\"module\", //module\n//// $params['view'], //view\n//// $moduletitle, // title\n//// $source, // source/prefix\n//// false, // used to apply to source picker. does nothing now.\n//// $chrome // Show chrome\n//// );\n// if ($source == null) $source = \"@section\";\n// $src = $source;\n// $src .= $sectionObj->id;\n// $module_scope[$src][$module] = new stdClass();\n// $module_scope[$src][$module]->scope = 'sectional';\n// self::showModule($module,$params['view'],$moduletitle,$src,false,null,$chrome);\n// }\n// }\n// return false;\n }",
" /** exdoc\n * Calls the necessary methods to show a specific module - NOT intended to be called directly from theme\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $source The source of the module.\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param null $section\n * @param bool $hide_menu\n * @param array $params\n *\n * @return void\n * @node Subsystems:Theme\n */\n public static function showModule(\n $module,\n $view = \"Default\",\n $title = \"\",\n $source = null,\n $pickable = false,\n $section = null,\n $hide_menu = false,\n $params = array()\n ) {\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if (!AUTHORIZED_SECTION && $module != 'navigation' && $module != 'login') {\n return;\n }",
" global $db, $sectionObj, $module_scope;",
" // Ensure that we have a section\n //FJD - changed to $sectionObj\n if ($sectionObj == null) {\n $section_id = expSession::get('last_section');\n if ($section_id == null) {\n $section_id = SITE_DEFAULT_SECTION;\n }\n $sectionObj = $db->selectObject('section', 'id=' . $section_id);\n //$section->id = $section_id;\n }\n if ($module == \"login\" && defined('PREVIEW_READONLY') && PREVIEW_READONLY == 1) {\n return;\n }",
"//\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\tif (in_array($module,$config['ignore_mods'])) return;\n//\t\t}\n if (empty($params['action'])) {\n $params['action'] = $view;\n }\n $loc = expCore::makeLocation($module, $source . \"\");",
" if (empty($module_scope[$source][$module]->scope)) {\n $module_scope[$source][$module] = new stdClass();\n $module_scope[$source][$module]->scope = 'global';\n }\n // make sure we've added this module to the sectionref table\n $secref = $db->selectObject(\"sectionref\", \"module='$module' AND source='\" . $loc->src . \"'\");\n if ($secref == null) {\n $secref = new stdClass();\n $secref->module = $module;\n $secref->source = $loc->src;\n $secref->internal = \"\";\n $secref->refcount = 1000; // only hard-coded modules should be missing\n if ($sectionObj != null) {\n $secref->section = $sectionObj->id;\n }\n//\t\t\t $secref->is_original = 1;\n $db->insertObject($secref, 'sectionref');\n// } elseif ($sectionObj != null && $secref->section != $sectionObj->id) {\n// $secref->section = $sectionObj->id;\n// $db->updateObject($secref, 'sectionref');\n }\n // add (hard-coded) modules to the container table, nested containers added in container showall method??\n $container = $db->selectObject('container', \"internal='\" . serialize($loc) . \"'\");\n if (empty($container->id)) {\n //if container isn't here already, then create it...hard-coded from theme template\n $newcontainer = new stdClass();\n $newcontainer->internal = serialize($loc);\n $newcontainer->external = serialize(null);\n $newcontainer->title = $title;\n $newcontainer->view = $view;\n $newcontainer->action = $params['action'];\n $newcontainer->id = $db->insertObject($newcontainer, 'container');\n }\n if (empty($title) && !empty($container->title)) {\n $title = $container->title;\n }\n//\t\t$iscontroller = expModules::controllerExists($module);",
" if (defined('SELECTOR') && call_user_func(array(expModules::getModuleClassName($module), \"hasSources\"))) {\n containerController::wrapOutput($module, $view, $loc, $title);\n } else {\n//\t\t\tif (is_callable(array($module,\"show\")) || $iscontroller) {\n if (expModules::controllerExists($module)) {\n // FIXME: we are checking here for a new MVC style controller or an old school module. We only need to perform\n // this check until we get the old modules all gone...until then we have the check and a lot of code duplication\n // in the if blocks below...oh well, that's life.\n//\t\t\t\tif (!$iscontroller) {\n////\t\t\t\t\tif ((!$hide_menu && $loc->mod != \"containermodule\" && (call_user_func(array($module,\"hasSources\")) || $db->tableExists($loc->mod.\"_config\")))) {\n// if ((!$hide_menu && (call_user_func(array($module,\"hasSources\")) || $db->tableExists($loc->mod.\"_config\")))) {\n// $container = new stdClass(); //php 5.4\n//\t\t\t\t\t\t$container->permissions = array(\n//\t\t\t\t\t\t\t'manage'=>(expPermissions::check('manage',$loc) ? 1 : 0),\n//\t\t\t\t\t\t\t'configure'=>(expPermissions::check('configure',$loc) ? 1 : 0)\n//\t\t\t\t\t\t);\n//\n//\t\t\t\t\t\tif ($container->permissions['manage'] || $container->permissions['configure']) {\n//\t\t\t\t\t\t\t$container->randomizer = mt_rand(1,ceil(microtime(1)));\n//\t\t\t\t\t\t\t$container->view = $view;\n//\t\t\t\t\t\t\t$container->info['class'] = expModules::getModuleClassName($loc->mod);\n//\t\t\t\t\t\t\t$container->info['module'] = call_user_func(array($module,\"name\"));\n//\t\t\t\t\t\t\t$container->info['source'] = $loc->src;\n// $container->info['scope'] = $module_scope[$source][$module]->scope;\n//\t\t\t\t\t\t\t$container->info['hasConfig'] = $db->tableExists($loc->mod.\"_config\");\n////\t\t\t\t\t\t\t$template = new template('containermodule','_hardcoded_module_menu',$loc);\n//// $template = new template('containerController','_hardcoded_module_menu',$loc,false,'controllers');\n// $c2 = new containerController();\n// $template = expTemplate::get_template_for_action($c2,'_hardcoded_module_menu');\n//\t\t\t\t\t\t\t$template->assign('container', $container);\n//\t\t\t\t\t\t\t$template->output();\n//\t\t\t\t\t\t}\n//\t\t\t\t\t}\n//\t\t\t\t} else {\n // if we hit here we're dealing with a hard-coded controller...not a module\n if (!$hide_menu && $loc->mod != \"container\") {\n $controller = expModules::getController($module);\n// $controller = expModules::getControllerClassName($module);\n $hccontainer = new stdClass(); //php 5.4\n $hccontainer->permissions = array(\n 'manage' => (expPermissions::check('manage', $loc) ? 1 : 0),\n 'configure' => (expPermissions::check('configure', $loc) ? 1 : 0)\n );",
" if ($hccontainer->permissions['manage'] || $hccontainer->permissions['configure']) {\n $hccontainer->randomizer = mt_rand(1, ceil(microtime(1)));\n $hccontainer->view = $view;\n $hccontainer->action = $params['action'];\n $hccontainer->info['class'] = expModules::getModuleClassName($loc->mod);\n $hccontainer->info['module'] = $controller->displayname();\n// $hccontainer->info['module'] = $controller::displayname();\n $hccontainer->info['source'] = $loc->src;\n $hccontainer->info['scope'] = $module_scope[$source][$module]->scope;\n//\t\t\t\t\t\t\t$hccontainer->info['hasConfig'] = true;\n//\t\t\t\t\t\t\t$template = new template('containermodule','_hardcoded_module_menu',$loc);\n//\t\t\t\t\t\t\t$template = new template('containerController','_hardcoded_module_menu',$loc,false,'controllers');\n $c2 = new containerController();\n $template = expTemplate::get_template_for_action($c2, '_hardcoded_module_menu');\n $template->assign('container', $hccontainer);\n $template->output();\n }\n }\n//\t\t\t\t}",
"//\t\t\t\tif ($iscontroller) {\n $params['src'] = $loc->src;\n $params['controller'] = $module;\n $params['view'] = $view;\n $params['moduletitle'] = $title;\n return renderAction($params);\n//\t\t\t\t} else {\n//\t\t\t\t\tcall_user_func(array($module,\"show\"),$view,$loc,$title);\n//\t\t\t\t}\n } else {\n echo sprintf(gt('The module \"%s\" was not found in the system.'), $module);\n return false;\n }\n }\n }",
" public static function getThemeDetails() {\n $theme_file = DISPLAY_THEME;\n if (is_readable(BASE.'themes/'.$theme_file.'/class.php')) {\n // Need to avoid the duplicate theme problem.\n if (!class_exists($theme_file)) {\n include_once(BASE.'themes/'.$theme_file.'/class.php');\n }",
" if (class_exists($theme_file)) {\n // Need to avoid instantiating non-existent classes.\n $theme = new $theme_file();\n return ' ' . gt('using') . ' ' . $theme->name() . ' ' . gt('by') . ' ' . $theme->author();\n }\n }\n return '';\n }",
" /**\n * Return the color style for the current framework\n *\n * @param $color\n *\n * @return mixed|string\n */\n public static function buttonColor($color = null)\n {\n $colors = array(\n 'green' => 'btn-success',\n 'blue' => 'btn-primary',\n 'red' => 'btn-danger',\n 'magenta' => 'btn-danger',\n 'orange' => 'btn-warning',\n 'yellow' => 'btn-warning',\n 'grey' => 'btn-default',\n 'purple' => 'btn-info',\n 'black' => 'btn-inverse',\n 'pink' => 'btn-danger',\n );\n if (bs()) {\n if (!empty($colors[$color])) { // awesome to bootstrap button conversion\n $found = $colors[$color];\n } else {\n $found = 'btn-default';\n }\n } else {\n $found = array_search($color, $colors); // bootstrap to awesome button conversion?\n if (empty($found)) {\n $found = $color;\n } else {\n $found = BTN_COLOR;\n }\n }\n return $found;\n }",
" /**\n * Return the button size for the current framework\n *\n * @param $size\n *\n * @return mixed|string\n */\n public static function buttonSize($size = null)\n {\n if (bs2()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $btn_size = ''; // actually default size, NOT true bootstrap large\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $btn_size = 'btn-mini';\n } else { // medium\n $btn_size = 'btn-small';\n }\n return $btn_size;\n } elseif (bs3()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $btn_size = 'btn-lg';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $btn_size = 'btn-sm';\n } elseif (BTN_SIZE == 'extrasmall' || (!empty($size) && $size == 'extrasmall')) {\n $btn_size = 'btn-xs';\n } else { // medium\n $btn_size = '';\n }\n return $btn_size;\n } else {\n if (empty($size)) {\n $size = BTN_SIZE;\n }\n return $size;\n }\n }",
" /**\n * Return the button color and size style for the current framework\n *\n * @param null $color\n * @param $size\n *\n * @return mixed|string\n */\n public static function buttonStyle($color = null, $size = null)\n {\n if (bs()) {\n $btn_class = 'btn ' . self::buttonColor($color) . ' ' . self::buttonSize($size);\n } else {\n $btn_size = !empty($size) ? $size : BTN_SIZE;\n $btn_color = !empty($color) ? $color : BTN_COLOR;\n $btn_class = \"awesome \" . $btn_size . \" \" . $btn_color;\n }\n return $btn_class;\n }",
" /**\n * Return the icon associated for the current frameowrk\n *\n * @param $class\n *\n * @return stdClass|string\n */\n public static function buttonIcon($class, $size=null)\n {\n $btn_type = '';\n if (bs2()) {\n switch ($class) {\n case 'delete' :\n case 'delete-title' :\n $class = \"remove-sign\";\n $btn_type = \"btn-danger\"; // red\n break;\n case 'add' :\n case 'add-title' :\n case 'add-body' :\n case 'switchtheme add' :\n $class = \"plus-sign\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'copy' :\n $class = \"copy\";\n break;\n case 'downloadfile' :\n case 'export' :\n $class = \"download-alt\";\n break;\n case 'uploadfile' :\n case 'import' :\n $class = \"upload-alt\";\n break;\n case 'manage' :\n $class = \"briefcase\";\n break;\n case 'merge' :\n case 'arrow_merge' :\n $class = \"signin\";\n break;\n case 'reranklink' :\n case 'alphasort' :\n $class = \"sort\";\n break;\n case 'configure' :\n $class = \"wrench\";\n break;\n case 'view' :\n $class = \"search\";\n break;\n case 'page_next' :\n $class = 'double-angle-right';\n break;\n case 'page_prev' :\n $class = 'double-angle-left';\n break;\n case 'password' :\n case 'change_password' :\n $class = 'key';\n break;\n case 'clean' :\n $class = 'check';\n break;\n case 'userperms' :\n $class = 'user';\n break;\n case 'groupperms' :\n $class = 'group';\n break;\n case 'monthviewlink' :\n case 'weekviewlink' :\n $class = 'calendar';\n break;\n case 'listviewlink' :\n $class = 'list';\n break;\n case 'adminviewlink' :\n $class = 'cogs';\n break;\n case 'approve' :\n $class = \"check\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'ajax' :\n $class = \"spinner icon-spin\";\n break;\n }\n $found = new stdClass();\n $found->type = $btn_type;\n $found->class = $class;\n $found->size = self::iconSize($size);\n $found->prefix = 'icon-';\n return $found;\n } elseif (bs3()) {\n switch ($class) {\n case 'delete' :\n case 'delete-title' :\n $class = \"times-circle\";\n $btn_type = \"btn-danger\"; // red\n break;\n case 'add' :\n case 'add-title' :\n case 'add-body' :\n case 'switchtheme add' :\n $class = \"plus-circle\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'copy' :\n $class = \"files-o\";\n break;\n case 'downloadfile' :\n case 'export' :\n $class = \"download\";\n break;\n case 'uploadfile' :\n case 'import' :\n $class = \"upload\";\n break;\n case 'manage' :\n $class = \"briefcase\";\n break;\n case 'merge' :\n case 'arrow_merge' :\n $class = \"sign-in\";\n break;\n case 'reranklink' :\n case 'alphasort' :\n $class = \"sort\";\n break;\n case 'configure' :\n $class = \"wrench\";\n break;\n case 'view' :\n $class = \"search\";\n break;\n case 'page_next' :\n $class ='angle-double-right';\n break;\n case 'page_prev' :\n $class = 'angle-double-left';\n break;\n case 'password' :\n case 'change_password' :\n $class = 'key';\n break;\n case 'clean' :\n $class = 'check-square-o';\n break;\n case 'trash' :\n $class = \"trash-o\";\n break;\n case 'userperms' :\n $class = 'user';\n break;\n case 'groupperms' :\n $class = 'group';\n break;\n case 'monthviewlink' :\n case 'weekviewlink' :\n $class = 'calendar';\n break;\n case 'listviewlink' :\n $class = 'list';\n break;\n case 'adminviewlink' :\n $class = 'cogs';\n break;\n case 'approve' :\n $class = \"check\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'ajax' :\n $class = \"spinner fa-spin\";\n break;\n }\n $found = new stdClass();\n $found->type = $btn_type;\n $found->class = $class;\n $found->size = self::iconSize($size);\n $found->prefix = 'fa fa-';\n return $found;\n } else {\n return $class;\n }\n }",
" /**\n * Return the full icon style string for the current framework\n *\n * @param $class\n *\n * @return string\n */\n public static function iconStyle($class, $text = null) {\n $style = self::buttonIcon($class);\n if (!empty($style->prefix)) {\n if ($text) {\n return '<i class=\"' .$style->prefix . $style->class . '\"></i> '. $text;\n } else {\n return $style->prefix . $style->class;\n }\n } else {\n return $style;\n }\n }",
" /**\n * Return the icon size for the current framework\n *\n * @param $size\n *\n * @return mixed|string\n */\n public static function iconSize($size = null)\n {\n if (bs2()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $icon_size = 'icon-large';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $icon_size = '';\n } else { // medium\n $icon_size = 'icon-large';\n }\n return $icon_size;\n } elseif (bs3()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $icon_size = 'fa-lg';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $icon_size = '';\n } else { // medium\n $icon_size = 'fa-lg';\n }\n return $icon_size;\n } else {\n return BTN_SIZE;\n }\n }",
" public static function is_mobile()\n {\n $tablet_browser = 0;\n $mobile_browser = 0;",
" if (preg_match(\n '/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i',\n strtolower($_SERVER['HTTP_USER_AGENT'])\n )\n ) {\n $tablet_browser++;\n }",
" if (preg_match(\n '/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android|iemobile)/i',\n strtolower($_SERVER['HTTP_USER_AGENT'])\n )\n ) {\n $mobile_browser++;\n }",
" if ((!empty($_SERVER['HTTP_ACCEPT']) && strpos(\n strtolower($_SERVER['HTTP_ACCEPT']),\n 'application/vnd.wap.xhtml+xml'\n ) > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))\n ) {\n $mobile_browser++;\n }",
" $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));\n $mobile_agents = array(\n 'w3c ',\n 'acs-',\n 'alav',\n 'alca',\n 'amoi',\n 'audi',\n 'avan',\n 'benq',\n 'bird',\n 'blac',\n 'blaz',\n 'brew',\n 'cell',\n 'cldc',\n 'cmd-',\n 'dang',\n 'doco',\n 'eric',\n 'hipt',\n 'inno',\n 'ipaq',\n 'java',\n 'jigs',\n 'kddi',\n 'keji',\n 'leno',\n 'lg-c',\n 'lg-d',\n 'lg-g',\n 'lge-',\n 'maui',\n 'maxo',\n 'midp',\n 'mits',\n 'mmef',\n 'mobi',\n 'mot-',\n 'moto',\n 'mwbp',\n 'nec-',\n 'newt',\n 'noki',\n 'palm',\n 'pana',\n 'pant',\n 'phil',\n 'play',\n 'port',\n 'prox',\n 'qwap',\n 'sage',\n 'sams',\n 'sany',\n 'sch-',\n 'sec-',\n 'send',\n 'seri',\n 'sgh-',\n 'shar',\n 'sie-',\n 'siem',\n 'smal',\n 'smar',\n 'sony',\n 'sph-',\n 'symb',\n 't-mo',\n 'teli',\n 'tim-',\n 'tosh',\n 'tsm-',\n 'upg1',\n 'upsi',\n 'vk-v',\n 'voda',\n 'wap-',\n 'wapa',\n 'wapi',\n 'wapp',\n 'wapr',\n 'webc',\n 'winw',\n 'winw',\n 'xda ',\n 'xda-'\n );",
" if (in_array($mobile_ua, $mobile_agents)) {\n $mobile_browser++;\n }",
" if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'opera mini') > 0) {\n $mobile_browser++;\n //Check for tablets on opera mini alternative headers\n $stock_ua = strtolower(\n isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) ? $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'] : (isset($_SERVER['HTTP_DEVICE_STOCK_UA']) ? $_SERVER['HTTP_DEVICE_STOCK_UA'] : '')\n );\n if (preg_match('/(tablet|ipad|playbook)|(android(?!.*mobile))/i', $stock_ua)) {\n $tablet_browser++;\n }\n }",
" if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') > 0) {\n $mobile_browser = 0;\n }",
" if ($tablet_browser > 0) {\n // do something for tablet devices\n// print 'is tablet';\n } elseif ($mobile_browser > 0) {\n // do something for mobile devices\n// print 'is mobile';\n } else {\n // do something for everything else\n// print 'is desktop';\n }",
" return $mobile_browser;\n }",
" /**\n * Warn admin of obsolete theme methods\n *\n * @param string $newcall\n * @param null $controller\n * @param null $actionview\n */\n public static function deprecated($newcall = \"expTheme::module()\", $controller = null, $actionview = null)\n {\n global $user;",
" if ($user->isAdmin() && DEVELOPMENT) {\n $trace = debug_backtrace();\n $caller = $trace[1];\n if (substr($caller['file'], -16, 6) == 'compat') {\n $caller = $trace[2];\n }\n $oldcall = $caller['function'];\n if ($caller['class'] == 'expTheme') {\n $oldcall = $caller['class'] . '::' . $oldcall;\n }\n $message = '<strong>' . $oldcall . '</strong> ' . gt(\n 'is deprecated and should be replaced by'\n ) . ' <strong>' . $newcall . '</strong>';\n if (!empty($controller)) {\n $message .= '<br>' . gt(\n 'for hard coded module'\n ) . ' - <strong>' . $controller . ' / ' . $actionview . '</strong>';\n }\n $message .= '<br>' . gt('line') . ' #' . $caller['line'] . ' ' . gt('of') . $caller['file'];\n $message .= ' <a class=\"helplink\" title=\"' . gt('Get Theme Update Help') . '\" href=\"' . help::makeHelpLink(\n 'theme_update'\n ) . '\" target=\"_blank\">' . gt('Help') . '</a>';\n flash('notice', $message);\n }\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @package Modules\n * @subpackage Controllers\n */",
"class addressController extends expController {",
"\tpublic $useractions = array(",
"// 'myaddressbook'=>'Show my addressbook'",
" );",
" protected $remove_permissions = array(\n 'create',\n 'edit',\n 'delete'\n );",
" protected $add_permissions = array(\n 'import' => 'Import External Addresses',\n// 'export' => 'Export External Addresses'",
" );\n\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Addresses\"); }\n static function description() { return gt(\"Display and manage addresses of users on your site.\"); }\n static function canImportData() { return true;}",
" static function hasSources() {\n return false;\n }",
" function showall() {\n// redirect_to(array(\"controller\"=>'address',\"action\"=>'myaddressbook'));\n $this->myaddressbook();\n\t}",
" ",
" public function edit()\n {\n if((isset($this->params['id']))) $record = new address(intval($this->params['id']));\n else $record = null;\n $config = ecomconfig::getConfig('address_allow_admins_all');\n assign_to_template(array(\n 'record'=>$record,\n 'admin_config'=>$config\n ));\n if (expSession::get('customer-signup')) {\n assign_to_template(array(\n 'checkout'=>true\n ));\n }\n }",
" ",
"\tpublic function myaddressbook() {\n\t\tglobal $user;",
"\t\t// check if the user is logged in.\n\t\texpQueue::flashIfNotLoggedIn('message',gt('You must be logged in to manage your address book.'));\n\t\texpHistory::set('viewable', $this->params);\n\t\t$userid = (empty($this->params['user_id'])) ? $user->id : $this->params['user_id'];\n\t\tassign_to_template(array(\n 'addresses'=>$this->address->find('all', 'user_id='.$userid)\n ));\n\t}",
"\t",
"\tfunction show() {\n\t expHistory::set('viewable', $this->params);\n\t\tassign_to_template(array(\n 'address'=>new address($this->params['id'])\n ));\n\t}",
"\tpublic function update() {\n global $user;",
" if (expSession::get('customer-signup')) expSession::set('customer-signup', false);\n if (isset($this->params['address_country_id'])) {\n $this->params['country'] = $this->params['address_country_id'];\n unset($this->params['address_country_id']);\n }\n if (isset($this->params['address_region_id'])) {\n $this->params['state'] = $this->params['address_region_id'];\n unset($this->params['address_region_id']);\n }\n\t\tif ($user->isLoggedIn()) {\n\t\t\t// check to see how many other addresses this user has already.\n\t\t\t$count = $this->address->find('count', 'user_id='.$user->id);\n\t\t\t// if this is first address save for this user we'll make this the default",
"\t\t\tif ($count == 0) ",
" {\n $this->params['is_default'] = 1;\n $this->params['is_billing'] = 1;\n $this->params['is_shipping'] = 1;\n }\n\t\t\t// associate this address with the current user.\n\t\t\t$this->params['user_id'] = $user->id;\n\t\t\t// save the object\n\t\t\t$this->address->update($this->params);\n\t\t}\n else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){",
" //user is not logged in, but allow anonymous checkout is enabled so we'll check ",
" //a few things that we don't check in the parent 'stuff and create a user account.\n $this->params['is_default'] = 1;\n $this->params['is_billing'] = 1;",
" $this->params['is_shipping'] = 1; ",
" $this->address->update($this->params);\n }",
"\t\texpHistory::back(); ",
"\t}",
"\t",
"\tpublic function delete() {\n\t global $user;",
" $count = $this->address->find('count', 'user_id=' . $user->id);\n if($count > 1)",
" { ",
" $address = new address($this->params['id']);\n\t if ($user->isAdmin() || ($user->id == $address->user_id)) {\n if ($address->is_billing)\n {\n $billAddress = $this->address->find('first', 'user_id=' . $user->id . \" AND id != \" . $address->id);\n $billAddress->is_billing = true;\n $billAddress->save();\n }",
" if ($address->is_shipping) ",
" {\n $shipAddress = $this->address->find('first', 'user_id=' . $user->id . \" AND id != \" . $address->id);\n $shipAddress->is_shipping = true;\n $shipAddress->save();\n }\n\t parent::delete();\n\t }\n }\n else\n {\n flash(\"error\", gt(\"You must have at least one address.\"));\n }\n\t expHistory::back();\n\t}",
" ",
" public function activate_address()\n {\n global $db, $user;",
" $object = new stdClass();\n $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(); \n }\n ",
" public function manage()\n {\n expHistory::set('manageable',$this->params);\n $gc = new geoCountry();\n $countries = $gc->find('all');",
" \n $gr = new geoRegion(); ",
" $regions = $gr->find('all',null,'rank asc,name asc');",
" ",
" assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions\n ));\n }",
" ",
" public function manage_update()\n {\n global $db;",
" //eDebug($this->params,true);\n //countries\n $db->columnUpdate('geo_country','active',0,'active=1');\n foreach($this->params['country'] as $country_id=>$is_active)\n {\n $gc = new geoCountry($country_id);",
" $gc->active = true; \n $gc->save(); ",
" }\n //country default\n $db->columnUpdate('geo_country','is_default',0,'is_default=1');\n if(isset($this->params['country_default']))\n {",
" $gc = new geoCountry($this->params['country_default']); \n $db->setUniqueFlag($gc,'geo_country','is_default','id=' . $gc->id); \n $gc->refresh(); ",
" }\n //regions\n $db->columnUpdate('geo_region','active',0,'active=1');\n foreach($this->params['region'] as $region_id=>$is_active)\n {\n $gr = new geoRegion($region_id);\n $gr->active = true;\n if(isset($this->params['region_rank'][$region_id])) $gr->rank = $this->params['region_rank'][$region_id];",
" $gr->save(); ",
" }\n flash('message',gt('Address configurations successfully updated.'));\n redirect_to(array('controller'=>'address','action'=>'manage'));\n// $this->manage();\n }",
" function edit_country() {\n $country_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $country = new geoCountry($country_id);\n assign_to_template(array(\n 'record'=>$country,\n ));\n }",
" function update_country() {\n $country_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $country = new geoCountry($country_id);\n $country->update($this->params);\n expHistory::returnTo('manageable');\n }",
" function delete_country() {\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the country you would like to delete'));\n expHistory::back();\n }\n $country = new geoCountry($this->params['id']);\n $country->delete();\n expHistory::returnTo('manageable');\n }",
" function edit_region() {\n $region_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $region = new geoRegion($region_id);\n assign_to_template(array(\n 'record'=>$region,\n ));\n }",
" function update_region() {\n $region_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $region = new geoRegion($region_id);\n $region->update($this->params);\n expHistory::returnTo('manageable');\n }",
" function delete_region() {\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the region you would like to delete'));\n expHistory::back();\n }\n $region = new geoRegion($this->params['id']);\n $region->delete();\n expHistory::returnTo('manageable');\n }",
" /**\n * Import external addresses\n */\n function import() {\n $sources = array('mc' => 'MilitaryClothing.com', 'nt' => 'NameTapes.com', 'am' => 'Amazon');\n assign_to_template(array(\n 'sources' => $sources\n ));\n }",
" function process_external_addresses() {\n global $db;",
" set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n eDebug($this->params);\n// eDebug($_FILES,true);\n if (!empty($_FILES['address_csv']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n// $this->import_external_addresses();\n }",
" $file = new stdClass();\n $file->path = $_FILES['address_csv']['tmp_name'];\n echo \"Validating file...<br/>\";",
" //replace tabs with commas\n /*if($this->params['type_of_address'][0] == 'am')\n {\n $checkhandle = fopen($file->path, \"w\");\n $oldFile = file_get_contents($file->path);\n $newFile = str_ireplace(chr(9),',',$oldFile);\n fwrite($checkhandle,$newFile);\n fclose($checkhandle);\n }*/",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n if ($this->params['type_of_address'][0] == 'am') {\n $checkdata = fgetcsv($checkhandle, 10000, \"\\t\");\n $fieldCount = count($checkdata);\n } else {\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n }",
" $count = 1;\n if ($this->params['type_of_address'][0] == 'am') {\n while (($checkdata = fgetcsv($checkhandle, 10000, \"\\t\")) !== FALSE) {\n $count++;\n //eDebug($checkdata);\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n } else {\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n }",
" fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");\n $data = fgetcsv($handle, 10000, \",\");\n //eDebug($data);\n $dataset = array();",
" //mc=1, nt=2, amm=3",
" if ($this->params['type_of_address'][0] == 'mc') {\n //militaryclothing\n $db->delete('external_addresses', 'source=1');",
" } else if ($this->params['type_of_address'][0] == 'nt') {\n //nametapes\n $db->delete('external_addresses', 'source=2');\n } else if ($this->params['type_of_address'][0] == 'am') {\n //amazon\n $db->delete('external_addresses', 'source=3');\n }",
" if ($this->params['type_of_address'][0] == 'am') {\n while (($data = fgetcsv($handle, 10000, \"\\t\")) !== FALSE) {\n //eDebug($data,true);\n $extAddy = new external_address();",
" //eDebug($data);\n $extAddy->source = 3;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[15]);\n $extAddy->firstname = $name[0];\n if (isset($name[3])) {\n $extAddy->firstname .= ' ' . $name[1];\n $extAddy->middlename = $name[2];\n $extAddy->lastname = $name[3];\n } else if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[16];\n $extAddy->address2 = $data[17];\n $extAddy->city = $data[19];\n $state = new geoRegion();\n $state = $state->findBy('code', trim($data[20]));\n if (empty($state->id)) {\n $state = new geoRegion();\n $state = $state->findBy('name', trim($data[20]));\n }\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[21]);\n $extAddy->phone = $data[6];\n $extAddy->email = $data[4];\n //eDebug($extAddy);\n $extAddy->save();\n }\n } else {\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n eDebug($data);\n $extAddy = new external_address();\n if ($this->params['type_of_address'][0] == 'mc') {\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[3]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[8]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n //eDebug($extAddy);\n $extAddy->save();",
" //Check if the shipping add is same as the billing add\n if ($data[5] != $data[14]) {\n $extAddy = new external_address();\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[12]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];\n $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[17]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n // eDebug($extAddy, true);\n $extAddy->save();\n }\n }\n if ($this->params['type_of_address'][0] == 'nt') {\n //eDebug($data,true);\n $extAddy->source = 2;\n $extAddy->user_id = 0;\n $extAddy->firstname = $data[16];\n $extAddy->lastname = $data[17];\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[18];\n $extAddy->address2 = $data[19];\n $extAddy->city = $data[20];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[21]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[22]);\n $extAddy->phone = $data[23];\n $extAddy->email = $data[13];\n //eDebug($extAddy);\n $extAddy->save();\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n echo \"Done!\";\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @package Modules\n * @subpackage Controllers\n */",
"class addressController extends expController {",
"//\tpublic $useractions = array(",
"// 'myaddressbook'=>'Show my addressbook'",
"// );",
" protected $remove_permissions = array(\n 'create',\n 'edit',\n 'delete'\n );",
" protected $manage_permissions = array(\n// 'import' => 'Import External Addresses',\n 'process' => 'Import External Addresses'",
" );\n\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Addresses\"); }\n static function description() { return gt(\"Display and manage addresses of users on your site.\"); }\n static function canImportData() { return true;}",
" static function hasSources() {\n return false;\n }",
" function showall() {\n// redirect_to(array(\"controller\"=>'address',\"action\"=>'myaddressbook'));\n $this->myaddressbook();\n\t}",
"",
" public function edit()\n {\n if((isset($this->params['id']))) $record = new address(intval($this->params['id']));\n else $record = null;\n $config = ecomconfig::getConfig('address_allow_admins_all');\n assign_to_template(array(\n 'record'=>$record,\n 'admin_config'=>$config\n ));\n if (expSession::get('customer-signup')) {\n assign_to_template(array(\n 'checkout'=>true\n ));\n }\n }",
"",
"\tpublic function myaddressbook() {\n\t\tglobal $user;",
"\t\t// check if the user is logged in.\n\t\texpQueue::flashIfNotLoggedIn('message',gt('You must be logged in to manage your address book.'));\n\t\texpHistory::set('viewable', $this->params);\n\t\t$userid = (empty($this->params['user_id'])) ? $user->id : $this->params['user_id'];\n\t\tassign_to_template(array(\n 'addresses'=>$this->address->find('all', 'user_id='.$userid)\n ));\n\t}",
"",
"\tfunction show() {\n\t expHistory::set('viewable', $this->params);\n\t\tassign_to_template(array(\n 'address'=>new address($this->params['id'])\n ));\n\t}",
"\tpublic function update() {\n global $user;",
" if (expSession::get('customer-signup')) expSession::set('customer-signup', false);\n if (isset($this->params['address_country_id'])) {\n $this->params['country'] = $this->params['address_country_id'];\n unset($this->params['address_country_id']);\n }\n if (isset($this->params['address_region_id'])) {\n $this->params['state'] = $this->params['address_region_id'];\n unset($this->params['address_region_id']);\n }\n\t\tif ($user->isLoggedIn()) {\n\t\t\t// check to see how many other addresses this user has already.\n\t\t\t$count = $this->address->find('count', 'user_id='.$user->id);\n\t\t\t// if this is first address save for this user we'll make this the default",
"\t\t\tif ($count == 0)",
" {\n $this->params['is_default'] = 1;\n $this->params['is_billing'] = 1;\n $this->params['is_shipping'] = 1;\n }\n\t\t\t// associate this address with the current user.\n\t\t\t$this->params['user_id'] = $user->id;\n\t\t\t// save the object\n\t\t\t$this->address->update($this->params);\n\t\t}\n else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){",
" //user is not logged in, but allow anonymous checkout is enabled so we'll check",
" //a few things that we don't check in the parent 'stuff and create a user account.\n $this->params['is_default'] = 1;\n $this->params['is_billing'] = 1;",
" $this->params['is_shipping'] = 1;",
" $this->address->update($this->params);\n }",
"\t\texpHistory::back();",
"\t}",
"",
"\tpublic function delete() {\n\t global $user;",
" $count = $this->address->find('count', 'user_id=' . $user->id);\n if($count > 1)",
" {",
" $address = new address($this->params['id']);\n\t if ($user->isAdmin() || ($user->id == $address->user_id)) {\n if ($address->is_billing)\n {\n $billAddress = $this->address->find('first', 'user_id=' . $user->id . \" AND id != \" . $address->id);\n $billAddress->is_billing = true;\n $billAddress->save();\n }",
" if ($address->is_shipping)",
" {\n $shipAddress = $this->address->find('first', 'user_id=' . $user->id . \" AND id != \" . $address->id);\n $shipAddress->is_shipping = true;\n $shipAddress->save();\n }\n\t parent::delete();\n\t }\n }\n else\n {\n flash(\"error\", gt(\"You must have at least one address.\"));\n }\n\t expHistory::back();\n\t}",
"",
" public function activate_address()\n {\n global $db, $user;",
" $object = new stdClass();\n $object->id = $this->params['id'];",
" $db->setUniqueFlag($object, 'addresses', expString::escape($this->params['is_what']), \"user_id=\" . $user->id);",
" flash(\"message\", gt(\"Successfully updated address.\"));",
" expHistory::back();\n }\n",
" public function manage()\n {\n expHistory::set('manageable',$this->params);\n $gc = new geoCountry();\n $countries = $gc->find('all');",
"\n $gr = new geoRegion();",
" $regions = $gr->find('all',null,'rank asc,name asc');",
"",
" assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions\n ));\n }",
"",
" public function manage_update()\n {\n global $db;",
" //eDebug($this->params,true);\n //countries\n $db->columnUpdate('geo_country','active',0,'active=1');\n foreach($this->params['country'] as $country_id=>$is_active)\n {\n $gc = new geoCountry($country_id);",
" $gc->active = true;\n $gc->save();",
" }\n //country default\n $db->columnUpdate('geo_country','is_default',0,'is_default=1');\n if(isset($this->params['country_default']))\n {",
" $gc = new geoCountry(intval($this->params['country_default']));\n $db->setUniqueFlag($gc,'geo_country','is_default','id=' . $gc->id);\n $gc->refresh();",
" }\n //regions\n $db->columnUpdate('geo_region','active',0,'active=1');\n foreach($this->params['region'] as $region_id=>$is_active)\n {\n $gr = new geoRegion($region_id);\n $gr->active = true;\n if(isset($this->params['region_rank'][$region_id])) $gr->rank = $this->params['region_rank'][$region_id];",
" $gr->save();",
" }\n flash('message',gt('Address configurations successfully updated.'));\n redirect_to(array('controller'=>'address','action'=>'manage'));\n// $this->manage();\n }",
" function edit_country() {\n $country_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $country = new geoCountry($country_id);\n assign_to_template(array(\n 'record'=>$country,\n ));\n }",
" function update_country() {\n $country_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $country = new geoCountry($country_id);\n $country->update($this->params);\n expHistory::returnTo('manageable');\n }",
" function delete_country() {\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the country you would like to delete'));\n expHistory::back();\n }\n $country = new geoCountry($this->params['id']);\n $country->delete();\n expHistory::returnTo('manageable');\n }",
" function edit_region() {\n $region_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $region = new geoRegion($region_id);\n assign_to_template(array(\n 'record'=>$region,\n ));\n }",
" function update_region() {\n $region_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $region = new geoRegion($region_id);\n $region->update($this->params);\n expHistory::returnTo('manageable');\n }",
" function delete_region() {\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the region you would like to delete'));\n expHistory::back();\n }\n $region = new geoRegion($this->params['id']);\n $region->delete();\n expHistory::returnTo('manageable');\n }",
" /**\n * Import external addresses\n */\n function import() {\n $sources = array('mc' => 'MilitaryClothing.com', 'nt' => 'NameTapes.com', 'am' => 'Amazon');\n assign_to_template(array(\n 'sources' => $sources\n ));\n }",
" function process_external_addresses() {\n global $db;",
" set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n eDebug($this->params);\n// eDebug($_FILES,true);\n if (!empty($_FILES['address_csv']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n// $this->import_external_addresses();\n }",
" $file = new stdClass();\n $file->path = $_FILES['address_csv']['tmp_name'];\n echo \"Validating file...<br/>\";",
" //replace tabs with commas\n /*if($this->params['type_of_address'][0] == 'am')\n {\n $checkhandle = fopen($file->path, \"w\");\n $oldFile = file_get_contents($file->path);\n $newFile = str_ireplace(chr(9),',',$oldFile);\n fwrite($checkhandle,$newFile);\n fclose($checkhandle);\n }*/",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n if ($this->params['type_of_address'][0] == 'am') {\n $checkdata = fgetcsv($checkhandle, 10000, \"\\t\");\n $fieldCount = count($checkdata);\n } else {\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n }",
" $count = 1;\n if ($this->params['type_of_address'][0] == 'am') {\n while (($checkdata = fgetcsv($checkhandle, 10000, \"\\t\")) !== FALSE) {\n $count++;\n //eDebug($checkdata);\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n } else {\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n }",
" fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");\n $data = fgetcsv($handle, 10000, \",\");\n //eDebug($data);\n $dataset = array();",
" //mc=1, nt=2, amm=3",
" if ($this->params['type_of_address'][0] == 'mc') {\n //militaryclothing\n $db->delete('external_addresses', 'source=1');",
" } else if ($this->params['type_of_address'][0] == 'nt') {\n //nametapes\n $db->delete('external_addresses', 'source=2');\n } else if ($this->params['type_of_address'][0] == 'am') {\n //amazon\n $db->delete('external_addresses', 'source=3');\n }",
" if ($this->params['type_of_address'][0] == 'am') {\n while (($data = fgetcsv($handle, 10000, \"\\t\")) !== FALSE) {\n //eDebug($data,true);\n $extAddy = new external_address();",
" //eDebug($data);\n $extAddy->source = 3;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[15]);\n $extAddy->firstname = $name[0];\n if (isset($name[3])) {\n $extAddy->firstname .= ' ' . $name[1];\n $extAddy->middlename = $name[2];\n $extAddy->lastname = $name[3];\n } else if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[16];\n $extAddy->address2 = $data[17];\n $extAddy->city = $data[19];\n $state = new geoRegion();\n $state = $state->findBy('code', trim($data[20]));\n if (empty($state->id)) {\n $state = new geoRegion();\n $state = $state->findBy('name', trim($data[20]));\n }\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[21]);\n $extAddy->phone = $data[6];\n $extAddy->email = $data[4];\n //eDebug($extAddy);\n $extAddy->save();\n }\n } else {\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n eDebug($data);\n $extAddy = new external_address();\n if ($this->params['type_of_address'][0] == 'mc') {\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[3]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[8]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n //eDebug($extAddy);\n $extAddy->save();",
" //Check if the shipping add is same as the billing add\n if ($data[5] != $data[14]) {\n $extAddy = new external_address();\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[12]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];\n $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[17]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n // eDebug($extAddy, true);\n $extAddy->save();\n }\n }\n if ($this->params['type_of_address'][0] == 'nt') {\n //eDebug($data,true);\n $extAddy->source = 2;\n $extAddy->user_id = 0;\n $extAddy->firstname = $data[16];\n $extAddy->lastname = $data[17];\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[18];\n $extAddy->address2 = $data[19];\n $extAddy->city = $data[20];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[21]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[22]);\n $extAddy->phone = $data[23];\n $extAddy->email = $data[13];\n //eDebug($extAddy);\n $extAddy->save();\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n echo \"Done!\";\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */",
"class administrationController extends expController {\n public $basemodel_name = 'expRecord';",
" protected $add_permissions = array(",
"\t 'clear'=>'Clear Caches', //FIXME this requires a logged in user to perform?\n\t \"fix\"=>\"Fix Database\",\n\t \"install\"=>\"Installation\",",
"",
"\t \"theme\"=>\"Manage Themes\",\n\t 'test_smtp'=>'Test SMTP Server Settings',\n\t 'toggle'=>'Toggle Settings',",
" 'mass'=>'Mass Mailing',\n 'update'=>'Update Settings',\n 'change'=>'Change Settings',\n 'save'=>'Save Settings',",
" );",
" static function displayname() { return gt(\"Administration Controls\"); }\n static function description() { return gt(\"This is the Administration Module\"); }",
" static function hasSources() {\n return false;\n }",
"\tpublic function install_tables() {\n\t\t$tables = expDatabase::install_dbtables();\n\t\tksort($tables);\n assign_to_template(array(\n 'status'=>$tables\n ));\n\t}",
" public function delete_unused_columns() {\n \t\t$tables = expDatabase::install_dbtables(true);\n \t\tksort($tables);\n assign_to_template(array(\n 'status'=>$tables\n ));\n \t}",
" public function manage_unused_tables() {\n global $db;",
" ",
" expHistory::set('manageable', $this->params);\n $unused_tables = array();\n $used_tables = array();\n $tables = $db->getTables();\n //eDebug($tables);",
"\t\t// first the core and 1.0 definitions\n\t\t$coredefs = BASE.'framework/core/definitions';\n\t\tif (is_readable($coredefs)) {\n\t\t\t$dh = opendir($coredefs);\n\t\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\t\tif (is_readable(\"$coredefs/$file\") && is_file(\"$coredefs/$file\") && substr($file,-4,4) == \".php\" && substr($file,-9,9) != \".info.php\") {\n\t\t\t\t\t$used_tables[]= strtolower(substr($file,0,-4));\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t // then search for module definitions\n $moddefs = array(\n BASE.'themes/'.DISPLAY_THEME_REAL.'/modules', // we only want to do this for the set theme, NOT the preview theme\n BASE.\"framework/modules\",\n );\n foreach ($moddefs as $moddef) {\n if (is_readable($moddef)) {\n $dh = opendir($moddef);\n while (($file = readdir($dh)) !== false) {\n if (is_dir($moddef.'/'.$file) && ($file != '..' && $file != '.')) {\n $dirpath = $moddef.'/'.$file.'/definitions';\n if (file_exists($dirpath)) {\n $def_dir = opendir($dirpath);\n while (($def = readdir($def_dir)) !== false) {\n if (is_readable(\"$dirpath/$def\") && is_file(\"$dirpath/$def\") && substr($def,-4,4) == \".php\" && substr($def,-9,9) != \".info.php\") {\n if ((!in_array(substr($def,0,-4), $used_tables))) {\n $used_tables[] = strtolower(substr($def,0,-4));\n }\n }\n }\n }\n }\n }\n }\n }",
" foreach($tables as $table) {\n $basename = strtolower(str_replace($db->prefix, '', $table));\n if (!in_array($basename, $used_tables) && !stristr($basename, 'forms')) {\n $unused_tables[$basename] = new stdClass();\n $unused_tables[$basename]->name = $table;\n $unused_tables[$basename]->rows = $db->countObjects($basename);\n }\n }",
" ",
" assign_to_template(array(\n 'unused_tables'=>$unused_tables\n ));\n }",
" ",
" public function delete_unused_tables() {\n global $db;",
" $count = 0;\n foreach($this->params['tables'] as $del=>$table) {\n $basename = str_replace($db->prefix, '', $table);\n $count += $db->dropTable($basename);\n }",
" ",
" flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');\n expHistory::back();\n }",
"\tpublic function fix_optimize_database() {\n\t global $db;",
"\t\t$before = $db->databaseInfo();\n\t\tforeach (array_keys($before) as $table) {\n\t\t\t$db->optimize($table);\n\t\t}\n\t\t$after = $db->databaseInfo();\n\t assign_to_template(array(\n 'before'=>$before,\n 'after'=>$after\n ));\n\t}\n",
"\tpublic function fixsessions() {\n\t global $db;",
"//\t\t$test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket');\n\t\t$fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket');\n\t\tflash('message', gt('Sessions Table was Repaired'));\n\t\texpHistory::back();\n\t}",
"\n\tpublic function fix_database() {\n\t global $db;",
"\t// upgrade sectionref's that have lost their originals\n// $no_origs = array();\n//\t\t$sectionrefs = $db->selectObjects('sectionref',\"is_original=0\");\n//\t\tif (count($sectionrefs)) {\n//\t\t\tprint_r(gt(\"Found\").\": \".count($sectionrefs).\" \".gt(\"copies (not originals)\").\"<br>\");\n// foreach ($sectionrefs as $sectionref) {\n// if ($db->selectObject('sectionref',\"module='\".$sectionref->module.\"' AND source='\".$sectionref->source.\"' AND is_original='1'\") == null) {\n// // There is no original for this sectionref so change it to the original\n// $sectionref->is_original = 1;\n// $db->updateObject($sectionref,\"sectionref\");\n// $no_origs[] = gt(\"Fixed\").\": \".$sectionref->module.\" - \".$sectionref->source;\n// }\n// }\n//\t\t}\n// assign_to_template(array(\n// 'no_origs'=>$no_origs,\n// ));",
"\t// upgrade sectionref's that point to missing sections (pages)\n\t\t$sectionrefs = $db->selectObjects('sectionref',\"refcount!=0\");\n\t\t$no_sections = array();\n\t\tforeach ($sectionrefs as $sectionref) {\n\t\t\tif ($db->selectObject('section',\"id='\".$sectionref->section.\"'\") == null) {\n\t\t\t// There is no section/page for sectionref so change the refcount\n\t\t\t\t$sectionref->refcount = 0;\n\t\t\t\t$db->updateObject($sectionref,\"sectionref\");\n $no_sections[] = gt(\"Fixed\").\": \".$sectionref->module.\" - \".$sectionref->source;\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'no_sections'=>$no_sections,\n ));",
"\t // delete sectionref's that have empty sources since they are dead\n\t\t $sectionrefs = $db->selectObjects('sectionref','source=\"\"');\n $no_assigns = array();\n\t\t if ($sectionrefs != null) {\n $no_assigns[] = gt(\"Removing\").\": \".count($sectionrefs).\" \".gt(\"empty sectionrefs (no source)\");\n\t\t\t $db->delete('sectionref','source=\"\"');\n\t\t }\n assign_to_template(array(\n 'no_assigns'=>$no_assigns,\n ));",
"\t// add missing sectionrefs based on existing containers (fixes aggregation problem)\n\t\t$containers = $db->selectObjects('container',1);\n $missing_sectionrefs = array();\n\t\tforeach ($containers as $container) {\n\t\t\t$iloc = expUnserialize($container->internal);\n\t\t\tif ($db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"'\") == null) {\n\t\t\t// There is no sectionref for this container. Populate sectionref\n if ($container->external != \"N;\") {\n $newSecRef = new stdClass();\n $newSecRef->module = $iloc->mod;\n $newSecRef->source = $iloc->src;\n $newSecRef->internal = '';\n $newSecRef->refcount = 1;\n// $newSecRef->is_original = 1;\n\t\t\t\t\t$eloc = expUnserialize($container->external);",
"//\t\t\t\t\t$section = $db->selectObject('sectionref',\"module='containermodule' AND source='\".$eloc->src.\"'\");",
" $section = $db->selectObject('sectionref',\"module='container' AND source='\".$eloc->src.\"'\");\n\t\t\t\t\tif (!empty($section)) {\n\t\t\t\t\t\t$newSecRef->section = $section->id;\n\t\t\t\t\t\t$db->insertObject($newSecRef,\"sectionref\");\n\t\t\t\t\t\t$missing_sectionrefs[] = gt(\"Missing sectionref for container replaced\").\": \".$iloc->mod.\" - \".$iloc->src.\" - PageID #\".$section->id;\n\t\t\t\t\t} else {\n $db->delete('container','id=\"'.$container->id.'\"');\n $missing_sectionrefs[] = gt(\"Cant' find the container page for container\").\": \".$iloc->mod.\" - \".$iloc->src.' - '.gt('deleted');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'missing_sectionrefs'=>$missing_sectionrefs,\n ));\n\t}",
" public function fix_tables() {\n $renamed = expDatabase::fix_table_names();\n assign_to_template(array(\n 'tables'=>$renamed,\n ));\n \t}",
" public function install_ecommerce_tables() {\n global $db;",
" $eql = BASE . \"install/samples/ecommerce.eql\";\n if (file_exists($eql)) {\n $errors = array();\n expFile::restoreDatabase($eql,$errors);\n } else {\n $errors = array(gt('The file does not exist'));\n }\n if (DEVELOPMENT && count($errors)) {\n $msg = gt('Errors were encountered importing the e-Commerce data.').'<ul>';\n foreach ($errors as $e) $msg .= '<li>'.$e.'</li>';\n $msg .= '</ul>';\n flash('error',$msg);\n } else {\n flash('message',gt('e-Commerce data was added to your database.'));\n }\n expHistory::back();\n \t}",
" public function toolbar() {\n// global $user;",
" $menu = array();\n\t\t$dirs = array(\n\t\t\tBASE.'framework/modules/administration/menus',\n\t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus'\n\t\t);",
"\t\tforeach ($dirs as $dir) {\n\t\t if (is_readable($dir)) {\n\t\t\t $dh = opendir($dir);\n\t\t\t while (($file = readdir($dh)) !== false) {\n\t\t\t\t if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {\n\t\t\t\t\t $menu[substr($file,0,-4)] = include($dir.'/'.$file);\n if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]);\n\t\t\t\t }\n\t\t\t }\n\t\t }\n\t\t}",
" // sort the top level menus alphabetically by filename",
"\t\tksort($menu);\t\t",
"\t\t$sorted = array();\n\t\tforeach($menu as $m) $sorted[] = $m;",
" ",
" // slingbar position\n if (isset($_COOKIE['slingbar-top'])){\n $top = $_COOKIE['slingbar-top'];\n } else {\n $top = SLINGBAR_TOP;\n }",
" ",
"\t\tassign_to_template(array(\n 'menu'=>(bs3()) ? $sorted : json_encode($sorted),\n \"top\"=>$top\n ));\n }",
" ",
"// public function index() {\n// redirect_to(array('controller'=>'administration', 'action'=>'toolbar'));\n//// $this->toolbar();\n// }",
" ",
" public function update_SetSlingbarPosition() {\n setcookie('slingbar-top', $this->params['top']);\n expHistory::back();\n }",
" public function manage_lang() {\n global $default_lang, $cur_lang;",
" // Available Languages\n\t $langs = expLang::langList();\n $num_missing = 0;\n foreach ($default_lang as $key => $value) {\n if (!array_key_exists($key,$cur_lang)) $num_missing++;\n }\n $num_untrans = 0;\n foreach ($cur_lang as $key => $value) {\n if ($key == $value) $num_untrans++;\n }\n assign_to_template(array(\n 'langs'=>$langs,\n 'missing'=>$num_missing,\n \"count\"=>count($cur_lang),\n 'untrans'=>$num_untrans\n ));\n \t}",
" public function update_language() {\n expSettings::change('LANGUAGE', $this->params['newlang']);\n flash('message',gt('Display Language changed to').\": \".$this->params['newlang']);\n redirect_to(array('controller'=>'administration', 'action'=>'manage_lang'));\n// $this->manage_lang();\n \t}",
" public function manage_lang_await() {\n global $cur_lang;",
" $awaiting_trans = array();\n foreach ($cur_lang as $key => $value) {\n if ($key == $value) {\n $awaiting_trans[$key] = stripslashes($value);\n }\n }\n assign_to_template(array(\n 'await'=>$awaiting_trans\n ));\n \t}",
" public function save_newlangfile() {\n\t\t$result = expLang::createNewLangFile($this->params['newlang']);\n flash($result['type'],$result['message']);\n if ($result['type'] != 'error') {\n expSettings::change('LANGUAGE', $this->params['newlang']);\n expLang::createNewLangInfoFile($this->params['newlang'],$this->params['newauthor'],$this->params['newcharset'],$this->params['newlocale']);\n flash('message',gt('Display Language changed to').\": \".$this->params['newlang']);\n }\n redirect_to(array('controller'=>'administration', 'action'=>'manage_lang'));\n// $this->manage_lang();\n \t}",
"\tpublic function test_smtp() {\n\t\t$smtp = new expMail();\n\t\t$smtp->test();\n\t}",
" public function toggle_minify() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Minification settings.'));\n } else {\n $newvalue = (MINIFY == 1) ? 0 : 1;\n expSettings::change('MINIFY', $newvalue);\n $message = ($newvalue) ? gt(\"Exponent is now minifying Javascript and CSS\") : gt(\n \"Exponent is no longer minifying Javascript and CSS\"\n );\n flash('message', $message);\n }\n \texpHistory::back();\n }",
" ",
"\tpublic function toggle_dev() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Error Reporting settings.'));\n } else {\n $newvalue = (DEVELOPMENT == 1) ? 0 : 1;\n expSettings::change('DEVELOPMENT', $newvalue);\n// expTheme::removeCss();\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n $message = ($newvalue) ? gt(\"Exponent is now in 'Development' mode\") : gt(\n \"Exponent is no longer in 'Development' mode\"\n );\n flash('message', $message);\n }\n\t\texpHistory::back();\n\t}",
" public function toggle_log() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Logging settings.'));\n } else {\n $newvalue = (LOGGER == 1) ? 0 : 1;\n expSettings::change('LOGGER', $newvalue);\n }\n \t\texpHistory::back();\n \t}",
"\tpublic function toggle_maintenance() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Maintenance settings.'));\n } else {\n $newvalue = (MAINTENANCE_MODE == 1) ? 0 : 1;\n expSettings::change('MAINTENANCE_MODE', $newvalue);\n MAINTENANCE_MODE == 1 ? flash('message', gt(\"Exponent is no longer in 'Maintenance' mode\")) : \"\";\n }\n\t\texpHistory::back();\n\t}",
" public function toggle_workflow() {\n global $db;",
" if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n } else {\n $newvalue = (ENABLE_WORKFLOW == 1) ? 0 : 1;\n expSettings::change('ENABLE_WORKFLOW', $newvalue);\n $models = expModules::initializeModels();\n if ($newvalue) {\n // workflow is now turned on, initialize by approving all items\n expDatabase::install_dbtables(true, $newvalue); // force a strict table update to add workflow columns\n foreach ($models as $modelname => $modelpath) {\n $model = new $modelname();\n if ($model->supports_revisions) {\n $db->columnUpdate($model->tablename, 'approved', 1, 'approved=0');\n }\n }\n } else {\n // workflow is now turned off, remove older revisions\n foreach ($models as $modelname => $modelpath) {\n $model = new $modelname();\n if ($model->supports_revisions) {\n $items = $model->find();\n foreach ($items as $item) {\n $db->trim_revisions($model->tablename, $item->id, 1, $newvalue);\n }\n }\n }\n expDatabase::install_dbtables(\n true,\n $newvalue\n ); // force a strict table update to remove workflow columns\n }\n $message = ($newvalue) ? gt(\"Exponent 'Workflow' is now ON\") : gt(\"Exponent 'Workflow' is now OFF\");\n flash('message', $message);\n }\n \t\texpHistory::back();\n \t}",
"\tpublic function toggle_preview() {\n\t\t$level = 99;\n\t\tif (expSession::is_set('uilevel')) {\n\t\t\t$level = expSession::get('uilevel');\n\t\t}\n\t\tif ($level == UILEVEL_PREVIEW) {\n\t\t\texpSession::un_set('uilevel');\n\t\t} else { //edit mode\n\t\t\texpSession::set(\"uilevel\",UILEVEL_PREVIEW);\n\t\t}\n\t\t$message = ($level == UILEVEL_PREVIEW) ? gt(\"Exponent is no longer in 'Preview' mode\") : gt(\"Exponent is now in 'Preview' mode\") ;\n\t\tflash('message',$message);\n\t\texpHistory::back();\n\t}",
" public function manage_version() {\n expSession::un_set('update-check'); // reset the already checked flag\n if (!expVersion::checkVersion(true)) {\n flash('message', gt('Your version of Exponent CMS is current.'));\n }\n \t\texpHistory::back();\n \t}",
"\tpublic function clear_smarty_cache() {\n\t\texpTheme::clearSmartyCache();\n expSession::clearAllUsersSessionCache();\n }",
"\tpublic function clear_css_cache() {\n\t\texpTheme::removeCss();\n expSession::set('force_less_compile', 1);\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n\t\tflash('message',gt(\"CSS/Minify Cache has been cleared\"));\n\t\texpHistory::back();\n\t}",
"\tpublic function clear_image_cache() {\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/pixidou');\n\t\tif (file_exists(BASE.'tmp/img_cache'))\n expFile::removeFilesInDirectory(BASE.'tmp/img_cache');\n\t\tflash('message',gt(\"Image/Pixidou Cache has been cleared\"));\n\t\texpHistory::back();\n\t}",
"\tpublic function clear_rss_cache() {\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/rsscache');\n\t\tflash('message',gt(\"RSS/Podcast/Twitter Cache has been cleared\"));\n\t\texpHistory::back();\n\t}",
"\tpublic static function clear_all_caches() {\n\t\texpTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache(); // clear the session cache for true 'clear all'\n expHistory::flush(); // clear the history\n expSession::un_set('framework');\n expSession::un_set('display_theme');\n expSession::un_set('theme_style');\n\t\texpTheme::removeCss();\n expSession::set('force_less_compile', 1);\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/pixidou');\n\t\tif (file_exists(BASE.'tmp/img_cache'))\n expFile::removeFilesInDirectory(BASE.'tmp/img_cache');\n if (file_exists(BASE.'tmp/elfinder'))\n expFile::removeFilesInDirectory(BASE.'tmp/elfinder');\n\t\tif (file_exists(BASE.'tmp/extensionuploads'))\n expFile::removeFilesInDirectory(BASE.'tmp/extensionuploads');\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/rsscache');\n\t\tflash('message',gt(\"All the System Caches have been cleared\"));\n\t\texpHistory::back();\n\t}",
"\tpublic function install_extension() {",
"\t\t$modsurl =array(\n\t\t\t'themes'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-themes',\n\t\t\t'fixes'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-fixes',\n\t\t\t'mods'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-mods'\n\t\t);",
"\t\t$RSS = new SimplePie();\n\t\t$RSS->set_cache_location(BASE.'tmp/rsscache'); // default is ./cache\n//\t $RSS->set_cache_duration(3600); // default if 3600\n\t\t$RSS->set_timeout(20); // default is 10\n//\t $RSS->set_output_encoding('UTF-8'); // which is the default\n\t\t$items['themes'] = array();\n\t\t$items['fixes'] = array();\n\t\t$items['mods'] = array();\n\t\tforeach($modsurl as $type=>$url) {\n\t\t $RSS->set_feed_url($url);\n\t\t $feed = $RSS->init();\n\t\t if (!$feed) {\n\t\t // an error occurred in the rss.\n\t\t continue;\n\t\t }\n\t\t\t$RSS->handle_content_type();\n\t\t foreach ($RSS->get_items() as $rssItem) {\n\t\t $rssObject = new stdClass();\n\t\t $rssObject->title = $rssItem->get_title();\n\t\t $rssObject->body = $rssItem->get_description();\n\t\t $rssObject->rss_link = $rssItem->get_permalink();\n\t\t $rssObject->publish = $rssItem->get_date('U');\n\t\t $rssObject->publish_date = $rssItem->get_date('U');\n\t\t\t\tforeach ($rssItem->get_enclosures() as $enclosure) {\n\t\t\t\t\t$rssObject->enclosure = $enclosure->get_link();\n $rssObject->length = $enclosure->get_length();\n\t\t\t\t}\n\t\t $items[$type][] = $rssObject;\n\t\t }\n\t\t}",
"//\t\t$form = new form();\n// $form->meta('module','administration');\n// $form->meta('action','install_extension_confirm');\n//\t\t$form->register(null,'',new htmlcontrol(expCore::maxUploadSizeMessage()));\n//\t\t$form->register('mod_archive','Extension Archive',new uploadcontrol());\n// $form->register('patch',gt('Patch Exponent CMS or Install Theme?'),new checkboxcontrol(false,false),null,null,gt('All extensions are normally placed within the CURRENT theme (folder)'));\n// $form->register('submit','',new buttongroupcontrol(gt('Upload Extension')));",
"\t\tassign_to_template(array(\n 'themes'=>$items['themes'],\n 'fixes'=>$items['fixes'],\n 'mods'=>$items['mods'],\n// 'form_html'=>$form->toHTML()\n ));\n\t}",
"\tpublic function install_extension_confirm() {\n if (!empty($this->params['files'])) {\n foreach ($this->params['files'] as $title=>$url) {\n $filename = tempnam(\"tmp/extensionuploads/\",'tmp');\n expCore::saveData($url,$filename);\n $_FILES['mod_archive']['name'] = end(explode(\"/\", $url));\n// $finfo = finfo_open(FILEINFO_MIME);\n// $mimetype = finfo_file($finfo, $filename);\n// finfo_close($finfo);\n// $_FILES['mod_archive']['type'] = $mimetype;\n $_FILES['mod_archive']['tmp_name'] = $filename;\n $_FILES['mod_archive']['error'] = 0;\n $_FILES['mod_archive']['size'] = filesize($filename);\n }\n }\n if ($_FILES['mod_archive']['error'] != UPLOAD_ERR_OK) {\n\t\t\tswitch($_FILES['mod_archive']['error']) {\n\t\t\t\tcase UPLOAD_ERR_INI_SIZE:\n\t\t\t\tcase UPLOAD_ERR_FORM_SIZE:\n\t\t\t\t\tflash('error', gt('The file you uploaded exceeded the size limits for the server.'));\n\t\t\t\t\tbreak;\n\t\t\t\tcase UPLOAD_ERR_PARTIAL:\n\t\t\t\t\tflash('error', gt('The file you uploaded was only partially uploaded.'));\n\t\t\t\t\tbreak;\n\t\t\t\tcase UPLOAD_ERR_NO_FILE:\n\t\t\t\t\tflash('error', gt('No file was uploaded.'));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\t$basename = basename($_FILES['mod_archive']['name']);\n\t\t\t// Check future radio buttons; for now, try auto-detect\n\t\t\t$compression = null;\n\t\t\t$ext = '';\n\t\t\tif (substr($basename,-4,4) == '.tar') {\n\t\t\t\t$compression = null;\n\t\t\t\t$ext = '.tar';\n\t\t\t} else if (substr($basename,-7,7) == '.tar.gz') {\n\t\t\t\t$compression = 'gz';\n\t\t\t\t$ext = '.tar.gz';\n\t\t\t} else if (substr($basename,-4,4) == '.tgz') {\n\t\t\t\t$compression = 'gz';\n\t\t\t\t$ext = '.tgz';\n\t\t\t} else if (substr($basename,-8,8) == '.tar.bz2') {\n\t\t\t\t$compression = 'bz2';\n\t\t\t\t$ext = '.tar.bz2';\n\t\t\t} else if (substr($basename,-4,4) == '.zip') {\n\t\t\t\t$compression = 'zip';\n\t\t\t\t$ext = '.zip';\n\t\t\t}",
"\t\t\tif ($ext == '') {\n\t\t\t\tflash('error', gt('Unknown archive format. Archives must either be regular ZIP files, TAR files, Gzipped Tarballs, or Bzipped Tarballs.'));\n\t\t\t} else {",
"\t\t\t\t// Look for stale sessid directories:\n\t\t\t\t$sessid = session_id();\n\t\t\t\tif (file_exists(BASE.\"tmp/extensionuploads/$sessid\") && is_dir(BASE.\"tmp/extensionuploads/$sessid\")) expFile::removeDirectory(\"tmp/extensionuploads/$sessid\");\n\t\t\t\t$return = expFile::makeDirectory(\"tmp/extensionuploads/$sessid\");\n\t\t\t\tif ($return != SYS_FILES_SUCCESS) {\n\t\t\t\t\tswitch ($return) {\n\t\t\t\t\t\tcase SYS_FILES_FOUNDFILE:\n\t\t\t\t\t\tcase SYS_FILES_FOUNDDIR:\n\t\t\t\t\t\t\tflash('error', gt('Found a file in the directory path when creating the directory to store the files in.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SYS_FILES_NOTWRITABLE:\n\t\t\t\t\t\t\tflash('error', gt('Destination parent is not writable.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SYS_FILES_NOTREADABLE:\n\t\t\t\t\t\t\tflash('error', gt('Destination parent is not readable.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"\t\t\t\t$dest = BASE.\"tmp/extensionuploads/$sessid/archive$ext\";\n if (is_uploaded_file($_FILES['mod_archive']['tmp_name'])) {\n\t\t\t\t move_uploaded_file($_FILES['mod_archive']['tmp_name'],$dest);\n } else {\n rename($_FILES['mod_archive']['tmp_name'],$dest);\n }",
"\t\t\t\tif ($compression != 'zip') {// If not zip, must be tar\n\t\t\t\t\tinclude_once(BASE.'external/Tar.php');",
"\t\t\t\t\t$tar = new Archive_Tar($dest,$compression);",
"\t\t\t\t\tPEAR::setErrorHandling(PEAR_ERROR_PRINT);\n\t\t\t\t\t$return = $tar->extract(dirname($dest));\n\t\t\t\t\tif (!$return) {\n\t\t\t\t\t\tflash('error',gt('Error extracting TAR archive'));\n\t\t\t\t\t} else {\n//\t\t\t\t\t\theader('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=tar');\n//\t\t\t\t\t\tself::verify_extension('tar');\n\t\t\t\t\t}\n\t\t\t\t} else { // must be zip\n\t\t\t\t\tinclude_once(BASE.'external/Zip.php');",
"\t\t\t\t\t$zip = new Archive_Zip($dest);",
"\t\t\t\t\tPEAR::setErrorHandling(PEAR_ERROR_PRINT);\n\t\t\t\t\tif ($zip->extract(array('add_path'=>dirname($dest))) == 0) {\n\t\t\t\t\t\tflash('error',gt('Error extracting ZIP archive').': '.$zip->_error_code . ' : ' . $zip->_error_string . '<br />');\n\t\t\t\t\t} else {\n//\t\t\t\t\t\theader('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=zip');\n//\t\t\t\t\t\tself::verify_extension('zip');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$sessid = session_id();\n\t\t\t\t$files = array();\n\t\t\t\tforeach (expFile::listFlat(BASE.'tmp/extensionuploads/'.$sessid,true,null,array(),BASE.'tmp/extensionuploads/'.$sessid) as $key=>$f) {\n\t\t\t\t\tif ($key != '/archive.tar' && $key != '/archive.tar.gz' && $key != '/archive.tar.bz2' && $key != '/archive.zip') {\n if (empty($this->params['patch']) || !$this->params['patch']) {\n $key = substr($key,1);\n if (substr($key,0,7)=='themes/') {\n $parts = explode('/',$key);\n $parts[1] = DISPLAY_THEME_REAL;\n $file = implode('/',$parts);\n } else {\n $file = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace(\"framework/\", \"\", $key);\n }\n $file = str_replace(\"modules-1\", \"modules\", $file);\n } else {\n $file = substr($key,1);\n }\n\t\t\t\t\t\t$files[] = array(\n\t\t\t\t\t\t\t'absolute'=>$file,\n\t\t\t\t\t\t\t'relative'=>$f,\n\t\t\t\t\t\t\t'canCreate'=>expFile::canCreate(BASE.$file,1),\n\t\t\t\t\t\t\t'ext'=>substr($f,-3,3)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tassign_to_template(array(\n 'relative'=>'tmp/extensionuploads/'.$sessid,\n 'files'=>$files,\n 'patch'=>empty($this->params['patch'])?0:$this->params['patch']\n ));\n\t\t\t}\n\t\t}\n\t}",
"\tpublic function install_extension_finish() {\n $patch =$this->params['patch']==1;\n\t\t$sessid = session_id();\n\t\tif (!file_exists(BASE.\"tmp/extensionuploads/$sessid\") || !is_dir(BASE.\"tmp/extensionuploads/$sessid\")) {\n\t\t\t$nofiles = 1;\n\t\t} else {\n\t\t\t$success = array();\n\t\t\tforeach (array_keys(expFile::listFlat(BASE.\"tmp/extensionuploads/$sessid\",true,null,array(),BASE.\"tmp/extensionuploads/$sessid\")) as $file) {\n\t\t\t\tif ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') {\n if ($patch) { // this is a patch/fix extension\n expFile::makeDirectory(dirname($file));\n $success[$file] = copy(BASE.\"tmp/extensionuploads/$sessid\".$file,BASE.substr($file,1));\n if (basename($file) == 'views_c') chmod(BASE.substr($file,1),0777);\n } else {\n $newfile = substr($file,1);\n if (substr($newfile,0,7)=='themes/') { // this is a theme extension\n $parts = explode('/',$newfile);\n $parts[1] = DISPLAY_THEME_REAL;\n $newfile = implode('/',$parts);\n } else { // this is a mod extension\n $newfile = str_replace(\"framework/\", \"\", $newfile);\n $newfile = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace(\"modules-1\", \"modules\", $newfile);\n }\n expFile::makeDirectory(dirname($newfile));\n $success[$newfile] = copy(BASE.\"tmp/extensionuploads/$sessid\".$file,BASE.$newfile);\n }\n\t\t\t\t}\n\t\t\t}",
"\t\t\t$del_return = expFile::removeDirectory(BASE.\"tmp/extensionuploads/$sessid\"); //FIXME shouldn't use echo\n//\t\t\techo $del_return;\n $tables = expDatabase::install_dbtables();\n ksort($tables);\n assign_to_template(array(\n 'tables'=>$tables\n ));\n\t\t\t$nofiles = 0;\n\t\t}",
"\t\tassign_to_template(array(\n 'nofiles'=>$nofiles,\n 'success'=>$success,\n 'redirect'=>expHistory::getLastNotEditable()\n ));\n\t}",
" public function mass_mail() {\n // nothing we need to do except display view\n }",
" public function mass_mail_out() {\n global $user;",
" $emaillist = array();\n if (!empty($this->params['allusers'])) {\n foreach (user::getAllUsers() as $u) {\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n } else {\n if(!empty($this->params['group_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'grouplist') as $group_id) {\n $grpusers = group::getUsersInGroup($group_id);\n foreach ($grpusers as $u) {\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n }\n }\n if(!empty($this->params['user_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'user_list') as $user_id) {\n $u = user::getUserById($user_id);\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n }\n if(!empty($this->params['address_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'address_list') as $email) {\n $emaillist[] = $email;\n }\n }\n }",
" //This is an easy way to remove duplicates\n $emaillist = array_flip(array_flip($emaillist));\n $emaillist = array_map('trim', $emaillist);",
" if (empty($emaillist)) {\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n expValidator::failAndReturnToForm(gt('No Mailing Recipients Selected!'), $post);\n }\n if (empty($this->params['subject']) && empty($this->params['body']) && empty($_FILES['attach']['size'])) {\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n expValidator::failAndReturnToForm(gt('Nothing to Send!'), $post);\n }",
" $emailText = $this->params['body'];\n\t\t$emailText = trim(strip_tags(str_replace(array(\"<br />\",\"<br>\",\"br/>\"),\"\\n\",$emailText)));\n\t\t$emailHtml = $this->params['body'];",
" $from = $user->email;\n\t\tif (empty($from)) {\n\t\t\t$from = trim(SMTP_FROMADDRESS);\n\t\t}\n $from_name = $user->firstname.\" \".$user->lastname.\" (\".$user->username.\")\";\n\t\tif (empty($from_name)) {\n\t\t\t$from_name = trim(ORGANIZATION_NAME);\n\t\t}\n $subject = $this->params['subject'];\n\t\tif (empty($subject)) {\n $subject = gt('Email from') . ' ' . trim(ORGANIZATION_NAME);\n\t\t}\n// $headers = array(\n// \"MIME-Version\" => \"1.0\",\n// \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n// );",
" if (count($emaillist)) {\n\t\t\t$mail = new expMail();\n if (!empty($_FILES['attach']['size'])) {\n $dir = 'tmp';\n $filename = expFile::fixName(time() . '_' . $_FILES['attach']['name']);\n $dest = $dir . '/' . $filename;\n //Check to see if the directory exists. If not, create the directory structure.\n if (!file_exists(BASE . $dir)) expFile::makeDirectory($dir);\n // Move the temporary uploaded file into the destination directory, and change the name.\n $file = expFile::moveUploadedFile($_FILES['attach']['tmp_name'], BASE . $dest);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $ftype = finfo_file($finfo, BASE.$dest);\n// finfo_close($finfo);\n if (!empty($file)) $mail->attach_file_on_disk(BASE . $file, expFile::getMimeType(BASE . $file));\n }\n if ($this->params['batchsend']) {\n $mail->quickBatchSend(array(\n// \t'headers'=>$headers,\n 'html_message'=>$emailHtml,\n \"text_message\"=>$emailText,\n 'to'=>$emaillist,\n 'from'=>array(trim($from) => $from_name),\n 'subject'=>$subject,\n ));\n } else {\n $mail->quickSend(array(\n// \t'headers'=>$headers,\n 'html_message'=>$emailHtml,\n \"text_message\"=>$emailText,\n 'to'=>$emaillist,\n 'from'=>array(trim($from)=>$from_name),\n 'subject'=>$subject,\n ));\n }\n if (!empty($file)) unlink(BASE . $file); // delete temp file attachment\n flash('message',gt('Mass Email was sent'));\n expHistory::back();\n }\n }",
" /**\n * feature to run upgrade scripts outside of installation\n *\n */\n public function install_upgrades() {\n //display the upgrade scripts\n if (is_readable(BASE.'install/upgrades')) {\n $i = 0;\n if (is_readable(BASE.'install/include/upgradescript.php')) include(BASE.'install/include/upgradescript.php');",
" // first build a list of valid upgrade scripts\n $oldscripts = array(\n 'install_tables.php',\n 'convert_db_trim.php',\n 'remove_exp1_faqmodule.php',\n 'remove_locationref.php',\n 'upgrade_attachableitem_tables.php',\n );\n $ext_dirs = array(\n BASE . 'install/upgrades',\n THEME_ABSOLUTE . 'modules/upgrades'\n );\n foreach ($ext_dirs as $dir) {\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($dir . '/' . $file) && is_file($dir . '/' . $file) && substr($file, -4, 4) == '.php' && !in_array($file,$oldscripts)) {\n include_once($dir . '/' . $file);\n $classname = substr($file, 0, -4);\n /**\n * Stores the upgradescript object\n * @var \\upgradescript $upgradescripts\n * @name $upgradescripts\n */\n $upgradescripts[] = new $classname;\n }\n }\n }\n }\n // next sort the list by priority\n usort($upgradescripts, array('upgradescript','prioritize'));",
" // next run through the list\n $db_version = expVersion::dbVersion();\n $upgrade_scripts = array();\n foreach ($upgradescripts as $upgradescript) {\n if ($upgradescript->checkVersion($db_version) && $upgradescript->needed()) {\n $upgradescript->classname = get_class($upgradescript);\n $upgrade_scripts[] = $upgradescript;\n $i++;\n }\n }\n }\n assign_to_template(array(\n 'scripts'=>$upgrade_scripts,\n ));\n }",
" /**\n * run selected upgrade scripts outside of installation\n *\n */\n public function install_upgrades_run() {",
" $tables = expDatabase::install_dbtables();\n ksort($tables);",
" // locate the upgrade scripts\n $upgrade_dir = BASE.'install/upgrades';\n if (is_readable($upgrade_dir)) {\n $i = 0;\n if (is_readable(BASE.'install/include/upgradescript.php')) include(BASE.'install/include/upgradescript.php');\n $dh = opendir($upgrade_dir);",
" // first build a list of valid upgrade scripts\n $oldscripts = array(\n 'install_tables.php',\n 'convert_db_trim.php',\n 'remove_exp1_faqmodule.php',\n 'remove_locationref.php',\n 'upgrade_attachableitem_tables.php',\n );\n while (($file = readdir($dh)) !== false) {\n if (is_readable($upgrade_dir . '/' . $file) && is_file($upgrade_dir . '/' . $file) && substr($file, -4, 4) == '.php' && !in_array($file,$oldscripts)) {\n include_once($upgrade_dir . '/' . $file);\n $classname = substr($file, 0, -4);\n /**\n * Stores the upgradescript object\n * @var \\upgradescript $upgradescripts\n * @name $upgradescripts\n */\n $upgradescripts[] = new $classname;\n }\n }\n // next sort the list by priority\n usort($upgradescripts, array('upgradescript','prioritize'));",
" // next run through the list\n $db_version = expVersion::dbVersion();\n $upgrade_scripts = array();\n foreach ($upgradescripts as $upgradescript) {\n if ($upgradescript->checkVersion($db_version) && $upgradescript->needed()) {\n if (!empty($this->params[get_class($upgradescript)])) {\n $upgradescript->results = $upgradescript->upgrade();\n }\n $upgradescript->classname = get_class($upgradescript);\n $upgrade_scripts[] = $upgradescript;\n $i++;\n }\n }\n }\n assign_to_template(array(\n 'scripts'=>$upgrade_scripts,\n 'tables'=>$tables,\n ));\n }",
" public function manage_themes() {\n expHistory::set('manageable', $this->params);",
" if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }",
" \t$themes = array();\n \tif (is_readable(BASE.'themes')) {\n \t\t$dh = opendir(BASE.'themes');\n \t\twhile (($file = readdir($dh)) !== false) {\n \t\t\tif ($file != '.' && $file != '..' && is_dir(BASE.\"themes/$file\") && is_readable(BASE.\"themes/$file/class.php\")) {\n \t\t\t\tinclude_once(BASE.\"themes/$file/class.php\");\n \t\t\t\t$theme = new $file();\n \t\t\t\t$t = new stdClass();\n\t\t\t\t $t->user_configured = isset($theme->user_configured) ? $theme->user_configured : '';\n $t->stock_theme = isset($theme->stock_theme) ? $theme->stock_theme : '';\n \t\t\t\t$t->name = $theme->name();\n \t\t\t\t$t->description = $theme->description();\n \t\t\t\t$t->author = $theme->author();",
"\t\t\t\t $t->style_variations = array();\n \t\t$sv = opendir(BASE.'themes/'.$file);\n \t\twhile (($s = readdir($sv)) !== false) {\n if (substr($s,0,4) == \"css_\") {\n $t->style_variations[str_replace(\"css_\",\"\",$s)] = str_replace(\"css_\",\"\",$s);\n } elseif (substr($s,0,5) == \"less_\") {\n $t->style_variations[str_replace(\"less_\",\"\",$s)] = str_replace(\"less_\",\"\",$s);\n }\n }\n if(count($t->style_variations)>0){\n $t->style_variations = array_merge(array('Default'=>'Default'),$t->style_variations);\n }",
" \t\t\t\t$t->preview = is_readable(BASE.\"themes/$file/preview.jpg\") ? PATH_RELATIVE . \"themes/$file/preview.jpg\" : YUI2_RELATIVE . \"yui2-skin-sam-editor/assets/skins/sam/blankimage.png\";\n\t\t\t\t $t->mobile = is_readable(BASE.\"themes/$file/mobile/index.php\") ? true : false;\n \t\t\t\t$themes[$file] = $t;\n \t\t\t}\n \t\t}\n \t}",
" assign_to_template(array(\n 'themes'=>$themes\n ));\n }",
" ",
" public function theme_switch() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }\n \texpSettings::change('DISPLAY_THEME_REAL', $this->params['theme']);\n\t expSession::set('display_theme',$this->params['theme']);\n\t $sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t if (strtolower($sv)=='default') {\n\t $sv = '';\n\t }\n\t expSettings::change('THEME_STYLE_REAL',$sv);\n\t expSession::set('theme_style',$sv);\n\t expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme",
" // $message = (MINIFY != 1) ? \"Exponent is now minifying Javascript and CSS\" : \"Exponent is no longer minifying Javascript and CSS\" ;\n // flash('message',$message);\n\t $message = gt(\"You have selected the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t if ($sv != '') {\n\t\t $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation');\n\t }\n\t flash('message',$message);\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n// expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n \texpHistory::returnTo('manageable');",
" }\t\n ",
"\tpublic function theme_preview() {\n\t\texpSession::set('display_theme',$this->params['theme']);\n\t\t$sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t\tif (strtolower($sv)=='default') {\n\t\t $sv = '';\n\t\t}\n\t\texpSession::set('theme_style',$sv);\n\t\t$message = gt(\"You are previewing the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t\tif ($sv) {\n\t\t\t$message .= ' with '.$sv.' style variation';\n\t\t}\n\t\tif ($this->params['theme'] != DISPLAY_THEME_REAL || $this->params['sv'] != THEME_STYLE_REAL) {\n\t\t\tflash('notice',$message);\n\t\t}\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n//\t\texpTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n\t\texpHistory::back();\n\t}",
"\tpublic function configure_theme() {\n\t\tif (is_readable(BASE.\"themes/\".$this->params['theme'].\"/class.php\")) {\n\t\t\tinclude_once(BASE.\"themes/\".$this->params['theme'].\"/class.php\");\n $themeclass = $this->params['theme'];\n\t\t\t$theme = new $themeclass($this->params);\n\t\t\t$theme->configureTheme();\n\t\t}\n\t}",
"\tpublic function update_theme() {\n\t\tif (is_readable(BASE.\"themes/\".$this->params['theme'].\"/class.php\")) {\n\t\t\tinclude_once(BASE.\"themes/\".$this->params['theme'].\"/class.php\");\n $themeclass = $this->params['theme'];\n\t\t\t$theme = new $themeclass();\n\t\t\t$theme->saveThemeConfig($this->params);\n expSession::set('force_less_compile', 1);\n expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n\t\t}\n\t}",
" public function export_theme() {\n include_once(BASE.'external/Tar.php');",
" $themeclass = $this->params['theme'];\n $fname = tempnam(BASE.'/tmp','exporter_files_');\n $tar = new Archive_Tar($fname,'gz');\n $tar->createModify(BASE.'themes/'.$themeclass,'themes/',BASE.'themes/');",
" $filename = preg_replace('/[^A-Za-z0-9_.-]/','-',$themeclass.'.tar.gz');",
" ob_end_clean();\n // This code was lifted from phpMyAdmin, but this is Open Source, right?",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }",
" $fh = fopen($fname,'rb');\n while (!feof($fh)) {\n echo fread($fh,8192);\n }\n fclose($fh);\n unlink($fname);",
" exit(''); // Exit, since we are exporting.\n }",
"\tpublic function togglemobile() {\n\t\tif (!expSession::is_set('mobile')) { // account for FORCE_MOBILE initial state\n\t\t\texpSession::set('mobile',MOBILE);\n\t\t}\n\t\texpSession::set('mobile',!expSession::get('mobile'));\n expSession::set('force_less_compile', 1);\n\t\texpTheme::removeSmartyCache();\n\t\texpHistory::back();\n\t}",
" public function configure_site () {\n\t expHistory::set('manageable',$this->params);",
" if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n }",
" // TYPES OF ANTISPAM CONTROLS... CURRENTLY ONLY ReCAPTCHA\n $as_types = array(\n '0'=>'-- '.gt('Please Select an Anti-Spam Control').' --',\n \"recaptcha\"=>'reCAPTCHA'\n );",
" ",
" //THEMES FOR RECAPTCHA\n $as_themes = array(\n \"light\"=>gt('Light (Default)'),\n \t\"dark\"=>gt('Dark'),\n );",
" ",
" // Available Themes\n $themes = array();\n if (is_readable(BASE.'themes')) {\n \t$theme_dh = opendir(BASE.'themes');\n \twhile (($theme_file = readdir($theme_dh)) !== false) {\n \t\tif (is_readable(BASE.'themes/'.$theme_file.'/class.php')) {\n \t\t\t// Need to avoid the duplicate theme problem.\n \t\t\tif (!class_exists($theme_file)) {\n \t\t\t\tinclude_once(BASE.'themes/'.$theme_file.'/class.php');\n \t\t\t}",
" \t\t\tif (class_exists($theme_file)) {\n \t\t\t\t// Need to avoid instantiating non-existent classes.\n \t\t\t\t$t = new $theme_file();\n \t\t\t\t$themes[$theme_file] = $t->name();\n \t\t\t}\n \t\t}\n \t}\n }\n uasort($themes,'strnatcmp');",
" // Available elFinder Themes\n $elf_themes = array(''=>gt('Default/OSX'));\n if (is_readable(BASE.'external/elFinder/themes')) {\n \t$theme_dh = opendir(BASE.'external/elFinder/themes');\n \twhile (($theme_file = readdir($theme_dh)) !== false) {\n \t\tif ($theme_file != '..' && is_readable(BASE.'external/elFinder/themes/'.$theme_file.'/css/theme.css')) {\n $elf_themes['/themes/' . $theme_file] = ucwords($theme_file);\n \t\t}\n \t}\n }\n uasort($elf_themes,'strnatcmp');",
" // Available Languages\n\t $langs = expLang::langList();\n// ksort($langs);",
" // smtp protocol\n $protocol = array(\n 'ssl'=>'SSL',\n 'tls'=>'TLS'\n );",
" // Currency Format\n $currency = expSettings::dropdownData('currency');",
" // attribution\n// $attribution = array(\n// 'firstlast'=>'John Doe',\n// 'lastfirst'=>'Doe, John',\n// 'first'=>'John',\n// 'last'=>'Doe',\n// 'username'=>'jdoe'\n// );\n $attribution = expSettings::dropdownData('attribution');",
" // These funcs need to be moved up in to new subsystems",
" ",
" // Date/Time Format\n $datetime_format = expSettings::dropdownData('datetime_format');",
" // Date Format\n $date_format = expSettings::dropdownData('date_format');",
" ",
" // Time Format\n $time_format = expSettings::dropdownData('time_format');",
" ",
" // Start of Week\n// $start_of_week = glist(expSettings::dropdownData('start_of_week'));\n $daysofweek = event::dayNames();\n $start_of_week = $daysofweek['long'];",
" // File Permissions\n $file_permisions = glist(expSettings::dropdownData('file_permissions'));",
" ",
" // File Permissions\n $dir_permissions = glist(expSettings::dropdownData('dir_permissions'));",
" // Homepage Dropdown\n $section_dropdown = section::levelDropdownControlArray(0, 0, array(), false, 'view', true);",
" // Timezone Dropdown\n $list = DateTimeZone::listAbbreviations();\n $idents = DateTimeZone::listIdentifiers();\n $data = $offset = $added = array();\n foreach ($list as $abbr => $info) {\n foreach ($info as $zone) {\n if (!empty($zone['timezone_id']) AND !in_array($zone['timezone_id'],$added) AND in_array($zone['timezone_id'],$idents)) {\n try{\n $z = new DateTimeZone($zone['timezone_id']);\n $c = new DateTime(null, $z);\n $zone['time'] = $c->format('H:i a');\n $data[] = $zone;\n $offset[] = $z->getOffset($c);\n $added[] = $zone['timezone_id'];\n } catch(Exception $e) {\n flash('error', $e->getMessage());\n }\n }\n }\n }",
" array_multisort($offset, SORT_ASC, $data);\n $tzoptions = array();\n foreach ($data as $row) {\n $tzoptions[$row['timezone_id']] = self::formatOffset($row['offset'])\n . ' ' . $row['timezone_id'];\n }",
" $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $folders = array();\n $folders[] = 'Root Folder';\n foreach ($cats as $cat) {\n $folders[$cat->id] = $cat->title;\n }",
" // profiles\n $profiles = expSettings::profiles();\n if (empty($profiles)) {\n $profiles = array('' => '(default)');\n }",
" assign_to_template(array(\n 'as_types'=>$as_types,\n 'as_themes'=>$as_themes,\n 'themes'=>$themes,\n 'elf_themes'=>$elf_themes,\n 'langs'=>$langs,\n 'protocol'=>$protocol,\n 'currency'=>$currency,\n 'attribution'=>$attribution,\n 'datetime_format'=>$datetime_format,\n 'date_format'=>$date_format,\n 'time_format'=>$time_format,\n 'start_of_week'=>$start_of_week,\n 'timezones'=>$tzoptions,\n 'file_permisions'=>$file_permisions,\n 'dir_permissions'=>$dir_permissions,\n 'section_dropdown'=>$section_dropdown,\n 'folders'=>$folders,\n 'profiles'=>$profiles\n ));\n }",
"\t// now you can use $options;\n\tprivate function formatOffset($offset) {\n\t\t\t$hours = $offset / 3600;\n\t\t\t$remainder = $offset % 3600;\n\t\t\t$sign = $hours > 0 ? '+' : '-';\n\t\t\t$hour = (int) abs($hours);\n\t\t\t$minutes = (int) abs($remainder / 60);",
"\t\t\tif ($hour == 0 AND $minutes == 0) {\n\t\t\t\t$sign = ' ';\n\t\t\t}\n\t\t\treturn 'GMT' . $sign . str_pad($hour, 2, '0', STR_PAD_LEFT)\n\t\t\t\t\t.':'. str_pad($minutes,2, '0');",
"\t}",
" public function update_siteconfig () {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n } else {\n $this->params['sc']['MAINTENANCE_RETURN_TIME'] = yuicalendarcontrol::parseData('MAINTENANCE_RETURN_TIME', $this->params['sc']);\n foreach ($this->params['sc'] as $key => $value) {\n// expSettings::change($key, addslashes($value));\n expSettings::change($key, $value);\n }",
" flash('message', gt(\"Your Website Configuration has been updated\"));\n }\n setcookie('slingbar-top', $this->params['sc']['SLINGBAR_TOP']);\n// expHistory::back();\n\t expHistory::returnTo('viewable');\n }",
" public function change_profile() {\n if (empty($this->params['profile'])) return;\n expSession::un_set('display_theme');\n expSession::un_set('theme_style');\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n expSettings::activateProfile($this->params['profile']);\n flash('message', gt(\"New Configuration Profile Loaded\") . ' (' . $this->params['profile'] . ')');\n redirect_to(array('controller'=>'administration', 'action'=>'configure_site'));\n }",
" public function save_profile() {\n if (empty($this->params['profile'])) return;\n $profile = expSettings::createProfile($this->params['profile']);\n flash('message', gt(\"Configuration Profile Saved\") . ' (' . $this->params['profile'] . ')');\n// redirect_to(array('controller'=>'administration', 'action'=>'configure_site'));\n redirect_to(array('controller'=>'administration', 'action'=>'change_profile', 'profile'=>$profile));\n }",
" /**\n \t * Routine to force launching exponent installer\n \t */\n \tpublic static function install_exponent() {\n \t\t// we'll need the not_configured file to exist for install routine to work\n// \t\tif (!@file_exists(BASE.'install/not_configured')) {\n// \t\t\t$nc_file = fopen(BASE.'install/not_configured', \"w\");\n// \t\t\tfclose($nc_file);\n// \t\t}\n// $page = \"\";\n// if (@file_exists(BASE.'framework/conf/config.php')) {\n// $page = \"?page=upgrade-1\";\n// }\n if (@file_exists(BASE.'install/index.php')) {\n header('Location: ' . URL_FULL . 'install/index.php');\n exit('Redirecting to the Exponent Install Wizard');\n } else {\n flash('error', gt(\"Installation files were not found\"));\n }\n \t}",
"}",
"/**\n * This is the base theme class\n *\n * @subpackage Controllers\n * @package Modules\n */\nclass theme {\n\tpublic $user_configured = false;\n public $stock_theme = false;",
"\tfunction name() { return \"theme\"; }\n\tfunction author() { return \"\"; }\n\tfunction description() { return gt(\"The theme shell\"); }",
" /**\n * @param array $params\n */\n function __construct($params = array()) {\n $this->params = $params;\n }",
"\t/**\n\t * Method to Configure theme settings\n\t * This generic routine parses the theme's config.php file\n\t * and presents the values as text boxes.\n\t */\n\tfunction configureTheme () {\n\t\tif (isset($this->params['sv']) && $this->params['sv'] != '') {\n\t\t\tif (strtolower($this->params['sv'])=='default') {\n $this->params['sv']='';\n\t\t\t}\n\t\t\t$settings = expSettings::parseFile(BASE.\"themes/\".$this->params['theme'].\"/config_\".$this->params['sv'].\".php\");\n\t\t} else {\n\t\t\t$settings = expSettings::parseFile(BASE.\"themes/\".$this->params['theme'].\"/config.php\");\n\t\t}\n\t\t$form = new form();\n\t\t$form->meta('controller','administration');\n\t\t$form->meta('action','update_theme');\n\t\t$form->meta('theme',$this->params['theme']);\n\t\t$form->meta('sv',isset($this->params['sv'])?$this->params['sv']:'');\n\t\tforeach ($settings as $setting=>$key) {\n\t\t\t$form->register($setting,$setting.': ',new textcontrol($key,20));\n\t\t}\n\t\t$form->register(null,'',new htmlcontrol('<br>'));\n\t\t$form->register('submit','',new buttongroupcontrol(gt('Save'),'',gt('Cancel')));\n\t\tassign_to_template(array(\n 'name'=>$this->name().(!empty($this->params['sv'])?' '.$this->params['sv']:''),\n 'form_html'=>$form->toHTML()\n ));\n\t}",
"\t/**\n\t * Method to save/update theme settings\n\t * This generic routine parses the passed params\n\t * and saves them to the theme's config.php file\n\t * It attempts to remove non-theme params such as analytics, etc..\n\t *\n\t * @param $params theme configuration parameters\n\t */\n\tfunction saveThemeConfig ($params) {\n\t\t$theme = $params['theme'];\n\t\tunset ($params['theme']);\n\t\t$sv = $params['sv'];\n\t\tif (strtolower($sv)=='default') {\n\t\t $sv='';\n\t\t}\n\t\tunset (\n $params['sv'],\n $params['controller'],\n $params['action'],\n $params['cid'],\n $params['scayt_verLang'],\n $params['slingbar-top'],\n $params['XDEBUG_SESSION']\n );\n\t\tforeach ($params as $key=>$value) {\n\t\t\tif ($key[0] == '_') {\n\t\t\t\tunset ($params[$key]);\n\t\t\t}\n\t\t}\n\t\tif (!empty($sv)) {\n\t\t\texpSettings::saveValues($params, BASE.\"themes/\".$theme.\"/config_\".$sv.\".php\");\n\t\t} else {\n\t\t\texpSettings::saveValues($params, BASE.\"themes/\".$theme.\"/config.php\");\n\t\t}\n\t\texpHistory::back();\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */",
"class administrationController extends expController {\n public $basemodel_name = 'expRecord';",
" protected $manage_permissions = array(\n 'change'=>'Change Settings',",
"\t 'clear'=>'Clear Caches', //FIXME this requires a logged in user to perform?\n\t \"fix\"=>\"Fix Database\",\n\t \"install\"=>\"Installation\",",
" 'mass'=>'Mass Mailing',\n 'save'=>'Save Settings',",
"\t \"theme\"=>\"Manage Themes\",\n\t 'test_smtp'=>'Test SMTP Server Settings',\n\t 'toggle'=>'Toggle Settings',",
"// 'update'=>'Update Settings',",
" );",
" static function displayname() { return gt(\"Administration Controls\"); }\n static function description() { return gt(\"This is the Administration Module\"); }",
" static function hasSources() {\n return false;\n }",
"\tpublic function install_tables() {\n\t\t$tables = expDatabase::install_dbtables();\n\t\tksort($tables);\n assign_to_template(array(\n 'status'=>$tables\n ));\n\t}",
" public function delete_unused_columns() {\n \t\t$tables = expDatabase::install_dbtables(true);\n \t\tksort($tables);\n assign_to_template(array(\n 'status'=>$tables\n ));\n \t}",
" public function manage_unused_tables() {\n global $db;",
"",
" expHistory::set('manageable', $this->params);\n $unused_tables = array();\n $used_tables = array();\n $tables = $db->getTables();\n //eDebug($tables);",
"\t\t// first the core and 1.0 definitions\n\t\t$coredefs = BASE.'framework/core/definitions';\n\t\tif (is_readable($coredefs)) {\n\t\t\t$dh = opendir($coredefs);\n\t\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\t\tif (is_readable(\"$coredefs/$file\") && is_file(\"$coredefs/$file\") && substr($file,-4,4) == \".php\" && substr($file,-9,9) != \".info.php\") {\n\t\t\t\t\t$used_tables[]= strtolower(substr($file,0,-4));\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t // then search for module definitions\n $moddefs = array(\n BASE.'themes/'.DISPLAY_THEME_REAL.'/modules', // we only want to do this for the set theme, NOT the preview theme\n BASE.\"framework/modules\",\n );\n foreach ($moddefs as $moddef) {\n if (is_readable($moddef)) {\n $dh = opendir($moddef);\n while (($file = readdir($dh)) !== false) {\n if (is_dir($moddef.'/'.$file) && ($file != '..' && $file != '.')) {\n $dirpath = $moddef.'/'.$file.'/definitions';\n if (file_exists($dirpath)) {\n $def_dir = opendir($dirpath);\n while (($def = readdir($def_dir)) !== false) {\n if (is_readable(\"$dirpath/$def\") && is_file(\"$dirpath/$def\") && substr($def,-4,4) == \".php\" && substr($def,-9,9) != \".info.php\") {\n if ((!in_array(substr($def,0,-4), $used_tables))) {\n $used_tables[] = strtolower(substr($def,0,-4));\n }\n }\n }\n }\n }\n }\n }\n }",
" foreach($tables as $table) {\n $basename = strtolower(str_replace($db->prefix, '', $table));\n if (!in_array($basename, $used_tables) && !stristr($basename, 'forms')) {\n $unused_tables[$basename] = new stdClass();\n $unused_tables[$basename]->name = $table;\n $unused_tables[$basename]->rows = $db->countObjects($basename);\n }\n }",
"",
" assign_to_template(array(\n 'unused_tables'=>$unused_tables\n ));\n }",
"",
" public function delete_unused_tables() {\n global $db;",
" $count = 0;\n foreach($this->params['tables'] as $del=>$table) {\n $basename = str_replace($db->prefix, '', $table);\n $count += $db->dropTable($basename);\n }",
"",
" flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');\n expHistory::back();\n }",
"\tpublic function fix_optimize_database() {\n\t global $db;",
"\t\t$before = $db->databaseInfo();\n\t\tforeach (array_keys($before) as $table) {\n\t\t\t$db->optimize($table);\n\t\t}\n\t\t$after = $db->databaseInfo();\n\t assign_to_template(array(\n 'before'=>$before,\n 'after'=>$after\n ));\n\t}\n",
"//\tpublic function fix_sessions() {\n//\t global $db;\n//\n////\t\t$test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket');\n//\t\t$fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket');\n//\t\tflash('message', gt('Sessions Table was Repaired'));\n//\t\texpHistory::back();\n//\t}",
"\n\tpublic function fix_database() {\n\t global $db;",
"\t// upgrade sectionref's that have lost their originals\n// $no_origs = array();\n//\t\t$sectionrefs = $db->selectObjects('sectionref',\"is_original=0\");\n//\t\tif (count($sectionrefs)) {\n//\t\t\tprint_r(gt(\"Found\").\": \".count($sectionrefs).\" \".gt(\"copies (not originals)\").\"<br>\");\n// foreach ($sectionrefs as $sectionref) {\n// if ($db->selectObject('sectionref',\"module='\".$sectionref->module.\"' AND source='\".$sectionref->source.\"' AND is_original='1'\") == null) {\n// // There is no original for this sectionref so change it to the original\n// $sectionref->is_original = 1;\n// $db->updateObject($sectionref,\"sectionref\");\n// $no_origs[] = gt(\"Fixed\").\": \".$sectionref->module.\" - \".$sectionref->source;\n// }\n// }\n//\t\t}\n// assign_to_template(array(\n// 'no_origs'=>$no_origs,\n// ));",
"\t// upgrade sectionref's that point to missing sections (pages)\n\t\t$sectionrefs = $db->selectObjects('sectionref',\"refcount!=0\");\n\t\t$no_sections = array();\n\t\tforeach ($sectionrefs as $sectionref) {\n\t\t\tif ($db->selectObject('section',\"id='\".$sectionref->section.\"'\") == null) {\n\t\t\t// There is no section/page for sectionref so change the refcount\n\t\t\t\t$sectionref->refcount = 0;\n\t\t\t\t$db->updateObject($sectionref,\"sectionref\");\n $no_sections[] = gt(\"Fixed\").\": \".$sectionref->module.\" - \".$sectionref->source;\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'no_sections'=>$no_sections,\n ));",
"\t // delete sectionref's that have empty sources since they are dead\n\t\t $sectionrefs = $db->selectObjects('sectionref','source=\"\"');\n $no_assigns = array();\n\t\t if ($sectionrefs != null) {\n $no_assigns[] = gt(\"Removing\").\": \".count($sectionrefs).\" \".gt(\"empty sectionrefs (no source)\");\n\t\t\t $db->delete('sectionref','source=\"\"');\n\t\t }\n assign_to_template(array(\n 'no_assigns'=>$no_assigns,\n ));",
"\t// add missing sectionrefs based on existing containers (fixes aggregation problem)\n\t\t$containers = $db->selectObjects('container',1);\n $missing_sectionrefs = array();\n\t\tforeach ($containers as $container) {\n\t\t\t$iloc = expUnserialize($container->internal);\n\t\t\tif ($db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"'\") == null) {\n\t\t\t// There is no sectionref for this container. Populate sectionref\n if ($container->external != \"N;\") {\n $newSecRef = new stdClass();\n $newSecRef->module = $iloc->mod;\n $newSecRef->source = $iloc->src;\n $newSecRef->internal = '';\n $newSecRef->refcount = 1;\n// $newSecRef->is_original = 1;\n\t\t\t\t\t$eloc = expUnserialize($container->external);",
"",
" $section = $db->selectObject('sectionref',\"module='container' AND source='\".$eloc->src.\"'\");\n\t\t\t\t\tif (!empty($section)) {\n\t\t\t\t\t\t$newSecRef->section = $section->id;\n\t\t\t\t\t\t$db->insertObject($newSecRef,\"sectionref\");\n\t\t\t\t\t\t$missing_sectionrefs[] = gt(\"Missing sectionref for container replaced\").\": \".$iloc->mod.\" - \".$iloc->src.\" - PageID #\".$section->id;\n\t\t\t\t\t} else {\n $db->delete('container','id=\"'.$container->id.'\"');\n $missing_sectionrefs[] = gt(\"Cant' find the container page for container\").\": \".$iloc->mod.\" - \".$iloc->src.' - '.gt('deleted');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'missing_sectionrefs'=>$missing_sectionrefs,\n ));\n\t}",
" public function fix_tables() {\n $renamed = expDatabase::fix_table_names();\n assign_to_template(array(\n 'tables'=>$renamed,\n ));\n \t}",
" public function install_ecommerce_tables() {\n global $db;",
" $eql = BASE . \"install/samples/ecommerce.eql\";\n if (file_exists($eql)) {\n $errors = array();\n expFile::restoreDatabase($eql,$errors);\n } else {\n $errors = array(gt('The file does not exist'));\n }\n if (DEVELOPMENT && count($errors)) {\n $msg = gt('Errors were encountered importing the e-Commerce data.').'<ul>';\n foreach ($errors as $e) $msg .= '<li>'.$e.'</li>';\n $msg .= '</ul>';\n flash('error',$msg);\n } else {\n flash('message',gt('e-Commerce data was added to your database.'));\n }\n expHistory::back();\n \t}",
" public function toolbar() {\n// global $user;",
" $menu = array();\n\t\t$dirs = array(\n\t\t\tBASE.'framework/modules/administration/menus',\n\t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus'\n\t\t);",
"\t\tforeach ($dirs as $dir) {\n\t\t if (is_readable($dir)) {\n\t\t\t $dh = opendir($dir);\n\t\t\t while (($file = readdir($dh)) !== false) {\n\t\t\t\t if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {\n\t\t\t\t\t $menu[substr($file,0,-4)] = include($dir.'/'.$file);\n if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]);\n\t\t\t\t }\n\t\t\t }\n\t\t }\n\t\t}",
" // sort the top level menus alphabetically by filename",
"\t\tksort($menu);",
"\t\t$sorted = array();\n\t\tforeach($menu as $m) $sorted[] = $m;",
"",
" // slingbar position\n if (isset($_COOKIE['slingbar-top'])){\n $top = $_COOKIE['slingbar-top'];\n } else {\n $top = SLINGBAR_TOP;\n }",
"",
"\t\tassign_to_template(array(\n 'menu'=>(bs3()) ? $sorted : json_encode($sorted),\n \"top\"=>$top\n ));\n }",
"",
"// public function index() {\n// redirect_to(array('controller'=>'administration', 'action'=>'toolbar'));\n//// $this->toolbar();\n// }",
"",
" public function update_SetSlingbarPosition() {\n setcookie('slingbar-top', $this->params['top']);\n expHistory::back();\n }",
" public function manage_lang() {\n global $default_lang, $cur_lang;",
" // Available Languages\n\t $langs = expLang::langList();\n $num_missing = 0;\n foreach ($default_lang as $key => $value) {\n if (!array_key_exists($key,$cur_lang)) $num_missing++;\n }\n $num_untrans = 0;\n foreach ($cur_lang as $key => $value) {\n if ($key == $value) $num_untrans++;\n }\n assign_to_template(array(\n 'langs'=>$langs,\n 'missing'=>$num_missing,\n \"count\"=>count($cur_lang),\n 'untrans'=>$num_untrans\n ));\n \t}",
" public function update_language() {\n expSettings::change('LANGUAGE', $this->params['newlang']);\n flash('message',gt('Display Language changed to').\": \".$this->params['newlang']);\n redirect_to(array('controller'=>'administration', 'action'=>'manage_lang'));\n// $this->manage_lang();\n \t}",
" public function manage_lang_await() {\n global $cur_lang;",
" $awaiting_trans = array();\n foreach ($cur_lang as $key => $value) {\n if ($key == $value) {\n $awaiting_trans[$key] = stripslashes($value);\n }\n }\n assign_to_template(array(\n 'await'=>$awaiting_trans\n ));\n \t}",
" public function save_newlangfile() {\n\t\t$result = expLang::createNewLangFile($this->params['newlang']);\n flash($result['type'],$result['message']);\n if ($result['type'] != 'error') {\n expSettings::change('LANGUAGE', $this->params['newlang']);\n expLang::createNewLangInfoFile($this->params['newlang'],$this->params['newauthor'],$this->params['newcharset'],$this->params['newlocale']);\n flash('message',gt('Display Language changed to').\": \".$this->params['newlang']);\n }\n redirect_to(array('controller'=>'administration', 'action'=>'manage_lang'));\n// $this->manage_lang();\n \t}",
"\tpublic function test_smtp() {\n\t\t$smtp = new expMail();\n\t\t$smtp->test();\n\t}",
" public function toggle_minify() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Minification settings.'));\n } else {\n $newvalue = (MINIFY == 1) ? 0 : 1;\n expSettings::change('MINIFY', $newvalue);\n $message = ($newvalue) ? gt(\"Exponent is now minifying Javascript and CSS\") : gt(\n \"Exponent is no longer minifying Javascript and CSS\"\n );\n flash('message', $message);\n }\n \texpHistory::back();\n }",
"",
"\tpublic function toggle_dev() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Error Reporting settings.'));\n } else {\n $newvalue = (DEVELOPMENT == 1) ? 0 : 1;\n expSettings::change('DEVELOPMENT', $newvalue);\n// expTheme::removeCss();\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n $message = ($newvalue) ? gt(\"Exponent is now in 'Development' mode\") : gt(\n \"Exponent is no longer in 'Development' mode\"\n );\n flash('message', $message);\n }\n\t\texpHistory::back();\n\t}",
" public function toggle_log() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Logging settings.'));\n } else {\n $newvalue = (LOGGER == 1) ? 0 : 1;\n expSettings::change('LOGGER', $newvalue);\n }\n \t\texpHistory::back();\n \t}",
"\tpublic function toggle_maintenance() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Maintenance settings.'));\n } else {\n $newvalue = (MAINTENANCE_MODE == 1) ? 0 : 1;\n expSettings::change('MAINTENANCE_MODE', $newvalue);\n MAINTENANCE_MODE == 1 ? flash('message', gt(\"Exponent is no longer in 'Maintenance' mode\")) : \"\";\n }\n\t\texpHistory::back();\n\t}",
" public function toggle_workflow() {\n global $db;",
" if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n } else {\n $newvalue = (ENABLE_WORKFLOW == 1) ? 0 : 1;\n expSettings::change('ENABLE_WORKFLOW', $newvalue);\n $models = expModules::initializeModels();\n if ($newvalue) {\n // workflow is now turned on, initialize by approving all items\n expDatabase::install_dbtables(true, $newvalue); // force a strict table update to add workflow columns\n foreach ($models as $modelname => $modelpath) {\n $model = new $modelname();\n if ($model->supports_revisions) {\n $db->columnUpdate($model->tablename, 'approved', 1, 'approved=0');\n }\n }\n } else {\n // workflow is now turned off, remove older revisions\n foreach ($models as $modelname => $modelpath) {\n $model = new $modelname();\n if ($model->supports_revisions) {\n $items = $model->find();\n foreach ($items as $item) {\n $db->trim_revisions($model->tablename, $item->id, 1, $newvalue);\n }\n }\n }\n expDatabase::install_dbtables(\n true,\n $newvalue\n ); // force a strict table update to remove workflow columns\n }\n $message = ($newvalue) ? gt(\"Exponent 'Workflow' is now ON\") : gt(\"Exponent 'Workflow' is now OFF\");\n flash('message', $message);\n }\n \t\texpHistory::back();\n \t}",
"\tpublic function toggle_preview() {\n\t\t$level = 99;\n\t\tif (expSession::is_set('uilevel')) {\n\t\t\t$level = expSession::get('uilevel');\n\t\t}\n\t\tif ($level == UILEVEL_PREVIEW) {\n\t\t\texpSession::un_set('uilevel');\n\t\t} else { //edit mode\n\t\t\texpSession::set(\"uilevel\",UILEVEL_PREVIEW);\n\t\t}\n\t\t$message = ($level == UILEVEL_PREVIEW) ? gt(\"Exponent is no longer in 'Preview' mode\") : gt(\"Exponent is now in 'Preview' mode\") ;\n\t\tflash('message',$message);\n\t\texpHistory::back();\n\t}",
" public function manage_version() {\n expSession::un_set('update-check'); // reset the already checked flag\n if (!expVersion::checkVersion(true)) {\n flash('message', gt('Your version of Exponent CMS is current.'));\n }\n \t\texpHistory::back();\n \t}",
"\tpublic function clear_smarty_cache() {\n\t\texpTheme::clearSmartyCache();\n expSession::clearAllUsersSessionCache();\n }",
"\tpublic function clear_css_cache() {\n\t\texpTheme::removeCss();\n expSession::set('force_less_compile', 1);\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n\t\tflash('message',gt(\"CSS/Minify Cache has been cleared\"));\n\t\texpHistory::back();\n\t}",
"\tpublic function clear_image_cache() {\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/pixidou');\n\t\tif (file_exists(BASE.'tmp/img_cache'))\n expFile::removeFilesInDirectory(BASE.'tmp/img_cache');\n\t\tflash('message',gt(\"Image/Pixidou Cache has been cleared\"));\n\t\texpHistory::back();\n\t}",
"\tpublic function clear_rss_cache() {\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/rsscache');\n\t\tflash('message',gt(\"RSS/Podcast/Twitter Cache has been cleared\"));\n\t\texpHistory::back();\n\t}",
"\tpublic static function clear_all_caches() {\n\t\texpTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache(); // clear the session cache for true 'clear all'\n expHistory::flush(); // clear the history\n expSession::un_set('framework');\n expSession::un_set('display_theme');\n expSession::un_set('theme_style');\n\t\texpTheme::removeCss();\n expSession::set('force_less_compile', 1);\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/pixidou');\n\t\tif (file_exists(BASE.'tmp/img_cache'))\n expFile::removeFilesInDirectory(BASE.'tmp/img_cache');\n if (file_exists(BASE.'tmp/elfinder'))\n expFile::removeFilesInDirectory(BASE.'tmp/elfinder');\n\t\tif (file_exists(BASE.'tmp/extensionuploads'))\n expFile::removeFilesInDirectory(BASE.'tmp/extensionuploads');\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/rsscache');\n\t\tflash('message',gt(\"All the System Caches have been cleared\"));\n\t\texpHistory::back();\n\t}",
"\tpublic function install_extension() {",
"\t\t$modsurl =array(\n\t\t\t'themes'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-themes',\n\t\t\t'fixes'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-fixes',\n\t\t\t'mods'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-mods'\n\t\t);",
"\t\t$RSS = new SimplePie();\n\t\t$RSS->set_cache_location(BASE.'tmp/rsscache'); // default is ./cache\n//\t $RSS->set_cache_duration(3600); // default if 3600\n\t\t$RSS->set_timeout(20); // default is 10\n//\t $RSS->set_output_encoding('UTF-8'); // which is the default\n\t\t$items['themes'] = array();\n\t\t$items['fixes'] = array();\n\t\t$items['mods'] = array();\n\t\tforeach($modsurl as $type=>$url) {\n\t\t $RSS->set_feed_url($url);\n\t\t $feed = $RSS->init();\n\t\t if (!$feed) {\n\t\t // an error occurred in the rss.\n\t\t continue;\n\t\t }\n\t\t\t$RSS->handle_content_type();\n\t\t foreach ($RSS->get_items() as $rssItem) {\n\t\t $rssObject = new stdClass();\n\t\t $rssObject->title = $rssItem->get_title();\n\t\t $rssObject->body = $rssItem->get_description();\n\t\t $rssObject->rss_link = $rssItem->get_permalink();\n\t\t $rssObject->publish = $rssItem->get_date('U');\n\t\t $rssObject->publish_date = $rssItem->get_date('U');\n\t\t\t\tforeach ($rssItem->get_enclosures() as $enclosure) {\n\t\t\t\t\t$rssObject->enclosure = $enclosure->get_link();\n $rssObject->length = $enclosure->get_length();\n\t\t\t\t}\n\t\t $items[$type][] = $rssObject;\n\t\t }\n\t\t}",
"//\t\t$form = new form();\n// $form->meta('module','administration');\n// $form->meta('action','install_extension_confirm');\n//\t\t$form->register(null,'',new htmlcontrol(expCore::maxUploadSizeMessage()));\n//\t\t$form->register('mod_archive','Extension Archive',new uploadcontrol());\n// $form->register('patch',gt('Patch Exponent CMS or Install Theme?'),new checkboxcontrol(false,false),null,null,gt('All extensions are normally placed within the CURRENT theme (folder)'));\n// $form->register('submit','',new buttongroupcontrol(gt('Upload Extension')));",
"\t\tassign_to_template(array(\n 'themes'=>$items['themes'],\n 'fixes'=>$items['fixes'],\n 'mods'=>$items['mods'],\n// 'form_html'=>$form->toHTML()\n ));\n\t}",
"\tpublic function install_extension_confirm() {\n if (!empty($this->params['files'])) {\n foreach ($this->params['files'] as $title=>$url) {\n $filename = tempnam(\"tmp/extensionuploads/\",'tmp');\n expCore::saveData($url,$filename);\n $_FILES['mod_archive']['name'] = end(explode(\"/\", $url));\n// $finfo = finfo_open(FILEINFO_MIME);\n// $mimetype = finfo_file($finfo, $filename);\n// finfo_close($finfo);\n// $_FILES['mod_archive']['type'] = $mimetype;\n $_FILES['mod_archive']['tmp_name'] = $filename;\n $_FILES['mod_archive']['error'] = 0;\n $_FILES['mod_archive']['size'] = filesize($filename);\n }\n }\n if ($_FILES['mod_archive']['error'] != UPLOAD_ERR_OK) {\n\t\t\tswitch($_FILES['mod_archive']['error']) {\n\t\t\t\tcase UPLOAD_ERR_INI_SIZE:\n\t\t\t\tcase UPLOAD_ERR_FORM_SIZE:\n\t\t\t\t\tflash('error', gt('The file you uploaded exceeded the size limits for the server.'));\n\t\t\t\t\tbreak;\n\t\t\t\tcase UPLOAD_ERR_PARTIAL:\n\t\t\t\t\tflash('error', gt('The file you uploaded was only partially uploaded.'));\n\t\t\t\t\tbreak;\n\t\t\t\tcase UPLOAD_ERR_NO_FILE:\n\t\t\t\t\tflash('error', gt('No file was uploaded.'));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\t$basename = basename($_FILES['mod_archive']['name']);\n\t\t\t// Check future radio buttons; for now, try auto-detect\n\t\t\t$compression = null;\n\t\t\t$ext = '';\n\t\t\tif (substr($basename,-4,4) == '.tar') {\n\t\t\t\t$compression = null;\n\t\t\t\t$ext = '.tar';\n\t\t\t} else if (substr($basename,-7,7) == '.tar.gz') {\n\t\t\t\t$compression = 'gz';\n\t\t\t\t$ext = '.tar.gz';\n\t\t\t} else if (substr($basename,-4,4) == '.tgz') {\n\t\t\t\t$compression = 'gz';\n\t\t\t\t$ext = '.tgz';\n\t\t\t} else if (substr($basename,-8,8) == '.tar.bz2') {\n\t\t\t\t$compression = 'bz2';\n\t\t\t\t$ext = '.tar.bz2';\n\t\t\t} else if (substr($basename,-4,4) == '.zip') {\n\t\t\t\t$compression = 'zip';\n\t\t\t\t$ext = '.zip';\n\t\t\t}",
"\t\t\tif ($ext == '') {\n\t\t\t\tflash('error', gt('Unknown archive format. Archives must either be regular ZIP files, TAR files, Gzipped Tarballs, or Bzipped Tarballs.'));\n\t\t\t} else {",
"\t\t\t\t// Look for stale sessid directories:\n\t\t\t\t$sessid = session_id();\n\t\t\t\tif (file_exists(BASE.\"tmp/extensionuploads/$sessid\") && is_dir(BASE.\"tmp/extensionuploads/$sessid\")) expFile::removeDirectory(\"tmp/extensionuploads/$sessid\");\n\t\t\t\t$return = expFile::makeDirectory(\"tmp/extensionuploads/$sessid\");\n\t\t\t\tif ($return != SYS_FILES_SUCCESS) {\n\t\t\t\t\tswitch ($return) {\n\t\t\t\t\t\tcase SYS_FILES_FOUNDFILE:\n\t\t\t\t\t\tcase SYS_FILES_FOUNDDIR:\n\t\t\t\t\t\t\tflash('error', gt('Found a file in the directory path when creating the directory to store the files in.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SYS_FILES_NOTWRITABLE:\n\t\t\t\t\t\t\tflash('error', gt('Destination parent is not writable.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SYS_FILES_NOTREADABLE:\n\t\t\t\t\t\t\tflash('error', gt('Destination parent is not readable.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"\t\t\t\t$dest = BASE.\"tmp/extensionuploads/$sessid/archive$ext\";\n if (is_uploaded_file($_FILES['mod_archive']['tmp_name'])) {\n\t\t\t\t move_uploaded_file($_FILES['mod_archive']['tmp_name'],$dest);\n } else {\n rename($_FILES['mod_archive']['tmp_name'],$dest);\n }",
"\t\t\t\tif ($compression != 'zip') {// If not zip, must be tar\n\t\t\t\t\tinclude_once(BASE.'external/Tar.php');",
"\t\t\t\t\t$tar = new Archive_Tar($dest,$compression);",
"\t\t\t\t\tPEAR::setErrorHandling(PEAR_ERROR_PRINT);\n\t\t\t\t\t$return = $tar->extract(dirname($dest));\n\t\t\t\t\tif (!$return) {\n\t\t\t\t\t\tflash('error',gt('Error extracting TAR archive'));\n\t\t\t\t\t} else {\n//\t\t\t\t\t\theader('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=tar');\n//\t\t\t\t\t\tself::verify_extension('tar');\n\t\t\t\t\t}\n\t\t\t\t} else { // must be zip\n\t\t\t\t\tinclude_once(BASE.'external/Zip.php');",
"\t\t\t\t\t$zip = new Archive_Zip($dest);",
"\t\t\t\t\tPEAR::setErrorHandling(PEAR_ERROR_PRINT);\n\t\t\t\t\tif ($zip->extract(array('add_path'=>dirname($dest))) == 0) {\n\t\t\t\t\t\tflash('error',gt('Error extracting ZIP archive').': '.$zip->_error_code . ' : ' . $zip->_error_string . '<br />');\n\t\t\t\t\t} else {\n//\t\t\t\t\t\theader('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=zip');\n//\t\t\t\t\t\tself::verify_extension('zip');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$sessid = session_id();\n\t\t\t\t$files = array();\n\t\t\t\tforeach (expFile::listFlat(BASE.'tmp/extensionuploads/'.$sessid,true,null,array(),BASE.'tmp/extensionuploads/'.$sessid) as $key=>$f) {\n\t\t\t\t\tif ($key != '/archive.tar' && $key != '/archive.tar.gz' && $key != '/archive.tar.bz2' && $key != '/archive.zip') {\n if (empty($this->params['patch']) || !$this->params['patch']) {\n $key = substr($key,1);\n if (substr($key,0,7)=='themes/') {\n $parts = explode('/',$key);\n $parts[1] = DISPLAY_THEME_REAL;\n $file = implode('/',$parts);\n } else {\n $file = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace(\"framework/\", \"\", $key);\n }\n $file = str_replace(\"modules-1\", \"modules\", $file);\n } else {\n $file = substr($key,1);\n }\n\t\t\t\t\t\t$files[] = array(\n\t\t\t\t\t\t\t'absolute'=>$file,\n\t\t\t\t\t\t\t'relative'=>$f,\n\t\t\t\t\t\t\t'canCreate'=>expFile::canCreate(BASE.$file,1),\n\t\t\t\t\t\t\t'ext'=>substr($f,-3,3)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tassign_to_template(array(\n 'relative'=>'tmp/extensionuploads/'.$sessid,\n 'files'=>$files,\n 'patch'=>empty($this->params['patch'])?0:$this->params['patch']\n ));\n\t\t\t}\n\t\t}\n\t}",
"\tpublic function install_extension_finish() {\n $patch =$this->params['patch']==1;\n\t\t$sessid = session_id();\n\t\tif (!file_exists(BASE.\"tmp/extensionuploads/$sessid\") || !is_dir(BASE.\"tmp/extensionuploads/$sessid\")) {\n\t\t\t$nofiles = 1;\n\t\t} else {\n\t\t\t$success = array();\n\t\t\tforeach (array_keys(expFile::listFlat(BASE.\"tmp/extensionuploads/$sessid\",true,null,array(),BASE.\"tmp/extensionuploads/$sessid\")) as $file) {\n\t\t\t\tif ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') {\n if ($patch) { // this is a patch/fix extension\n expFile::makeDirectory(dirname($file));\n $success[$file] = copy(BASE.\"tmp/extensionuploads/$sessid\".$file,BASE.substr($file,1));\n if (basename($file) == 'views_c') chmod(BASE.substr($file,1),0777);\n } else {\n $newfile = substr($file,1);\n if (substr($newfile,0,7)=='themes/') { // this is a theme extension\n $parts = explode('/',$newfile);\n $parts[1] = DISPLAY_THEME_REAL;\n $newfile = implode('/',$parts);\n } else { // this is a mod extension\n $newfile = str_replace(\"framework/\", \"\", $newfile);\n $newfile = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace(\"modules-1\", \"modules\", $newfile);\n }\n expFile::makeDirectory(dirname($newfile));\n $success[$newfile] = copy(BASE.\"tmp/extensionuploads/$sessid\".$file,BASE.$newfile);\n }\n\t\t\t\t}\n\t\t\t}",
"\t\t\t$del_return = expFile::removeDirectory(BASE.\"tmp/extensionuploads/$sessid\"); //FIXME shouldn't use echo\n//\t\t\techo $del_return;\n $tables = expDatabase::install_dbtables();\n ksort($tables);\n assign_to_template(array(\n 'tables'=>$tables\n ));\n\t\t\t$nofiles = 0;\n\t\t}",
"\t\tassign_to_template(array(\n 'nofiles'=>$nofiles,\n 'success'=>$success,\n 'redirect'=>expHistory::getLastNotEditable()\n ));\n\t}",
" public function mass_mail() {\n // nothing we need to do except display view\n }",
" public function mass_mail_out() {\n global $user;",
" $emaillist = array();\n if (!empty($this->params['allusers'])) {\n foreach (user::getAllUsers() as $u) {\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n } else {\n if(!empty($this->params['group_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'grouplist') as $group_id) {\n $grpusers = group::getUsersInGroup($group_id);\n foreach ($grpusers as $u) {\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n }\n }\n if(!empty($this->params['user_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'user_list') as $user_id) {\n $u = user::getUserById($user_id);\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n }\n if(!empty($this->params['address_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'address_list') as $email) {\n $emaillist[] = $email;\n }\n }\n }",
" //This is an easy way to remove duplicates\n $emaillist = array_flip(array_flip($emaillist));\n $emaillist = array_map('trim', $emaillist);",
" if (empty($emaillist)) {\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n expValidator::failAndReturnToForm(gt('No Mailing Recipients Selected!'), $post);\n }\n if (empty($this->params['subject']) && empty($this->params['body']) && empty($_FILES['attach']['size'])) {\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n expValidator::failAndReturnToForm(gt('Nothing to Send!'), $post);\n }",
" $emailText = $this->params['body'];\n\t\t$emailText = trim(strip_tags(str_replace(array(\"<br />\",\"<br>\",\"br/>\"),\"\\n\",$emailText)));\n\t\t$emailHtml = $this->params['body'];",
" $from = $user->email;\n\t\tif (empty($from)) {\n\t\t\t$from = trim(SMTP_FROMADDRESS);\n\t\t}\n $from_name = $user->firstname.\" \".$user->lastname.\" (\".$user->username.\")\";\n\t\tif (empty($from_name)) {\n\t\t\t$from_name = trim(ORGANIZATION_NAME);\n\t\t}\n $subject = $this->params['subject'];\n\t\tif (empty($subject)) {\n $subject = gt('Email from') . ' ' . trim(ORGANIZATION_NAME);\n\t\t}\n// $headers = array(\n// \"MIME-Version\" => \"1.0\",\n// \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n// );",
" if (count($emaillist)) {\n\t\t\t$mail = new expMail();\n if (!empty($_FILES['attach']['size'])) {\n $dir = 'tmp';\n $filename = expFile::fixName(time() . '_' . $_FILES['attach']['name']);\n $dest = $dir . '/' . $filename;\n //Check to see if the directory exists. If not, create the directory structure.\n if (!file_exists(BASE . $dir)) expFile::makeDirectory($dir);\n // Move the temporary uploaded file into the destination directory, and change the name.\n $file = expFile::moveUploadedFile($_FILES['attach']['tmp_name'], BASE . $dest);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $ftype = finfo_file($finfo, BASE.$dest);\n// finfo_close($finfo);\n if (!empty($file)) $mail->attach_file_on_disk(BASE . $file, expFile::getMimeType(BASE . $file));\n }\n if ($this->params['batchsend']) {\n $mail->quickBatchSend(array(\n// \t'headers'=>$headers,\n 'html_message'=>$emailHtml,\n \"text_message\"=>$emailText,\n 'to'=>$emaillist,\n 'from'=>array(trim($from) => $from_name),\n 'subject'=>$subject,\n ));\n } else {\n $mail->quickSend(array(\n// \t'headers'=>$headers,\n 'html_message'=>$emailHtml,\n \"text_message\"=>$emailText,\n 'to'=>$emaillist,\n 'from'=>array(trim($from)=>$from_name),\n 'subject'=>$subject,\n ));\n }\n if (!empty($file)) unlink(BASE . $file); // delete temp file attachment\n flash('message',gt('Mass Email was sent'));\n expHistory::back();\n }\n }",
" /**\n * feature to run upgrade scripts outside of installation\n *\n */\n public function install_upgrades() {\n //display the upgrade scripts\n if (is_readable(BASE.'install/upgrades')) {\n $i = 0;\n if (is_readable(BASE.'install/include/upgradescript.php')) include(BASE.'install/include/upgradescript.php');",
" // first build a list of valid upgrade scripts\n $oldscripts = array(\n 'install_tables.php',\n 'convert_db_trim.php',\n 'remove_exp1_faqmodule.php',\n 'remove_locationref.php',\n 'upgrade_attachableitem_tables.php',\n );\n $ext_dirs = array(\n BASE . 'install/upgrades',\n THEME_ABSOLUTE . 'modules/upgrades'\n );\n foreach ($ext_dirs as $dir) {\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($dir . '/' . $file) && is_file($dir . '/' . $file) && substr($file, -4, 4) == '.php' && !in_array($file,$oldscripts)) {\n include_once($dir . '/' . $file);\n $classname = substr($file, 0, -4);\n /**\n * Stores the upgradescript object\n * @var \\upgradescript $upgradescripts\n * @name $upgradescripts\n */\n $upgradescripts[] = new $classname;\n }\n }\n }\n }\n // next sort the list by priority\n usort($upgradescripts, array('upgradescript','prioritize'));",
" // next run through the list\n $db_version = expVersion::dbVersion();\n $upgrade_scripts = array();\n foreach ($upgradescripts as $upgradescript) {\n if ($upgradescript->checkVersion($db_version) && $upgradescript->needed()) {\n $upgradescript->classname = get_class($upgradescript);\n $upgrade_scripts[] = $upgradescript;\n $i++;\n }\n }\n }\n assign_to_template(array(\n 'scripts'=>$upgrade_scripts,\n ));\n }",
" /**\n * run selected upgrade scripts outside of installation\n *\n */\n public function install_upgrades_run() {",
" $tables = expDatabase::install_dbtables();\n ksort($tables);",
" // locate the upgrade scripts\n $upgrade_dir = BASE.'install/upgrades';\n if (is_readable($upgrade_dir)) {\n $i = 0;\n if (is_readable(BASE.'install/include/upgradescript.php')) include(BASE.'install/include/upgradescript.php');\n $dh = opendir($upgrade_dir);",
" // first build a list of valid upgrade scripts\n $oldscripts = array(\n 'install_tables.php',\n 'convert_db_trim.php',\n 'remove_exp1_faqmodule.php',\n 'remove_locationref.php',\n 'upgrade_attachableitem_tables.php',\n );\n while (($file = readdir($dh)) !== false) {\n if (is_readable($upgrade_dir . '/' . $file) && is_file($upgrade_dir . '/' . $file) && substr($file, -4, 4) == '.php' && !in_array($file,$oldscripts)) {\n include_once($upgrade_dir . '/' . $file);\n $classname = substr($file, 0, -4);\n /**\n * Stores the upgradescript object\n * @var \\upgradescript $upgradescripts\n * @name $upgradescripts\n */\n $upgradescripts[] = new $classname;\n }\n }\n // next sort the list by priority\n usort($upgradescripts, array('upgradescript','prioritize'));",
" // next run through the list\n $db_version = expVersion::dbVersion();\n $upgrade_scripts = array();\n foreach ($upgradescripts as $upgradescript) {\n if ($upgradescript->checkVersion($db_version) && $upgradescript->needed()) {\n if (!empty($this->params[get_class($upgradescript)])) {\n $upgradescript->results = $upgradescript->upgrade();\n }\n $upgradescript->classname = get_class($upgradescript);\n $upgrade_scripts[] = $upgradescript;\n $i++;\n }\n }\n }\n assign_to_template(array(\n 'scripts'=>$upgrade_scripts,\n 'tables'=>$tables,\n ));\n }",
" public function manage_themes() {\n expHistory::set('manageable', $this->params);",
" if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }",
" \t$themes = array();\n \tif (is_readable(BASE.'themes')) {\n \t\t$dh = opendir(BASE.'themes');\n \t\twhile (($file = readdir($dh)) !== false) {\n \t\t\tif ($file != '.' && $file != '..' && is_dir(BASE.\"themes/$file\") && is_readable(BASE.\"themes/$file/class.php\")) {\n \t\t\t\tinclude_once(BASE.\"themes/$file/class.php\");\n \t\t\t\t$theme = new $file();\n \t\t\t\t$t = new stdClass();\n\t\t\t\t $t->user_configured = isset($theme->user_configured) ? $theme->user_configured : '';\n $t->stock_theme = isset($theme->stock_theme) ? $theme->stock_theme : '';\n \t\t\t\t$t->name = $theme->name();\n \t\t\t\t$t->description = $theme->description();\n \t\t\t\t$t->author = $theme->author();",
"\t\t\t\t $t->style_variations = array();\n \t\t$sv = opendir(BASE.'themes/'.$file);\n \t\twhile (($s = readdir($sv)) !== false) {\n if (substr($s,0,4) == \"css_\") {\n $t->style_variations[str_replace(\"css_\",\"\",$s)] = str_replace(\"css_\",\"\",$s);\n } elseif (substr($s,0,5) == \"less_\") {\n $t->style_variations[str_replace(\"less_\",\"\",$s)] = str_replace(\"less_\",\"\",$s);\n }\n }\n if(count($t->style_variations)>0){\n $t->style_variations = array_merge(array('Default'=>'Default'),$t->style_variations);\n }",
" \t\t\t\t$t->preview = is_readable(BASE.\"themes/$file/preview.jpg\") ? PATH_RELATIVE . \"themes/$file/preview.jpg\" : YUI2_RELATIVE . \"yui2-skin-sam-editor/assets/skins/sam/blankimage.png\";\n\t\t\t\t $t->mobile = is_readable(BASE.\"themes/$file/mobile/index.php\") ? true : false;\n \t\t\t\t$themes[$file] = $t;\n \t\t\t}\n \t\t}\n \t}",
" assign_to_template(array(\n 'themes'=>$themes\n ));\n }",
"",
" public function theme_switch() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }\n \texpSettings::change('DISPLAY_THEME_REAL', $this->params['theme']);\n\t expSession::set('display_theme',$this->params['theme']);\n\t $sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t if (strtolower($sv)=='default') {\n\t $sv = '';\n\t }\n\t expSettings::change('THEME_STYLE_REAL',$sv);\n\t expSession::set('theme_style',$sv);\n\t expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme",
" // $message = (MINIFY != 1) ? \"Exponent is now minifying Javascript and CSS\" : \"Exponent is no longer minifying Javascript and CSS\" ;\n // flash('message',$message);\n\t $message = gt(\"You have selected the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t if ($sv != '') {\n\t\t $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation');\n\t }\n\t flash('message',$message);\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n// expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n \texpHistory::returnTo('manageable');",
" }\n",
"\tpublic function theme_preview() {\n\t\texpSession::set('display_theme',$this->params['theme']);\n\t\t$sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t\tif (strtolower($sv)=='default') {\n\t\t $sv = '';\n\t\t}\n\t\texpSession::set('theme_style',$sv);\n\t\t$message = gt(\"You are previewing the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t\tif ($sv) {\n\t\t\t$message .= ' with '.$sv.' style variation';\n\t\t}\n\t\tif ($this->params['theme'] != DISPLAY_THEME_REAL || $this->params['sv'] != THEME_STYLE_REAL) {\n\t\t\tflash('notice',$message);\n\t\t}\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n//\t\texpTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n\t\texpHistory::back();\n\t}",
"\tpublic function configure_theme() {\n\t\tif (is_readable(BASE.\"themes/\".$this->params['theme'].\"/class.php\")) {\n\t\t\tinclude_once(BASE.\"themes/\".$this->params['theme'].\"/class.php\");\n $themeclass = $this->params['theme'];\n\t\t\t$theme = new $themeclass($this->params);\n\t\t\t$theme->configureTheme();\n\t\t}\n\t}",
"\tpublic function update_theme() {\n\t\tif (is_readable(BASE.\"themes/\".$this->params['theme'].\"/class.php\")) {\n\t\t\tinclude_once(BASE.\"themes/\".$this->params['theme'].\"/class.php\");\n $themeclass = $this->params['theme'];\n\t\t\t$theme = new $themeclass();\n\t\t\t$theme->saveThemeConfig($this->params);\n expSession::set('force_less_compile', 1);\n expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n\t\t}\n\t}",
" public function export_theme() {\n include_once(BASE.'external/Tar.php');",
" $themeclass = $this->params['theme'];\n $fname = tempnam(BASE.'/tmp','exporter_files_');\n $tar = new Archive_Tar($fname,'gz');\n $tar->createModify(BASE.'themes/'.$themeclass,'themes/',BASE.'themes/');",
" $filename = preg_replace('/[^A-Za-z0-9_.-]/','-',$themeclass.'.tar.gz');",
" ob_end_clean();\n // This code was lifted from phpMyAdmin, but this is Open Source, right?",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }",
" $fh = fopen($fname,'rb');\n while (!feof($fh)) {\n echo fread($fh,8192);\n }\n fclose($fh);\n unlink($fname);",
" exit(''); // Exit, since we are exporting.\n }",
"\tpublic function togglemobile() {\n\t\tif (!expSession::is_set('mobile')) { // account for FORCE_MOBILE initial state\n\t\t\texpSession::set('mobile',MOBILE);\n\t\t}\n\t\texpSession::set('mobile',!expSession::get('mobile'));\n expSession::set('force_less_compile', 1);\n\t\texpTheme::removeSmartyCache();\n\t\texpHistory::back();\n\t}",
" public function configure_site () {\n\t expHistory::set('manageable',$this->params);",
" if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n }",
" // TYPES OF ANTISPAM CONTROLS... CURRENTLY ONLY ReCAPTCHA\n $as_types = array(\n '0'=>'-- '.gt('Please Select an Anti-Spam Control').' --',\n \"recaptcha\"=>'reCAPTCHA'\n );",
"",
" //THEMES FOR RECAPTCHA\n $as_themes = array(\n \"light\"=>gt('Light (Default)'),\n \t\"dark\"=>gt('Dark'),\n );",
"",
" // Available Themes\n $themes = array();\n if (is_readable(BASE.'themes')) {\n \t$theme_dh = opendir(BASE.'themes');\n \twhile (($theme_file = readdir($theme_dh)) !== false) {\n \t\tif (is_readable(BASE.'themes/'.$theme_file.'/class.php')) {\n \t\t\t// Need to avoid the duplicate theme problem.\n \t\t\tif (!class_exists($theme_file)) {\n \t\t\t\tinclude_once(BASE.'themes/'.$theme_file.'/class.php');\n \t\t\t}",
" \t\t\tif (class_exists($theme_file)) {\n \t\t\t\t// Need to avoid instantiating non-existent classes.\n \t\t\t\t$t = new $theme_file();\n \t\t\t\t$themes[$theme_file] = $t->name();\n \t\t\t}\n \t\t}\n \t}\n }\n uasort($themes,'strnatcmp');",
" // Available elFinder Themes\n $elf_themes = array(''=>gt('Default/OSX'));\n if (is_readable(BASE.'external/elFinder/themes')) {\n \t$theme_dh = opendir(BASE.'external/elFinder/themes');\n \twhile (($theme_file = readdir($theme_dh)) !== false) {\n \t\tif ($theme_file != '..' && is_readable(BASE.'external/elFinder/themes/'.$theme_file.'/css/theme.css')) {\n $elf_themes['/themes/' . $theme_file] = ucwords($theme_file);\n \t\t}\n \t}\n }\n uasort($elf_themes,'strnatcmp');",
" // Available Languages\n\t $langs = expLang::langList();\n// ksort($langs);",
" // smtp protocol\n $protocol = array(\n 'ssl'=>'SSL',\n 'tls'=>'TLS'\n );",
" // Currency Format\n $currency = expSettings::dropdownData('currency');",
" // attribution\n// $attribution = array(\n// 'firstlast'=>'John Doe',\n// 'lastfirst'=>'Doe, John',\n// 'first'=>'John',\n// 'last'=>'Doe',\n// 'username'=>'jdoe'\n// );\n $attribution = expSettings::dropdownData('attribution');",
" // These funcs need to be moved up in to new subsystems",
"",
" // Date/Time Format\n $datetime_format = expSettings::dropdownData('datetime_format');",
" // Date Format\n $date_format = expSettings::dropdownData('date_format');",
"",
" // Time Format\n $time_format = expSettings::dropdownData('time_format');",
"",
" // Start of Week\n// $start_of_week = glist(expSettings::dropdownData('start_of_week'));\n $daysofweek = event::dayNames();\n $start_of_week = $daysofweek['long'];",
" // File Permissions\n $file_permisions = glist(expSettings::dropdownData('file_permissions'));",
"",
" // File Permissions\n $dir_permissions = glist(expSettings::dropdownData('dir_permissions'));",
" // Homepage Dropdown\n $section_dropdown = section::levelDropdownControlArray(0, 0, array(), false, 'view', true);",
" // Timezone Dropdown\n $list = DateTimeZone::listAbbreviations();\n $idents = DateTimeZone::listIdentifiers();\n $data = $offset = $added = array();\n foreach ($list as $abbr => $info) {\n foreach ($info as $zone) {\n if (!empty($zone['timezone_id']) AND !in_array($zone['timezone_id'],$added) AND in_array($zone['timezone_id'],$idents)) {\n try{\n $z = new DateTimeZone($zone['timezone_id']);\n $c = new DateTime(null, $z);\n $zone['time'] = $c->format('H:i a');\n $data[] = $zone;\n $offset[] = $z->getOffset($c);\n $added[] = $zone['timezone_id'];\n } catch(Exception $e) {\n flash('error', $e->getMessage());\n }\n }\n }\n }",
" array_multisort($offset, SORT_ASC, $data);\n $tzoptions = array();\n foreach ($data as $row) {\n $tzoptions[$row['timezone_id']] = self::formatOffset($row['offset'])\n . ' ' . $row['timezone_id'];\n }",
" $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $folders = array();\n $folders[] = 'Root Folder';\n foreach ($cats as $cat) {\n $folders[$cat->id] = $cat->title;\n }",
" // profiles\n $profiles = expSettings::profiles();\n if (empty($profiles)) {\n $profiles = array('' => '(default)');\n }",
" assign_to_template(array(\n 'as_types'=>$as_types,\n 'as_themes'=>$as_themes,\n 'themes'=>$themes,\n 'elf_themes'=>$elf_themes,\n 'langs'=>$langs,\n 'protocol'=>$protocol,\n 'currency'=>$currency,\n 'attribution'=>$attribution,\n 'datetime_format'=>$datetime_format,\n 'date_format'=>$date_format,\n 'time_format'=>$time_format,\n 'start_of_week'=>$start_of_week,\n 'timezones'=>$tzoptions,\n 'file_permisions'=>$file_permisions,\n 'dir_permissions'=>$dir_permissions,\n 'section_dropdown'=>$section_dropdown,\n 'folders'=>$folders,\n 'profiles'=>$profiles\n ));\n }",
"\t// now you can use $options;\n\tprivate function formatOffset($offset) {\n\t\t\t$hours = $offset / 3600;\n\t\t\t$remainder = $offset % 3600;\n\t\t\t$sign = $hours > 0 ? '+' : '-';\n\t\t\t$hour = (int) abs($hours);\n\t\t\t$minutes = (int) abs($remainder / 60);",
"\t\t\tif ($hour == 0 AND $minutes == 0) {\n\t\t\t\t$sign = ' ';\n\t\t\t}\n\t\t\treturn 'GMT' . $sign . str_pad($hour, 2, '0', STR_PAD_LEFT)\n\t\t\t\t\t.':'. str_pad($minutes,2, '0');",
"\t}",
" public function update_siteconfig () {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n } else {\n $this->params['sc']['MAINTENANCE_RETURN_TIME'] = yuicalendarcontrol::parseData('MAINTENANCE_RETURN_TIME', $this->params['sc']);\n foreach ($this->params['sc'] as $key => $value) {\n// expSettings::change($key, addslashes($value));\n expSettings::change($key, $value);\n }",
" flash('message', gt(\"Your Website Configuration has been updated\"));\n }\n setcookie('slingbar-top', $this->params['sc']['SLINGBAR_TOP']);\n// expHistory::back();\n\t expHistory::returnTo('viewable');\n }",
" public function change_profile() {\n if (empty($this->params['profile'])) return;\n expSession::un_set('display_theme');\n expSession::un_set('theme_style');\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n expSettings::activateProfile($this->params['profile']);\n flash('message', gt(\"New Configuration Profile Loaded\") . ' (' . $this->params['profile'] . ')');\n redirect_to(array('controller'=>'administration', 'action'=>'configure_site'));\n }",
" public function save_profile() {\n if (empty($this->params['profile'])) return;\n $profile = expSettings::createProfile($this->params['profile']);\n flash('message', gt(\"Configuration Profile Saved\") . ' (' . $this->params['profile'] . ')');\n// redirect_to(array('controller'=>'administration', 'action'=>'configure_site'));\n redirect_to(array('controller'=>'administration', 'action'=>'change_profile', 'profile'=>$profile));\n }",
" /**\n \t * Routine to force launching exponent installer\n \t */\n \tpublic static function install_exponent() {\n \t\t// we'll need the not_configured file to exist for install routine to work\n// \t\tif (!@file_exists(BASE.'install/not_configured')) {\n// \t\t\t$nc_file = fopen(BASE.'install/not_configured', \"w\");\n// \t\t\tfclose($nc_file);\n// \t\t}\n// $page = \"\";\n// if (@file_exists(BASE.'framework/conf/config.php')) {\n// $page = \"?page=upgrade-1\";\n// }\n if (@file_exists(BASE.'install/index.php')) {\n header('Location: ' . URL_FULL . 'install/index.php');\n exit('Redirecting to the Exponent Install Wizard');\n } else {\n flash('error', gt(\"Installation files were not found\"));\n }\n \t}",
"}",
"/**\n * This is the base theme class\n *\n * @subpackage Controllers\n * @package Modules\n */\nclass theme {\n\tpublic $user_configured = false;\n public $stock_theme = false;",
"\tfunction name() { return \"theme\"; }\n\tfunction author() { return \"\"; }\n\tfunction description() { return gt(\"The theme shell\"); }",
" /**\n * @param array $params\n */\n function __construct($params = array()) {\n $this->params = $params;\n }",
"\t/**\n\t * Method to Configure theme settings\n\t * This generic routine parses the theme's config.php file\n\t * and presents the values as text boxes.\n\t */\n\tfunction configureTheme () {\n\t\tif (isset($this->params['sv']) && $this->params['sv'] != '') {\n\t\t\tif (strtolower($this->params['sv'])=='default') {\n $this->params['sv']='';\n\t\t\t}\n\t\t\t$settings = expSettings::parseFile(BASE.\"themes/\".$this->params['theme'].\"/config_\".$this->params['sv'].\".php\");\n\t\t} else {\n\t\t\t$settings = expSettings::parseFile(BASE.\"themes/\".$this->params['theme'].\"/config.php\");\n\t\t}\n\t\t$form = new form();\n\t\t$form->meta('controller','administration');\n\t\t$form->meta('action','update_theme');\n\t\t$form->meta('theme',$this->params['theme']);\n\t\t$form->meta('sv',isset($this->params['sv'])?$this->params['sv']:'');\n\t\tforeach ($settings as $setting=>$key) {\n\t\t\t$form->register($setting,$setting.': ',new textcontrol($key,20));\n\t\t}\n\t\t$form->register(null,'',new htmlcontrol('<br>'));\n\t\t$form->register('submit','',new buttongroupcontrol(gt('Save'),'',gt('Cancel')));\n\t\tassign_to_template(array(\n 'name'=>$this->name().(!empty($this->params['sv'])?' '.$this->params['sv']:''),\n 'form_html'=>$form->toHTML()\n ));\n\t}",
"\t/**\n\t * Method to save/update theme settings\n\t * This generic routine parses the passed params\n\t * and saves them to the theme's config.php file\n\t * It attempts to remove non-theme params such as analytics, etc..\n\t *\n\t * @param $params theme configuration parameters\n\t */\n\tfunction saveThemeConfig ($params) {\n\t\t$theme = $params['theme'];\n\t\tunset ($params['theme']);\n\t\t$sv = $params['sv'];\n\t\tif (strtolower($sv)=='default') {\n\t\t $sv='';\n\t\t}\n\t\tunset (\n $params['sv'],\n $params['controller'],\n $params['action'],\n $params['cid'],\n $params['scayt_verLang'],\n $params['slingbar-top'],\n $params['XDEBUG_SESSION']\n );\n\t\tforeach ($params as $key=>$value) {\n\t\t\tif ($key[0] == '_') {\n\t\t\t\tunset ($params[$key]);\n\t\t\t}\n\t\t}\n\t\tif (!empty($sv)) {\n\t\t\texpSettings::saveValues($params, BASE.\"themes/\".$theme.\"/config_\".$sv.\".php\");\n\t\t} else {\n\t\t\texpSettings::saveValues($params, BASE.\"themes/\".$theme.\"/config.php\");\n\t\t}\n\t\texpHistory::back();\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class bannerController extends expController {",
"",
" public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'module_title',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
" public $useractions = array(\n 'showall'=>'Display Banner(s)'\n );",
"\n static function displayname() { return gt(\"Banners\"); }\n static function description() { return gt(\"Display banners on your website and track 'clicks'.\"); }",
" ",
" public function showall() {\n $banners = array();\n if (!empty($this->config['banners'])) {\n // only show banners that this module is configured to show.\n // do not show banners that have gone over their impression limit\n // do not show banners that have gone over their click limit",
" // randomly grab one banner to be displayed ",
" // increase the impression count for this banner",
" $where = 'id IN ('.implode(',', $this->config['banners']).')'; ",
" $where .= ' AND (impression_limit > impressions || impression_limit=0)';\n $where .= ' AND (click_limit > clicks || click_limit=0)';\n $limit = isset($this->config['limit']) ? $this->config['limit'] : 1;\n $banners = $this->banner->find('all', $where , 'RAND()', $limit);",
" foreach($banners as $banner) { ",
" $banner->increaseImpressions();\n }\n }",
" ",
" // assign banner to the template and show it!\n assign_to_template(array(\n 'banners'=>$banners\n ));\n }",
" ",
" public function click() {\n $banner = new banner($this->params['id']);\n $banner->increaseClicks();\n redirect_to($banner->url);\n }",
" ",
" public function create() {\n// global $db;\n //make sure we have companies.\n// $count = $db->countObjects('companies');\n $comp = new company();\n $count = $comp->find('count');\n if ($count < 1) {\n flash('message', gt('There are no companies created yet. You need to create at least one company first.'));\n redirect_to(array('controller'=>'company', 'action'=>'edit'));\n// $this->edit();\n } else {\n parent::create();\n }\n }",
" ",
" public function manage() {\n expHistory::set('manageable', $this->params);",
" ",
" // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';\n $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';\n $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type=\"banner\")';",
"\t\t",
"\t\t$page = new expPaginator(array(\n\t\t\t'model'=>'banner',\n\t\t\t'sql'=>$sql,\n\t\t\t'order'=>'title',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n\t\t\t'columns'=>array(\n gt('Title')=>'title',\n gt('Company')=>'companyname',\n gt('Impressions')=>'impressions',\n gt('Clicks')=>'clicks'\n )\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }",
" ",
" public function configure() {\n $this->config['defaultbanner'] = array();\n if (!empty($this->config['defaultbanner_id'])) {\n $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']);",
" } ",
"\t parent::configure();\n\t $banners = $this->banner->find('all', null, 'companies_id');\n\t assign_to_template(array(\n 'banners'=>$banners,\n 'title'=>static::displayname()\n ));\n\t}",
"\t",
"\tpublic function saveconfig() {\n\t $this->params['defaultbanner_id'] = isset($this->params['expFile'][0]) ? $this->params['expFile'][0] : 0;\n \t parent::saveconfig();\n\t}",
"\t",
"\tpublic function export() {\n // gather all the data\n $banners = $this->banner->find('all');\n $out = '\"Banner ID\",\"Banner Title\",\"Banner URL\",\"Company Name\",\"Impression Limit\",\"Click Limit\",\"Impressions\",\"Clicks\"' . \"\\n\";\n foreach ($banners as $l) {\n $out .='\"'.$l->id.'\",\"'.$l->title.'\",\"'.$l->url.'\",\"'.$l->company->title.'\",\"'.$l->impression_limit.'\",\"'.$l->click_limit.'\",\"'.$l->impressions.'\",\"'.$l->clicks.'\"' . \"\\n\";\n }",
" ",
" // open the file\n $dir = BASE.'tmp';",
" $filename = 'banner_export' . date(\"m-d-Y\") . '.csv'; ",
" $fh = fopen ($dir .'/'. $filename, 'w');",
" // Put all values from $out to export.csv.\n fputs($fh, $out);",
" fclose($fh); ",
"\n // push the file to the user\n $export = new expFile(array('directory'=>$dir, 'filename'=>$filename)); //FIXME we are using a full path BASE instead of relative to root\n expFile::download($export);\n }",
" function reset_stats() {\n// global $db;",
" // reset the counters\n// $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1');\n banner::resetImpressions();\n// $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1');\n banner::resetClicks();",
" \n // let the user know we did stuff. ",
" flash('message', gt(\"Banner statistics reset.\"));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class bannerController extends expController {",
" public $useractions = array(\n 'showall'=>'Display Banner(s)'\n );\n protected $manage_permissions = array(\n 'reset' => 'Reset Stats'\n );",
" public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'module_title',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"",
"\n static function displayname() { return gt(\"Banners\"); }\n static function description() { return gt(\"Display banners on your website and track 'clicks'.\"); }",
"",
" public function showall() {\n $banners = array();\n if (!empty($this->config['banners'])) {\n // only show banners that this module is configured to show.\n // do not show banners that have gone over their impression limit\n // do not show banners that have gone over their click limit",
" // randomly grab one banner to be displayed",
" // increase the impression count for this banner",
" $where = 'id IN ('.implode(',', $this->config['banners']).')';",
" $where .= ' AND (impression_limit > impressions || impression_limit=0)';\n $where .= ' AND (click_limit > clicks || click_limit=0)';\n $limit = isset($this->config['limit']) ? $this->config['limit'] : 1;\n $banners = $this->banner->find('all', $where , 'RAND()', $limit);",
" foreach($banners as $banner) {",
" $banner->increaseImpressions();\n }\n }",
"",
" // assign banner to the template and show it!\n assign_to_template(array(\n 'banners'=>$banners\n ));\n }",
"",
" public function click() {\n $banner = new banner($this->params['id']);\n $banner->increaseClicks();\n redirect_to($banner->url);\n }",
"",
" public function create() {\n// global $db;\n //make sure we have companies.\n// $count = $db->countObjects('companies');\n $comp = new company();\n $count = $comp->find('count');\n if ($count < 1) {\n flash('message', gt('There are no companies created yet. You need to create at least one company first.'));\n redirect_to(array('controller'=>'company', 'action'=>'edit'));\n// $this->edit();\n } else {\n parent::create();\n }\n }",
"",
" public function manage() {\n expHistory::set('manageable', $this->params);",
"",
" // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';\n $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';\n $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type=\"banner\")';",
"",
"\t\t$page = new expPaginator(array(\n\t\t\t'model'=>'banner',\n\t\t\t'sql'=>$sql,\n\t\t\t'order'=>'title',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n\t\t\t'columns'=>array(\n gt('Title')=>'title',\n gt('Company')=>'companyname',\n gt('Impressions')=>'impressions',\n gt('Clicks')=>'clicks'\n )\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }",
"",
" public function configure() {\n $this->config['defaultbanner'] = array();\n if (!empty($this->config['defaultbanner_id'])) {\n $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']);",
" }",
"\t parent::configure();\n\t $banners = $this->banner->find('all', null, 'companies_id');\n\t assign_to_template(array(\n 'banners'=>$banners,\n 'title'=>static::displayname()\n ));\n\t}",
"",
"\tpublic function saveconfig() {\n\t $this->params['defaultbanner_id'] = isset($this->params['expFile'][0]) ? $this->params['expFile'][0] : 0;\n \t parent::saveconfig();\n\t}",
"",
"\tpublic function export() {\n // gather all the data\n $banners = $this->banner->find('all');\n $out = '\"Banner ID\",\"Banner Title\",\"Banner URL\",\"Company Name\",\"Impression Limit\",\"Click Limit\",\"Impressions\",\"Clicks\"' . \"\\n\";\n foreach ($banners as $l) {\n $out .='\"'.$l->id.'\",\"'.$l->title.'\",\"'.$l->url.'\",\"'.$l->company->title.'\",\"'.$l->impression_limit.'\",\"'.$l->click_limit.'\",\"'.$l->impressions.'\",\"'.$l->clicks.'\"' . \"\\n\";\n }",
"",
" // open the file\n $dir = BASE.'tmp';",
" $filename = 'banner_export' . date(\"m-d-Y\") . '.csv';",
" $fh = fopen ($dir .'/'. $filename, 'w');",
" // Put all values from $out to export.csv.\n fputs($fh, $out);",
" fclose($fh);",
"\n // push the file to the user\n $export = new expFile(array('directory'=>$dir, 'filename'=>$filename)); //FIXME we are using a full path BASE instead of relative to root\n expFile::download($export);\n }",
" function reset_stats() {\n// global $db;",
" // reset the counters\n// $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1');\n banner::resetImpressions();\n// $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1');\n banner::resetClicks();",
"\n // let the user know we did stuff.",
" flash('message', gt(\"Banner statistics reset.\"));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class blogController extends expController {\n public $useractions = array(\n 'showall'=>'Show All Posts',\n 'tags'=>\"Show Post Tags\",\n 'authors'=>\"Show Post Authors\",\n 'categories'=>\"Show Post Categories\",\n 'dates'=>\"Show Post Dates\",\n 'comments'=>\"Show Recent Post Comments\",\n );",
"",
" public $remove_configs = array(\n// 'categories',\n// 'ealerts'\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
" protected $add_permissions = array(\n 'approve'=>\"Approve Comments\",\n 'import'=>'Import Blog Items',\n 'export'=>'Export Blog Items'\n );",
"\n static function displayname() { return gt(\"Blog\"); }\n static function description() { return gt(\"Run a blog on your site.\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }\n static function hasSources() { return false; } // must be explicitly added by config['add_source'] or config['aggregate']\n static function isSearchable() { return true; }",
" static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" public function showall() {\n\t expHistory::set('viewable', $this->params);\n\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] :10,\n 'order'=>'publish',\n 'dir'=>empty($this->config['sort_dir']) ? 'DESC' : $this->config['sort_dir'],\n 'categorize'=> empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'groups'=>!isset($this->params['cat']) ? array() : array($this->params['cat']),\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'params'=>$this->params,\n ));\n if (isset($this->params['cat'])) assign_to_template(array(\n 'moduletitle' => gt('Posts filed under') . ' ' . (empty($page->records[0]->expCat[0]->title) ? $this->config['uncat'] : $page->records[0]->expCat[0]->title),\n ));",
"\t}",
"\tpublic function authors() {\n expHistory::set('viewable', $this->params);\n $blogs = $this->blog->find('all');\n $users = array();\n foreach ($blogs as $blog) {\n if (isset($users[$blog->poster])) {\n $users[$blog->poster]->count++;\n } else {\n $users[$blog->poster] = new user($blog->poster);\n $users[$blog->poster]->count = 1;\n }\n }",
"\t assign_to_template(array(\n 'authors'=>$users\n ));\n\t}",
"\tpublic function dates() {\n\t global $db;",
" expHistory::set('viewable', $this->params);\n $where = $this->aggregateWhereClause();\n\t $dates = $db->selectColumn('blog', 'publish', $where, 'publish DESC');\n\t $blog_date = array();\n $count = 0;\n $limit = empty($this->config['limit']) ? count($dates) : $this->config['limit'];\n\t foreach ($dates as $date) {\n\t $year = date('Y',$date);\n\t $month = date('n',$date);\n\t if (isset($blog_date[$year][$month])) {\n\t $blog_date[$year][$month]->count++;\n\t } else {\n $count++;\n if ($count > $limit) break;\n $blog_date[$year][$month] = new stdClass();\n\t $blog_date[$year][$month]->name = date('F',$date);\n\t $blog_date[$year][$month]->count = 1;\n\t }\n\t }\n if (!empty($blog_date)) {\n ksort($blog_date);\n $blog_date = array_reverse($blog_date,1);\n foreach ($blog_date as $key=>$val) {\n ksort($blog_date[$key]);\n $blog_date[$key] = array_reverse($blog_date[$key],1);\n }\n } else {\n $blog_date = array();\n }\n\t //eDebug($blog_date);\n\t assign_to_template(array(\n 'dates'=>$blog_date\n ));\n\t}",
" public function showall_by_date() {\n\t expHistory::set('viewable', $this->params);\n\t $start_date = expDateTime::startOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));\n\t $end_date = expDateTime::endOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));",
"\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"publish >= '\".$start_date.\"' AND publish <= '\".$end_date.\"'\",\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'dir'=>'desc',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('Blogs by date').' \"'.expDateTime::format_date($start_date,\"%B %Y\").'\"')\n );\n\t}",
"\tpublic function showall_by_author() {\n\t expHistory::set('viewable', $this->params);\n",
"",
" $user = user::getUserByName($this->params['author']);\n\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"poster=\".$user->id,\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('Blogs by author').' \"'.$this->params['author'].'\"'\n ));\n\t}",
"\tpublic function show() {\n expHistory::set('viewable', $this->params);\n\t $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];\n $record = new blog($id);\n if (empty($record->id))",
" redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));",
"\n\t // since we are probably getting here via a router mapped url\n\t // some of the links (tags in particular) require a source, we will\n\t // populate the location data in the template now.\n $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc->src = $r_loc->src;\n }",
" $nextwhere = $this->aggregateWhereClause().' AND publish > '.$record->publish.' ORDER BY publish';\n $record->next = $record->find('first',$nextwhere);\n $prevwhere = $this->aggregateWhereClause().' AND publish < '.$record->publish.' ORDER BY publish DESC';\n $record->prev = $record->find('first',$prevwhere);",
"\t assign_to_template(array(\n 'record'=>$record,\n 'config'=>$config,\n 'params'=>$this->params\n ));\n\t}",
" /**\n * view items referenced by tags\n * @deprecated 2.0.0\n */\n function showByTags() {\n global $db;",
" // set the history point for this action\n expHistory::set('viewable', $this->params);",
" // setup some objects\n $tagobj = new expTag();",
" $modelname = empty($this->params['model']) ? $this->basemodel_name : $this->params['model'];",
" $model = new $modelname();",
" // start building the sql query\n $sql = 'SELECT DISTINCT m.id FROM '.$db->prefix.$model->tablename.' m ';\n $sql .= 'JOIN '.$db->prefix.$tagobj->attachable_table.' ct ';\n $sql .= 'ON m.id = ct.content_id WHERE (';\n $first = true;",
" if (isset($this->params['tags'])) {\n $tags = is_array($this->params['tags']) ? $this->params['tags'] : array($this->params['tags']);\n } elseif (isset($this->config['expTags'])) {\n $tags = $this->config['expTags'];\n } else {\n $tags = array();\n }",
" foreach ($tags as $tagid) {\n $sql .= ($first) ? 'exptags_id='.intval($tagid) : ' OR exptags_id='.intval($tagid);\n $first = false;\n }\n $sql .= \") AND content_type='\".$model->classname.\"'\";\n if (!expPermissions::check('edit',$this->loc)) {\n $sql = \"(publish =0 or publish <= \" . time() . \")) AND \". $sql . ' AND private=0';\n }",
" // get the objects and render the template\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $modelname($assoc->id);\n }",
" assign_to_template(array(\n 'items'=>$records\n ));\n }",
" /**\n * get the blog items in an rss feed format\n *\n * @return array\n */\n// function getRSSContent() {\n// $class = new blog();\n// $items = $class->find('all', $this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'publish DESC');\n//\n// //Convert the items to rss items\n// $rssitems = array();\n// foreach ($items as $key => $item) {\n// $rss_item = new FeedItem();\n// $rss_item->title = expString::convertSmartQuotes($item->title);\n// $rss_item->link = $rss_item->guid = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url));\n// $rss_item->description = expString::convertSmartQuotes($item->body);\n// $rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n// $rss_item->authorEmail = user::getEmailById($item->poster);\n//// $rss_item->date = isset($item->publish_date) ? date(DATE_RSS,$item->publish_date) : date(DATE_RSS, $item->created_at);\n// $rss_item->date = isset($item->publish_date) ? $item->publish_date : $item->created_at;\n//// $rss_item->guid = expUnserialize($item->location_data)->src.'-id#'.$item->id;\n// if (!empty($item->expCat[0]->title)) $rss_item->category = array($item->expCat[0]->title);\n// $comment_count = expCommentController::countComments(array('content_id'=>$item->id,'content_type'=>$this->basemodel_name));\n// if ($comment_count) {\n// $rss_item->comments = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n//// $rss_item->commentsRSS = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n// $rss_item->commentsCount = $comment_count;\n// }\n// $rssitems[$key] = $rss_item;\n// }\n// return $rssitems;\n// }",
" /**\n * additional check for display of search hit, only display non-draft\n *\n * @param $record\n *\n * @return bool\n */\n public static function searchHit($record) {\n $blog = new blog($record->original_id);\n if (expPermissions::check('edit', expUnserialize($record->location_data)) || $blog->private == 0 && ($blog->publish === 0 || $blog->publish <= time())) {\n return true;\n } else {\n return false;\n }\n }",
" /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n \tfunction aggregateWhereClause($type='') {\n $sql = parent::aggregateWhereClause();\n if (!expPermissions::check('edit',$this->loc)) {\n if (!empty($sql)) {\n $sql .= \" AND \";\n }\n $sql .= \"private = 0 AND (publish = 0 OR publish <= \" . time() . \")\";\n }",
" return $sql;\n }",
" /**\n * delete module's items (all) by instance\n */\n function delete_instance($loc = false) {\n parent::delete_instance(true);\n }",
" /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_fb($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['type'] = 'article';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $metainfo['title'] = substr(empty($object->meta_fb['title']) ? $object->title : $object->meta_fb['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_fb['description']) ? $desc : $object->meta_fb['description'], 0, 199);\n $metainfo['url'] = empty($object->meta_fb['url']) ? $canonical : $object->meta_fb['url'];\n $metainfo['image'] = empty($object->meta_fb['fbimage'][0]) ? '' : $object->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['files'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['files'][0]->url;\n } else {\n $config = expConfig::getConfig($object->location_data);\n if (!empty($config['expFile']['fbimage'][0]))\n $file = new expFile($config['expFile']['fbimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
" /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_tw($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['card'] = 'summary';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $config = expConfig::getConfig($object->location_data);\n if (!empty($object->meta_tw['twsite'])) {\n $metainfo['site'] = $object->meta_tw['twsite'];\n } elseif (!empty($config['twsite'])) {\n $metainfo['site'] = $config['twsite'];\n }\n $metainfo['title'] = substr(empty($object->meta_tw['title']) ? $object->title : $object->meta_tw['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_tw['description']) ? $desc : $object->meta_tw['description'], 0, 199);\n $metainfo['image'] = empty($object->meta_tw['twimage'][0]) ? '' : $object->meta_tw['twimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n if (!empty($config['expFile']['twimage'][0]))\n $file = new expFile($config['expFile']['twimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
" function showall_by_author_meta($request) {\n global $router;",
" // look up the record.\n if (isset($request['author'])) {\n // set the meta info\n $u = user::getUserByName(expString::sanitize($request['author']));\n $str = user::getUserAttribution($u->id);\n// switch (DISPLAY_ATTRIBUTION) {\n// case \"firstlast\":\n// $str = $u->firstname . \" \" . $u->lastname;\n// break;\n// case \"lastfirst\":\n// $str = $u->lastname . \", \" . $u->firstname;\n// break;\n// case \"first\":\n// $str = $u->firstname;\n// break;\n// case \"username\":\n// default:\n// $str = $u->username;\n// break;\n// }",
" if (!empty($str)) {\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $metainfo['title'] = gt('Showing all Blog Posts written by') .\" \\\"\" . $str . \"\\\"\";\n// $metainfo['keywords'] = empty($object->meta_keywords) ? SITE_KEYWORDS : $object->meta_keywords; //FIXME $object not set\n $metainfo['keywords'] = $str;\n// $metainfo['description'] = empty($object->meta_description) ? SITE_DESCRIPTION : $object->meta_description; //FIXME $object not set\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical; //FIXME $object not set\n// $metainfo['canonical'] = URL_FULL.substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();",
" return $metainfo;\n }\n }\n }",
"}",
"?>"
] |
[
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class blogController extends expController {\n public $useractions = array(\n 'showall'=>'Show All Posts',\n 'tags'=>\"Show Post Tags\",\n 'authors'=>\"Show Post Authors\",\n 'categories'=>\"Show Post Categories\",\n 'dates'=>\"Show Post Dates\",\n 'comments'=>\"Show Recent Post Comments\",\n );",
" protected $manage_permissions = array(\n// 'approve'=>\"Approve Comments\",\n );",
" public $remove_configs = array(\n// 'categories',\n// 'ealerts'\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"",
"\n static function displayname() { return gt(\"Blog\"); }\n static function description() { return gt(\"Run a blog on your site.\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }\n static function hasSources() { return false; } // must be explicitly added by config['add_source'] or config['aggregate']\n static function isSearchable() { return true; }",
" static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" public function showall() {\n\t expHistory::set('viewable', $this->params);\n\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] :10,\n 'order'=>'publish',\n 'dir'=>empty($this->config['sort_dir']) ? 'DESC' : $this->config['sort_dir'],\n 'categorize'=> empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'groups'=>!isset($this->params['cat']) ? array() : array($this->params['cat']),\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'params'=>$this->params,\n ));\n if (isset($this->params['cat'])) assign_to_template(array(\n 'moduletitle' => gt('Posts filed under') . ' ' . (empty($page->records[0]->expCat[0]->title) ? $this->config['uncat'] : $page->records[0]->expCat[0]->title),\n ));",
"\t}",
"\tpublic function authors() {\n expHistory::set('viewable', $this->params);\n $blogs = $this->blog->find('all');\n $users = array();\n foreach ($blogs as $blog) {\n if (isset($users[$blog->poster])) {\n $users[$blog->poster]->count++;\n } else {\n $users[$blog->poster] = new user($blog->poster);\n $users[$blog->poster]->count = 1;\n }\n }",
"\t assign_to_template(array(\n 'authors'=>$users\n ));\n\t}",
"\tpublic function dates() {\n\t global $db;",
" expHistory::set('viewable', $this->params);\n $where = $this->aggregateWhereClause();\n\t $dates = $db->selectColumn('blog', 'publish', $where, 'publish DESC');\n\t $blog_date = array();\n $count = 0;\n $limit = empty($this->config['limit']) ? count($dates) : $this->config['limit'];\n\t foreach ($dates as $date) {\n\t $year = date('Y',$date);\n\t $month = date('n',$date);\n\t if (isset($blog_date[$year][$month])) {\n\t $blog_date[$year][$month]->count++;\n\t } else {\n $count++;\n if ($count > $limit) break;\n $blog_date[$year][$month] = new stdClass();\n\t $blog_date[$year][$month]->name = date('F',$date);\n\t $blog_date[$year][$month]->count = 1;\n\t }\n\t }\n if (!empty($blog_date)) {\n ksort($blog_date);\n $blog_date = array_reverse($blog_date,1);\n foreach ($blog_date as $key=>$val) {\n ksort($blog_date[$key]);\n $blog_date[$key] = array_reverse($blog_date[$key],1);\n }\n } else {\n $blog_date = array();\n }\n\t //eDebug($blog_date);\n\t assign_to_template(array(\n 'dates'=>$blog_date\n ));\n\t}",
" public function showall_by_date() {\n\t expHistory::set('viewable', $this->params);\n\t $start_date = expDateTime::startOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));\n\t $end_date = expDateTime::endOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));",
"\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"publish >= '\".$start_date.\"' AND publish <= '\".$end_date.\"'\",\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'dir'=>'desc',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('Blogs by date').' \"'.expDateTime::format_date($start_date,\"%B %Y\").'\"')\n );\n\t}",
"\tpublic function showall_by_author() {\n\t expHistory::set('viewable', $this->params);\n",
" $this->params['author'] = expString::escape($this->params['author']);",
" $user = user::getUserByName($this->params['author']);\n\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"poster=\".$user->id,\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('Blogs by author').' \"'.$this->params['author'].'\"'\n ));\n\t}",
"\tpublic function show() {\n expHistory::set('viewable', $this->params);\n\t $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];\n $record = new blog($id);\n if (empty($record->id))",
" redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>expString::escape($this->params['title'])));",
"\n\t // since we are probably getting here via a router mapped url\n\t // some of the links (tags in particular) require a source, we will\n\t // populate the location data in the template now.\n $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc->src = $r_loc->src;\n }",
" $nextwhere = $this->aggregateWhereClause().' AND publish > '.$record->publish.' ORDER BY publish';\n $record->next = $record->find('first',$nextwhere);\n $prevwhere = $this->aggregateWhereClause().' AND publish < '.$record->publish.' ORDER BY publish DESC';\n $record->prev = $record->find('first',$prevwhere);",
"\t assign_to_template(array(\n 'record'=>$record,\n 'config'=>$config,\n 'params'=>$this->params\n ));\n\t}",
" /**\n * view items referenced by tags\n * @deprecated 2.0.0\n */\n function showByTags() {\n global $db;",
" // set the history point for this action\n expHistory::set('viewable', $this->params);",
" // setup some objects\n $tagobj = new expTag();",
" $modelname = empty($this->params['model']) ? $this->basemodel_name : expString::escape($this->params['model']);",
" $model = new $modelname();",
" // start building the sql query\n $sql = 'SELECT DISTINCT m.id FROM '.$db->prefix.$model->tablename.' m ';\n $sql .= 'JOIN '.$db->prefix.$tagobj->attachable_table.' ct ';\n $sql .= 'ON m.id = ct.content_id WHERE (';\n $first = true;",
" if (isset($this->params['tags'])) {\n $tags = is_array($this->params['tags']) ? $this->params['tags'] : array($this->params['tags']);\n } elseif (isset($this->config['expTags'])) {\n $tags = $this->config['expTags'];\n } else {\n $tags = array();\n }",
" foreach ($tags as $tagid) {\n $sql .= ($first) ? 'exptags_id='.intval($tagid) : ' OR exptags_id='.intval($tagid);\n $first = false;\n }\n $sql .= \") AND content_type='\".$model->classname.\"'\";\n if (!expPermissions::check('edit',$this->loc)) {\n $sql = \"(publish =0 or publish <= \" . time() . \")) AND \". $sql . ' AND private=0';\n }",
" // get the objects and render the template\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $modelname($assoc->id);\n }",
" assign_to_template(array(\n 'items'=>$records\n ));\n }",
" /**\n * get the blog items in an rss feed format\n *\n * @return array\n */\n// function getRSSContent() {\n// $class = new blog();\n// $items = $class->find('all', $this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'publish DESC');\n//\n// //Convert the items to rss items\n// $rssitems = array();\n// foreach ($items as $key => $item) {\n// $rss_item = new FeedItem();\n// $rss_item->title = expString::convertSmartQuotes($item->title);\n// $rss_item->link = $rss_item->guid = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url));\n// $rss_item->description = expString::convertSmartQuotes($item->body);\n// $rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n// $rss_item->authorEmail = user::getEmailById($item->poster);\n//// $rss_item->date = isset($item->publish_date) ? date(DATE_RSS,$item->publish_date) : date(DATE_RSS, $item->created_at);\n// $rss_item->date = isset($item->publish_date) ? $item->publish_date : $item->created_at;\n//// $rss_item->guid = expUnserialize($item->location_data)->src.'-id#'.$item->id;\n// if (!empty($item->expCat[0]->title)) $rss_item->category = array($item->expCat[0]->title);\n// $comment_count = expCommentController::countComments(array('content_id'=>$item->id,'content_type'=>$this->basemodel_name));\n// if ($comment_count) {\n// $rss_item->comments = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n//// $rss_item->commentsRSS = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n// $rss_item->commentsCount = $comment_count;\n// }\n// $rssitems[$key] = $rss_item;\n// }\n// return $rssitems;\n// }",
" /**\n * additional check for display of search hit, only display non-draft\n *\n * @param $record\n *\n * @return bool\n */\n public static function searchHit($record) {\n $blog = new blog($record->original_id);\n if (expPermissions::check('edit', expUnserialize($record->location_data)) || $blog->private == 0 && ($blog->publish === 0 || $blog->publish <= time())) {\n return true;\n } else {\n return false;\n }\n }",
" /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n \tfunction aggregateWhereClause($type='') {\n $sql = parent::aggregateWhereClause();\n if (!expPermissions::check('edit',$this->loc)) {\n if (!empty($sql)) {\n $sql .= \" AND \";\n }\n $sql .= \"private = 0 AND (publish = 0 OR publish <= \" . time() . \")\";\n }",
" return $sql;\n }",
" /**\n * delete module's items (all) by instance\n */\n function delete_instance($loc = false) {\n parent::delete_instance(true);\n }",
" /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_fb($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['type'] = 'article';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $metainfo['title'] = substr(empty($object->meta_fb['title']) ? $object->title : $object->meta_fb['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_fb['description']) ? $desc : $object->meta_fb['description'], 0, 199);\n $metainfo['url'] = empty($object->meta_fb['url']) ? $canonical : $object->meta_fb['url'];\n $metainfo['image'] = empty($object->meta_fb['fbimage'][0]) ? '' : $object->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['files'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['files'][0]->url;\n } else {\n $config = expConfig::getConfig($object->location_data);\n if (!empty($config['expFile']['fbimage'][0]))\n $file = new expFile($config['expFile']['fbimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
" /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_tw($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['card'] = 'summary';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $config = expConfig::getConfig($object->location_data);\n if (!empty($object->meta_tw['twsite'])) {\n $metainfo['site'] = $object->meta_tw['twsite'];\n } elseif (!empty($config['twsite'])) {\n $metainfo['site'] = $config['twsite'];\n }\n $metainfo['title'] = substr(empty($object->meta_tw['title']) ? $object->title : $object->meta_tw['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_tw['description']) ? $desc : $object->meta_tw['description'], 0, 199);\n $metainfo['image'] = empty($object->meta_tw['twimage'][0]) ? '' : $object->meta_tw['twimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n if (!empty($config['expFile']['twimage'][0]))\n $file = new expFile($config['expFile']['twimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
" function showall_by_author_meta($request) {\n global $router;",
" // look up the record.\n if (isset($request['author'])) {\n // set the meta info\n $u = user::getUserByName(expString::sanitize($request['author']));\n $str = user::getUserAttribution($u->id);\n// switch (DISPLAY_ATTRIBUTION) {\n// case \"firstlast\":\n// $str = $u->firstname . \" \" . $u->lastname;\n// break;\n// case \"lastfirst\":\n// $str = $u->lastname . \", \" . $u->firstname;\n// break;\n// case \"first\":\n// $str = $u->firstname;\n// break;\n// case \"username\":\n// default:\n// $str = $u->username;\n// break;\n// }",
" if (!empty($str)) {\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $metainfo['title'] = gt('Showing all Blog Posts written by') .\" \\\"\" . $str . \"\\\"\";\n// $metainfo['keywords'] = empty($object->meta_keywords) ? SITE_KEYWORDS : $object->meta_keywords; //FIXME $object not set\n $metainfo['keywords'] = $str;\n// $metainfo['description'] = empty($object->meta_description) ? SITE_DESCRIPTION : $object->meta_description; //FIXME $object not set\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical; //FIXME $object not set\n// $metainfo['canonical'] = URL_FULL.substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();",
" return $metainfo;\n }\n }\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expCatController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expCatController extends expController {",
"",
"\n\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Category Manager\"); }",
"\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is used to manage categories\"); }",
" /**\n \t * author of module\n \t * @return string\n \t */\n static function author() { return \"Dave Leffler\"; }",
"\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }",
"\t/**\n\t * manage categories\n\t */\n\tfunction manage() {\n// global $db;",
" expHistory::set('manageable', $this->params);\n if (!empty($this->params['model'])) {\n// $modulename = expModules::getControllerClassName($this->params['model']);\n// $module = new $modulename(empty($this->params['src'])?null:$this->params['src']);\n $module = expModules::getController($this->params['model'], empty($this->params['src']) ? null : $this->params['src']);\n $where = $module->aggregateWhereClause();\n if ($this->params['model'] == 'file') $where = 1;\n $page = new expPaginator(array(\n 'model'=>($this->params['model'] == 'file') ? 'expFile' : $this->params['model'],\n// 'where'=>\"location_data='\".serialize(expCore::makeLocation($this->params['model'],$this->loc->src,'')).\"'\",\n 'where'=>$where,\n// 'order'=>'module,rank',\n 'categorize'=>true,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['model'],\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));\n if ($this->params['model'] == 'faq') {\n foreach ($page->records as $record) {\n $record->title = $record->question;\n }\n } elseif ($this->params['model'] == 'file') {\n foreach ($page->records as $record) {\n $record->title = $record->filename;\n }\n }\n } else $page = '';\n $cats = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>empty($this->params['model']) ? null : \"module='\".$this->params['model'].\"'\",\n// 'limit'=>50,\n 'order'=>'module,rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n// gt('Body')=>'body'\n ),\n ));",
"// foreach ($db->selectColumn('content_expCats','content_type',null,null,true) as $contenttype) {\n foreach (expCat::selectAllCatContentType() as $contenttype) {\n foreach ($cats->records as $key => $value) {\n $attatchedat = $cats->records[$key]->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $cats->records[$key]->attachedcount = @$cats->records[$key]->attachedcount + count($attatchedat);\n $cats->records[$key]->attached[$contenttype] = $attatchedat;\n //FIXME here is a hack to get the faq to be listed\n if ($contenttype == 'faq' && !empty($cats->records[$key]->attached[$contenttype][0]->question)) {\n $cats->records[$key]->attached[$contenttype][0]->title = $cats->records[$key]->attached[$contenttype][0]->question;\n }\n }\n }\n }\n foreach ($cats->records as $record) {\n $cats->modules[$record->module][] = $record;\n }\n if (SITE_FILE_MANAGER == 'elfinder') {\n unset($cats->modules['file']); // we're not using the traditional file manager\n }\n if (!empty($this->params['model']) && $this->params['model'] == 'file') {\n $catlist[0] = gt('Root Folder');\n } else {\n $catlist[0] = gt('Uncategorized');\n }\n if (!empty($cats->modules)) foreach ($cats->modules as $key=>$module) {\n foreach ($module as $listing) {\n $catlist[$listing->id] = $listing->title;\n }\n }\n assign_to_template(array(\n 'catlist'=>$catlist,\n 'cats'=>$cats,\n 'page'=>$page,\n 'model'=>empty($this->params['model']) ? null : $this->params['model']\n ));\n }",
" function edit() {\n $mod = array();\n// $modules = expModules::listControllers();\n// foreach ($modules as $modname=>$mods) {\n// if (!strstr($mods,'Controller')) {\n// $mod[$modname] = ucfirst($modname);\n// }\n// }\n $modules = expModules::listUserRunnableControllers();\n foreach ($modules as $modname) {\n// $modname = expModules::getControllerName($modname);\n $mod[expModules::getControllerName($modname)] = ucfirst(expModules::getControllerDisplayName($modname));\n }\n $mod['expFile'] = 'File';\n asort($mod);\n assign_to_template(array(\n 'mods'=>$mod\n ));\n if (!empty($this->params['model'])) {\n assign_to_template(array(\n 'model'=>$this->params['model'],\n ));\n }\n parent::edit();\n }",
" function update() {\n if ($this->params['module'] == 'expFile') $this->params['module'] = 'file';\n parent::update();\n }",
" /**\n * this method changes the category of the selected items to the chosen category\n */\n function change_cats() {\n if (!empty($this->params['change_cat'])) {\n foreach ($this->params['change_cat'] as $item) {\n $classname = $this->params['mod'];\n $object = new $classname($item);\n $params['expCat'][0] = $this->params['newcat'];\n $object->update($params);\n }\n }\n expHistory::returnTo('viewable');\n }",
" /**\n * this method adds cats properties to object and then sorts by category\n * it is assumed the records have expCats attachments, even if they are empty\n *\n * @static\n * @param array $records\n * @param string $order sort order/dir for items\n * @param string $uncattitle name to use for uncategorized group\n * @param array $groups limit set to these groups only if set\n * @param bool $dontsort\n *\n * @return void\n */\n public static function addCats(&$records,$order,$uncattitle,$groups=array(),$dontsort=false) {\n if (empty($uncattitle)) $uncattitle = gt('Not Categorized');\n foreach ($records as $key=>$record) {\n foreach ($record->expCat as $cat) {\n $records[$key]->catid = $cat->id;\n $records[$key]->catrank = $cat->rank;\n $records[$key]->cat = $cat->title;\n $catcolor = empty($cat->color) ? null : trim($cat->color);\n if (substr($catcolor,0,1)=='#') $catcolor = '\" style=\"color:'.$catcolor.';';\n $records[$key]->color = $catcolor;\n $records[$key]->module = empty($cat->module) ? null : $cat->module;\n break;\n }\n if (empty($records[$key]->catid)) {\n $records[$key]->catid = 0;\n $records[$key]->expCat[0] = new stdClass();\n $records[$key]->expCat[0]->id = 0;\n $records[$key]->catrank = 9999;\n $records[$key]->cat = $uncattitle;\n $records[$key]->color = null;\n }\n if (!empty($groups) && !in_array($records[$key]->catid,$groups)) {\n unset ($records[$key]);\n }\n }\n // we don't always want to sort by cat first\n if (!$dontsort) {\n $orderby = explode(\" \",$order);\n $order = $orderby[0];\n $order_direction = !empty($orderby[1]) && $orderby[1] == 'DESC' ? SORT_DESC : SORT_ASC;\n expSorter::osort($records, array('catrank',$order => $order_direction));\n }\n }",
" /**\n * this method fills a multidimensional array from a sorted records object\n * it is assumed the records object is already processed by expCatController::addCats\n *\n * @static\n * @param array $records\n * @param array $cats array of site category objects\n * @param array $groups limit set to these groups only if set\n * @param null $grouplimit\n * @return void\n */\n public static function sortedByCats($records,&$cats,$groups=array(),$grouplimit=null) {\n foreach ($records as $record) {\n if (empty($groups) || in_array($record->catid,$groups)) {\n if (empty($record->catid)) $record->catid = 0;\n if (empty($cats[$record->catid])) {\n $cats[$record->catid] = new stdClass();\n $cats[$record->catid]->count = 1;\n $cats[$record->catid]->name = $record->cat;\n $cats[$record->catid]->color = $record->color;\n } else {\n $cats[$record->catid]->count++;\n }\n if (empty($grouplimit)) {\n $cats[$record->catid]->records[] = $record;\n } else {\n if (empty($cats[$record->catid]->records[0])) $cats[$record->catid]->records[0] = $record;\n }\n }\n }\n }",
"}",
"?>"
] |
[
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expCatController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expCatController extends expController {",
" protected $manage_permissions = array(\n 'change' => 'Change Cats'\n );",
"\n\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Category Manager\"); }",
"\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is used to manage categories\"); }",
" /**\n \t * author of module\n \t * @return string\n \t */\n static function author() { return \"Dave Leffler\"; }",
"\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }",
"\t/**\n\t * manage categories\n\t */\n\tfunction manage() {\n// global $db;",
" expHistory::set('manageable', $this->params);\n if (!empty($this->params['model'])) {\n// $modulename = expModules::getControllerClassName($this->params['model']);\n// $module = new $modulename(empty($this->params['src'])?null:$this->params['src']);\n $module = expModules::getController($this->params['model'], empty($this->params['src']) ? null : $this->params['src']);\n $where = $module->aggregateWhereClause();\n if ($this->params['model'] == 'file') $where = 1;\n $page = new expPaginator(array(\n 'model'=>($this->params['model'] == 'file') ? 'expFile' : $this->params['model'],\n// 'where'=>\"location_data='\".serialize(expCore::makeLocation($this->params['model'],$this->loc->src,'')).\"'\",\n 'where'=>$where,\n// 'order'=>'module,rank',\n 'categorize'=>true,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['model'],\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));\n if ($this->params['model'] == 'faq') {\n foreach ($page->records as $record) {\n $record->title = $record->question;\n }\n } elseif ($this->params['model'] == 'file') {\n foreach ($page->records as $record) {\n $record->title = $record->filename;\n }\n }\n } else $page = '';\n $cats = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>empty($this->params['model']) ? null : \"module='\".$this->params['model'].\"'\",\n// 'limit'=>50,\n 'order'=>'module,rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n// gt('Body')=>'body'\n ),\n ));",
"// foreach ($db->selectColumn('content_expCats','content_type',null,null,true) as $contenttype) {\n foreach (expCat::selectAllCatContentType() as $contenttype) {\n foreach ($cats->records as $key => $value) {\n $attatchedat = $cats->records[$key]->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $cats->records[$key]->attachedcount = @$cats->records[$key]->attachedcount + count($attatchedat);\n $cats->records[$key]->attached[$contenttype] = $attatchedat;\n //FIXME here is a hack to get the faq to be listed\n if ($contenttype == 'faq' && !empty($cats->records[$key]->attached[$contenttype][0]->question)) {\n $cats->records[$key]->attached[$contenttype][0]->title = $cats->records[$key]->attached[$contenttype][0]->question;\n }\n }\n }\n }\n foreach ($cats->records as $record) {\n $cats->modules[$record->module][] = $record;\n }\n if (SITE_FILE_MANAGER == 'elfinder') {\n unset($cats->modules['file']); // we're not using the traditional file manager\n }\n if (!empty($this->params['model']) && $this->params['model'] == 'file') {\n $catlist[0] = gt('Root Folder');\n } else {\n $catlist[0] = gt('Uncategorized');\n }\n if (!empty($cats->modules)) foreach ($cats->modules as $key=>$module) {\n foreach ($module as $listing) {\n $catlist[$listing->id] = $listing->title;\n }\n }\n assign_to_template(array(\n 'catlist'=>$catlist,\n 'cats'=>$cats,\n 'page'=>$page,\n 'model'=>empty($this->params['model']) ? null : $this->params['model']\n ));\n }",
" function edit() {\n $mod = array();\n// $modules = expModules::listControllers();\n// foreach ($modules as $modname=>$mods) {\n// if (!strstr($mods,'Controller')) {\n// $mod[$modname] = ucfirst($modname);\n// }\n// }\n $modules = expModules::listUserRunnableControllers();\n foreach ($modules as $modname) {\n// $modname = expModules::getControllerName($modname);\n $mod[expModules::getControllerName($modname)] = ucfirst(expModules::getControllerDisplayName($modname));\n }\n $mod['expFile'] = 'File';\n asort($mod);\n assign_to_template(array(\n 'mods'=>$mod\n ));\n if (!empty($this->params['model'])) {\n assign_to_template(array(\n 'model'=>$this->params['model'],\n ));\n }\n parent::edit();\n }",
" function update() {\n if ($this->params['module'] == 'expFile') $this->params['module'] = 'file';\n parent::update();\n }",
" /**\n * this method changes the category of the selected items to the chosen category\n */\n function change_cats() {\n if (!empty($this->params['change_cat'])) {\n foreach ($this->params['change_cat'] as $item) {\n $classname = $this->params['mod'];\n $object = new $classname($item);\n $params['expCat'][0] = $this->params['newcat'];\n $object->update($params);\n }\n }\n expHistory::returnTo('viewable');\n }",
" /**\n * this method adds cats properties to object and then sorts by category\n * it is assumed the records have expCats attachments, even if they are empty\n *\n * @static\n * @param array $records\n * @param string $order sort order/dir for items\n * @param string $uncattitle name to use for uncategorized group\n * @param array $groups limit set to these groups only if set\n * @param bool $dontsort\n *\n * @return void\n */\n public static function addCats(&$records,$order,$uncattitle,$groups=array(),$dontsort=false) {\n if (empty($uncattitle)) $uncattitle = gt('Not Categorized');\n foreach ($records as $key=>$record) {\n foreach ($record->expCat as $cat) {\n $records[$key]->catid = $cat->id;\n $records[$key]->catrank = $cat->rank;\n $records[$key]->cat = $cat->title;\n $catcolor = empty($cat->color) ? null : trim($cat->color);\n if (substr($catcolor,0,1)=='#') $catcolor = '\" style=\"color:'.$catcolor.';';\n $records[$key]->color = $catcolor;\n $records[$key]->module = empty($cat->module) ? null : $cat->module;\n break;\n }\n if (empty($records[$key]->catid)) {\n $records[$key]->catid = 0;\n $records[$key]->expCat[0] = new stdClass();\n $records[$key]->expCat[0]->id = 0;\n $records[$key]->catrank = 9999;\n $records[$key]->cat = $uncattitle;\n $records[$key]->color = null;\n }\n if (!empty($groups) && !in_array($records[$key]->catid,$groups)) {\n unset ($records[$key]);\n }\n }\n // we don't always want to sort by cat first\n if (!$dontsort) {\n $orderby = explode(\" \",$order);\n $order = $orderby[0];\n $order_direction = !empty($orderby[1]) && $orderby[1] == 'DESC' ? SORT_DESC : SORT_ASC;\n expSorter::osort($records, array('catrank',$order => $order_direction));\n }\n }",
" /**\n * this method fills a multidimensional array from a sorted records object\n * it is assumed the records object is already processed by expCatController::addCats\n *\n * @static\n * @param array $records\n * @param array $cats array of site category objects\n * @param array $groups limit set to these groups only if set\n * @param null $grouplimit\n * @return void\n */\n public static function sortedByCats($records,&$cats,$groups=array(),$grouplimit=null) {\n foreach ($records as $record) {\n if (empty($groups) || in_array($record->catid,$groups)) {\n if (empty($record->catid)) $record->catid = 0;\n if (empty($cats[$record->catid])) {\n $cats[$record->catid] = new stdClass();\n $cats[$record->catid]->count = 1;\n $cats[$record->catid]->name = $record->cat;\n $cats[$record->catid]->color = $record->color;\n } else {\n $cats[$record->catid]->count++;\n }\n if (empty($grouplimit)) {\n $cats[$record->catid]->records[] = $record;\n } else {\n if (empty($cats[$record->catid]->records[0])) $cats[$record->catid]->records[0] = $record;\n }\n }\n }\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expCommentController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expCommentController extends expController {\n public $base_class = 'expComment';",
" protected $add_permissions = array(\n 'approve'=>\"Approve Comments\"\n );\n \tprotected $remove_permissions = array(",
" 'create'\n );",
"",
"\n static function displayname() { return gt(\"Comments\"); }\n static function description() { return gt(\"Use this module to add comments to a page.\"); }",
" ",
"\tfunction edit() {\n\t if (empty($this->params['content_id'])) {\n\t flash('message',gt('An error occurred: No content id set.'));",
" expHistory::back(); \n\t } ",
" /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
" \n ",
"\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $comment = new expComment($id);\n //FIXME here is where we might sanitize the comment before displaying/editing it\n\t\tassign_to_template(array(\n\t\t 'content_id'=>$this->params['content_id'],\n 'content_type'=>$this->params['content_type'],\n\t\t 'comment'=>$comment\n\t\t));",
"\t}\t\n\t",
"\tfunction manage() {\n\t expHistory::set('manageable', $this->params);",
" $order = 'approved';\n $dir = 'ASC';\n /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\t ",
"\t $sql = 'SELECT c.*, cnt.* FROM '.DB_TABLE_PREFIX.'_expComments c ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expComments cnt ON c.id=cnt.expcomments_id ';\n if (!empty($this->params['content_id']) && !empty($this->params['content_type'])) {\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $order = 'created_at';\n $dir = 'DESC';\n }\n //$sql .= 'AND c.approved=0';",
" $page = new expPaginator(array(\n// 'model'=>'expComment',",
" 'sql'=>$sql, ",
" 'limit'=>10,\n 'order'=>$order,\n 'dir'=>$dir,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body',\n gt('Type')=>'content_type'\n ),\n ));",
" $refs[][] = array();\n foreach ($page->records as $record) {\n //FIXME here is where we might sanitize the comments before displaying them\n $item = new $record->content_type($record->content_id);\n $refs[$record->content_type][$record->content_id] = $item->title;\n }\n assign_to_template(array(\n 'page'=>$page,\n 'refs'=>$refs,\n ));\n\t}",
" /**\n * Displays comments attached to specified item\n */\n\tfunction showComments() {\n\t\tglobal $user, $db;",
" /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet",
" $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\n// $sql = 'SELECT c.*, ua.image, u.username FROM '.$db->prefix.'expComments c ';\n// $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';\n// $sql .= 'JOIN '.$db->prefix.'user_avatar ua ON c.poster=ua.user_id ';\n// $sql .= 'JOIN '.$db->prefix.'user u ON c.poster=u.id ';\n// $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";",
" $sql = 'SELECT c.* FROM '.$db->prefix.'expComments c ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';",
" $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";",
" if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }",
" $comments = new expPaginator(array(\n //'model'=>'expComment',",
" 'sql'=>$sql, ",
"// 'limit'=>999,\n 'order'=>'created_at',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Readable Column Name')=>'Column Name'\n ),\n ));",
" // add username and avatar\n foreach ($comments->records as $key=>$record) {\n $commentor = new user($record->poster);\n //FIXME here is where we might sanitize the comments before displaying them\n// $comments->records[$key]->username = $commentor->username; //FIXME this should follow the site attribution setting\n $comments->records[$key]->username = user::getUserAttribution($commentor->id); // follow the site attribution setting\n $comments->records[$key]->avatar = $db->selectObject('user_avatar',\"user_id='\".$record->poster.\"'\");\n }",
" if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);\n // eDebug($sql, true);",
" ",
" // count the unapproved comments\n if ($require_approval == 1 && $user->isAdmin()) {\n $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id ';",
" $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";",
" $sql .= 'AND com.approved=0';\n $unapproved = $db->countObjectsBySql($sql);\n } else {\n $unapproved = 0;",
" } \n ",
" $this->config = $this->params['config'];\n $type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment');\n $ratings = !empty($this->params['ratings']) ? true : false;",
" assign_to_template(array(\n 'comments'=>$comments,\n 'config'=>$this->params['config'],\n 'unapproved'=>$unapproved,",
"\t\t\t'content_id'=>$this->params['content_id'], ",
"\t\t\t'content_type'=>$this->params['content_type'],\n\t\t\t'user'=>$user,\n\t\t\t'hideform'=>$this->params['hideform'],\n\t\t\t'hidecomments'=>$this->params['hidecomments'],\n\t\t\t'title'=>$this->params['title'],\n\t\t\t'formtitle'=>$this->params['formtitle'],\n 'type'=>$type,\n 'ratings'=>$ratings,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n\t\t));\n\t}",
" /**\n * function to arrange comments in hierarchy of parent_id's as children properties\n *\n * @param array $comments\n *\n * @return array\n */\n function arrangecomments($comments) {",
" $tree = array();",
" /* We get all the parent into the tree array */\n foreach ($comments as &$node) {\n /* Note: I've used 0 for top level parent, you can change this to == 'NULL' */\n if($node->parent_id=='0'){\n $tree[] = $node;\n unset($node);\n }\n }",
" /* This is the recursive function that does the magic */\n /* $k is the position in the array */\n if (!function_exists('findchildren')) {\n function findchildren(&$parent, &$comments, $k = 0)\n {\n if (isset($comments[$k])) {\n if ($comments[$k]->parent_id == $parent->id) {\n $com = $comments[$k];\n findchildren($com, $comments); // We try to find children's children\n $parent->children[] = $com;\n }\n findchildren($parent, $comments, $k + 1); // And move to the next sibling\n }\n }\n }",
" /* looping through the parent array, we try to find the children */\n foreach ($tree as &$parent) {\n findchildren($parent, $comments);\n }",
" return $tree;\n }",
" /**\n * Returns count of comments attached to specified item\n *\n * @static\n * @param $params\n * @return int\n */\n public static function countComments($params) {\n// global $user, $db;\n global $user;",
" $sql = 'SELECT c.* FROM '.DB_TABLE_PREFIX.'_expComments c ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expComments cnt ON c.id=cnt.expcomments_id ';\n $sql .= 'WHERE cnt.content_id='.$params['content_id'].\" AND cnt.content_type='\".$params['content_type'].\"' \";\n if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }",
" $comments = new expPaginator(array(\n 'sql'=>$sql,\n ));\n return count($comments->records);\n// return $count = $db->countObjectsBySql($sql);",
" }",
" /**\n * Returns comments attached to specified item\n *\n * @static\n * @param $params\n * @return array\n */\n public static function getComments($params) {\n global $user, $db;",
" $sql = 'SELECT c.* FROM '.$db->prefix.'expComments c ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';\n $sql .= 'WHERE cnt.content_id='.$params['content_id'].\" AND cnt.content_type='\".$params['content_type'].\"' \";\n if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }",
" $comments = new expPaginator(array(\n //'model'=>'expComment',\n 'sql'=>$sql,\n // 'limit'=>999,\n 'order'=>'created_at',\n// 'page'=>(isset($params['page']) ? $params['page'] : 1),\n 'controller'=>'expComment',\n// 'action'=>$params['action'],\n// 'columns'=>array(\n// gt('Readable Column Name')=>'Column Name'\n// ),\n ));",
" // add username and avatar\n foreach ($comments->records as $key=>$record) {\n $commentor = new user($record->poster);\n //FIXME here is where we might sanitize the comments before displaying them\n// $comments->records[$key]->username = $commentor->username; //FIXME this should follow the site attribution setting\n $comments->records[$key]->username = user::getUserAttribution($commentor->id); // follow the site attribution setting\n $comments->records[$key]->avatar = $db->selectObject('user_avatar',\"user_id='\".$record->poster.\"'\");\n }\n// if (empty($params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);\n // eDebug($sql, true);",
" // count the unapproved comments\n $unapproved = 0;",
"// assign_to_template(array(\n// 'comments'=>$comments,\n// 'config'=>$params['config'],\n// 'unapproved'=>$unapproved,\n// 'content_id'=>$params['content_id'],\n// 'content_type'=>$params['content_type'],\n// 'user'=>$user,\n// 'hideform'=>$params['hideform'],\n// 'hidecomments'=>$params['hidecomments'],\n// 'title'=>$params['title'],\n// 'formtitle'=>$params['formtitle'],\n// ));\n return $comments->records;\n }",
" function update() {\n global $user;",
" ",
" /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
" if (COMMENTS_REQUIRE_LOGIN && !$user->isLoggedIn()) {\n expValidator::failAndReturnToForm('You must be logged on to post a comment!', $this->params);\n }\n // check the anti-spam control\n if (!(ANTI_SPAM_USERS_SKIP && $user->isLoggedIn())) {\n expValidator::check_antispam($this->params, gt('Your comment was not posted.') . ' ' . gt(\"Anti-spam verification failed. Please try again. Please try again.\"));\n }",
" ",
" // figure out the name and email address\n if (!empty($user->id) && empty($this->params['id'])) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }",
" ",
" // save the comment\n if (empty($require_approval)) {\n $this->expComment->approved=1;\n }\n $this->expComment->update($this->params);",
" ",
" // attach the comment to the datatype it belongs to (blog, news, etc..);\n// $obj = new stdClass();\n//\t\t$obj->content_type = $this->params['content_type'];\n//\t\t$obj->content_id = $this->params['content_id'];\n//\t\t$obj->expcomments_id = $this->expComment->id;\n//\t\tif(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n//\t\t$db->insertObject($obj, $this->expComment->attachable_table);\n $this->expComment->attachComment($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);",
"\t\t$msg = 'Thank you for posting a comment.';\n\t\tif ($require_approval == 1 && !$user->isAdmin()) {\n\t\t $msg .= ' '.gt('Your comment is now pending approval. You will receive an email to').' ';\n\t\t $msg .= $this->expComment->email.' '.gt('letting you know when it has been approved.');\n\t\t}",
"\t\t",
"\t\tif ($require_notification && !$user->isAdmin()) {\n\t\t $this->sendNotification($this->expComment,$this->params);\n\t\t}\n if ($require_approval==1 && $this->params['approved']==1 && $this->expComment->poster != $user->id) {\n\t\t $this->sendApprovalNotification($this->expComment,$this->params);\n }",
"\t\tflash('message', $msg);",
"\t\t",
"\t\texpHistory::back();\n\t}",
"\t",
"\tpublic function approve() {\n\t expHistory::set('editable', $this->params);",
" \n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\t ",
"\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }",
"\t ",
"\t $comment = new expComment($this->params['id']);\n\t assign_to_template(array(\n 'comment'=>$comment\n ));\n\t}",
"\t",
"\tpublic function approve_submit() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }",
" \n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\t ",
"\t $comment = new expComment($this->params['id']);\n\t $comment->body = $this->params['body'];\n\t $comment->approved = $this->params['approved'];\n\t $comment->save();\n\t expHistory::back();\n\t}",
"\t",
"\tpublic function approve_toggle() {\n\t if (empty($this->params['id'])) return;",
" \n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\t $comment = new expComment($this->params['id']);\n\t $comment->approved = $comment->approved == 1 ? 0 : 1;\n\t if ($comment->approved) {\n\t\t $this->sendApprovalNotification($comment,$this->params);\n\t }\n\t $comment->save();\n\t expHistory::back();\n\t}",
" /**\n * this method bulk processes the selected comments\n */\n function bulk_process() {\n global $db;",
" if (!empty($this->params['bulk_select']) && !empty($this->params['command'])) {\n foreach ($this->params['bulk_select'] as $item) {\n switch ($this->params['command']) {\n case 1: // approve\n $comment = new expComment($item);\n if (!$comment->approved) {\n $comment->approved = 1;\n //FIXME here is where we might sanitize the comments before approving them\n $attached = $db->selectObject('content_expComments','expcomments_id='.$item);\n $params['content_type'] = $attached->content_type;\n $params['content_id'] = $attached->content_id;\n $this->sendApprovalNotification($comment,$params);\n $comment->save();\n }\n break;\n case 2: // disable\n $comment = new expComment($item);\n \t $comment->approved = 0;\n \t $comment->save();\n break;\n case 3: //delete\n // delete the comment\n $comment = new expComment($item);\n $comment->delete();\n // delete the association too\n $db->delete($comment->attachable_table, 'expcomments_id='.$item);\n }\n }\n }\n expHistory::returnTo('manageable');\n }",
"\tpublic function delete() {\n\t global $db;",
" \n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\t ",
"\t if (empty($this->params['id'])) {\n\t flash('error', gt('Missing id for the comment you would like to delete'));\n\t expHistory::back();\n\t }",
"\t ",
"\t // delete the comment\n $comment = new expComment($this->params['id']);\n $comment->delete();",
" ",
" // delete the association too",
" $db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']); \n ",
" // send the user back where they came from.\n expHistory::back();\n\t}",
"\t",
"\tprivate function sendNotification($comment,$params) {\n//\t global $db;\n\t if (empty($comment)) return false;",
" ",
" //eDebug($comment,1);",
" /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\t ",
"\t // setup some email variables.\n\t $subject = gt('Notification of a New Comment Posted to').' '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $tos = array_filter($tos);\n if (empty($tos)) return false;",
" $model = new $params['content_type']($params['content_id']);\n//\t $loc = expUnserialize($model->location_data);",
" $posting = makelink(array('controller'=>$params['content_type'], 'action'=>'show', 'title'=>$model->sef_url));\n $editlink = makelink(array('controller'=>'expComment', 'action'=>'edit', 'content_id'=>$params['content_id'], 'content_type'=>$params['content_type'], 'id'=>$comment->id));",
" ",
" // make the email body\n $body = '<h1>'.gt('New Comment Posted').'</h1>';\n $body .= '<h2>'.gt('Posted By').'</h2>';\n $body .= '<p>'.$comment->name.\"</p>\";\n $body .= '<h2>'.gt('Poster\\'s Email').'</h2>';\n $body .= '<p>'.$comment->email.\"</p>\";\n $body .= '<h2>'.gt('Comment').'</h2>';\n $body .= '<p>'.$comment->body.'</p>';\n $body .= '<h3>'.gt('View posting').'</h3>';\n $body .= '<a href=\"'.$posting.'\">'.$posting.'</a>';\n //1$body .= \"<br><br>\";\n $body .= '<h3>'.gt('Edit / Approve comment').'</h3>';\n $body .= '<a href=\"'.$editlink.'\">'.$editlink.'</a>';",
" ",
" // create the mail message",
" $mail = new expMail(); ",
" $mail->quickSend(array(\n 'html_message'=>$body,\n\t\t\t 'to'=>$tos,\n\t\t\t\t'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t\t 'subject'=>$subject,\n ));",
" ",
" return true;\n\t}",
"\tprivate function sendApprovalNotification($comment,$params) {\n\t if (empty($comment)) return false;",
" \n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\t ",
"\t // setup some email variables.\n\t $subject = gt('Notification of Comment Approval on').' '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $tos[] = $comment->email;\n\t\t$tos = array_filter($tos);\n\t\tif (empty($tos)) return false;",
" $model = new $params['content_type']($params['content_id']);\n//\t $loc = expUnserialize($model->location_data);",
" $posting = makelink(array('controller'=>$params['content_type'], 'action'=>'show', 'title'=>$model->sef_url));",
" // make the email body\n $body = '<h1>'.gt('Comment Approved').'</h1>';\n $body .= '<h2>'.gt('Posted By').'</h2>';\n $body .= '<p>'.$comment->name.\"</p>\";\n $body .= '<h2>'.gt('Poster\\'s Email').'</h2>';\n $body .= '<p>'.$comment->email.'</p>';\n $body .= '<h2>'.gt('Comment').'</h2>';\n $body .= '<p>'.$comment->body.\"</p>\";\n $body .= '<h3>'.gt('View posting').'</h3>';\n $body .= '<a href=\"'.$posting.'\">'.$posting.'</a>';",
" // create the mail message",
" $mail = new expMail(); ",
" $mail->quickSend(array(\n 'html_message'=>$body,\n\t\t\t 'to'=>$tos,\n\t\t\t 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t\t 'subject'=>$subject,\n ));",
" ",
" return true;\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expCommentController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expCommentController extends expController {\n public $base_class = 'expComment';",
" protected $remove_permissions = array(",
" 'create'\n );",
" protected $add_permissions = array(\n 'approve'=>\"Approve Comments\",\n 'bulk'=>\"Bulk Actions\"\n );",
"\n static function displayname() { return gt(\"Comments\"); }\n static function description() { return gt(\"Use this module to add comments to a page.\"); }",
"",
"\tfunction edit() {\n\t if (empty($this->params['content_id'])) {\n\t flash('message',gt('An error occurred: No content id set.'));",
" expHistory::back();\n\t }",
" /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\n",
"\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $comment = new expComment($id);\n //FIXME here is where we might sanitize the comment before displaying/editing it\n\t\tassign_to_template(array(\n\t\t 'content_id'=>$this->params['content_id'],\n 'content_type'=>$this->params['content_type'],\n\t\t 'comment'=>$comment\n\t\t));",
"\t}\n",
"\tfunction manage() {\n\t expHistory::set('manageable', $this->params);",
" $order = 'approved';\n $dir = 'ASC';\n /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"",
"\t $sql = 'SELECT c.*, cnt.* FROM '.DB_TABLE_PREFIX.'_expComments c ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expComments cnt ON c.id=cnt.expcomments_id ';\n if (!empty($this->params['content_id']) && !empty($this->params['content_type'])) {\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $order = 'created_at';\n $dir = 'DESC';\n }\n //$sql .= 'AND c.approved=0';",
" $page = new expPaginator(array(\n// 'model'=>'expComment',",
" 'sql'=>$sql,",
" 'limit'=>10,\n 'order'=>$order,\n 'dir'=>$dir,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body',\n gt('Type')=>'content_type'\n ),\n ));",
" $refs[][] = array();\n foreach ($page->records as $record) {\n //FIXME here is where we might sanitize the comments before displaying them\n $item = new $record->content_type($record->content_id);\n $refs[$record->content_type][$record->content_id] = $item->title;\n }\n assign_to_template(array(\n 'page'=>$page,\n 'refs'=>$refs,\n ));\n\t}",
" /**\n * Displays comments attached to specified item\n */\n\tfunction showComments() {\n\t\tglobal $user, $db;",
" /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet",
" $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : intval($this->params['require_login']);\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : intval($this->params['require_approval']);\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : intval($this->params['require_notification']);\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : expString::escape($this->params['notification_email']);",
"\n// $sql = 'SELECT c.*, ua.image, u.username FROM '.$db->prefix.'expComments c ';\n// $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';\n// $sql .= 'JOIN '.$db->prefix.'user_avatar ua ON c.poster=ua.user_id ';\n// $sql .= 'JOIN '.$db->prefix.'user u ON c.poster=u.id ';\n// $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";",
" $sql = 'SELECT c.* FROM '.$db->prefix.'expComments c ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';",
" $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".expString::escape($this->params['content_type']).\"' \";",
" if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }",
" $comments = new expPaginator(array(\n //'model'=>'expComment',",
" 'sql'=>$sql,",
"// 'limit'=>999,\n 'order'=>'created_at',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Readable Column Name')=>'Column Name'\n ),\n ));",
" // add username and avatar\n foreach ($comments->records as $key=>$record) {\n $commentor = new user($record->poster);\n //FIXME here is where we might sanitize the comments before displaying them\n// $comments->records[$key]->username = $commentor->username; //FIXME this should follow the site attribution setting\n $comments->records[$key]->username = user::getUserAttribution($commentor->id); // follow the site attribution setting\n $comments->records[$key]->avatar = $db->selectObject('user_avatar',\"user_id='\".$record->poster.\"'\");\n }",
" if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);\n // eDebug($sql, true);",
"",
" // count the unapproved comments\n if ($require_approval == 1 && $user->isAdmin()) {\n $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id ';",
" $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".expString::escape($this->params['content_type']).\"' \";",
" $sql .= 'AND com.approved=0';\n $unapproved = $db->countObjectsBySql($sql);\n } else {\n $unapproved = 0;",
" }\n",
" $this->config = $this->params['config'];\n $type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment');\n $ratings = !empty($this->params['ratings']) ? true : false;",
" assign_to_template(array(\n 'comments'=>$comments,\n 'config'=>$this->params['config'],\n 'unapproved'=>$unapproved,",
"\t\t\t'content_id'=>$this->params['content_id'],",
"\t\t\t'content_type'=>$this->params['content_type'],\n\t\t\t'user'=>$user,\n\t\t\t'hideform'=>$this->params['hideform'],\n\t\t\t'hidecomments'=>$this->params['hidecomments'],\n\t\t\t'title'=>$this->params['title'],\n\t\t\t'formtitle'=>$this->params['formtitle'],\n 'type'=>$type,\n 'ratings'=>$ratings,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n\t\t));\n\t}",
" /**\n * function to arrange comments in hierarchy of parent_id's as children properties\n *\n * @param array $comments\n *\n * @return array\n */\n function arrangecomments($comments) {",
" $tree = array();",
" /* We get all the parent into the tree array */\n foreach ($comments as &$node) {\n /* Note: I've used 0 for top level parent, you can change this to == 'NULL' */\n if($node->parent_id=='0'){\n $tree[] = $node;\n unset($node);\n }\n }",
" /* This is the recursive function that does the magic */\n /* $k is the position in the array */\n if (!function_exists('findchildren')) {\n function findchildren(&$parent, &$comments, $k = 0)\n {\n if (isset($comments[$k])) {\n if ($comments[$k]->parent_id == $parent->id) {\n $com = $comments[$k];\n findchildren($com, $comments); // We try to find children's children\n $parent->children[] = $com;\n }\n findchildren($parent, $comments, $k + 1); // And move to the next sibling\n }\n }\n }",
" /* looping through the parent array, we try to find the children */\n foreach ($tree as &$parent) {\n findchildren($parent, $comments);\n }",
" return $tree;\n }",
" /**\n * Returns count of comments attached to specified item\n *\n * @static\n * @param $params\n * @return int\n */\n public static function countComments($params) {\n// global $user, $db;\n global $user;",
" $sql = 'SELECT c.* FROM '.DB_TABLE_PREFIX.'_expComments c ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expComments cnt ON c.id=cnt.expcomments_id ';\n $sql .= 'WHERE cnt.content_id='.$params['content_id'].\" AND cnt.content_type='\".$params['content_type'].\"' \";\n if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }",
" $comments = new expPaginator(array(\n 'sql'=>$sql,\n ));\n return count($comments->records);\n// return $count = $db->countObjectsBySql($sql);",
" }",
" /**\n * Returns comments attached to specified item\n *\n * @static\n * @param $params\n * @return array\n */\n public static function getComments($params) {\n global $user, $db;",
" $sql = 'SELECT c.* FROM '.$db->prefix.'expComments c ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';\n $sql .= 'WHERE cnt.content_id='.$params['content_id'].\" AND cnt.content_type='\".$params['content_type'].\"' \";\n if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }",
" $comments = new expPaginator(array(\n //'model'=>'expComment',\n 'sql'=>$sql,\n // 'limit'=>999,\n 'order'=>'created_at',\n// 'page'=>(isset($params['page']) ? $params['page'] : 1),\n 'controller'=>'expComment',\n// 'action'=>$params['action'],\n// 'columns'=>array(\n// gt('Readable Column Name')=>'Column Name'\n// ),\n ));",
" // add username and avatar\n foreach ($comments->records as $key=>$record) {\n $commentor = new user($record->poster);\n //FIXME here is where we might sanitize the comments before displaying them\n// $comments->records[$key]->username = $commentor->username; //FIXME this should follow the site attribution setting\n $comments->records[$key]->username = user::getUserAttribution($commentor->id); // follow the site attribution setting\n $comments->records[$key]->avatar = $db->selectObject('user_avatar',\"user_id='\".$record->poster.\"'\");\n }\n// if (empty($params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);\n // eDebug($sql, true);",
" // count the unapproved comments\n $unapproved = 0;",
"// assign_to_template(array(\n// 'comments'=>$comments,\n// 'config'=>$params['config'],\n// 'unapproved'=>$unapproved,\n// 'content_id'=>$params['content_id'],\n// 'content_type'=>$params['content_type'],\n// 'user'=>$user,\n// 'hideform'=>$params['hideform'],\n// 'hidecomments'=>$params['hidecomments'],\n// 'title'=>$params['title'],\n// 'formtitle'=>$params['formtitle'],\n// ));\n return $comments->records;\n }",
" function update() {\n global $user;",
"",
" /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
" if (COMMENTS_REQUIRE_LOGIN && !$user->isLoggedIn()) {\n expValidator::failAndReturnToForm('You must be logged on to post a comment!', $this->params);\n }\n // check the anti-spam control\n if (!(ANTI_SPAM_USERS_SKIP && $user->isLoggedIn())) {\n expValidator::check_antispam($this->params, gt('Your comment was not posted.') . ' ' . gt(\"Anti-spam verification failed. Please try again. Please try again.\"));\n }",
"",
" // figure out the name and email address\n if (!empty($user->id) && empty($this->params['id'])) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }",
"",
" // save the comment\n if (empty($require_approval)) {\n $this->expComment->approved=1;\n }\n $this->expComment->update($this->params);",
"",
" // attach the comment to the datatype it belongs to (blog, news, etc..);\n// $obj = new stdClass();\n//\t\t$obj->content_type = $this->params['content_type'];\n//\t\t$obj->content_id = $this->params['content_id'];\n//\t\t$obj->expcomments_id = $this->expComment->id;\n//\t\tif(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n//\t\t$db->insertObject($obj, $this->expComment->attachable_table);\n $this->expComment->attachComment($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);",
"\t\t$msg = 'Thank you for posting a comment.';\n\t\tif ($require_approval == 1 && !$user->isAdmin()) {\n\t\t $msg .= ' '.gt('Your comment is now pending approval. You will receive an email to').' ';\n\t\t $msg .= $this->expComment->email.' '.gt('letting you know when it has been approved.');\n\t\t}",
"",
"\t\tif ($require_notification && !$user->isAdmin()) {\n\t\t $this->sendNotification($this->expComment,$this->params);\n\t\t}\n if ($require_approval==1 && $this->params['approved']==1 && $this->expComment->poster != $user->id) {\n\t\t $this->sendApprovalNotification($this->expComment,$this->params);\n }",
"\t\tflash('message', $msg);",
"",
"\t\texpHistory::back();\n\t}",
"",
"\tpublic function approve() {\n\t expHistory::set('editable', $this->params);",
"\n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"",
"\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }",
"",
"\t $comment = new expComment($this->params['id']);\n\t assign_to_template(array(\n 'comment'=>$comment\n ));\n\t}",
"",
"\tpublic function approve_submit() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }",
"\n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"",
"\t $comment = new expComment($this->params['id']);\n\t $comment->body = $this->params['body'];\n\t $comment->approved = $this->params['approved'];\n\t $comment->save();\n\t expHistory::back();\n\t}",
"",
"\tpublic function approve_toggle() {\n\t if (empty($this->params['id'])) return;",
"\n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"\t $comment = new expComment($this->params['id']);\n\t $comment->approved = $comment->approved == 1 ? 0 : 1;\n\t if ($comment->approved) {\n\t\t $this->sendApprovalNotification($comment,$this->params);\n\t }\n\t $comment->save();\n\t expHistory::back();\n\t}",
" /**\n * this method bulk processes the selected comments\n */\n function bulk_process() {\n global $db;",
" if (!empty($this->params['bulk_select']) && !empty($this->params['command'])) {\n foreach ($this->params['bulk_select'] as $item) {\n switch ($this->params['command']) {\n case 1: // approve\n $comment = new expComment($item);\n if (!$comment->approved) {\n $comment->approved = 1;\n //FIXME here is where we might sanitize the comments before approving them\n $attached = $db->selectObject('content_expComments','expcomments_id='.$item);\n $params['content_type'] = $attached->content_type;\n $params['content_id'] = $attached->content_id;\n $this->sendApprovalNotification($comment,$params);\n $comment->save();\n }\n break;\n case 2: // disable\n $comment = new expComment($item);\n \t $comment->approved = 0;\n \t $comment->save();\n break;\n case 3: //delete\n // delete the comment\n $comment = new expComment($item);\n $comment->delete();\n // delete the association too\n $db->delete($comment->attachable_table, 'expcomments_id='.$item);\n }\n }\n }\n expHistory::returnTo('manageable');\n }",
"\tpublic function delete() {\n\t global $db;",
"\n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"",
"\t if (empty($this->params['id'])) {\n\t flash('error', gt('Missing id for the comment you would like to delete'));\n\t expHistory::back();\n\t }",
"",
"\t // delete the comment\n $comment = new expComment($this->params['id']);\n $comment->delete();",
"",
" // delete the association too",
" $db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']);\n",
" // send the user back where they came from.\n expHistory::back();\n\t}",
"",
"\tprivate function sendNotification($comment,$params) {\n//\t global $db;\n\t if (empty($comment)) return false;",
"",
" //eDebug($comment,1);",
" /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"",
"\t // setup some email variables.\n\t $subject = gt('Notification of a New Comment Posted to').' '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $tos = array_filter($tos);\n if (empty($tos)) return false;",
" $model = new $params['content_type']($params['content_id']);\n//\t $loc = expUnserialize($model->location_data);",
" $posting = makelink(array('controller'=>$params['content_type'], 'action'=>'show', 'title'=>$model->sef_url));\n $editlink = makelink(array('controller'=>'expComment', 'action'=>'edit', 'content_id'=>$params['content_id'], 'content_type'=>$params['content_type'], 'id'=>$comment->id));",
"",
" // make the email body\n $body = '<h1>'.gt('New Comment Posted').'</h1>';\n $body .= '<h2>'.gt('Posted By').'</h2>';\n $body .= '<p>'.$comment->name.\"</p>\";\n $body .= '<h2>'.gt('Poster\\'s Email').'</h2>';\n $body .= '<p>'.$comment->email.\"</p>\";\n $body .= '<h2>'.gt('Comment').'</h2>';\n $body .= '<p>'.$comment->body.'</p>';\n $body .= '<h3>'.gt('View posting').'</h3>';\n $body .= '<a href=\"'.$posting.'\">'.$posting.'</a>';\n //1$body .= \"<br><br>\";\n $body .= '<h3>'.gt('Edit / Approve comment').'</h3>';\n $body .= '<a href=\"'.$editlink.'\">'.$editlink.'</a>';",
"",
" // create the mail message",
" $mail = new expMail();",
" $mail->quickSend(array(\n 'html_message'=>$body,\n\t\t\t 'to'=>$tos,\n\t\t\t\t'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t\t 'subject'=>$subject,\n ));",
"",
" return true;\n\t}",
"\tprivate function sendApprovalNotification($comment,$params) {\n\t if (empty($comment)) return false;",
"\n /* 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\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"",
"\t // setup some email variables.\n\t $subject = gt('Notification of Comment Approval on').' '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $tos[] = $comment->email;\n\t\t$tos = array_filter($tos);\n\t\tif (empty($tos)) return false;",
" $model = new $params['content_type']($params['content_id']);\n//\t $loc = expUnserialize($model->location_data);",
" $posting = makelink(array('controller'=>$params['content_type'], 'action'=>'show', 'title'=>$model->sef_url));",
" // make the email body\n $body = '<h1>'.gt('Comment Approved').'</h1>';\n $body .= '<h2>'.gt('Posted By').'</h2>';\n $body .= '<p>'.$comment->name.\"</p>\";\n $body .= '<h2>'.gt('Poster\\'s Email').'</h2>';\n $body .= '<p>'.$comment->email.'</p>';\n $body .= '<h2>'.gt('Comment').'</h2>';\n $body .= '<p>'.$comment->body.\"</p>\";\n $body .= '<h3>'.gt('View posting').'</h3>';\n $body .= '<a href=\"'.$posting.'\">'.$posting.'</a>';",
" // create the mail message",
" $mail = new expMail();",
" $mail->quickSend(array(\n 'html_message'=>$body,\n\t\t\t 'to'=>$tos,\n\t\t\t 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t\t 'subject'=>$subject,\n ));",
"",
" return true;\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expDefinableFieldController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expDefinableFieldController extends expController {\n\tpublic $basemodel_name = 'expDefinableField';",
"\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Definable Field\"); }",
"\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is for managing definable fields\"); }",
"\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }",
" /**\n \t * default view for individual field\n \t */\n \tfunction show() {",
" assign_to_template(array('record'=>$record,'tag'=>$tag)); //FIXME $record & $tag are undefined",
" }",
"\t/**\n\t * manage definable field\n\t */\n\tfunction manage() {\n global $db;",
"\t\t",
" expHistory::set('manageable', $this->params);\n\t\t$fields = $db->selectObjects(\"expDefinableFields\",'1','rank');\n\t\t$types = expTemplate::listControlTypes();\n uasort($types, \"strnatcmp\");\n\t\tarray_unshift($types,'['.gt('Please Select'.']'));\n assign_to_template(array('fields'=>$fields, 'types'=>$types));\n }",
"\t",
"\tfunction edit() {\n\t\tglobal $db;",
"\t\t ",
"\t\t$control_type = \"\";\n\t\t$ctl = null;\n\t\tif (isset($this->params['id'])) {\n\t\t\t$control = $db->selectObject(\"expDefinableFields\",\"id=\".$this->params['id']);\n\t\t\tif ($control) {\n\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t$ctl->identifier = $control->name;\n\t\t\t\t$ctl->id = $control->id;\n\t\t\t\t$control_type = get_class($ctl);\n\t\t\t}\n\t\t}\n\t\tif ($control_type == \"\") $control_type = $this->params['control_type'];\n\t\t$form = call_user_func(array($control_type,\"form\"),$ctl);",
"\t\tif ($ctl) { ",
"\t\t\t$form->controls['identifier']->disabled = true;\n\t\t\t$form->meta(\"id\",$ctl->id);\n\t\t\t$form->meta(\"identifier\",$ctl->identifier);\n\t\t}\n\t\t$form->meta(\"action\",\"save\");\n\t\t$form->meta('module',\"expDefinableField\");\n\t\t$form->meta('control_type',$control_type);\n\t\t$form->meta(\"type\", $control_type);\n\t\t$types = expTemplate::listControlTypes();\n",
"\t\tassign_to_template(array('form_html'=>$form->toHTML(), 'types'=>$types[$control_type]));\t\t\t",
"\t}",
"\t\n\tfunction save() {\t",
"\t\tglobal $db;\n\t\t$ctl = null;\n\t\t$control = null;\n\t\tif (isset($this->params['id'])) {\n\t\t\t$control = $db->selectObject('expDefinableFields','id='.$this->params['id']);\n\t\t\tif ($control) {\n\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t$ctl->name = $ctl->identifier;\n\t\t\t}\n\t\t}\n",
"\t\tif (call_user_func(array($_POST['control_type'],'useGeneric')) == true) { \t",
"\t\t\t$ctl = call_user_func(array('genericcontrol','update'),expString::sanitize($_POST),$ctl);\n\t\t} else {\n\t\t\t$ctl = call_user_func(array($_POST['control_type'],'update'),expString::sanitize($_POST),$ctl);\n\t\t}",
"\t\t",
"\t\tif ($ctl != null) {\n\t\t\t$name = substr(preg_replace('/[^A-Za-z0-9]/','_',$ctl->identifier),0,20);",
"\t",
"\t\t\tif (!isset($this->params['id'])) {\n\t\t\t\t$control->name = $name;\n\t\t\t}",
"\t",
" if (!empty($ctl->pattern)) $ctl->pattern = addslashes($ctl->pattern);\n\t\t\t$control->data = serialize($ctl);\n\t\t\t$control->type = $this->params['type'];",
"\t\t\t",
"\t\t\tif (isset($control->id)) {\n\t\t\t\t$db->updateObject($control,'expDefinableFields');\n\t\t\t} else {\n\t\t\t\t$db->insertObject($control,'expDefinableFields');\n\t\t\t}\n\t\t}",
"\t\t",
"\t\tredirect_to(array('controller'=>'expDefinableField','action'=>'manage'));\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expDefinableFieldController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expDefinableFieldController extends expController {\n\tpublic $basemodel_name = 'expDefinableField';",
"\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Definable Field\"); }",
"\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is for managing definable fields\"); }",
"\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }",
" /**\n \t * default view for individual field\n \t */\n \tfunction show() {",
"// assign_to_template(array('record'=>$record,'tag'=>$tag)); //FIXME $record & $tag are undefined",
" }",
"\t/**\n\t * manage definable field\n\t */\n\tfunction manage() {\n global $db;",
"",
" expHistory::set('manageable', $this->params);\n\t\t$fields = $db->selectObjects(\"expDefinableFields\",'1','rank');\n\t\t$types = expTemplate::listControlTypes();\n uasort($types, \"strnatcmp\");\n\t\tarray_unshift($types,'['.gt('Please Select'.']'));\n assign_to_template(array('fields'=>$fields, 'types'=>$types));\n }",
"",
"\tfunction edit() {\n\t\tglobal $db;",
"",
"\t\t$control_type = \"\";\n\t\t$ctl = null;\n\t\tif (isset($this->params['id'])) {\n\t\t\t$control = $db->selectObject(\"expDefinableFields\",\"id=\".$this->params['id']);\n\t\t\tif ($control) {\n\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t$ctl->identifier = $control->name;\n\t\t\t\t$ctl->id = $control->id;\n\t\t\t\t$control_type = get_class($ctl);\n\t\t\t}\n\t\t}\n\t\tif ($control_type == \"\") $control_type = $this->params['control_type'];\n\t\t$form = call_user_func(array($control_type,\"form\"),$ctl);",
"\t\tif ($ctl) {",
"\t\t\t$form->controls['identifier']->disabled = true;\n\t\t\t$form->meta(\"id\",$ctl->id);\n\t\t\t$form->meta(\"identifier\",$ctl->identifier);\n\t\t}\n\t\t$form->meta(\"action\",\"save\");\n\t\t$form->meta('module',\"expDefinableField\");\n\t\t$form->meta('control_type',$control_type);\n\t\t$form->meta(\"type\", $control_type);\n\t\t$types = expTemplate::listControlTypes();\n",
"\t\tassign_to_template(array('form_html'=>$form->toHTML(), 'types'=>$types[$control_type]));",
"\t}",
"\n\tfunction save() {",
"\t\tglobal $db;\n\t\t$ctl = null;\n\t\t$control = null;\n\t\tif (isset($this->params['id'])) {\n\t\t\t$control = $db->selectObject('expDefinableFields','id='.$this->params['id']);\n\t\t\tif ($control) {\n\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t$ctl->name = $ctl->identifier;\n\t\t\t}\n\t\t}\n",
"\t\tif (call_user_func(array($_POST['control_type'],'useGeneric')) == true) {",
"\t\t\t$ctl = call_user_func(array('genericcontrol','update'),expString::sanitize($_POST),$ctl);\n\t\t} else {\n\t\t\t$ctl = call_user_func(array($_POST['control_type'],'update'),expString::sanitize($_POST),$ctl);\n\t\t}",
"",
"\t\tif ($ctl != null) {\n\t\t\t$name = substr(preg_replace('/[^A-Za-z0-9]/','_',$ctl->identifier),0,20);",
"",
"\t\t\tif (!isset($this->params['id'])) {\n\t\t\t\t$control->name = $name;\n\t\t\t}",
"",
" if (!empty($ctl->pattern)) $ctl->pattern = addslashes($ctl->pattern);\n\t\t\t$control->data = serialize($ctl);\n\t\t\t$control->type = $this->params['type'];",
"",
"\t\t\tif (isset($control->id)) {\n\t\t\t\t$db->updateObject($control,'expDefinableFields');\n\t\t\t} else {\n\t\t\t\t$db->insertObject($control,'expDefinableFields');\n\t\t\t}\n\t\t}",
"",
"\t\tredirect_to(array('controller'=>'expDefinableField','action'=>'manage'));\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expHTMLEditorController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expHTMLEditorController extends expController\n{",
" static function displayname()\n {\n return gt(\"Editors\");\n }",
" static function description()\n {\n return gt(\"Mostly for CKEditor\");\n }",
" static function author()\n {\n return \"Phillip Ball\";\n }",
" static function hasSources()\n {\n return false;\n }",
" static function hasContent()\n {\n return false;\n }",
" protected $add_permissions = array(",
" 'activate' => \"Activate\",\n 'preview' => \"Preview Editor Toolbars\"\n );",
"",
"\n function __construct($src = null, $params = array())\n {\n parent:: __construct($src, $params);\n if (empty($this->params['editor'])) {\n $this->params['editor'] = SITE_WYSIWYG_EDITOR;\n }\n }",
" function manage()\n {\n global $db;",
" expHistory::set('manageable', $this->params);\n if (SITE_WYSIWYG_EDITOR == \"FCKeditor\") {\n flash('error', gt('FCKeditor is deprecated!'));\n redirect_to(array(\"module\" => \"administration\", \"action\" => \"configure_site\"));\n }",
" // otherwise, on to the show\n $configs = $db->selectObjects('htmleditor_' . $this->params['editor'], 1);",
" assign_to_template(\n array(\n 'configs' => $configs,\n 'editor' => $this->params['editor']\n )\n );\n }",
" function update()\n {\n global $db;",
" $obj = self::getEditorSettings($this->params['id'], $this->params['editor']);\n $obj->name = $this->params['name'];\n $obj->data = stripSlashes($this->params['data']);\n $obj->skin = $this->params['skin'];\n $obj->scayt_on = $this->params['scayt_on'];\n $obj->paste_word = $this->params['paste_word'];\n $obj->plugins = stripSlashes($this->params['plugins']);\n $obj->stylesset = stripSlashes($this->params['stylesset']);\n $obj->formattags = stripSlashes($this->params['formattags']);\n $obj->fontnames = stripSlashes($this->params['fontnames']);\n if (empty($this->params['id'])) {\n $this->params['id'] = $db->insertObject($obj, 'htmleditor_' . $this->params['editor']);\n } else {\n $db->updateObject($obj, 'htmleditor_' . $this->params['editor'], null, 'id');\n }\n if ($this->params['active']) {\n $this->activate();\n }\n expHistory::returnTo('manageable');\n }",
" function edit()\n {\n expHistory::set('editable', $this->params);\n $tool = self::getEditorSettings(!empty($this->params['id'])?$this->params['id']:null, $this->params['editor']);\n if ($tool == null) $tool = new stdClass();\n $tool->data = !empty($tool->data) ? @stripSlashes($tool->data) : '';\n $tool->plugins = !empty($tool->plugins) ? @stripSlashes($tool->plugins) : '';\n $tool->stylesset = !empty($tool->stylesset) ? @stripSlashes($tool->stylesset) : '';\n $tool->formattags = !empty($tool->formattags) ? @stripSlashes($tool->formattags) : '';\n $tool->fontnames = !empty($tool->fontnames) ? @stripSlashes($tool->fontnames) : '';\n $skins_dir = opendir(BASE . 'external/editors/' . $this->params['editor'] . '/skins');\n $skins = array();\n while (($skin = readdir($skins_dir)) !== false) {\n if ($skin != '.' && $skin != '..') {\n $skins[] = $skin;\n }\n }\n assign_to_template(\n array(\n 'record' => $tool,\n 'skins' => $skins,\n 'editor' => $this->params['editor']\n )\n );\n }",
" function delete()\n {\n global $db;",
" expHistory::set('editable', $this->params);\n @$db->delete('htmleditor_' . $this->params['editor'], \"id=\" . $this->params['id']);\n expHistory::returnTo('manageable');\n }",
" function activate()\n {\n global $db;",
" $db->toggle('htmleditor_' . $this->params['editor'], \"active\", 'active=1');\n if ($this->params['id'] != \"default\") {\n $active = self::getEditorSettings($this->params['id'], $this->params['editor']);\n $active->active = 1;\n $db->updateObject($active, 'htmleditor_' . $this->params['editor'], null, 'id');\n }\n expHistory::returnTo('manageable');\n }",
" function preview()\n {\n if ($this->params['id'] == 0) { // we want the default editor\n $demo = new stdClass();\n $demo->id = 0;\n $demo->name = \"Default\";\n if ($this->params['editor'] == 'ckeditor') {\n $demo->skin = 'kama';\n } elseif ($this->params['editor'] == 'tinymce') {\n $demo->skin = 'lightgray';\n }\n } else {\n $demo = self::getEditorSettings($this->params['id'], $this->params['editor']);\n }\n assign_to_template(\n array(\n 'demo' => $demo,\n 'editor' => $this->params['editor']\n )\n );\n }",
" public static function getEditorSettings($settings_id, $editor)\n {\n global $db;",
" return @$db->selectObject('htmleditor_' . $editor, \"id=\" . $settings_id);\n }",
" public static function getActiveEditorSettings($editor)\n {\n global $db;",
" return $db->selectObject('htmleditor_' . $editor, 'active=1');\n }",
"}",
"?>"
] |
[
1,
1,
1,
0,
0,
0,
0,
0,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expHTMLEditorController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expHTMLEditorController extends expController\n{",
" protected $manage_permissions = array(",
" 'activate' => \"Activate\",\n 'preview' => \"Preview Editor Toolbars\"\n );",
" public $requires_login = array(\n 'preview'=>'Preview Editor',\n );",
" static function displayname()\n {\n return gt(\"Editors\");\n }",
" static function description()\n {\n return gt(\"Mostly for CKEditor\");\n }",
" static function author()\n {\n return \"Phillip Ball\";\n }",
" static function hasSources()\n {\n return false;\n }",
" static function hasContent()\n {\n return false;\n }",
"\n function __construct($src = null, $params = array())\n {\n parent:: __construct($src, $params);\n if (empty($this->params['editor'])) {\n $this->params['editor'] = SITE_WYSIWYG_EDITOR;\n }\n }",
" function manage()\n {\n global $db;",
" expHistory::set('manageable', $this->params);\n if (SITE_WYSIWYG_EDITOR == \"FCKeditor\") {\n flash('error', gt('FCKeditor is deprecated!'));\n redirect_to(array(\"module\" => \"administration\", \"action\" => \"configure_site\"));\n }",
" // otherwise, on to the show\n $configs = $db->selectObjects('htmleditor_' . $this->params['editor'], 1);",
" assign_to_template(\n array(\n 'configs' => $configs,\n 'editor' => $this->params['editor']\n )\n );\n }",
" function update()\n {\n global $db;",
" $obj = self::getEditorSettings($this->params['id'], $this->params['editor']);\n $obj->name = $this->params['name'];\n $obj->data = stripSlashes($this->params['data']);\n $obj->skin = $this->params['skin'];\n $obj->scayt_on = $this->params['scayt_on'];\n $obj->paste_word = $this->params['paste_word'];\n $obj->plugins = stripSlashes($this->params['plugins']);\n $obj->stylesset = stripSlashes($this->params['stylesset']);\n $obj->formattags = stripSlashes($this->params['formattags']);\n $obj->fontnames = stripSlashes($this->params['fontnames']);\n if (empty($this->params['id'])) {\n $this->params['id'] = $db->insertObject($obj, 'htmleditor_' . $this->params['editor']);\n } else {\n $db->updateObject($obj, 'htmleditor_' . $this->params['editor'], null, 'id');\n }\n if ($this->params['active']) {\n $this->activate();\n }\n expHistory::returnTo('manageable');\n }",
" function edit()\n {\n expHistory::set('editable', $this->params);\n $tool = self::getEditorSettings(!empty($this->params['id'])?$this->params['id']:null, $this->params['editor']);\n if ($tool == null) $tool = new stdClass();\n $tool->data = !empty($tool->data) ? @stripSlashes($tool->data) : '';\n $tool->plugins = !empty($tool->plugins) ? @stripSlashes($tool->plugins) : '';\n $tool->stylesset = !empty($tool->stylesset) ? @stripSlashes($tool->stylesset) : '';\n $tool->formattags = !empty($tool->formattags) ? @stripSlashes($tool->formattags) : '';\n $tool->fontnames = !empty($tool->fontnames) ? @stripSlashes($tool->fontnames) : '';\n $skins_dir = opendir(BASE . 'external/editors/' . $this->params['editor'] . '/skins');\n $skins = array();\n while (($skin = readdir($skins_dir)) !== false) {\n if ($skin != '.' && $skin != '..') {\n $skins[] = $skin;\n }\n }\n assign_to_template(\n array(\n 'record' => $tool,\n 'skins' => $skins,\n 'editor' => $this->params['editor']\n )\n );\n }",
" function delete()\n {\n global $db;",
" expHistory::set('editable', $this->params);\n @$db->delete('htmleditor_' . $this->params['editor'], \"id=\" . $this->params['id']);\n expHistory::returnTo('manageable');\n }",
" function activate()\n {\n global $db;",
" $db->toggle('htmleditor_' . $this->params['editor'], \"active\", 'active=1');\n if ($this->params['id'] != \"default\") {\n $active = self::getEditorSettings($this->params['id'], $this->params['editor']);\n $active->active = 1;\n $db->updateObject($active, 'htmleditor_' . $this->params['editor'], null, 'id');\n }\n expHistory::returnTo('manageable');\n }",
" function preview()\n {\n if ($this->params['id'] == 0) { // we want the default editor\n $demo = new stdClass();\n $demo->id = 0;\n $demo->name = \"Default\";\n if ($this->params['editor'] == 'ckeditor') {\n $demo->skin = 'kama';\n } elseif ($this->params['editor'] == 'tinymce') {\n $demo->skin = 'lightgray';\n }\n } else {\n $demo = self::getEditorSettings($this->params['id'], $this->params['editor']);\n }\n assign_to_template(\n array(\n 'demo' => $demo,\n 'editor' => $this->params['editor']\n )\n );\n }",
" public static function getEditorSettings($settings_id, $editor)\n {\n global $db;",
" return @$db->selectObject('htmleditor_' . $editor, \"id=\" . $settings_id);\n }",
" public static function getActiveEditorSettings($editor)\n {\n global $db;",
" return $db->selectObject('htmleditor_' . $editor, 'active=1');\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expSimpleNoteController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expSimpleNoteController extends expController {\n public $base_class = 'expSimpleNote';",
" protected $add_permissions = array(\n 'approve'=>\"Approve Comments\"",
" );\n// protected $remove_permissions = array(\n// 'edit',\n// 'create'\n// );",
" static function displayname() { return gt(\"Simple Notes\"); }\n static function description() { return gt(\"Use this module to add Simple Notes attached to something (product, order, etc)\"); }\n static function author() { return \"Jonathan Worent @ OIC Group, Inc\"; }",
" ",
" function edit() {\n global $user;",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n if (empty($this->params['formtitle'])) ",
" {\n if (empty($this->params['id']))\n {\n $formtitle = gt(\"Add New Note\");\n }\n else\n {\n $formtitle = gt(\"Edit Note\");\n }\n }\n else\n {\n $formtitle = $this->params['formtitle'];\n }",
" ",
" $id = empty($this->params['id']) ? null : $this->params['id'];\n $simpleNote = new expSimpleNote($id);\n //FIXME here is where we might sanitize the note before displaying/editing it",
" assign_to_template(array(\n 'simplenote'=>$simpleNote,\n 'user'=>$user,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'formtitle'=>$formtitle,\n 'content_type'=>$this->params['content_type'],\n 'content_id'=>$this->params['content_id'],\n 'tab'=>empty($this->params['tab'])?0:$this->params['tab']\n ));",
" } \n ",
" function manage() {\n expHistory::set('manageable', $this->params);",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ",
" $sql = 'SELECT n.* FROM '.DB_TABLE_PREFIX.'_expSimpleNote n ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $sql .= 'AND n.approved=0';",
" ",
" $page = new expPaginator(array(\n// 'model'=>'expSimpleNote', // brings in all of model",
" 'sql'=>$sql, ",
" 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body'\n ),\n ));",
" ",
" //FIXME here is where we might sanitize the notes before displaying them",
" assign_to_template(array(\n 'page'=>$page,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }",
" ",
" function getNotes() {\n global $user, $db;",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n ",
" $sql = 'SELECT n.* FROM '.$db->prefix.'expSimpleNote n ';\n $sql .= 'JOIN '.$db->prefix.'content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';",
" $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";",
" $sql .= 'AND n.approved=1';",
" ",
" $simplenotes = new expPaginator(array(\n //'model'=>'expSimpleNote',",
" 'sql'=>$sql, ",
" 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Readable Column Name')=>'Column Name'\n ),\n ));",
" \n // count the unapproved comments",
" if ($require_approval == 1 && $user->isAdmin()) {\n $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expSimpleNote com ';\n $sql .= 'JOIN '.$db->prefix.'content_expSimpleNote cnt ON com.id=cnt.expsimplenote_id ';",
" $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";",
" $sql .= 'AND com.approved=0';\n $unapproved = $db->countObjectsBySql($sql);\n } else {\n $unapproved = 0;",
" } \n ",
" //FIXME here is where we might sanitize the notes before displaying them",
" assign_to_template(array(\n 'simplenotes'=>$simplenotes,",
" 'unapproved'=>$unapproved, \n 'content_id'=>$this->params['content_id'], ",
" 'content_type'=>$this->params['content_type'],\n 'user'=>$user,\n 'hideform'=>$this->params['hideform'],\n 'hidenotes'=>$this->params['hidenotes'],\n 'title'=>$this->params['title'],\n 'formtitle'=>$this->params['formtitle'],\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }",
" function update() {\n global $db, $user, $history;",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ",
" // figure out the name and email address\n if (!empty($user->id)) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }",
" \n // if simplenotes are configed to require approvals set this to 0 otherwise we ",
" // will just go ahead and turn the approval on for this comment.\n $this->expSimpleNote->approved = ($require_approval == 1 && !$user->isAdmin()) ? 0 : 1;",
" ",
" // save the note\n //FIXME here is where we might sanitize the note before saving it\n $this->expSimpleNote->update($this->params);",
" ",
" // attach the note to the datatype it belongs to (product, order, etc..);\n// $obj = new stdClass();\n// $obj->content_type = $this->params['content_type'];\n// $obj->content_id = $this->params['content_id'];\n// $obj->expsimplenote_id = $this->expSimpleNote->id;\n// if(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n// $db->insertObject($obj, $this->expSimpleNote->attachable_table);\n $this->expSimpleNote->attachNote($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);",
" $msg = gt('Your note has been added.');\n if ($require_approval == 1 && !$user->isAdmin()) {\n $msg .= ' '.gt('Your note is now pending approval. You will receive an email to').' ';\n $msg .= $this->expSimpleNote->email.' '.gt('letting you know when it has been approved.');\n }",
" ",
" if ($require_notification && !$user->isAdmin()) {\n $this->sendNotification($this->expComment);\n }",
" ",
" flash('message', $msg);",
" \n ",
" $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }",
" ",
" public function approve() {\n expHistory::set('editable', $this->params);",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ",
" if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for note to approve'));\n $lastUrl = expHistory::getLast('editable');\n }",
" ",
" $simplenote = new expSimpleNote($this->params['id']);\n assign_to_template(array(\n 'simplenote'=>$simplenote,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }",
" ",
" public function approve_submit() {\n global $history;",
" ",
" if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for comment to approve'));\n $lastUrl = expHistory::getLast('editable');\n }",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ",
" $simplenote = new expSimpleNote($this->params['id']);\n //FIXME here is where we might sanitize the note before approving it\n $simplenote->body = $this->params['body'];\n $simplenote->approved = $this->params['approved'];\n $simplenote->save();",
" ",
" $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }",
" ",
" public function approve_toggle() {\n global $history;",
" ",
" if (empty($this->params['id'])) return;",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n ",
" $simplenote = new expSimpleNote($this->params['id']);\n $simplenote->approved = $simplenote->approved == 1 ? 0 : 1;\n $simplenote->save();",
" ",
" $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }",
" ",
" public function delete() {\n global $db, $history;",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ",
" if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the comment you would like to delete'));\n $lastUrl = expHistory::getLast('editable');\n }",
" ",
" // delete the note\n $simplenote = new expSimpleNote($this->params['id']);\n $rows = $simplenote->delete();",
" ",
" // delete the assocication too",
" $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']); \n ",
" // send the user back where they came from.\n $lastUrl = expHistory::getLast('editable');\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }",
" ",
" private function sendNotification($simplenote) {\n if (empty($simplenote)) return false;",
" \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ",
" // setup some email variables.\n $subject = 'Notification of a New Note Posted to '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $editlink = makelink(array('controller'=>'expSimpleNote', 'action'=>'edit', 'id'=>$simplenote->id));",
" ",
" // make the email body\n $body = gt('Posted By').': '.$simplenote->name.\"<br>\";\n $body .= gt('Posters Email').': '.$simplenote->email.\"<br><br>\";\n $body .= $simplenote->body.\"<br><br>\";\n $body .= gt('You can view, edit and optionally approved this comment by going to').' ';\n $body .= '<a href=\"'.$editlink.'\">'.$editlink.'</a>';",
" ",
" // create the mail message",
" $mail = new expMail(); ",
" $mail->quickSend(array(\n 'html_message'=>$body,\n 'to'=>$tos,\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n 'subject'=>$subject,\n ));",
" ",
" return true;\n }",
"}",
"?>"
] |
[
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expSimpleNoteController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expSimpleNoteController extends expController {\n public $base_class = 'expSimpleNote';",
" protected $manage_permissions = array(\n 'approve'=>\"Approve Notes\"",
" );\n// protected $remove_permissions = array(\n// 'edit',\n// 'create'\n// );",
" static function displayname() { return gt(\"Simple Notes\"); }\n static function description() { return gt(\"Use this module to add Simple Notes attached to something (product, order, etc)\"); }\n static function author() { return \"Jonathan Worent @ OIC Group, Inc\"; }",
"",
" function edit() {\n global $user;",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];",
" if (empty($this->params['formtitle']))",
" {\n if (empty($this->params['id']))\n {\n $formtitle = gt(\"Add New Note\");\n }\n else\n {\n $formtitle = gt(\"Edit Note\");\n }\n }\n else\n {\n $formtitle = $this->params['formtitle'];\n }",
"",
" $id = empty($this->params['id']) ? null : $this->params['id'];\n $simpleNote = new expSimpleNote($id);\n //FIXME here is where we might sanitize the note before displaying/editing it",
" assign_to_template(array(\n 'simplenote'=>$simpleNote,\n 'user'=>$user,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'formtitle'=>$formtitle,\n 'content_type'=>$this->params['content_type'],\n 'content_id'=>$this->params['content_id'],\n 'tab'=>empty($this->params['tab'])?0:$this->params['tab']\n ));",
" }\n",
" function manage() {\n expHistory::set('manageable', $this->params);",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n",
" $sql = 'SELECT n.* FROM '.DB_TABLE_PREFIX.'_expSimpleNote n ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $sql .= 'AND n.approved=0';",
"",
" $page = new expPaginator(array(\n// 'model'=>'expSimpleNote', // brings in all of model",
" 'sql'=>$sql,",
" 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body'\n ),\n ));",
"",
" //FIXME here is where we might sanitize the notes before displaying them",
" assign_to_template(array(\n 'page'=>$page,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }",
"",
" function getNotes() {\n global $user, $db;",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : intval($this->params['require_login']);\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : intval($this->params['require_approval']);\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : intval($this->params['require_notification']);\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : expString::escape($this->params['notification_email']);",
"",
" $sql = 'SELECT n.* FROM '.$db->prefix.'expSimpleNote n ';\n $sql .= 'JOIN '.$db->prefix.'content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';",
" $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".expString::escape($this->params['content_type']).\"' \";",
" $sql .= 'AND n.approved=1';",
"",
" $simplenotes = new expPaginator(array(\n //'model'=>'expSimpleNote',",
" 'sql'=>$sql,",
" 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Readable Column Name')=>'Column Name'\n ),\n ));",
"\n // count the unapproved notes",
" if ($require_approval == 1 && $user->isAdmin()) {\n $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expSimpleNote com ';\n $sql .= 'JOIN '.$db->prefix.'content_expSimpleNote cnt ON com.id=cnt.expsimplenote_id ';",
" $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".expString::escape($this->params['content_type']).\"' \";",
" $sql .= 'AND com.approved=0';\n $unapproved = $db->countObjectsBySql($sql);\n } else {\n $unapproved = 0;",
" }\n",
" //FIXME here is where we might sanitize the notes before displaying them",
" assign_to_template(array(\n 'simplenotes'=>$simplenotes,",
" 'unapproved'=>$unapproved,\n 'content_id'=>$this->params['content_id'],",
" 'content_type'=>$this->params['content_type'],\n 'user'=>$user,\n 'hideform'=>$this->params['hideform'],\n 'hidenotes'=>$this->params['hidenotes'],\n 'title'=>$this->params['title'],\n 'formtitle'=>$this->params['formtitle'],\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }",
" function update() {\n global $db, $user, $history;",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n",
" // figure out the name and email address\n if (!empty($user->id)) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }",
"\n // if simplenotes are configed to require approvals set this to 0 otherwise we",
" // will just go ahead and turn the approval on for this comment.\n $this->expSimpleNote->approved = ($require_approval == 1 && !$user->isAdmin()) ? 0 : 1;",
"",
" // save the note\n //FIXME here is where we might sanitize the note before saving it\n $this->expSimpleNote->update($this->params);",
"",
" // attach the note to the datatype it belongs to (product, order, etc..);\n// $obj = new stdClass();\n// $obj->content_type = $this->params['content_type'];\n// $obj->content_id = $this->params['content_id'];\n// $obj->expsimplenote_id = $this->expSimpleNote->id;\n// if(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n// $db->insertObject($obj, $this->expSimpleNote->attachable_table);\n $this->expSimpleNote->attachNote($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);",
" $msg = gt('Your note has been added.');\n if ($require_approval == 1 && !$user->isAdmin()) {\n $msg .= ' '.gt('Your note is now pending approval. You will receive an email to').' ';\n $msg .= $this->expSimpleNote->email.' '.gt('letting you know when it has been approved.');\n }",
"",
" if ($require_notification && !$user->isAdmin()) {\n $this->sendNotification($this->expComment);\n }",
"",
" flash('message', $msg);",
"\n",
" $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }",
"",
" public function approve() {\n expHistory::set('editable', $this->params);",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n",
" if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for note to approve'));\n $lastUrl = expHistory::getLast('editable');\n }",
"",
" $simplenote = new expSimpleNote($this->params['id']);\n assign_to_template(array(\n 'simplenote'=>$simplenote,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }",
"",
" public function approve_submit() {\n global $history;",
"",
" if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for comment to approve'));\n $lastUrl = expHistory::getLast('editable');\n }",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n",
" $simplenote = new expSimpleNote($this->params['id']);\n //FIXME here is where we might sanitize the note before approving it\n $simplenote->body = $this->params['body'];\n $simplenote->approved = $this->params['approved'];\n $simplenote->save();",
"",
" $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }",
"",
" public function approve_toggle() {\n global $history;",
"",
" if (empty($this->params['id'])) return;",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];",
"",
" $simplenote = new expSimpleNote($this->params['id']);\n $simplenote->approved = $simplenote->approved == 1 ? 0 : 1;\n $simplenote->save();",
"",
" $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }",
"",
" public function delete() {\n global $db, $history;",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n",
" if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the comment you would like to delete'));\n $lastUrl = expHistory::getLast('editable');\n }",
"",
" // delete the note\n $simplenote = new expSimpleNote($this->params['id']);\n $rows = $simplenote->delete();",
"",
" // delete the assocication too",
" $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']);\n",
" // send the user back where they came from.\n $lastUrl = expHistory::getLast('editable');\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }",
"",
" private function sendNotification($simplenote) {\n if (empty($simplenote)) return false;",
"\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : intval($this->params['require_login']);\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : intval($this->params['require_approval']);\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : intval($this->params['require_notification']);\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : expString::escape($this->params['notification_email']);\n",
" // setup some email variables.\n $subject = 'Notification of a New Note Posted to '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $editlink = makelink(array('controller'=>'expSimpleNote', 'action'=>'edit', 'id'=>$simplenote->id));",
"",
" // make the email body\n $body = gt('Posted By').': '.$simplenote->name.\"<br>\";\n $body .= gt('Posters Email').': '.$simplenote->email.\"<br><br>\";\n $body .= $simplenote->body.\"<br><br>\";\n $body .= gt('You can view, edit and optionally approved this comment by going to').' ';\n $body .= '<a href=\"'.$editlink.'\">'.$editlink.'</a>';",
"",
" // create the mail message",
" $mail = new expMail();",
" $mail->quickSend(array(\n 'html_message'=>$body,\n 'to'=>$tos,\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n 'subject'=>$subject,\n ));",
"",
" return true;\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expTagController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expTagController extends expController {",
"",
"\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Tag Manager\"); }",
"\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is used to manage tags\"); }",
" static function canImportData() { return true;}\n static function canExportData() { return true;}",
"\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }",
" /**\n \t * default view for individual item\n \t */\n \tfunction show() {\n// global $db;",
" expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;",
" // figure out if we're looking this up by id or title\n $id = null;\n $tag = '';\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {",
" $id = $this->params['title'];",
" $tag = $id;\n }",
" $record = new $modelname($id);\n if (empty($tag) && !empty($record->title)) {\n $tag = $record->title;\n }",
"// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n foreach (expTag::selectAllTagContentType() as $contenttype) {\n $attatchedat = $record->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $record->attachedcount = @$record->attachedcount + count($attatchedat);\n $record->attached[$contenttype] = $attatchedat;\n }\n }",
" assign_to_template(array(\n 'record'=>$record,\n 'tag'=>$tag\n ));\n }",
"\t/**\n\t * manage tags\n\t */\n\tfunction manage() {\n// global $db;",
" expHistory::set('manageable', $this->params);\n $page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>static::hasSources() ? $this->aggregateWhereClause() : null,\n 'limit'=>10,\n 'order'=>\"title\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n// gt('Body')=>'body'\n ),\n ));",
"// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n foreach (expTag::selectAllTagContentType() as $contenttype) {\n foreach ($page->records as $key => $value) {\n $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n $page->records[$key]->attached[$contenttype] = $attatchedat;\n //FIXME here is a hack to get the faq to be listed\n if ($contenttype == 'faq' && !empty($page->records[$key]->attached[$contenttype][0]->question)) {\n $page->records[$key]->attached[$contenttype][0]->title = $page->records[$key]->attached[$contenttype][0]->question;\n }\n }\n }\n }",
" assign_to_template(array(\n 'page'=>$page\n ));\n }",
" /**\n \t * manage tags\n \t */\n \tfunction manage_module() {\n expHistory::set('manageable', $this->params);\n// $modulename = expModules::getControllerClassName($this->params['model']);\n// $module = new $modulename($this->params['src']);\n $module = expModules::getController($this->params['model'], $this->params['src']);\n $where = $module->aggregateWhereClause();\n if ($this->params['model'] == 'sermonseries') {\n $model = 'sermons';\n } else {\n $model = $this->params['model'];\n }\n $page = new expPaginator(array(\n 'model'=>$model,\n 'where'=>$where,\n// 'order'=>'module,rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['model'],\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));\n if ($this->params['model'] == 'faq') {\n foreach ($page->records as $record) {\n $record->title = $record->question;\n }\n }",
"// $page = new expPaginator(array(\n// 'model'=>$this->basemodel_name,\n// 'where'=>static::hasSources() ? $this->aggregateWhereClause() : null,\n// 'limit'=>50,\n// 'order'=>\"title\",\n// 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n// 'controller'=>$this->baseclassname,\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n// ));\n//\n// foreach ($db->selectColumn('content_expTags','content_type',\"content_type='\".$this->params['model'].\"'\",null,true) as $contenttype) {\n// foreach ($page->records as $key => $value) {\n// $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n// if (!empty($attatchedat)) {\n// $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n// $page->records[$key]->attached[$contenttype] = $attatchedat;\n// //FIXME here is a hack to get the faq to be listed\n// if ($contenttype == 'faq' && !empty($page->records[$key]->attached[$contenttype][0]->question)) {\n// $page->records[$key]->attached[$contenttype][0]->title = $page->records[$key]->attached[$contenttype][0]->question;\n// }\n// }\n// }\n// }\n// $tags = $db->selectObjects('expTags','1','title ASC');\n// $taglist = '';\n// foreach ($tags as $tag) {\n// $taglist .= \"'\".$tag->title.\"',\";\n// }\n $taglist = expTag::getAllTags();",
" assign_to_template(array(\n 'page'=>$page,\n 'taglist'=>$taglist\n ));\n }",
" /**\n * this method changes the tags of the selected items as requested\n */\n function change_tags() {\n// global $db;",
" if (!empty($this->params['change_tag'])) {\n // build array of tags to add\n $addtags = explode(\",\", trim($this->params['addTag']));\n \t foreach($addtags as $key=>$tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag)) {\n $addtags[$key] = $tag;\n $expTag = new expTag($tag);\n if (empty($expTag->id)) // create the new tag\n $expTag->update(array('title' => $tag));\n }\n }\n \t }\n // build array of tags to remove\n $removetags = explode(\",\", trim($this->params['removeTag']));\n \t foreach($removetags as $key=>$tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag))\n $removetags[$key] = $tag;\n }\n \t }\n foreach ($this->params['change_tag'] as $item) {\n $params['expTag'] = array();\n $classname = $this->params['mod'];\n $object = new $classname($item);\n expTag::deleteTag($this->params['mod'], $object->id);\n $tags = $object->expTag;\n $object->expTag = array();\n foreach ($tags as $tag) {\n if (!in_array($tag->title, $removetags)) {\n $params['expTag'][] = $tag->id; // add back any tags not being removed\n }\n }\n foreach ($addtags as $tag) {\n $expTag = new expTag($tag);\n $params['expTag'][] = $expTag->id; // add new tags\n }\n $object->update($params);\n }\n }\n expHistory::returnTo('viewable');\n }",
" function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }",
" function importTags($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Tag Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n $count = 0;\n if (stripos($header[0], 'tag') === false) {\n rewind($handle);\n } else {\n $count++;\n }",
" $errorSet = array();",
" // read in the data lines\n echo \"<h1>\", gt(\"Importing Tags\"), \"</h1>\";\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;",
" $row[0] = strtolower(trim($row['0']));\n if (empty($row['0'])) {\n $errorSet[$count] = gt(\"Is empty.\");\n continue;\n } else {\n $newtag = new expTag($row[0]);\n if ($newtag->id) {\n echo gt(\"Tag already existed\"), \": \", $row[0], \"<br/>\";\n } else {\n $newtag->update(array('title'=>$row[0]));\n echo gt(\"Tag successfully added\"), \": <strong>\", $row[0], \"</strong><br/>\";\n }\n }\n }",
" fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \", $rownum, \" -- \", $err, \"<br/>\";\n }\n echo \"</div>\";\n }\n echo \"<br>\";\n }",
" function export() {\n $out = gt('Tag Name (lower case)') . chr(13) . chr(10);\n $tg = new expTag();\n $tags = $tg->find('all');\n set_time_limit(0);\n foreach ($tags as $tag) {\n $out .= $tag->title . chr(13) . chr(10);\n }",
" $filename = 'tags_export_' . time() . '.csv';",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting\n }",
"}",
"?>"
] |
[
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * This is the class expTagController\n *\n * @package Core\n * @subpackage Controllers\n */",
"class expTagController extends expController {",
" protected $manage_permissions = array(\n// 'import' => 'Import Tags',\n// 'importTags' => 'Import Tags',\n// 'export' => 'Export Tags',\n 'change' => 'Change Tags',\n );",
"\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Tag Manager\"); }",
"\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is used to manage tags\"); }",
" static function canImportData() { return true;}\n static function canExportData() { return true;}",
"\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }",
" /**\n \t * default view for individual item\n \t */\n \tfunction show() {\n// global $db;",
" expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;",
" // figure out if we're looking this up by id or title\n $id = null;\n $tag = '';\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {",
" $id = expString::escape($this->params['title']);",
" $tag = $id;\n }",
" $record = new $modelname($id);\n if (empty($tag) && !empty($record->title)) {\n $tag = $record->title;\n }",
"// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n foreach (expTag::selectAllTagContentType() as $contenttype) {\n $attatchedat = $record->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $record->attachedcount = @$record->attachedcount + count($attatchedat);\n $record->attached[$contenttype] = $attatchedat;\n }\n }",
" assign_to_template(array(\n 'record'=>$record,\n 'tag'=>$tag\n ));\n }",
"\t/**\n\t * manage tags\n\t */\n\tfunction manage() {\n// global $db;",
" expHistory::set('manageable', $this->params);\n $page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>static::hasSources() ? $this->aggregateWhereClause() : null,\n 'limit'=>10,\n 'order'=>\"title\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n// gt('Body')=>'body'\n ),\n ));",
"// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n foreach (expTag::selectAllTagContentType() as $contenttype) {\n foreach ($page->records as $key => $value) {\n $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n $page->records[$key]->attached[$contenttype] = $attatchedat;\n //FIXME here is a hack to get the faq to be listed\n if ($contenttype == 'faq' && !empty($page->records[$key]->attached[$contenttype][0]->question)) {\n $page->records[$key]->attached[$contenttype][0]->title = $page->records[$key]->attached[$contenttype][0]->question;\n }\n }\n }\n }",
" assign_to_template(array(\n 'page'=>$page\n ));\n }",
" /**\n \t * manage tags\n \t */\n \tfunction manage_module() {\n expHistory::set('manageable', $this->params);\n// $modulename = expModules::getControllerClassName($this->params['model']);\n// $module = new $modulename($this->params['src']);\n $module = expModules::getController($this->params['model'], $this->params['src']);\n $where = $module->aggregateWhereClause();\n if ($this->params['model'] == 'sermonseries') {\n $model = 'sermons';\n } else {\n $model = $this->params['model'];\n }\n $page = new expPaginator(array(\n 'model'=>$model,\n 'where'=>$where,\n// 'order'=>'module,rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['model'],\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));\n if ($this->params['model'] == 'faq') {\n foreach ($page->records as $record) {\n $record->title = $record->question;\n }\n }",
"// $page = new expPaginator(array(\n// 'model'=>$this->basemodel_name,\n// 'where'=>static::hasSources() ? $this->aggregateWhereClause() : null,\n// 'limit'=>50,\n// 'order'=>\"title\",\n// 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n// 'controller'=>$this->baseclassname,\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n// ));\n//\n// foreach ($db->selectColumn('content_expTags','content_type',\"content_type='\".$this->params['model'].\"'\",null,true) as $contenttype) {\n// foreach ($page->records as $key => $value) {\n// $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n// if (!empty($attatchedat)) {\n// $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n// $page->records[$key]->attached[$contenttype] = $attatchedat;\n// //FIXME here is a hack to get the faq to be listed\n// if ($contenttype == 'faq' && !empty($page->records[$key]->attached[$contenttype][0]->question)) {\n// $page->records[$key]->attached[$contenttype][0]->title = $page->records[$key]->attached[$contenttype][0]->question;\n// }\n// }\n// }\n// }\n// $tags = $db->selectObjects('expTags','1','title ASC');\n// $taglist = '';\n// foreach ($tags as $tag) {\n// $taglist .= \"'\".$tag->title.\"',\";\n// }\n $taglist = expTag::getAllTags();",
" assign_to_template(array(\n 'page'=>$page,\n 'taglist'=>$taglist\n ));\n }",
" /**\n * this method changes the tags of the selected items as requested\n */\n function change_tags() {\n// global $db;",
" if (!empty($this->params['change_tag'])) {\n // build array of tags to add\n $addtags = explode(\",\", trim($this->params['addTag']));\n \t foreach($addtags as $key=>$tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag)) {\n $addtags[$key] = $tag;\n $expTag = new expTag($tag);\n if (empty($expTag->id)) // create the new tag\n $expTag->update(array('title' => $tag));\n }\n }\n \t }\n // build array of tags to remove\n $removetags = explode(\",\", trim($this->params['removeTag']));\n \t foreach($removetags as $key=>$tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag))\n $removetags[$key] = $tag;\n }\n \t }\n foreach ($this->params['change_tag'] as $item) {\n $params['expTag'] = array();\n $classname = $this->params['mod'];\n $object = new $classname($item);\n expTag::deleteTag($this->params['mod'], $object->id);\n $tags = $object->expTag;\n $object->expTag = array();\n foreach ($tags as $tag) {\n if (!in_array($tag->title, $removetags)) {\n $params['expTag'][] = $tag->id; // add back any tags not being removed\n }\n }\n foreach ($addtags as $tag) {\n $expTag = new expTag($tag);\n $params['expTag'][] = $expTag->id; // add new tags\n }\n $object->update($params);\n }\n }\n expHistory::returnTo('viewable');\n }",
" function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }",
" function importTags($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Tag Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n $count = 0;\n if (stripos($header[0], 'tag') === false) {\n rewind($handle);\n } else {\n $count++;\n }",
" $errorSet = array();",
" // read in the data lines\n echo \"<h1>\", gt(\"Importing Tags\"), \"</h1>\";\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;",
" $row[0] = strtolower(trim($row['0']));\n if (empty($row['0'])) {\n $errorSet[$count] = gt(\"Is empty.\");\n continue;\n } else {\n $newtag = new expTag($row[0]);\n if ($newtag->id) {\n echo gt(\"Tag already existed\"), \": \", $row[0], \"<br/>\";\n } else {\n $newtag->update(array('title'=>$row[0]));\n echo gt(\"Tag successfully added\"), \": <strong>\", $row[0], \"</strong><br/>\";\n }\n }\n }",
" fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \", $rownum, \" -- \", $err, \"<br/>\";\n }\n echo \"</div>\";\n }\n echo \"<br>\";\n }",
" function export() {\n $out = gt('Tag Name (lower case)') . chr(13) . chr(10);\n $tg = new expTag();\n $tags = $tg->find('all');\n set_time_limit(0);\n foreach ($tags as $tag) {\n $out .= $tag->title . chr(13) . chr(10);\n }",
" $filename = 'tags_export_' . time() . '.csv';",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class eaasController extends expController {\n //public $basemodel_name = '';\n public $useractions = array(\n 'showall'=>'Install Service API'\n // 'tags'=>\"Tags\",\n // 'authors'=>\"Authors\",\n // 'dates'=>\"Dates\",\n );\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n// 'module',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" protected $add_permissions = array(\n // 'approve'=>\"Approve Comments\"\n );\n",
" public $tabs = array(\n 'aboutus'=>'About Us', \n 'blog'=>'Blog', \n 'photo'=>'Photos', \n 'media'=>'Media',\n 'event'=>'Events',\n 'filedownload'=>'File Downloads', \n 'news'=>'News'\n );",
"",
" protected $data = array();\n \n static function displayname() { return gt(\"Exponent as a Service\"); }",
" static function description() { return gt(\"This module allows you make service calls and return JSON for parts of Exponent\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }\n static function hasSources() { return false; } // must be explicitly added by config['add_source'] or config['aggregate']\n// static function isSearchable() { return true; }",
" static function requiresConfiguration()\n {\n return true;\n }",
" public function showall() {\n expHistory::set('viewable', $this->params);\n $info = array();\n $info['config'] = $this->config;\n $info['apikey'] = base64_encode(serialize($this->loc));",
" assign_to_template(array('info'=>$info));\n }",
" public function api() {\n if (empty($this->params['apikey'])) {\n $_REQUEST['apikey'] = true; // set this to force an ajax reply\n $ar = new expAjaxReply(550, 'Permission Denied', 'You need an API key in order to access Exponent as a Service', null);\n $ar->send(); //FIXME this doesn't seem to work correctly in this scenario\n } else {\n $key = expUnserialize(base64_decode(urldecode($this->params['apikey'])));\n $cfg = new expConfig($key);\n $this->config = $cfg->config;\n if(empty($cfg->id)) {\n $ar = new expAjaxReply(550, 'Permission Denied', 'Incorrect API key or Exponent as a Service module configuration missing', null);\n $ar->send();\n } else {\n if (!empty($this->params['get'])) {\n $this->handleRequest();\n } else {\n $ar = new expAjaxReply(200, 'ok', 'Your API key is working, no data requested', null);\n $ar->send();\n }\n }\n }\n }",
" private function handleRequest() {\n if (!array_key_exists($this->params['get'], $this->tabs)) {\n $ar = new expAjaxReply(400, 'Bad Request', 'No service available for your request', null);\n $ar->send();\n }\n if ($this->params['get'] != 'aboutus' && empty($this->config[$this->params['get'].'_aggregate'])) {\n $ar = new expAjaxReply(400, 'Bad Request', 'No modules assigned to requested service', null);\n $ar->send();\n }\n switch ($this->params['get']) {\n case 'aboutus':\n $ar = new expAjaxReply(200, 'ok', $this->aboutUs(), null);\n $ar->send();\n break;\n case 'news':\n $ar = new expAjaxReply(200, 'ok', $this->news(), null);\n $ar->send();\n break;\n case 'photo':\n case 'photos':\n $ar = new expAjaxReply(200, 'ok', $this->photo(), null);\n $ar->send();\n break;\n case 'media':\n $ar = new expAjaxReply(200, 'ok', $this->media(), null);\n $ar->send();\n break;\n case 'filedownload':\n case 'filedownloads':\n $ar = new expAjaxReply(200, 'ok', $this->filedownload(), null);\n $ar->send();\n break;\n case 'blog':\n case 'blogs':\n $ar = new expAjaxReply(200, 'ok', $this->blog(), null);\n $ar->send();\n break;\n case 'event':\n case 'events':\n $ar = new expAjaxReply(200, 'ok', $this->event(), null);\n $ar->send();\n break;\n default: // probably shouldn't evet get to this point\n $ar = new expAjaxReply(400, 'Bad Request', 'No service available for your request', null);\n $ar->send();\n break;\n }\n }",
" /**\n * Return the About Us data along with a quick item count by module\n * @return array\n */\n private function aboutUs() {\n $counts = array();\n foreach ($this->tabs as $key=>$name) {\n if ($key != 'aboutus') {\n $data = $this->$key();\n $counts[$key] = count($data['records']);\n }\n }\n $this->data = array(); // initialize\n $this->data = $counts;\n $this->data['records'] = array();\n $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function news() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $news = new news($this->params['id']);\n $this->data['records'] = $news;\n } else {\n $news = new news();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'publish DESC';\n $items = $news->find('all', $this->aggregateWhereClause('news'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
"// private function youtube() { //FIXME must replace with media player and then removed\n// $this->data = array(); // initialize\n// if (!empty($this->params['id'])) {\n// $youtube = new youtube($this->params['id']);\n// $this->data['records'] = $youtube;\n// } else {\n// $youtube = new youtube();\n//\n// // figure out if should limit the results\n// if (isset($this->params['limit'])) {\n// $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n// } else {\n// $limit = '';\n// }\n//\n// $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';\n//\n// $items = $youtube->find('all', $this->aggregateWhereClause('youtube'), $order, $limit);\n// $this->data['records'] = $items;\n// }\n//\n// $this->getImageBody($this->params['get']);\n// return $this->data;\n// }",
" private function media() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $media = new media($this->params['id']);\n $this->data['records'] = $media;\n } else {\n $media = new media();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n }",
" $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';",
" $items = $media->find('all', $this->aggregateWhereClause('media'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function filedownload() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $filedownload = new filedownload($this->params['id']);\n $this->data['records'] = $filedownload;\n } else {\n $filedownload = new filedownload();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } ",
" $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';",
" $items = $filedownload->find('all', $this->aggregateWhereClause('filedownload'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function photo() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $photo = new photo($this->params['id']);\n $this->data['records'] = $photo;\n } else {\n $photo = new photo();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'rank';\n $items = $photo->find('all', $this->aggregateWhereClause('photo'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function blog() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $blog = new blog($this->params['id']);\n $this->data['records'] = $blog;\n } else {\n $blog = new blog();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'publish DESC';\n $items = $blog->find('all', $this->aggregateWhereClause('blog'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function event() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $event = new event($this->params['id']);\n $this->data['records'] = $event;\n } else {\n $event = new event();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n// $order = isset($this->params['order']) ? $this->params['order'] : 'created_at'; //FIXME we shoud be getting upcoming events\n// $items = $event->find('all', $this->aggregateWhereClause('event'), $order, $limit); //FIXME needs 'upcoming' type of find\n $items = $event->find('upcoming', $this->aggregateWhereClause('event'), false, $limit); //new 'upcoming' type of find\n $this->data['records'] = $items;\n }",
" if (!empty($this->params['groupbydate'])&&!empty($items)) { // aggregate by day like with regular calendar\n $this->data['records'] = array();\n foreach ($items as $value) {\n $this->data['records'][date('r',$value->eventdate[0]->date)][] = $value;\n // edebug($value);\n }\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" function configure() {\n expHistory::set('editable', $this->params);\n parent::configure();\n $order = isset($this->params['order']) ? $this->params['order'] : 'section';\n $dir = isset($this->params['dir']) ? $this->params['dir'] : '';\n \n $views = expTemplate::get_config_templates($this, $this->loc);\n $pullable = array();\n $page = array();",
" foreach ($this->tabs as $tab => $name) {\n // news tab\n if ($tab!='aboutus') {\n $pullable[$tab] = expModules::listInstalledControllers($tab);\n $page[$tab] = new expPaginator(array(\n 'controller'=>$tab.'Controller',\n 'action' => $this->params['action'],\n 'records'=>$pullable[$tab],\n 'limit'=>count($pullable[$tab]),\n 'order'=>$order,\n 'dir'=>$dir,\n 'columns'=>array(gt('Title')=>'title',gt('Page')=>'section'),\n ));\n }",
" $this->configImage($tab); // fix attached files for proper display of file manager control\n }\n // edebug($this->config['expFile']);",
" assign_to_template(array(\n 'config'=>$this->config, // though already assigned in controllertemplate, we need to update expFiles\n 'pullable'=>$pullable,\n 'page'=>$page,\n// 'views'=>$views\n ));\n }",
" private function configImage($tab) {\n if (count(@$this->config['expFile'][$tab.'_image'])>1) {\n $ftmp[] = new expFile($this->config['expFile'][$tab.'_image'][0]);\n $this->config['expFile'][$tab.'_image'] = $ftmp;\n } else {\n $this->config['expFile'][$tab.'_image'] = array();\n }\n }",
" private function getImageBody($tab) {\n // create an empty 'banner' object to prevent errors in caller\n $this->data['banner']['obj'] = null;\n $this->data['banner']['obj']->url = null;\n $this->data['banner']['md5'] = null;",
" if (count(@$this->config['expFile'][$tab.'_image'])>1) {\n $img = new expFile($this->config['expFile'][$tab.'_image'][0]);\n if ($img) {\n $this->data['banner']['obj'] = $img;\n $this->data['banner']['md5'] = md5_file($img->path);\n }\n }\n $this->data['html'] = $this->config[$tab.'_body'];\n }",
" /**\n * Only return selected modules\n *\n * @param string $type\n * @return string\n */\n function aggregateWhereClause($type='') {\n $sql = '(0'; // simply to offset the 'OR' added in loop\n if (!empty($this->config[$type.'_aggregate'])) {\n foreach ($this->config[$type.'_aggregate'] as $src) {\n $loc = expCore::makeLocation($type, $src);\n $sql .= \" OR location_data ='\".serialize($loc).\"'\";\n }\n \n }\n $sql .= ')';\n $model = $this->basemodel_name;\n if ($this->$model->needs_approval && ENABLE_WORKFLOW) {\n $sql .= ' AND approved=1';\n }",
" return $sql;\n }",
"}",
"?>"
] |
[
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class eaasController extends expController {\n //public $basemodel_name = '';\n public $useractions = array(\n 'showall'=>'Install Service API'\n // 'tags'=>\"Tags\",\n // 'authors'=>\"Authors\",\n // 'dates'=>\"Dates\",\n );\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n// 'module',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
"",
" public $tabs = array(\n 'aboutus'=>'About Us', \n 'blog'=>'Blog', \n 'photo'=>'Photos', \n 'media'=>'Media',\n 'event'=>'Events',\n 'filedownload'=>'File Downloads', \n 'news'=>'News'\n );",
"",
" protected $data = array();\n \n static function displayname() { return gt(\"Exponent as a Service\"); }",
" static function description() { return gt(\"This module allows you make service calls and return JSON for parts of Exponent\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }\n static function hasSources() { return false; } // must be explicitly added by config['add_source'] or config['aggregate']\n// static function isSearchable() { return true; }",
" static function requiresConfiguration()\n {\n return true;\n }",
" public function showall() {\n expHistory::set('viewable', $this->params);\n $info = array();\n $info['config'] = $this->config;\n $info['apikey'] = base64_encode(serialize($this->loc));",
" assign_to_template(array('info'=>$info));\n }",
" public function api() {\n if (empty($this->params['apikey'])) {\n $_REQUEST['apikey'] = true; // set this to force an ajax reply\n $ar = new expAjaxReply(550, 'Permission Denied', 'You need an API key in order to access Exponent as a Service', null);\n $ar->send(); //FIXME this doesn't seem to work correctly in this scenario\n } else {\n $key = expUnserialize(base64_decode(urldecode($this->params['apikey'])));\n $cfg = new expConfig($key);\n $this->config = $cfg->config;\n if(empty($cfg->id)) {\n $ar = new expAjaxReply(550, 'Permission Denied', 'Incorrect API key or Exponent as a Service module configuration missing', null);\n $ar->send();\n } else {\n if (!empty($this->params['get'])) {\n $this->handleRequest();\n } else {\n $ar = new expAjaxReply(200, 'ok', 'Your API key is working, no data requested', null);\n $ar->send();\n }\n }\n }\n }",
" private function handleRequest() {\n if (!array_key_exists($this->params['get'], $this->tabs)) {\n $ar = new expAjaxReply(400, 'Bad Request', 'No service available for your request', null);\n $ar->send();\n }\n if ($this->params['get'] != 'aboutus' && empty($this->config[$this->params['get'].'_aggregate'])) {\n $ar = new expAjaxReply(400, 'Bad Request', 'No modules assigned to requested service', null);\n $ar->send();\n }\n switch ($this->params['get']) {\n case 'aboutus':\n $ar = new expAjaxReply(200, 'ok', $this->aboutUs(), null);\n $ar->send();\n break;\n case 'news':\n $ar = new expAjaxReply(200, 'ok', $this->news(), null);\n $ar->send();\n break;\n case 'photo':\n case 'photos':\n $ar = new expAjaxReply(200, 'ok', $this->photo(), null);\n $ar->send();\n break;\n case 'media':\n $ar = new expAjaxReply(200, 'ok', $this->media(), null);\n $ar->send();\n break;\n case 'filedownload':\n case 'filedownloads':\n $ar = new expAjaxReply(200, 'ok', $this->filedownload(), null);\n $ar->send();\n break;\n case 'blog':\n case 'blogs':\n $ar = new expAjaxReply(200, 'ok', $this->blog(), null);\n $ar->send();\n break;\n case 'event':\n case 'events':\n $ar = new expAjaxReply(200, 'ok', $this->event(), null);\n $ar->send();\n break;\n default: // probably shouldn't evet get to this point\n $ar = new expAjaxReply(400, 'Bad Request', 'No service available for your request', null);\n $ar->send();\n break;\n }\n }",
" /**\n * Return the About Us data along with a quick item count by module\n * @return array\n */\n private function aboutUs() {\n $counts = array();\n foreach ($this->tabs as $key=>$name) {\n if ($key != 'aboutus') {\n $data = $this->$key();\n $counts[$key] = count($data['records']);\n }\n }\n $this->data = array(); // initialize\n $this->data = $counts;\n $this->data['records'] = array();\n $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function news() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $news = new news($this->params['id']);\n $this->data['records'] = $news;\n } else {\n $news = new news();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'publish DESC';\n $items = $news->find('all', $this->aggregateWhereClause('news'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
"// private function youtube() { //FIXME must replace with media player and then removed\n// $this->data = array(); // initialize\n// if (!empty($this->params['id'])) {\n// $youtube = new youtube($this->params['id']);\n// $this->data['records'] = $youtube;\n// } else {\n// $youtube = new youtube();\n//\n// // figure out if should limit the results\n// if (isset($this->params['limit'])) {\n// $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n// } else {\n// $limit = '';\n// }\n//\n// $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';\n//\n// $items = $youtube->find('all', $this->aggregateWhereClause('youtube'), $order, $limit);\n// $this->data['records'] = $items;\n// }\n//\n// $this->getImageBody($this->params['get']);\n// return $this->data;\n// }",
" private function media() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $media = new media($this->params['id']);\n $this->data['records'] = $media;\n } else {\n $media = new media();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n }",
" $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';",
" $items = $media->find('all', $this->aggregateWhereClause('media'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function filedownload() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $filedownload = new filedownload($this->params['id']);\n $this->data['records'] = $filedownload;\n } else {\n $filedownload = new filedownload();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } ",
" $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';",
" $items = $filedownload->find('all', $this->aggregateWhereClause('filedownload'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function photo() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $photo = new photo($this->params['id']);\n $this->data['records'] = $photo;\n } else {\n $photo = new photo();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'rank';\n $items = $photo->find('all', $this->aggregateWhereClause('photo'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function blog() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $blog = new blog($this->params['id']);\n $this->data['records'] = $blog;\n } else {\n $blog = new blog();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'publish DESC';\n $items = $blog->find('all', $this->aggregateWhereClause('blog'), $order, $limit);\n $this->data['records'] = $items;\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" private function event() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $event = new event($this->params['id']);\n $this->data['records'] = $event;\n } else {\n $event = new event();",
" // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n// $order = isset($this->params['order']) ? $this->params['order'] : 'created_at'; //FIXME we shoud be getting upcoming events\n// $items = $event->find('all', $this->aggregateWhereClause('event'), $order, $limit); //FIXME needs 'upcoming' type of find\n $items = $event->find('upcoming', $this->aggregateWhereClause('event'), false, $limit); //new 'upcoming' type of find\n $this->data['records'] = $items;\n }",
" if (!empty($this->params['groupbydate'])&&!empty($items)) { // aggregate by day like with regular calendar\n $this->data['records'] = array();\n foreach ($items as $value) {\n $this->data['records'][date('r',$value->eventdate[0]->date)][] = $value;\n // edebug($value);\n }\n }",
" $this->getImageBody($this->params['get']);\n return $this->data;\n }",
" function configure() {\n expHistory::set('editable', $this->params);\n parent::configure();\n $order = isset($this->params['order']) ? $this->params['order'] : 'section';\n $dir = isset($this->params['dir']) ? $this->params['dir'] : '';\n \n $views = expTemplate::get_config_templates($this, $this->loc);\n $pullable = array();\n $page = array();",
" foreach ($this->tabs as $tab => $name) {\n // news tab\n if ($tab!='aboutus') {\n $pullable[$tab] = expModules::listInstalledControllers($tab);\n $page[$tab] = new expPaginator(array(\n 'controller'=>$tab.'Controller',\n 'action' => $this->params['action'],\n 'records'=>$pullable[$tab],\n 'limit'=>count($pullable[$tab]),\n 'order'=>$order,\n 'dir'=>$dir,\n 'columns'=>array(gt('Title')=>'title',gt('Page')=>'section'),\n ));\n }",
" $this->configImage($tab); // fix attached files for proper display of file manager control\n }\n // edebug($this->config['expFile']);",
" assign_to_template(array(\n 'config'=>$this->config, // though already assigned in controllertemplate, we need to update expFiles\n 'pullable'=>$pullable,\n 'page'=>$page,\n// 'views'=>$views\n ));\n }",
" private function configImage($tab) {\n if (count(@$this->config['expFile'][$tab.'_image'])>1) {\n $ftmp[] = new expFile($this->config['expFile'][$tab.'_image'][0]);\n $this->config['expFile'][$tab.'_image'] = $ftmp;\n } else {\n $this->config['expFile'][$tab.'_image'] = array();\n }\n }",
" private function getImageBody($tab) {\n // create an empty 'banner' object to prevent errors in caller\n $this->data['banner']['obj'] = null;\n $this->data['banner']['obj']->url = null;\n $this->data['banner']['md5'] = null;",
" if (count(@$this->config['expFile'][$tab.'_image'])>1) {\n $img = new expFile($this->config['expFile'][$tab.'_image'][0]);\n if ($img) {\n $this->data['banner']['obj'] = $img;\n $this->data['banner']['md5'] = md5_file($img->path);\n }\n }\n $this->data['html'] = $this->config[$tab.'_body'];\n }",
" /**\n * Only return selected modules\n *\n * @param string $type\n * @return string\n */\n function aggregateWhereClause($type='') {\n $sql = '(0'; // simply to offset the 'OR' added in loop\n if (!empty($this->config[$type.'_aggregate'])) {\n foreach ($this->config[$type.'_aggregate'] as $src) {\n $loc = expCore::makeLocation($type, $src);\n $sql .= \" OR location_data ='\".serialize($loc).\"'\";\n }\n \n }\n $sql .= ')';\n $model = $this->basemodel_name;\n if ($this->$model->needs_approval && ENABLE_WORKFLOW) {\n $sql .= ' AND approved=1';\n }",
" return $sql;\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class ealertController extends expController {\n public $basemodel_name = 'expeAlerts';",
"",
"\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"\t",
" static function displayname() { return gt(\"E-Alerts\"); }\n static function description() { return gt(\"This module will allow users to sign up for email alerts on a module by module basis.\"); }",
" ",
" static function hasSources() {\n return false;\n }",
" public function showall() {\n $ealerts = new expeAlerts();\n $subscriptions = array();\n assign_to_template(array(\n 'ealerts'=>$ealerts->find('all'),\n 'subscriptions'=>$subscriptions\n ));\n }",
" ",
" public function send_confirm() {\n global $db;",
" // find this E-Alert in the database",
" $src = empty($this->params['src']) ? null : $this->params['src'];",
" $ealert = $db->selectObject('expeAlerts', 'module=\"'.$this->params['orig_controller'].'\" AND src=\"'.$src.'\"');\n if (!empty($ealert->autosend_ealerts)) {\n redirect_to(array('controller'=>'ealert','action'=>'send_auto','model'=>$this->params['model'],'id'=>$this->params['id'], 'src'=>$this->params['src']));\n }",
" // find the content for the E-Alerts\n $model = $this->params['model'];\n $record = new $model($this->params['id']);\n // setup the content for the view\n $subject = $record->title;\n $body = $record->body;",
" ",
" // figure out how many subscribers there are\n $number_of_subscribers = $db->countObjects('user_subscriptions', 'expeAlerts_id='.$ealert->id);",
" ",
" assign_to_template(array(\n 'record'=>$record,\n 'number_of_subscribers'=>$number_of_subscribers,\n 'ealert'=>$ealert\n ));\n }",
" ",
" public function send_process() {\n global $db, $router;",
" $obj = new stdClass();\n $obj->subject = $this->params['subject'];\n $obj->body = $this->params['body'];\n $link = $router->makelink(array('controller'=>$this->params['model'], 'action'=>'show', 'title'=>$this->params['sef_url']));\n $obj->body .= '<hr><a href=\"'.$link.'\">'.gt('View posting').'.</a>';\n $obj->created_at = time();\n $id = $db->insertObject($obj, 'expeAlerts_temp');",
" ",
" $bot = new expBot(array(\n 'url'=>PATH_RELATIVE.\"index.php?controller=ealert&action=send&id=\".$id.'&ealert_id='.$this->params['id'],\n 'method'=>'POST',\n ));",
" ",
" $bot->fire();\n flash('message', gt(\"E-Alerts are being sent to subscribers.\"));\n expHistory::back();\n }",
" ",
" public function send_auto() {\n global $db, $router;",
" // find this E-Alert in the database",
" $src = empty($this->params['src']) ? null : $this->params['src'];",
" $ealert = $db->selectObject('expeAlerts', 'module=\"'.$this->params['model'].'\" AND src=\"'.$src.'\"');",
" // find the content for the E-Alerts\n $model = $this->params['model'];\n $record = new $model($this->params['id']);\n $obj = new stdClass();\n $obj->subject = gt('Notification of New Content Posted to').' '.$ealert->ealert_title;\n $obj->body .= \"<h3>\".gt('New content was added titled').\" '\".$record->title.\"'</h3><hr>\";\n if ($ealert->ealert_usebody == 0) {\n $obj->body .= $record->body;\n } elseif ($ealert->ealert_usebody == 1) {\n $obj->body .= expString::summarize($record->body,'html','paralinks');\n }\n $link = $router->makelink(array('controller'=>$this->params['model'], 'action'=>'show', 'title'=>$record->sef_url));\n $obj->body .= '<hr><a href=\"'.$link.'\">'.gt('View posting').'.</a>';\n $obj->created_at = time();\n $id = $db->insertObject($obj, 'expeAlerts_temp');",
" $bot = new expBot(array(\n 'url'=>PATH_RELATIVE.\"index.php?controller=ealert&action=send&id=\".$id.'&ealert_id='.$ealert->id,\n 'method'=>'POST',\n ));",
" $bot->fire();\n flash('message', gt(\"E-Alerts are being sent to subscribers.\"));\n expHistory::back();\n }",
" public function send() {\n global $db, $router;",
" ",
" // get the message body we saved in the temp table\n $message = $db->selectObject('expeAlerts_temp', 'id='.$this->params['id']);",
" ",
" // look up the subscribers\n $sql = 'SELECT s.* FROM '.$db->prefix.'user_subscriptions es ';\n $sql .= 'LEFT JOIN '.$db->prefix.'user s ON s.id=es.user_id WHERE es.expeAlerts_id='.$this->params['ealert_id'];\n $subscribers = $db->selectObjectsBySql($sql);",
" ",
" $count = 1;\n $total = count($subscribers);\n foreach($subscribers as $subscriber) {\n// $link = $router->makelink(array('controller'=>'ealert', 'action'=>'subscriptions', 'id'=>$subscriber->id, 'key'=>$subscriber->hash));\n// $body = $message->body;\n// $body .= '<br><a href=\"'.$link.'\">'.gt('Click here to change your E-Alert subscription settings').'.</a>';",
" ",
" $mail = new expMail();\n $mail->quickSend(array(\n 'html_message'=>$message->body,\n\t\t 'to'=>array(trim($subscriber->email) => trim(user::getUserAttribution($subscriber->id))),\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t 'subject'=>$message->subject,\n ));",
" ",
" $message->edited_at = time();\n $message->status = 'Sent message '.$count.' of '.$total;\n $db->updateObject($message, 'expeAlerts_temp');\n $count++;",
" } \n ",
" $db->delete('expeAlerts_temp', 'id='.$message->id);\n }",
" public function subscribe() {\n global $user,$db;",
" // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The id was not supplied.'));\n if (empty($user->id)) expQueue::flashAndFlow('error', gt('You must be logged on to subscribe.'));\n if (!$db->selectObject('user_subscriptions','user_id='.$user->id.' AND expeAlerts_id='.$this->params['id'])) {\n $subscription = new stdClass();\n $subscription->user_id = $user->id;\n $subscription->expeAlerts_id = $this->params['id'];\n $db->insertObject($subscription,'user_subscriptions');\n $ealert = $db->selectObject('expeAlerts','id='.$this->params['id']);\n flash('message', gt(\"You are now subscribed to receive email alerts for updates to\".\" \".$ealert->ealert_title));\n }\n expHistory::back();\n }",
" public function unsubscribe() {\n global $user,$db;",
" // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The id was not supplied.'));\n if (empty($user->id)) expQueue::flashAndFlow('error', gt('You must be logged on to un-subscribe.'));\n $db->delete('user_subscriptions','user_id='.$user->id.' AND expeAlerts_id='.$this->params['id']);\n $ealert = $db->selectObject('expeAlerts','id='.$this->params['id']);\n flash('message', gt(\"You are now un-subscribed from email alerts to\".\" \".$ealert->ealert_title));\n expHistory::back();\n }",
" /**\n * @deprecated\n */",
" public function subscriptions() {\n global $db;\n \n expHistory::set('manageable', $this->params);\n // make sure we have what we need.\n if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n \n // verify the id/key pair \n $sub = new subscribers($this->params['id']);\n if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n \n // get this users subscriptions\n $subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id);\n \n // get a list of all available E-Alerts\n $ealerts = new expeAlerts();\n assign_to_template(array(\n 'subscriber'=>$sub,\n 'subscriptions'=>$subscriptions,\n 'ealerts'=>$ealerts->find('all')\n ));\n }\n \n /**\n * @deprecated\n */\n public function subscription_update() {\n global $db;\n \n // make sure we have what we need.\n if (empty($this->params['email'])) expQueue::flashAndFlow('error', gt('You must supply an email address to sign up for email alerts.'));\n if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n \n // find the subscriber and validate the security key\n $subscriber = new subscribers($this->params['id']);\n if ($subscriber->hash != $this->params['key']) expQueue::flashAndFlow('error', gt('The security key you supplied does not match the one we have on file.'));\n \n // delete any old subscriptions and add the user to new subscriptions\n $db->delete('expeAlerts_subscribers', 'subscribers_id='.$subscriber->id);\n foreach($this->params['ealerts'] as $ea_id) {\n $obj = new stdClass();\n $obj->subscribers_id = $subscriber->id;\n $obj->expeAlerts_id = $ea_id;\n $db->insertObject($obj, 'expeAlerts_subscribers');\n }\n \n $count = count($this->params['ealerts']);\n \n if ($count > 0) {\n flash('message', gt(\"Your subscriptions have been updated. You are now subscriber to\").\" \".$count.' '.gt('E-Alerts.'));\n } else {\n flash('error', gt(\"You have been unsubscribed from all E-Alerts.\"));\n }\n \n expHistory::back();\n }\n \n /**\n * @deprecated\n */\n public function signup() {\n global $db;\n // check the anti-spam control\n expValidator::check_antispam($this->params, gt(\"Anti-spam verification failed. Please try again.\"));\n \n // make sure we have what we need.\n if (empty($this->params['email'])) expQueue::flashAndFlow('error', gt('You must supply an email address to sign up for email alerts.'));\n if (empty($this->params['ealerts'])) expQueue::flashAndFlow('error', gt('You did not select any E-Alert topics to subscribe to.'));\n \n // find or create the subscriber\n $id = $db->selectValue('subscribers', 'id', 'email=\"'.$this->params['email'].'\"');\n $subscriber = new subscribers($id);\n if (empty($subscriber->id)) {\n $subscriber->email = trim($this->params['email']);\n $subscriber->hash = md5($subscriber->email.time());\n $subscriber->save();\n }\n \n // delete any old subscriptions and add the user to new subscriptions\n $db->delete('expeAlerts_subscribers', 'subscribers_id='.$subscriber->id);\n foreach($this->params['ealerts'] as $ea_id) {\n $obj = new stdClass();\n $obj->subscribers_id = $subscriber->id;\n $obj->expeAlerts_id = $ea_id;\n $db->insertObject($obj, 'expeAlerts_subscribers');\n }\n \n // send a confirmation email to the user. \n $ealerts = $db->selectObjects('expeAlerts', 'id IN ('.implode(',', $this->params['ealerts']).')');\n $body = expTemplate::get_template_for_action($this, 'email/confirmation_email', $this->loc);\n $body->assign('ealerts', $ealerts);\n $body->assign('subscriber', $subscriber);\n \n $mail = new expMail();\n $mail->quickSend(array(\n 'html_message'=>$body->render(),\n\t\t 'to'=>$subscriber->email,\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t 'subject'=>gt('Please confirm your E-Alert subscriptions'),\n ));\n \n redirect_to(array('controller'=>'ealert', 'action'=>'pending', 'id'=>$subscriber->id));\n }\n \n /**\n * @deprecated\n */\n public function pending() {",
"// global $db;",
" \n // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));",
" // find the subscriber and their pending subscriptions\n $ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);\n $subscriber = new subscribers($this->params['id']);\n \n // render the template\n assign_to_template(array(\n 'subscriber'=>$subscriber,\n 'ealerts'=>$ealerts\n ));\n }\n \n public function confirm() {\n global $db;\n \n // make sure we have what we need.\n if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n \n // verify the id/key pair \n $id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash=\"'.$this->params['key'].'\"');\n if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n \n // activate this users pending subscriptions\n $sub = new stdClass();\n $sub->enabled = 1;\n $db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id);\n \n // find the users active subscriptions\n $ealerts = expeAlerts::getBySubscriber($id);\n assign_to_template(array(\n 'ealerts'=>$ealerts\n ));\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
0,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class ealertController extends expController {\n public $basemodel_name = 'expeAlerts';",
" protected $manage_permissions = array(\n 'send'=>'Send E-Alert',\n );",
"\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"",
" static function displayname() { return gt(\"E-Alerts\"); }\n static function description() { return gt(\"This module will allow users to sign up for email alerts on a module by module basis.\"); }",
"",
" static function hasSources() {\n return false;\n }",
" public function showall() {\n $ealerts = new expeAlerts();\n $subscriptions = array();\n assign_to_template(array(\n 'ealerts'=>$ealerts->find('all'),\n 'subscriptions'=>$subscriptions\n ));\n }",
"",
" public function send_confirm() {\n global $db;",
" // find this E-Alert in the database",
" $src = empty($this->params['src']) ? null : expString::escape($this->params['src']);",
" $ealert = $db->selectObject('expeAlerts', 'module=\"'.$this->params['orig_controller'].'\" AND src=\"'.$src.'\"');\n if (!empty($ealert->autosend_ealerts)) {\n redirect_to(array('controller'=>'ealert','action'=>'send_auto','model'=>$this->params['model'],'id'=>$this->params['id'], 'src'=>$this->params['src']));\n }",
" // find the content for the E-Alerts\n $model = $this->params['model'];\n $record = new $model($this->params['id']);\n // setup the content for the view\n $subject = $record->title;\n $body = $record->body;",
"",
" // figure out how many subscribers there are\n $number_of_subscribers = $db->countObjects('user_subscriptions', 'expeAlerts_id='.$ealert->id);",
"",
" assign_to_template(array(\n 'record'=>$record,\n 'number_of_subscribers'=>$number_of_subscribers,\n 'ealert'=>$ealert\n ));\n }",
"",
" public function send_process() {\n global $db, $router;",
" $obj = new stdClass();\n $obj->subject = $this->params['subject'];\n $obj->body = $this->params['body'];\n $link = $router->makelink(array('controller'=>$this->params['model'], 'action'=>'show', 'title'=>$this->params['sef_url']));\n $obj->body .= '<hr><a href=\"'.$link.'\">'.gt('View posting').'.</a>';\n $obj->created_at = time();\n $id = $db->insertObject($obj, 'expeAlerts_temp');",
"",
" $bot = new expBot(array(\n 'url'=>PATH_RELATIVE.\"index.php?controller=ealert&action=send&id=\".$id.'&ealert_id='.$this->params['id'],\n 'method'=>'POST',\n ));",
"",
" $bot->fire();\n flash('message', gt(\"E-Alerts are being sent to subscribers.\"));\n expHistory::back();\n }",
"",
" public function send_auto() {\n global $db, $router;",
" // find this E-Alert in the database",
" $src = empty($this->params['src']) ? null : expString::escape($this->params['src']);",
" $ealert = $db->selectObject('expeAlerts', 'module=\"'.$this->params['model'].'\" AND src=\"'.$src.'\"');",
" // find the content for the E-Alerts\n $model = $this->params['model'];\n $record = new $model($this->params['id']);\n $obj = new stdClass();\n $obj->subject = gt('Notification of New Content Posted to').' '.$ealert->ealert_title;\n $obj->body .= \"<h3>\".gt('New content was added titled').\" '\".$record->title.\"'</h3><hr>\";\n if ($ealert->ealert_usebody == 0) {\n $obj->body .= $record->body;\n } elseif ($ealert->ealert_usebody == 1) {\n $obj->body .= expString::summarize($record->body,'html','paralinks');\n }\n $link = $router->makelink(array('controller'=>$this->params['model'], 'action'=>'show', 'title'=>$record->sef_url));\n $obj->body .= '<hr><a href=\"'.$link.'\">'.gt('View posting').'.</a>';\n $obj->created_at = time();\n $id = $db->insertObject($obj, 'expeAlerts_temp');",
" $bot = new expBot(array(\n 'url'=>PATH_RELATIVE.\"index.php?controller=ealert&action=send&id=\".$id.'&ealert_id='.$ealert->id,\n 'method'=>'POST',\n ));",
" $bot->fire();\n flash('message', gt(\"E-Alerts are being sent to subscribers.\"));\n expHistory::back();\n }",
" public function send() {\n global $db, $router;",
"",
" // get the message body we saved in the temp table\n $message = $db->selectObject('expeAlerts_temp', 'id='.$this->params['id']);",
"",
" // look up the subscribers\n $sql = 'SELECT s.* FROM '.$db->prefix.'user_subscriptions es ';\n $sql .= 'LEFT JOIN '.$db->prefix.'user s ON s.id=es.user_id WHERE es.expeAlerts_id='.$this->params['ealert_id'];\n $subscribers = $db->selectObjectsBySql($sql);",
"",
" $count = 1;\n $total = count($subscribers);\n foreach($subscribers as $subscriber) {\n// $link = $router->makelink(array('controller'=>'ealert', 'action'=>'subscriptions', 'id'=>$subscriber->id, 'key'=>$subscriber->hash));\n// $body = $message->body;\n// $body .= '<br><a href=\"'.$link.'\">'.gt('Click here to change your E-Alert subscription settings').'.</a>';",
"",
" $mail = new expMail();\n $mail->quickSend(array(\n 'html_message'=>$message->body,\n\t\t 'to'=>array(trim($subscriber->email) => trim(user::getUserAttribution($subscriber->id))),\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t 'subject'=>$message->subject,\n ));",
"",
" $message->edited_at = time();\n $message->status = 'Sent message '.$count.' of '.$total;\n $db->updateObject($message, 'expeAlerts_temp');\n $count++;",
" }\n",
" $db->delete('expeAlerts_temp', 'id='.$message->id);\n }",
" public function subscribe() {\n global $user,$db;",
" // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The id was not supplied.'));\n if (empty($user->id)) expQueue::flashAndFlow('error', gt('You must be logged on to subscribe.'));\n if (!$db->selectObject('user_subscriptions','user_id='.$user->id.' AND expeAlerts_id='.$this->params['id'])) {\n $subscription = new stdClass();\n $subscription->user_id = $user->id;\n $subscription->expeAlerts_id = $this->params['id'];\n $db->insertObject($subscription,'user_subscriptions');\n $ealert = $db->selectObject('expeAlerts','id='.$this->params['id']);\n flash('message', gt(\"You are now subscribed to receive email alerts for updates to\".\" \".$ealert->ealert_title));\n }\n expHistory::back();\n }",
" public function unsubscribe() {\n global $user,$db;",
" // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The id was not supplied.'));\n if (empty($user->id)) expQueue::flashAndFlow('error', gt('You must be logged on to un-subscribe.'));\n $db->delete('user_subscriptions','user_id='.$user->id.' AND expeAlerts_id='.$this->params['id']);\n $ealert = $db->selectObject('expeAlerts','id='.$this->params['id']);\n flash('message', gt(\"You are now un-subscribed from email alerts to\".\" \".$ealert->ealert_title));\n expHistory::back();\n }",
" /**\n * @deprecated\n */",
"// public function subscriptions() {",
"// global $db;",
"//\n// expHistory::set('manageable', $this->params);\n// // make sure we have what we need.\n// if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n// if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n//\n// // verify the id/key pair\n// $sub = new subscribers($this->params['id']);\n// if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n//\n// // get this users subscriptions\n// $subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id);\n//\n// // get a list of all available E-Alerts\n// $ealerts = new expeAlerts();\n// assign_to_template(array(\n// 'subscriber'=>$sub,\n// 'subscriptions'=>$subscriptions,\n// 'ealerts'=>$ealerts->find('all')\n// ));\n// }",
" /**\n * @deprecated\n */\n// public function subscription_update() {\n// global $db;\n//\n// // make sure we have what we need.\n// if (empty($this->params['email'])) expQueue::flashAndFlow('error', gt('You must supply an email address to sign up for email alerts.'));\n// if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n// if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n//\n// // find the subscriber and validate the security key\n// $subscriber = new subscribers($this->params['id']);\n// if ($subscriber->hash != $this->params['key']) expQueue::flashAndFlow('error', gt('The security key you supplied does not match the one we have on file.'));\n//\n// // delete any old subscriptions and add the user to new subscriptions\n// $db->delete('expeAlerts_subscribers', 'subscribers_id='.$subscriber->id);\n// foreach($this->params['ealerts'] as $ea_id) {\n// $obj = new stdClass();\n// $obj->subscribers_id = $subscriber->id;\n// $obj->expeAlerts_id = $ea_id;\n// $db->insertObject($obj, 'expeAlerts_subscribers');\n// }\n//\n// $count = count($this->params['ealerts']);\n//\n// if ($count > 0) {\n// flash('message', gt(\"Your subscriptions have been updated. You are now subscriber to\").\" \".$count.' '.gt('E-Alerts.'));\n// } else {\n// flash('error', gt(\"You have been unsubscribed from all E-Alerts.\"));\n// }\n//\n// expHistory::back();\n// }",
" /**\n * @deprecated\n */\n// public function signup() {\n// global $db;\n// // check the anti-spam control\n// expValidator::check_antispam($this->params, gt(\"Anti-spam verification failed. Please try again.\"));\n//\n// // make sure we have what we need.\n// if (empty($this->params['email'])) expQueue::flashAndFlow('error', gt('You must supply an email address to sign up for email alerts.'));\n// if (empty($this->params['ealerts'])) expQueue::flashAndFlow('error', gt('You did not select any E-Alert topics to subscribe to.'));\n//\n// // find or create the subscriber\n// $id = $db->selectValue('subscribers', 'id', 'email=\"'.$this->params['email'].'\"');\n// $subscriber = new subscribers($id);\n// if (empty($subscriber->id)) {\n// $subscriber->email = trim($this->params['email']);\n// $subscriber->hash = md5($subscriber->email.time());\n// $subscriber->save();\n// }\n//\n// // delete any old subscriptions and add the user to new subscriptions\n// $db->delete('expeAlerts_subscribers', 'subscribers_id='.$subscriber->id);\n// foreach($this->params['ealerts'] as $ea_id) {\n// $obj = new stdClass();\n// $obj->subscribers_id = $subscriber->id;\n// $obj->expeAlerts_id = $ea_id;\n// $db->insertObject($obj, 'expeAlerts_subscribers');\n// }\n//\n// // send a confirmation email to the user.\n// $ealerts = $db->selectObjects('expeAlerts', 'id IN ('.implode(',', $this->params['ealerts']).')');\n// $body = expTemplate::get_template_for_action($this, 'email/confirmation_email', $this->loc);\n// $body->assign('ealerts', $ealerts);\n// $body->assign('subscriber', $subscriber);\n//\n// $mail = new expMail();\n// $mail->quickSend(array(\n// 'html_message'=>$body->render(),\n//\t\t 'to'=>$subscriber->email,\n// 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n//\t\t 'subject'=>gt('Please confirm your E-Alert subscriptions'),\n// ));\n//\n// redirect_to(array('controller'=>'ealert', 'action'=>'pending', 'id'=>$subscriber->id));\n// }",
" /**\n * @deprecated\n */\n// public function pending() {\n//// global $db;\n//\n// // make sure we have what we need.\n// if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));\n//\n// // find the subscriber and their pending subscriptions\n// $ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);\n// $subscriber = new subscribers($this->params['id']);\n//\n// // render the template\n// assign_to_template(array(\n// 'subscriber'=>$subscriber,\n// 'ealerts'=>$ealerts\n// ));\n// }",
" /**\n * @deprecated\n */\n// public function confirm() {\n// global $db;\n//\n// // make sure we have what we need.\n// if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n// if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n//\n// // verify the id/key pair\n// $id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash=\"'.$this->params['key'].'\"');\n// if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n//\n// // activate this users pending subscriptions\n// $sub = new stdClass();\n// $sub->enabled = 1;\n// $db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id);\n//\n// // find the users active subscriptions\n// $ealerts = expeAlerts::getBySubscriber($id);\n// assign_to_template(array(\n// 'ealerts'=>$ealerts\n// ));\n// }\n",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class billingController extends expController {",
" protected $add_permissions = array(\n 'activate'=>'Activate Payment Options'",
" );",
" ",
" static function displayname() { return gt(\"e-Commerce Billing Controller\"); }\n static function description() { return \"\"; }\n\tstatic function hasSources() { return false; }",
"\t",
"\tfunction selectBillingCalculator() {\n\t\t$billing = new billing();\n\t\t$billing->billingmethod->update($this->params);\n\t\t$ar = new expAjaxReply(200, 'ok', $billing, array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
"\tfunction setAddress() {\n\t\t$billing = new billing();\n\t\t$billing->billingmethod->setAddress($this->params['billing_address']);\n\t\t$ar = new expAjaxReply(200, 'ok', new address($billing->billingmethod->addresses_id), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
"\tfunction selectBillingOptions() {",
"\t\t",
"\t}",
"\t",
"\tfunction manage() {\n\t global $db;",
"\t ",
"\t expHistory::set('manageable', $this->params);\n//\t $classes = array();\n $dir = BASE.\"framework/modules/ecommerce/billingcalculators\";\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_file(\"$dir/$file\") && substr(\"$dir/$file\", -4) == \".php\") {\n include_once(\"$dir/$file\");\n $classname = substr($file, 0, -4);\n $id = $db->selectValue('billingcalculator', 'id', 'calculator_name=\"'.$classname.'\"');\n if (empty($id)) {\n// $calobj = null;\n $calcobj = new $classname();\n if ($calcobj->isSelectable() == true) {\n $obj = new billingcalculator(array(\n 'title'=>$calcobj->name(),\n// 'user_title'=>$calcobj->title,",
" 'body'=>$calcobj->description(), ",
" 'calculator_name'=>$classname,\n 'enabled'=>false));\n $obj->save();\n }\n }\n }\n }\n }",
" ",
" $bcalc = new billingcalculator();\n $calculators = $bcalc->find('all');\n assign_to_template(array(\n 'calculators'=>$calculators\n ));\n\t}",
"\t\n\tpublic function activate(){\t",
"\t if (isset($this->params['id'])) {\n\t $calc = new billingcalculator($this->params['id']);\n\t $calc->update($this->params);\n //FIXME we need to ensure our default calculator is still active\n\t if ($calc->calculator->hasConfig() && empty($calc->config)) {\n\t flash('message', $calc->calculator->name().' '.gt('requires configuration. Please do so now.'));\n\t redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$calc->id));\n\t }\n\t }\n\t expHistory::back();\n\t}",
" public function toggle_default() {\n \t global $db;",
" $db->toggle('billingcalculator',\"is_default\",'is_default=1');\n \t if (isset($this->params['id'])) {\n $active = $db->selectObject('billingcalculator',\"id=\".$this->params['id']);\n $active->is_default = 1;\n $db->updateObject($active,'billingcalculator',null,'id');\n }\n if ($db->selectValue('billingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('billingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('billingcalculator', 'enabled', 'id='.$this->params['id']);\n }\n \t expHistory::back();\n \t}",
" public function configure() {\n if (empty($this->params['id'])) return false;\n $calc = new billingcalculator($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc,\n 'title'=>static::displayname()\n ));\n }",
" ",
" public function saveconfig() {\n $calc = new billingcalculator($this->params['id']);\n $conf = serialize($calc->calculator->parseConfig($this->params));\n $calc->update(array('config'=>$conf));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class billingController extends expController {",
" protected $manage_permissions = array(\n 'select'=>'Select Feature',\n 'toggle'=>'Toggle Feature',",
" );",
"",
" static function displayname() { return gt(\"e-Commerce Billing Controller\"); }\n static function description() { return \"\"; }\n\tstatic function hasSources() { return false; }",
"",
"\tfunction selectBillingCalculator() {\n\t\t$billing = new billing();\n\t\t$billing->billingmethod->update($this->params);\n\t\t$ar = new expAjaxReply(200, 'ok', $billing, array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
"\tfunction setAddress() {\n\t\t$billing = new billing();\n\t\t$billing->billingmethod->setAddress($this->params['billing_address']);\n\t\t$ar = new expAjaxReply(200, 'ok', new address($billing->billingmethod->addresses_id), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
"\tfunction selectBillingOptions() {",
"",
"\t}",
"",
"\tfunction manage() {\n\t global $db;",
"",
"\t expHistory::set('manageable', $this->params);\n//\t $classes = array();\n $dir = BASE.\"framework/modules/ecommerce/billingcalculators\";\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_file(\"$dir/$file\") && substr(\"$dir/$file\", -4) == \".php\") {\n include_once(\"$dir/$file\");\n $classname = substr($file, 0, -4);\n $id = $db->selectValue('billingcalculator', 'id', 'calculator_name=\"'.$classname.'\"');\n if (empty($id)) {\n// $calobj = null;\n $calcobj = new $classname();\n if ($calcobj->isSelectable() == true) {\n $obj = new billingcalculator(array(\n 'title'=>$calcobj->name(),\n// 'user_title'=>$calcobj->title,",
" 'body'=>$calcobj->description(),",
" 'calculator_name'=>$classname,\n 'enabled'=>false));\n $obj->save();\n }\n }\n }\n }\n }",
"",
" $bcalc = new billingcalculator();\n $calculators = $bcalc->find('all');\n assign_to_template(array(\n 'calculators'=>$calculators\n ));\n\t}",
"\n\tpublic function activate(){",
"\t if (isset($this->params['id'])) {\n\t $calc = new billingcalculator($this->params['id']);\n\t $calc->update($this->params);\n //FIXME we need to ensure our default calculator is still active\n\t if ($calc->calculator->hasConfig() && empty($calc->config)) {\n\t flash('message', $calc->calculator->name().' '.gt('requires configuration. Please do so now.'));\n\t redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$calc->id));\n\t }\n\t }\n\t expHistory::back();\n\t}",
" public function toggle_default() {\n \t global $db;",
" $db->toggle('billingcalculator',\"is_default\",'is_default=1');\n \t if (isset($this->params['id'])) {\n $active = $db->selectObject('billingcalculator',\"id=\".$this->params['id']);\n $active->is_default = 1;\n $db->updateObject($active,'billingcalculator',null,'id');\n }\n if ($db->selectValue('billingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('billingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('billingcalculator', 'enabled', 'id='.$this->params['id']);\n }\n \t expHistory::back();\n \t}",
" public function configure() {\n if (empty($this->params['id'])) return false;\n $calc = new billingcalculator($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc,\n 'title'=>static::displayname()\n ));\n }",
"",
" public function saveconfig() {\n $calc = new billingcalculator($this->params['id']);\n $conf = serialize($calc->calculator->parseConfig($this->params));\n $calc->update(array('config'=>$conf));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */",
"class ecomconfigController extends expController {\n protected $add_permissions = array(\n 'show'=>'View Admin Options'\n );",
"\t",
" static function displayname() { return gt(\"e-Commerce Configuration Manager\"); }\n static function description() { return gt(\"Use this module to configure your e-Commerce store\"); }\n static function hasSources() { return false; }",
" function show() {\n expHistory::set('manageable', $this->params);\n }",
" ",
" /*****************************************************************/\n /*************** PRODUCT OPTIONS *******************************/\n /*****************************************************************/\n function edit_optiongroup_master() {\n expHistory::set('editable', $this->params);",
" ",
" $id = isset($this->params['id']) ? $this->params['id'] : null;",
" $record = new optiongroup_master($id); ",
" assign_to_template(array(\n 'record'=>$record\n ));\n }",
" ",
" function update_optiongroup_master() {\n global $db;",
" $id = empty($this->params['id']) ? null : $this->params['id'];\n $og = new optiongroup_master($id);\n $oldtitle = $og->title;\n $og->update($this->params);",
" ",
" // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $og->title) {\n $db->sql('UPDATE '.$db->prefix.'optiongroup SET title=\"'.$og->title.'\" WHERE title=\"'.$oldtitle.'\"');\n }",
" \n expHistory::back();\n }\n ",
" function delete_optiongroup_master() {\n global $db;",
" ",
" $mastergroup = new optiongroup_master($this->params);",
" ",
" // delete all the options for this optiongroup master\n foreach ($mastergroup->option_master as $masteroption) {\n $db->delete('option', 'option_master_id='.$masteroption->id);\n $masteroption->delete();\n }",
" ",
" // delete the mastergroup\n $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id);\n $mastergroup->delete();",
" \n expHistory::back();\n }\n ",
" function delete_option_master() {\n global $db;",
" $masteroption = new option_master($this->params['id']);",
" ",
" // delete any implementations of this option master\n $db->delete('option', 'option_master_id='.$masteroption->id);\n $masteroption->delete('optiongroup_master_id=' . $masteroption->optiongroup_master_id);\n //eDebug($masteroption);\n expHistory::back();\n }",
" ",
" function edit_option_master() {\n expHistory::set('editable', $this->params);",
" ",
" $params = isset($this->params['id']) ? $this->params['id'] : $this->params;",
" $record = new option_master($params); ",
" assign_to_template(array(\n 'record'=>$record\n ));\n }",
" \n function update_option_master() { ",
" global $db;",
" $id = empty($this->params['id']) ? null : $this->params['id'];\n $opt = new option_master($id);\n $oldtitle = $opt->title;",
" ",
" $opt->update($this->params);",
" ",
" // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $opt->title) {",
" ",
" }$db->sql('UPDATE '.$db->prefix.'option SET title=\"'.$opt->title.'\" WHERE option_master_id='.$opt->id);",
" \n expHistory::back();\n }\n ",
" public function options() {\n expHistory::set('viewable', $this->params);\n $optiongroup = new optiongroup_master();\n $optiongroups = $optiongroup->find('all');\n assign_to_template(array(\n 'optiongroups'=>$optiongroups\n ));\n }",
" ",
" function rerank_optionmaster() {\n $om = new option_master($this->params['id']);\n $om->rerank($this->params['push'], 'optiongroup_master_id=' . $this->params['master_id']);\n expHistory::back();\n }",
" ",
" /*****************************************************************/\n /*************** DISCOUNTS *******************************/\n /*****************************************************************/\n public function manage_discounts() {\n expHistory::set('manageable', $this->params);",
"\t\t",
" $page = new expPaginator(array(\n 'model'=>'discounts',\n\t\t\t'sql'=>'SELECT * FROM '.DB_TABLE_PREFIX.'_discounts',\n\t\t\t'limit'=> 10,\n\t\t\t'order'=>isset($this->params['order']) ? $this->params['order'] : null,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n\t\t\t'columns'=>array(gt('Enabled')=>'enabled',gt('Name')=>'title',gt('Type')=>'action_type',gt('Coupon Code')=>'coupon_code',gt('Valid Until')=>'enddate'),\n ));",
" assign_to_template(array(\n /*'apply_rules'=>$discountObj->apply_rules, 'discount_types'=>$discountObj->discount_types,*/\n 'page'=>$page\n ));\n }",
" ",
" public function edit_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);",
" ",
" //grab all user groups\n $group = new group();",
" ",
" //create two 'default' groups:",
" $groups = array( ",
" -1 => 'ALL LOGGED IN USERS',\n -2 => 'ALL NON-LOGGED IN USERS'\n );\n //loop our groups and append them to the array\n // foreach ($group->find() as $g){\n //this is a workaround for older code. Use the previous line if possible:\n $allGroups = group::getAllGroups();\n if (count($allGroups))\n {\n foreach ($allGroups as $g)\n {\n $groups[$g->id] = $g->name;\n };\n }\n //find our selected groups for this discount already",
" // eDebug($discount); ",
" $selected_groups = array();\n if (!empty($discount->group_ids))\n {\n $selected_groups = expUnserialize($discount->group_ids);\n }",
" ",
" if ($discount->minimum_order_amount == \"\") $discount->minimum_order_amount = 0;\n if ($discount->discount_amount == \"\") $discount->discount_amount = 0;\n if ($discount->discount_percent == \"\") $discount->discount_percent = 0;",
" ",
" // get the shipping options and their methods\n $shipping_services = array();\n $shipping_methods = array();\n// $shipping = new shipping();\n foreach (shipping::listAvailableCalculators() as $calcid=>$name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }",
" ",
" assign_to_template(array(\n 'discount'=>$discount,\n 'groups'=>$groups,\n 'selected_groups'=>$selected_groups,\n 'shipping_services'=>$shipping_services,\n 'shipping_methods'=>$shipping_methods\n ));\n }",
" ",
" public function update_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);\n // find required shipping method if needed\n if ($this->params['required_shipping_calculator_id'] > 0) {\n $this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']];\n } else {\n $this->params['required_shipping_calculator_id'] = 0;\n }",
" ",
" $discount->update($this->params);\n expHistory::back();\n }",
" \n public function activate_discount(){ ",
" if (isset($this->params['id'])) {\n $discount = new discounts($this->params['id']);\n $discount->update($this->params);\n //if ($discount->discountulator->hasConfig() && empty($discount->config)) {\n //flash('messages', $discount->discountulator->name().' requires configuration. Please do so now.');\n //redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$discount->id));\n //}\n }",
" \n expHistory::back();\n }\n ",
" /*****************************************************************/\n /*************** PROMO CODE *******************************/\n /*****************************************************************/\n\tpublic function manage_promocodes() {\n\t\texpHistory::set('manageable', $this->params);\n $pc = new promocodes();\n $do = new discounts();\n $promo_codes = $pc->find('all');\n $discounts = $do->find('all');\n\t\tassign_to_template(array(\n 'promo_codes'=>$promo_codes,\n 'discounts'=>$discounts\n ));\n\t}",
"\tpublic function update_promocode() {\n//\t global $db;\n\t //$id = empty($this->params['id']) ? null : $this->params['id'];\n\t $code = new promocodes();\n\t $code->update($this->params);\n\t expHistory::back();\n\t}",
"\t",
" /*****************************************************************/\n /*************** GROUP DISCOUNTS *******************************/\n /*****************************************************************/\n\tpublic function manage_groupdiscounts() {\n\t\tglobal $db;",
"\t\texpHistory::set('manageable', $this->params);\n\t\t$groups = group::getAllGroups();\n\t\t$discounts = $db->selectObjects('discounts');\n//\t\t$group_discounts = $db->selectObjects('groupdiscounts', null, 'rank');\n $gd = new groupdiscounts();\n $group_discounts = $gd->find('all', null, 'rank');\n if (!empty($group_discounts)) foreach ($group_discounts as $key=>$group_discount) {\n $group_discounts[$key]->title = $group_discount->group->name . ' (' . $group_discount->discounts->title . ')';\n }\n\t\tassign_to_template(array(\n 'groups'=>$groups,\n 'discounts'=>$discounts,\n 'group_discounts'=>$group_discounts\n ));\n\t}",
"\tpublic function update_groupdiscounts() {\n\t global $db;",
"\t ",
"\t if (empty($this->params['id'])) {\n\t // look for existing discounts for the same group\n\t $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']);\n\t if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.'));\n\t }",
" $gd = new groupdiscounts();\n\t $gd->update($this->params);\n\t expHistory::back();\n\t}",
"\t",
"\tfunction rerank_groupdiscount() {\n $gd = new groupdiscounts($this->params['id']);\n $gd->rerank($this->params['push']);\n expHistory::back();\n }",
" ",
" /*****************************************************************/\n /*************** GENERAL STORE CONFIG *******************************/\n /*****************************************************************/\n function configure() {\n expHistory::set('editable', $this->params);\n // little bit of trickery so that that categories can have their own configs",
" ",
" $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n $this->config = $config->config;\n $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $views = expTemplate::get_config_templates($this, $this->loc);",
" \n $gc = new geoCountry(); ",
" $countries = $gc->find('all');",
" \n $gr = new geoRegion(); ",
" $regions = $gr->find('all');",
" ",
" assign_to_template(array(\n 'config'=>$this->config,\n 'pullable_modules'=>$pullable_modules,\n 'views'=>$views,\n 'countries'=>$countries,\n 'regions'=>$regions,\n 'title'=>static::displayname()\n ));",
" } ",
"\n function saveconfig() {\n $this->params['min_order'] = substr($this->params['min_order'], 1) ;\n \t\t$this->params['minimum_gift_card_purchase'] = substr($this->params['minimum_gift_card_purchase'], 1) ;\n \t\t$this->params['custom_message_product'] = substr($this->params['custom_message_product'], 1) ;\n if (isset($this->params['store']['address_country_id'])) {\n $this->params['store']['country'] = $this->params['store']['address_country_id'];\n unset($this->params['store']['address_country_id']);\n }\n if (isset($this->params['store']['address_region_id'])) {\n $this->params['store']['state'] = $this->params['store']['address_region_id'];\n unset($this->params['store']['address_region_id']);\n }\n \t\tparent::saveconfig();\n \t}",
"\t/*****************************************************************/\n /*************** Upcharge Rate *******************************/\n /*****************************************************************/",
"\t",
"\t function manage_upcharge() {\n\t\t$this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;\n",
"\t\t$gc = new geoCountry(); ",
" $countries = $gc->find('all');",
" \n $gr = new geoRegion(); ",
" $regions = $gr->find('all',null,'rank asc,name asc');\n assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions,\n 'upcharge'=>!empty($this->config['upcharge'])?$this->config['upcharge']:''\n ));\n\t }",
"\t ",
"\t function update_upcharge() {\n $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;",
"\t\t",
"\t\t//This will make sure that only the country or region that given a rate value will be saved in the db\n\t\t$upcharge = array();\n\t\tforeach($this->params['upcharge'] as $key => $item) {\n\t\t\tif(!empty($item)) {\n\t\t\t\t$upcharge[$key] = $item;\n\t\t\t}\n\t\t}\n\t\t$this->config['upcharge'] = $upcharge;",
"\t\t",
" $config->update(array('config'=>$this->config));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }",
"\t",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */",
"class ecomconfigController extends expController {\n protected $add_permissions = array(\n 'show'=>'View Admin Options'\n );",
" protected $manage_permissions = array(\n 'options'=>'Display Options'\n );\n",
" static function displayname() { return gt(\"e-Commerce Configuration Manager\"); }\n static function description() { return gt(\"Use this module to configure your e-Commerce store\"); }\n static function hasSources() { return false; }",
" function show() {\n expHistory::set('manageable', $this->params);\n }",
"",
" /*****************************************************************/\n /*************** PRODUCT OPTIONS *******************************/\n /*****************************************************************/\n function edit_optiongroup_master() {\n expHistory::set('editable', $this->params);",
"",
" $id = isset($this->params['id']) ? $this->params['id'] : null;",
" $record = new optiongroup_master($id);",
" assign_to_template(array(\n 'record'=>$record\n ));\n }",
"",
" function update_optiongroup_master() {\n global $db;",
" $id = empty($this->params['id']) ? null : $this->params['id'];\n $og = new optiongroup_master($id);\n $oldtitle = $og->title;\n $og->update($this->params);",
"",
" // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $og->title) {\n $db->sql('UPDATE '.$db->prefix.'optiongroup SET title=\"'.$og->title.'\" WHERE title=\"'.$oldtitle.'\"');\n }",
"\n expHistory::back();\n }\n",
" function delete_optiongroup_master() {\n global $db;",
"",
" $mastergroup = new optiongroup_master($this->params);",
"",
" // delete all the options for this optiongroup master\n foreach ($mastergroup->option_master as $masteroption) {\n $db->delete('option', 'option_master_id='.$masteroption->id);\n $masteroption->delete();\n }",
"",
" // delete the mastergroup\n $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id);\n $mastergroup->delete();",
"\n expHistory::back();\n }\n",
" function delete_option_master() {\n global $db;",
" $masteroption = new option_master($this->params['id']);",
"",
" // delete any implementations of this option master\n $db->delete('option', 'option_master_id='.$masteroption->id);\n $masteroption->delete('optiongroup_master_id=' . $masteroption->optiongroup_master_id);\n //eDebug($masteroption);\n expHistory::back();\n }",
"",
" function edit_option_master() {\n expHistory::set('editable', $this->params);",
"",
" $params = isset($this->params['id']) ? $this->params['id'] : $this->params;",
" $record = new option_master($params);",
" assign_to_template(array(\n 'record'=>$record\n ));\n }",
"\n function update_option_master() {",
" global $db;",
" $id = empty($this->params['id']) ? null : $this->params['id'];\n $opt = new option_master($id);\n $oldtitle = $opt->title;",
"",
" $opt->update($this->params);",
"",
" // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $opt->title) {",
"",
" }$db->sql('UPDATE '.$db->prefix.'option SET title=\"'.$opt->title.'\" WHERE option_master_id='.$opt->id);",
"\n expHistory::back();\n }\n",
" public function options() {\n expHistory::set('viewable', $this->params);\n $optiongroup = new optiongroup_master();\n $optiongroups = $optiongroup->find('all');\n assign_to_template(array(\n 'optiongroups'=>$optiongroups\n ));\n }",
"",
" function rerank_optionmaster() {\n $om = new option_master($this->params['id']);\n $om->rerank($this->params['push'], 'optiongroup_master_id=' . $this->params['master_id']);\n expHistory::back();\n }",
"",
" /*****************************************************************/\n /*************** DISCOUNTS *******************************/\n /*****************************************************************/\n public function manage_discounts() {\n expHistory::set('manageable', $this->params);",
"",
" $page = new expPaginator(array(\n 'model'=>'discounts',\n\t\t\t'sql'=>'SELECT * FROM '.DB_TABLE_PREFIX.'_discounts',\n\t\t\t'limit'=> 10,\n\t\t\t'order'=>isset($this->params['order']) ? $this->params['order'] : null,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n\t\t\t'columns'=>array(gt('Enabled')=>'enabled',gt('Name')=>'title',gt('Type')=>'action_type',gt('Coupon Code')=>'coupon_code',gt('Valid Until')=>'enddate'),\n ));",
" assign_to_template(array(\n /*'apply_rules'=>$discountObj->apply_rules, 'discount_types'=>$discountObj->discount_types,*/\n 'page'=>$page\n ));\n }",
"",
" public function edit_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);",
"",
" //grab all user groups\n $group = new group();",
"",
" //create two 'default' groups:",
" $groups = array(",
" -1 => 'ALL LOGGED IN USERS',\n -2 => 'ALL NON-LOGGED IN USERS'\n );\n //loop our groups and append them to the array\n // foreach ($group->find() as $g){\n //this is a workaround for older code. Use the previous line if possible:\n $allGroups = group::getAllGroups();\n if (count($allGroups))\n {\n foreach ($allGroups as $g)\n {\n $groups[$g->id] = $g->name;\n };\n }\n //find our selected groups for this discount already",
" // eDebug($discount);",
" $selected_groups = array();\n if (!empty($discount->group_ids))\n {\n $selected_groups = expUnserialize($discount->group_ids);\n }",
"",
" if ($discount->minimum_order_amount == \"\") $discount->minimum_order_amount = 0;\n if ($discount->discount_amount == \"\") $discount->discount_amount = 0;\n if ($discount->discount_percent == \"\") $discount->discount_percent = 0;",
"",
" // get the shipping options and their methods\n $shipping_services = array();\n $shipping_methods = array();\n// $shipping = new shipping();\n foreach (shipping::listAvailableCalculators() as $calcid=>$name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }",
"",
" assign_to_template(array(\n 'discount'=>$discount,\n 'groups'=>$groups,\n 'selected_groups'=>$selected_groups,\n 'shipping_services'=>$shipping_services,\n 'shipping_methods'=>$shipping_methods\n ));\n }",
"",
" public function update_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);\n // find required shipping method if needed\n if ($this->params['required_shipping_calculator_id'] > 0) {\n $this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']];\n } else {\n $this->params['required_shipping_calculator_id'] = 0;\n }",
"",
" $discount->update($this->params);\n expHistory::back();\n }",
"\n public function activate_discount(){",
" if (isset($this->params['id'])) {\n $discount = new discounts($this->params['id']);\n $discount->update($this->params);\n //if ($discount->discountulator->hasConfig() && empty($discount->config)) {\n //flash('messages', $discount->discountulator->name().' requires configuration. Please do so now.');\n //redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$discount->id));\n //}\n }",
"\n expHistory::back();\n }\n",
" /*****************************************************************/\n /*************** PROMO CODE *******************************/\n /*****************************************************************/\n\tpublic function manage_promocodes() {\n\t\texpHistory::set('manageable', $this->params);\n $pc = new promocodes();\n $do = new discounts();\n $promo_codes = $pc->find('all');\n $discounts = $do->find('all');\n\t\tassign_to_template(array(\n 'promo_codes'=>$promo_codes,\n 'discounts'=>$discounts\n ));\n\t}",
"\tpublic function update_promocode() {\n//\t global $db;\n\t //$id = empty($this->params['id']) ? null : $this->params['id'];\n\t $code = new promocodes();\n\t $code->update($this->params);\n\t expHistory::back();\n\t}",
"",
" /*****************************************************************/\n /*************** GROUP DISCOUNTS *******************************/\n /*****************************************************************/\n\tpublic function manage_groupdiscounts() {\n\t\tglobal $db;",
"\t\texpHistory::set('manageable', $this->params);\n\t\t$groups = group::getAllGroups();\n\t\t$discounts = $db->selectObjects('discounts');\n//\t\t$group_discounts = $db->selectObjects('groupdiscounts', null, 'rank');\n $gd = new groupdiscounts();\n $group_discounts = $gd->find('all', null, 'rank');\n if (!empty($group_discounts)) foreach ($group_discounts as $key=>$group_discount) {\n $group_discounts[$key]->title = $group_discount->group->name . ' (' . $group_discount->discounts->title . ')';\n }\n\t\tassign_to_template(array(\n 'groups'=>$groups,\n 'discounts'=>$discounts,\n 'group_discounts'=>$group_discounts\n ));\n\t}",
"\tpublic function update_groupdiscounts() {\n\t global $db;",
"",
"\t if (empty($this->params['id'])) {\n\t // look for existing discounts for the same group\n\t $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']);\n\t if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.'));\n\t }",
" $gd = new groupdiscounts();\n\t $gd->update($this->params);\n\t expHistory::back();\n\t}",
"",
"\tfunction rerank_groupdiscount() {\n $gd = new groupdiscounts($this->params['id']);\n $gd->rerank($this->params['push']);\n expHistory::back();\n }",
"",
" /*****************************************************************/\n /*************** GENERAL STORE CONFIG *******************************/\n /*****************************************************************/\n function configure() {\n expHistory::set('editable', $this->params);\n // little bit of trickery so that that categories can have their own configs",
"",
" $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n $this->config = $config->config;\n $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $views = expTemplate::get_config_templates($this, $this->loc);",
"\n $gc = new geoCountry();",
" $countries = $gc->find('all');",
"\n $gr = new geoRegion();",
" $regions = $gr->find('all');",
"",
" assign_to_template(array(\n 'config'=>$this->config,\n 'pullable_modules'=>$pullable_modules,\n 'views'=>$views,\n 'countries'=>$countries,\n 'regions'=>$regions,\n 'title'=>static::displayname()\n ));",
" }",
"\n function saveconfig() {\n $this->params['min_order'] = substr($this->params['min_order'], 1) ;\n \t\t$this->params['minimum_gift_card_purchase'] = substr($this->params['minimum_gift_card_purchase'], 1) ;\n \t\t$this->params['custom_message_product'] = substr($this->params['custom_message_product'], 1) ;\n if (isset($this->params['store']['address_country_id'])) {\n $this->params['store']['country'] = $this->params['store']['address_country_id'];\n unset($this->params['store']['address_country_id']);\n }\n if (isset($this->params['store']['address_region_id'])) {\n $this->params['store']['state'] = $this->params['store']['address_region_id'];\n unset($this->params['store']['address_region_id']);\n }\n \t\tparent::saveconfig();\n \t}",
"\t/*****************************************************************/\n /*************** Upcharge Rate *******************************/\n /*****************************************************************/",
"",
"\t function manage_upcharge() {\n\t\t$this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;\n",
"\t\t$gc = new geoCountry();",
" $countries = $gc->find('all');",
"\n $gr = new geoRegion();",
" $regions = $gr->find('all',null,'rank asc,name asc');\n assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions,\n 'upcharge'=>!empty($this->config['upcharge'])?$this->config['upcharge']:''\n ));\n\t }",
"",
"\t function update_upcharge() {\n $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;",
"",
"\t\t//This will make sure that only the country or region that given a rate value will be saved in the db\n\t\t$upcharge = array();\n\t\tforeach($this->params['upcharge'] as $key => $item) {\n\t\t\tif(!empty($item)) {\n\t\t\t\t$upcharge[$key] = $item;\n\t\t\t}\n\t\t}\n\t\t$this->config['upcharge'] = $upcharge;",
"",
" $config->update(array('config'=>$this->config));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }",
"",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\nfunction compare($x, $y) {\n if ($x->eventdate == $y->eventdate)\n return 0;\n else if ($x->eventdate < $y->eventdate)\n return -1;\n else\n return 1;\n}",
"class eventregistrationController extends expController {\n public $basemodel_name = 'eventregistration';",
"",
" public $useractions = array(\n 'showall' => 'Show all events',\n 'eventsCalendar' => 'Calendar View',\n 'upcomingEvents' => 'Upcoming Events',\n// 'showByTitle' => \"Show events by title\",\n );",
"",
" // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"\n protected $add_permissions = array(\n 'view_registrants'=> 'View Registrants',\n 'emailRegistrants'=> 'Email Registrants',\n );",
"\n static function displayname() {\n return gt(\"e-Commerce Online Event Registration\");\n }",
" static function description() {\n return gt(\"Manage event registrations on your website\");\n }",
" function showall() {\n global $user;",
" expHistory::set('viewable', $this->params);\n $limit = (!empty($this->config['limit'])) ? $this->config['limit'] : 10;",
" $pass_events = array();\n if (!empty($this->params['past']) && $user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate <= time() && $event->eventenddate <= time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n } else {\n if ($user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n } else {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\", $limit);\n }\n foreach ($events as $event) {\n if ($user->isAdmin()) {\n $endtime = $event->eventenddate;\n } else {\n $endtime = $event->signup_cutoff;\n }\n // $this->signup_cutoff > time()\n if ($event->eventdate > time() && $endtime > time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n }\n // echo \"<pre>\";\n // print_r($pass_events);\n // exit();\n // uasort($pass_events,'compare');\n //eDebug($this->config['limit'], true);\n $page = new expPaginator(array(\n 'records'=>$pass_events,\n 'limit'=>$limit,\n 'order'=>\"eventdate ASC\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view'],\n 'columns'=>array(\n gt('Event')=>'title',\n gt('Date')=>'eventdate',\n gt('Seats')=>'quantity'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'admin'=> $user->isAdmin(),\n 'past'=> !empty($this->params['past'])\n ));\n }",
" function eventsCalendar() {\n global $user;",
" expHistory::set('viewable', $this->params);",
" $time = isset($this->params['time']) ? $this->params['time'] : time();\n assign_to_template(array(\n 'time' => $time\n ));",
"// $monthly = array();\n// $counts = array();",
" $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;",
" $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = intval(date('W', $timefirst));\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);",
"// if ($infofirst['wday'] == 0) {\n// $monthly[$week] = array(); // initialize for non days\n// $counts[$week] = array();\n// }\n// for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {\n// $monthly[$week][$i] = array();\n// $counts[$week][$i] = -1;\n// }\n// $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);",
" for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;",
"// $dates = $db->selectObjects(\"eventregistration\", \"`eventdate` = $start\");\n// $dates = $db->selectObjects(\"eventregistration\", \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $er = new eventregistration();\n// $dates = $er->find('all', \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");",
" if ($user->isAdmin()) {\n $events = $er->find('all', 'product_type=\"eventregistration\"', \"title ASC\");\n } else {\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\");\n }\n $dates = array();",
" foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate >= expDateTime::startOfDayTimestamp($start) && $event->eventdate <= expDateTime::endOfDayTimestamp($start)) {\n $dates[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }",
" $monthly[$week][$i] = $this->getEventsForDates($dates);\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }",
" $this->params['time'] = $time;\n assign_to_template(array(\n 'currentweek' => $currentweek,\n 'monthly' => $monthly,\n 'counts' => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n 'now' => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params,\n 'daynames' => event::dayNames(),\n ));\n }",
" function upcomingEvents() {\n $sql = 'SELECT DISTINCT p.*, er.eventdate, er.event_starttime, er.signup_cutoff FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE er.signup_cutoff > ' . time() . ' AND er.eventdate > ' . time();",
" $limit = empty($this->config['limit']) ? 10 : $this->config['limit'];\n $order = 'eventdate';\n $dir = 'ASC';",
" $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));\n assign_to_template(array(\n 'page' => $page\n ));\n }",
" function show() {\n global $order, $user;",
" expHistory::set('viewable', $this->params);\n if (!empty($this->params['token'])) {\n $record = expSession::get(\"last_POST_Paypal\");\n } else {\n $record = expSession::get(\"last_POST\");\n }\n $id = isset($this->params['title']) ? addslashes($this->params['title']) : $this->params['id'];\n $product = new eventregistration($id);",
" //FIXME we only have 0=active & 2=inactive ???\n if ($product->active_type == 1) {\n $product->user_message = \"This event is temporarily unavailable for registration.\";\n } elseif ($product->active_type == 2) {\n if ($user->isAdmin()) {\n $product->user_message = $product->title . \" is currently marked as unavailable for open registration or display. Normal users will not see this event.\";\n } else {\n flash(\"error\", $product->title . \" \" . gt(\"registration is currently unavailable for registration.\"));\n expHistory::back();\n }\n }",
" $order_registrations = array();\n $count = 1;\n if (!empty($this->params['orderitem_id'])) { // editing an event already in the cart?\n $f = new forms($product->forms_id);\n $loc_data = new stdClass();\n $loc_data->order_id = $order->id;\n $loc_data->orderitem_id = $this->params['orderitem_id'];\n $loc_data->event_id = $product->id;\n $locdata = serialize($loc_data);\n// $order_registrations = $db->selectObjects('forms_' . $f->table_name, \"location_data='\" . $locdata . \"'\");\n $order_registrations = $f->getRecords(\"location_data='\" . $locdata . \"'\");",
"// $registrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order->id}' AND orderitem_id =\" . $this->params['orderitem_id'] . \" AND event_id =\" . $product->id);\n// if (!empty($registrants)) foreach ($registrants as $registrant) {\n// $order_registrations[] = expUnserialize($registrant->value);\n// }\n $item = $order->isItemInCart($product->id, $product->product_type, $this->params['orderitem_id']);\n if (!empty($item)) {\n $params['options'] = $item->opts;\n assign_to_template(array(\n 'params'=> $params,\n 'orderitem_id'=>$item->id\n ));\n $count = $item->quantity;\n }\n }",
" //eDebug($product, true);\n assign_to_template(array(\n 'product'=> $product,\n// 'record'=> $record,\n 'registered' => $order_registrations,\n 'count' => $count,\n ));\n }",
" function showByTitle() {\n global $order, $template, $user;\n expHistory::set('viewable', $this->params);\n if (!empty($this->params['token'])) {\n $record = expSession::get(\"last_POST_Paypal\");\n } else {\n $record = expSession::get(\"last_POST\");\n }\n $product = new eventregistration(addslashes($this->params['title']));",
" //TODO should we pull in an existing reservation already in the cart to edit? e.g., the registrants\n //FIXME we only have 0=active & 2=inactive ???\n if ($product->active_type == 1) {\n $product->user_message = \"This event is temporarily unavailable for registration.\";\n } elseif ($product->active_type == 2) {\n if ($user->isAdmin()) {\n $product->user_message = $product->title . \" is currently marked as unavailable for open registration or display. Normal users will not see this event.\";\n } else {\n flash(\"error\", $product->title . \" \" . gt(\"registration is currently unavailable.\"));\n expHistory::back();\n }\n }",
" //eDebug($product, true);\n assign_to_template(array(\n 'product'=> $product,\n 'record'=> $record\n ));\n }",
" function manage() {\n global $user;",
" expHistory::set('viewable', $this->params);\n $limit = (!empty($this->config['limit'])) ? $this->config['limit'] : 10;",
" $pass_events = array();\n if (!empty($this->params['past']) && $user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate <= time() && $event->eventenddate <= time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n } else {\n if ($user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n } else {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\", $limit);\n }\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($user->isAdmin()) {\n $endtime = $event->eventenddate;\n } else {\n $endtime = $event->signup_cutoff;\n }\n if ($event->eventdate > time() && $endtime > time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n }\n foreach ($pass_events as $key=>$pass_event) {\n $pass_events[$key]->number_of_registrants = $pass_event->countRegistrants();\n }\n // echo \"<pre>\";\n // print_r($pass_events);\n // exit();\n // uasort($pass_events,'compare');\n //eDebug($this->config['limit'], true);\n $page = new expPaginator(array(\n 'records'=>$pass_events,\n 'limit'=>$limit,\n 'order'=>\"eventdate ASC\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view'],\n 'columns'=>array(\n gt('Event')=>'title',\n gt('Date')=>'eventdate',\n gt('Seats')=>'quantity'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'admin'=> $user->isAdmin(),\n 'past'=> !empty($this->params['past'])\n ));\n }",
" function metainfo() {\n global $router;\n if (empty($router->params['action'])) return false;",
" // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'showall':\n case 'eventsCalendar':\n case 'upcomingEvents':\n $metainfo['title'] = gt('Event Registration') . ' - ' . $storename;\n $metainfo['keywords'] = gt('event registration online');\n $metainfo['description'] = gt(\"Make an event registration\");\n break;\n case 'show':\n case 'showByTitle':\n if (isset($router->params['id']) || isset($router->params['title'])) {\n $lookup = isset($router->params['id']) ? $router->params['id'] : $router->params['title'];\n $object = new eventregistration($lookup);\n // set the meta info\n if (!empty($object)) {\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n if (!empty($object->expTag)) {\n $keyw = '';\n foreach ($object->expTag as $tag) {\n if (!empty($keyw)) $keyw .= ', ';\n $keyw .= $tag->title;\n }\n } else {\n $keyw = SITE_KEYWORDS;\n }\n $metainfo['title'] = empty($object->meta_title) ? $object->title . \" - \" . $storename : $object->meta_title;\n $metainfo['keywords'] = empty($object->meta_keywords) ? $keyw : $object->meta_keywords;\n $metainfo['description'] = empty($object->meta_description) ? $desc : $object->meta_description;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical;\n $metainfo['canonical'] = empty($object->canonical) ? $router->plainPath() : $object->canonical;\n $metainfo['noindex'] = empty($object->meta_noindex) ? false : $object->meta_noindex;\n $metainfo['nofollow'] = empty($object->meta_nofollow) ? false : $object->meta_nofollow;\n }\n break;\n }\n default:\n $metainfo['title'] = self::displayname() . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }",
" return $metainfo;\n }",
" function eventregistration_process() { // FIXME only used by the eventregistration_form view (no method)\n global $db, $user, $order;",
" //Clear the cart first\n foreach ($order->orderitem as $orderItem) {\n $orderItem->delete();\n }\n $order->refresh();",
" eDebug($order, true);",
" expHistory::set('viewable', $this->params);\n expSession::set('last_POST_Paypal', $this->params);\n expSession::set('terms_and_conditions', $product->terms_and_condition); //FIXME $product doesn't exist\n expSession::set('paypal_link', makeLink(array('controller'=> 'eventregistration', 'action'=> 'show', 'title'=> $product->sef_url)));",
" //Validation for customValidation\n foreach ($this->params['event'] as $key => $value) {\n $expField = $db->selectObject(\"expDefinableFields\", \"name = '{$key}'\");\n $expFieldData = expUnserialize($expField->data);\n if (!empty($expFieldData->customvalidation)) {",
" $customValidation = \"is_valid_\" . $expFieldData->customvalidation;\n $fieldname = $expField->name;\n $obj = new stdClass();\n $obj->$fieldname = $value;\n if ($fieldname == \"email\") { //Change this to much more loose coding\n $ret = expValidator::$customValidation($fieldname, $this->params['event']['email'], $this->params['event']['email_confirm']);\n } else {\n $ret = expValidator::$customValidation($fieldname, $obj, $obj);\n }\n if (strlen($ret) > 1) {",
" expValidator::failAndReturnToForm($ret, $this->params);\n }\n }",
" if (@$expFieldData->minimum_size > 0 || @$expFieldData->maximum_size > 0) {\n $ret = expValidator::check_size_of($expFieldData->identifier, $value, $expFieldData->minimum_size, $expFieldData->maximum_size);",
" if (strlen($ret) > 1) {\n expValidator::failAndReturnToForm($ret, $this->params);\n }\n }\n }",
" $event = new eventregistration();\n //Validation for ticker types\n if (isset($this->params['ticket_types']) && empty($this->params['options'])) {\n expValidator::failAndReturnToForm(\"Invalid ticket types.\", $this->params);\n }",
"// if (!empty($this->params['event'])) {\n $sess_id = session_id();\n// $sess_id = expSession::getTicketString();\n// $data = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order->id}' AND event_id =\" . $this->params['eventregistration']['product_id']);\n $data = $event->getRecords(\"connector_id ='{$order->id}' AND event_id =\" . $this->params['eventregistration']['product_id']);\n //FIXME change this to forms table\n if (!empty($data)) {\n foreach ($data as $item) {\n if (!empty($this->params['event'][$item->control_name])) {\n $item->value = $this->params['event'][$item->control_name];\n// $db->updateObject($item, \"eventregistration_registrants\");\n $event->updateRecord($item);\n }\n }\n } else {\n if (!empty($this->params['event'])) foreach ($this->params['event'] as $key => $value) {\n $obj = new stdClass();\n $obj->event_id = $this->params['eventregistration']['product_id'];\n $obj->control_name = $key;\n $obj->value = $value;\n $obj->connector_id = $order->id;\n $obj->registered_date = time();\n// $db->insertObject($obj, \"eventregistration_registrants\");\n $event->insertRecord($obj);\n } else {\n $obj = new stdClass();\n $obj->event_id = $this->params['eventregistration']['product_id'];\n $obj->connector_id = $order->id;\n $obj->registered_date = time();\n// $db->insertObject($obj, \"eventregistration_registrants\");\n $event->insertRecord($obj);\n }\n }\n expSession::set('session_id', $sess_id);\n// }",
" //Add to Cart\n $product_id = $this->params['eventregistration']['product_id'];\n $product_type = \"eventregistration\";\n $product = new $product_type($product_id, true, true);",
" if ($this->params['options']) {\n $this->params['eventregistration']['options'] = $this->params['options'];\n $this->params['eventregistration']['options_quantity'] = $this->params['options_quantity'];\n $product->addToCart($this->params['eventregistration']);\n } else {\n $this->params['eventregistration']['qtyr'] = $this->params['theValue'] + 1;\n $product->addToCart($this->params['eventregistration']);\n }",
" $order->calculateGrandTotal();\n $order->setOrderType($this->params);\n $order->setOrderStatus($this->params);",
" $billing = new billing();\n $result = $billing->calculator->preprocess($billing->billingmethod, $opts, $this->params, $order); //FIXME $opts doesn't exist\n redirect_to(array('controller'=> 'cart', 'action'=> 'preprocess'));\n }",
" function delete() {\n redirect_to(array('controller'=> 'eventregistration', 'action'=> 'showall'));\n }",
" function view_registrants() {\n expHistory::set('viewable', $this->params);\n $event = new eventregistration($this->params['id']);\n //Get all the registrants in the event\n// $registrants = $event->getRegistrants();\n assign_to_template(array(\n 'event'=> $event,\n 'registrants'=> $event->getRegistrants(),\n 'count'=> $event->countRegistrants(),\n// 'header'=> $header,\n// 'body'=> $body,\n// 'email'=> $email\n ));",
"// $order_ids_complete = $db->selectColumn(\"eventregistration_registrants\", \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"registered_date\", true);\n// $orders = new order();\n// foreach ($order_ids_complete as $item) {\n// $connector = expUnserialize($item);\n//// $odr = $db->selectObject(\"orders\", \"id = {$item} and invoice_id <> 0\");\n//// $odr = $db->selectObject(\"orders\", \"id ='{$item}' and invoice_id <> 0\");\n// $odr = $orders->find(\"first\", \"id ='{$connector->order_id}' and invoice_id <> 0\");\n// if (!empty($odr) || strpos($connector->order_id, \"admin-created\") !== false) {\n// $order_ids[] = $connector->order_id;\n// }\n// }\n//\n// $header = array();\n// $control_names = array();\n// $header[] = 'Date Registered';\n// //Check if it has ticket types\n// if ($event->hasOptions()) {\n// $header[] = \"Types\"; //Add some configuration here\n// }\n// //Get the input labels as table headers\n// if (!empty($event->expDefinableField['registrant'])) foreach ($event->expDefinableField['registrant'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption;\n// } else {\n// $header[] = $field->name;\n// }\n// $control_names[] = $field->name;\n// }\n//\n// //Check if there are guests using expDefinableFields\n// if (!empty($event->num_guest_allowed)) {\n// for ($i = 1; $i <= $event->num_guest_allowed; $i++) {\n// if (!empty($event->expDefinableField['guest'])) foreach ($event->expDefinableField['guest'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption . \"_$i\";\n// } else {\n// $header[] = $field->name . \"_$i\";\n// }\n// $control_names[] = $field->name . \"_$i\";\n// }\n// }\n// }\n//\n// // new method to check for guests/registrants in eventregistration_registrants\n//// if (!empty($event->num_guest_allowed)) {\n// $registrants = array();\n// if (!empty($event->quantity)) {\n// $registered = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $newregistrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order_id}'\");\n// $registered = array_merge($registered,$newregistrants);\n// }\n// foreach ($registered as $person) {\n// $registrants[$person->id] = expUnserialize($person->value);\n// }\n// }\n//\n// //Get the data and registrant emails\n// $email = array();\n// $num_of_guest_fields = 0;\n// $num_of_guest = 0;\n// $num_of_guest_total = 0;\n//\n// $body = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $body[$order_id][] = date(\"M d, Y h:i a\", $db->selectValue(\"eventregistration_registrants\", \"registered_date\", \"event_id = {$event->id} AND connector_id = '{$order_id}'\"));\n// if ($event->hasOptions()) {\n// $or = new order($order_id);\n// $orderitem = new orderitem();\n// if (isset($or->orderitem[0])) {\n// $body[$order_id][] = $orderitem->getOption($or->orderitem[0]->options);\n// } else {\n// $body[$order_id][] = '';\n// }\n// }\n// foreach ($control_names as $control_name) {\n// $value = $db->selectValue(\"eventregistration_registrants\", \"value\", \"event_id = {$event->id} AND control_name ='{$control_name}' AND connector_id = '{$order_id}'\");\n// $body[$order_id][] = $value;\n// if (expValidator::isValidEmail($value) === true) {\n// $email[$value] = $value;\n// }\n// }\n//\n// if (!empty($order_id)) {\n// $num_of_guest_total += $db->countObjects(\"eventregistration_registrants\", \"event_id ={$event->id} AND control_name LIKE 'guest_%' AND connector_id = '{$order_id}'\");\n// }\n// } else $order_ids = array();\n//\n// // check numbers based on expDefinableFields\n// $num_of_guest_fields = $db->countObjects(\"content_expDefinableFields\", \"content_id ={$event->id} AND subtype='guest'\");\n// if ($num_of_guest_fields <> 0) {\n// $num_of_guest = $num_of_guest_total / $num_of_guest_fields;\n// } else {\n// $num_of_guest = 0;\n// }\n//\n// //Removed duplicate emails\n// $email = array_unique($email);\n//\n// $registered = count($order_ids) + $num_of_guest;\n// if (!empty($event->registrants)) {\n// $event->registrants = expUnserialize($event->registrants);\n// } else {\n// $event->registrants = array();\n// }\n//\n// $event->number_of_registrants = $registered;\n// assign_to_template(array(\n// 'event'=> $event,\n// 'registrants'=> $registrants,\n//// 'header'=> $header,\n//// 'body'=> $body,\n//// 'email'=> $email\n// ));\n }",
" public function delete_registrant() {\n// global $db;",
" $event = new eventregistration($this->params['event_id']);\n $f = new forms($event->forms_id);\n if (!empty($f->is_saved)) { // is there user input data\n// $db->delete('forms_' . $f->table_name, \"id='{$this->params['id']}'\");\n $f->deleteRecord($this->params['id']);\n } else {\n// $db->delete('eventregistration_registrants', \"id ='{$this->params['id']}'\");\n $event->deleteRecord($this->params['id']);\n }\n flash('message', gt(\"Registrant successfully deleted.\"));\n expHistory::back();\n }",
" public function edit_registrant() {\n// global $db;",
"// $event_id = $this->params['event_id'];\n// $connector_id = @$this->params['connector_id'];\n// if (empty($connector_id)) {\n// $connector_id = \"admin-created\" . mt_rand() . time(); //Meaning it is been added by admin\n// }\n// $reg_data = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$connector_id}'\");",
" $registrant = array();\n $event = new eventregistration($this->params['event_id']);\n if (!empty($this->params['id'])) {\n// $reg_data = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $f = new forms($event->forms_id);",
" // foreach ($reg_data as $item) {\n // $registrant[$item->control_name] = $item->value;\n // }\n// $registrant = expUnserialize($reg_data->value);\n if (!empty($f->is_saved)) {\n// $registrant = $db->selectObject('forms_' . $f->table_name, \"id ='{$this->params['id']}'\");\n $registrant = $f->getRecord($this->params['id']);\n// $registrant['id'] = $reg_data->id;\n// $eventid = $reg_data->event_id;\n// } else {\n// $eventid = $this->params['event_id'];\n } else {\n// $registrant = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $registrant = $event->getRecord($this->params['id']);\n }\n }",
" // eDebug($registrant, true);\n assign_to_template(array(\n 'registrant'=> $registrant,\n 'event'=> $event,\n// 'connector_id' => $connector_id\n ));\n }",
" public function update_registrant() {\n global $db, $user;",
" $event = new eventregistration($this->params['event_id']);\n // create a new order/invoice if needed\n if (empty($this->params['id'])) {\n //create new order\n $orderc= expModules::getController('order');\n $orderc->params = array(\n 'customer_type' => 1, // blank user/address\n 'addresses_id' => 0,\n 'order_status_id' => order::getDefaultOrderStatus(),\n 'order_type_id' => order::getDefaultOrderType(),\n 'no_redirect' => true,\n );\n $orderc_id = $orderc->save_new_order();\n //create new order item\n $orderc->params = array(\n 'orderid' => $orderc_id,\n 'product_id' => $event->id,\n 'product_type' => 'eventregistration',\n// 'products_price' => $event->getBasePrice(),\n// 'products_name' => $event->title,\n 'quantity' => $this->params['value'],\n 'no_redirect' => true,\n );\n $orderi_id = $orderc->save_order_item(); // will redirect us to the new order view\n }\n $f = new forms($event->forms_id);\n $registrant = new stdClass();\n// if (!empty($this->params['id'])) $registrant = $db->selectObject('forms_' . $f->table_name, \"id ='{$this->params['id']}'\");\n if (!empty($this->params['id'])) $registrant = $f->getRecord($this->params['id']);\n if (!empty($f->is_saved)) {\n $fc = new forms_control();\n $controls = $fc->find('all', \"forms_id=\" . $f->id . \" AND is_readonly=0\",'rank');\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, \"getFieldDefinition\"));\n if ($def != null) {\n $emailValue = htmlspecialchars_decode(call_user_func(array($control_type, 'parseData'), $c->name, $this->params['registrant'], true));\n $value = stripslashes(expString::escape($emailValue));\n $varname = $c->name;\n $registrant->$varname = $value;\n }\n }\n if (!empty($registrant->id)) {\n// $db->updateObject($registrant, 'forms_' . $f->table_name);\n $f->updateRecord($registrant);\n } else { // create new registrant record\n $loc_data = new stdClass();\n// $loc_data->order_id = 'admin-created';\n// $loc_data->orderitem_id = 'admin-created';\n $loc_data->order_id = $orderc_id;\n $loc_data->orderitem_id = $orderi_id;\n $loc_data->event_id = $this->params['event_id'];\n $locdata = serialize($loc_data);\n $registrant->ip = $_SERVER['REMOTE_ADDR'];\n $registrant->referrer = $this->params['event_id'];\n $registrant->timestamp = time();\n if (expSession::loggedIn()) {\n $registrant->user_id = $user->id;\n } else {\n $registrant->user_id = 0;\n }\n $registrant->location_data = $locdata;\n// $db->insertObject($registrant, 'forms_' . $f->table_name);\n $f->insertRecord($registrant);\n }\n } else {\n// $registrant = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $registrant = $event->getRecord($this->params['id']);\n if (!is_object($registrant)) $registrant = new stdClass();\n $registrant->control_name = $this->params['control_name'];\n //FIXME if $registrant->value != $this->params['value'] update order/invoice w/ new quantity???\n $registrant->value = $this->params['value'];\n if (!empty($registrant->id)) {\n// $db->updateObject($registrant, \"eventregistration_registrants\");\n $event->updateRecord($registrant);\n } else { // create new registrant record\n $registrant->event_id = $this->params['event_id'];\n// $registrant->connector_id = 'admin-created';\n// $registrant->orderitem_id = 'admin-created';\n $registrant->registered_date = time();\n $registrant->connector_id = $orderc_id;\n $registrant->orderitem_id = $orderi_id;\n// $db->insertObject($registrant, \"eventregistration_registrants\");\n $event->insertRecord($registrant);\n }\n }\n redirect_to(array('controller'=> 'eventregistration', 'action'=> 'view_registrants', 'id'=> $this->params['event_id']));\n }",
" public function export() {\n// global $db;",
" $event = new eventregistration($this->params['id']);",
" $registrants = $event->getRegistrants();\n $f = new forms($event->forms_id);\n// $registrants = array();\n// if (!empty($f->is_saved)) { // is there user input data\n// $registrants = $db->selectObjects('forms_' . $f->table_name, \"referrer = {$event->id}\", \"timestamp\");\n// } else {\n// $registrants = $db->selectObjects('eventregistration_registrants', \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"timestamp\");\n// }\n// foreach ($registrants as $key=>$registrant) {\n// $order_data = expUnserialize($registrant->location_data);\n// if (is_numeric($order_data->order_id)) {\n// $order = new order($order_data->order_id);\n// $billingstatus = expUnserialize($order->billingmethod[0]->billing_options);\n// $registrants[$key]->payment = !empty($billingstatus->payment_due) ? gt('payment due') : gt('paid');\n// } else {\n// $registrants[$key]->payment = '???';\n// }\n// }",
"// $sql = \"SELECT connector_id FROM \" . $db->prefix . \"eventregistration_registrants GROUP BY connector_id\";\n// $order_ids_complete = $db->selectColumn(\"eventregistration_registrants\", \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"registered_date\", true);\n//\n// $orders = new order();\n// foreach ($order_ids_complete as $item) {\n//// $odr = $db->selectObject(\"orders\", \"id = {$item} and invoice_id <> 0\");\n// $odr = $orders->find(\"first\", \"id ='{$item}' and invoice_id <> 0\");\n// if (!empty($odr) || strpos($item, \"admin-created\") !== false) {\n// $order_ids[] = $item;\n// }\n// }\n//\n// $header = array();\n// $control_names = array();\n// $header[] = '\"Date Registered\"';\n// //Check if it has ticket types\n// if ($event->hasOptions()) {\n// $header[] = '\"Ticket Types\"'; //Add some configuration here\n// }\n//\n// if (!empty($event->expDefinableField['registrant'])) foreach ($event->expDefinableField['registrant'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = '\"' . $data->caption . '\"';\n// } else {\n// $header[] = '\"' . $field->name . '\"';\n// }\n// $control_names[] = $field->name;\n// }",
" //FIXME we don't have a 'guest' definable field type\n// if ($event->num_guest_allowed > 0) {\n// for ($i = 1; $i <= $event->num_guest_allowed; $i++) {\n// if (!empty($event->expDefinableField['guest'])) foreach ($event->expDefinableField['guest'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption . \"_$i\";\n// } else {\n// $header[] = $field->name . \"_$i\";\n// }\n// $control_names[] = $field->name . \"_$i\";\n// }\n//\n// }\n// }",
" // new method to check for guests/registrants\n// if (!empty($event->num_guest_allowed)) {\n// if (!empty($event->quantity)) {\n// $registered = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $newregistrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order_id}'\");\n// $registered = array_merge($registered,$newregistrants);\n// }\n//// $registrants = array();\n// foreach ($registered as $key=>$person) {\n// $registered[$key]->person = expUnserialize($person->value);\n// }\n if (!empty($f->is_saved)) {\n $controls = $event->getAllControls();\n if ($f->column_names_list == '') {\n //define some default columns...\n foreach ($controls as $control) {\n $rpt_columns[$control->name] = $control->caption;\n }\n } else {\n $rpt_columns2 = explode(\"|!|\", $f->column_names_list);\n $fc = new forms_control();\n foreach ($rpt_columns2 as $column) {\n $control = $fc->find('first', \"forms_id=\" . $f->id . \" AND name = '\" . $column . \"' AND is_readonly = 0 AND is_static = 0\", \"rank\");\n if (!empty($control)) {\n $rpt_columns[$control->name] = $control->caption;\n } else {\n switch ($column) {\n case 'ip':\n $rpt_columns[$column] = gt('IP Address');\n break;\n case 'referrer':\n $rpt_columns[$column] = gt('Event ID');\n break;\n case 'user_id':\n $rpt_columns[$column] = gt('Posted by');\n break;\n case 'timestamp':\n $rpt_columns[$column] = gt('Registered');\n break;\n }\n }\n }\n }\n $rpt_columns['payment'] = gt('Paid?');\n $fc = new forms_control();\n foreach ($rpt_columns as $column_name=>$column_caption) {\n if ($column_name == \"ip\" || $column_name == \"referrer\" || $column_name == \"location_data\") {\n } elseif ($column_name == \"user_id\") {\n foreach ($registrants as $key => $item) {\n if ($item->$column_name != 0) {\n $locUser = user::getUserById($item->$column_name);\n $item->$column_name = $locUser->username;\n } else {\n $item->$column_name = '';\n }\n $registrants[$key] = $item;\n }\n } elseif ($column_name == \"timestamp\") {\n foreach ($registrants as $key => $item) {\n $item->$column_name = strftime(\"%m/%d/%y %T\", $item->$column_name); // needs to be in a machine readable format\n $registrants[$key] = $item;\n }\n } else {\n $control = $fc->find('first', \"name='\" . $column_name . \"' AND forms_id=\" . $this->params['id'],'rank');\n if ($control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n foreach ($registrants as $key => $item) {\n $item->$column_name = call_user_func(array($control_type, 'templateFormat'), $item->$column_name, $ctl);\n $registrants[$key] = $item;\n }\n }\n }\n }\n } else {\n $rpt_columns = array(\n 'user' => gt('Name'),\n 'qty' => gt('Quantity'),\n 'registered_date' => gt('Registered'),\n 'payment' => gt('Paid?'),\n );\n foreach ($registrants as $key=>$registrant) {\n $registrants[$key]->registered_date = strftime(DISPLAY_DATETIME_FORMAT, $registrants[$key]->registered_date);\n }\n }\n// $header = array(); //FIXME reset & pulled from above\n// $header[] = gt('IP Address'); //FIXME\n// $header[] = gt('Event');\n// $header[] = gt('Date Registered');\n// $header[] = gt('User');\n// $header[] = gt('Location');\n// foreach ($controls as $control) {\n// $header[] = $control->caption;\n// }\n// }",
" if (LANG_CHARSET == 'UTF-8') {\n $out = chr(0xEF).chr(0xBB).chr(0xBF); // add utf-8 signature to file to open appropriately in Excel, etc...\n } else {\n $out = \"\";\n }\n// $out .= implode(\",\", $header);\n// $out .= \"\\n\";\n// $body = '';\n// foreach ($order_ids as $order_id) {\n// $body .= '\"' . date(\"M d, Y h:i a\", $db->selectValue(\"eventregistration_registrants\", \"registered_date\", \"event_id = {$event->id} AND connector_id = '{$order_id}'\")) . '\",';\n//\n// if ($event->hasOptions()) {\n// $or = new order($order_id);\n// $orderitem = new orderitem();\n// if (isset($or->orderitem[0])) {\n// $body .= '\"' . str_replace(\"<br />\", \" \", $orderitem->getOption($or->orderitem[0]->options)) . '\",';\n// ;\n// } else {\n// $body .= '\"\",';\n// }\n// }\n//\n// foreach ($control_names as $control_name) {\n// $value = $db->selectValue(\"eventregistration_registrants\", \"value\", \"event_id = {$event->id} AND control_name ='{$control_name}' AND connector_id = '{$order_id}'\");\n// $body .= '\"' . iconv(\"UTF-8\", \"ISO-8859-1\", $value) . '\",';\n// }\n// $body = substr($body, 0, -1) . \"\\n\";\n// }\n// foreach ($registrants as $person) {\n// $body .= '\"' . date(\"M d, Y h:i a\", $person->registered_date) . '\",';\n// foreach ($person->person as $value) {\n//// $body .= '\"' . iconv(\"UTF-8\", \"ISO-8859-1\", $value) . '\",';\n// $body .= '\"' . $value . '\",';\n// }\n// $body = substr($body, 0, -1) . \"\\n\";\n// }\n// $out .= $body;\n $out .= formsController::sql2csv($registrants, $rpt_columns);",
" $fn = str_replace(' ', '_', $event->title) . '_' . gt('Roster') . '.csv';",
"\t\t// CREATE A TEMP FILE\n\t\t$tmpfname = tempnam(getcwd(), \"rep\"); // Rig",
"\t\t$handle = fopen($tmpfname, \"w\");\n\t\tfwrite($handle,$out);\n\t\tfclose($handle);",
"\t\tif(file_exists($tmpfname)) {\n // NO buffering from here on out or things break unexpectedly. - RAM\n ob_end_clean();",
" // This code was lifted from phpMyAdmin, but this is Open Source, right?\n // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n // It seems that other headers I've added make IE prefer octet-stream again. - RAM\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : 'text/comma-separated-values;';\n header('Content-Type: ' . $mime_type . ' charset=' . LANG_CHARSET. \"'\");\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Content-length: '.filesize($tmpfname));\n header('Content-Transfer-Encoding: binary');\n header('Content-Encoding:');\n header('Content-Disposition: attachment; filename=\"' . $fn . '\";');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }\n //Read the file out directly\n readfile($tmpfname);",
"// if (DEVELOPMENT == 0) exit();\n unlink($tmpfname);\n exit();\n }\n }",
" public function get_guest_controls($ajax = '') { //FIXME this is never used\n $id = $this->params['id'];\n $ctr = $this->params['counter'];\n $event = new eventregistration($id);",
" $str = \"\";\n foreach ($event->expDefinableField['guest'] as $field) {\n $str = $str . $event->showControl($field, $field->name . \"_\" . $ctr);\n }",
" echo $str;\n exit();\n }",
" function emailRegistrants() {",
" if (empty($this->params['email_addresses'])) {\n flash('error', gt('Please add at least one email.'));\n expHistory::back();\n }",
" if (empty($this->params['email_subject']) || empty($this->params['email_message'])) {\n flash('error', gt('Nothing to Send! Please enter subject and message.'));\n expHistory::back();\n }",
"// $email_arr = explode(\"|!|\", $this->params['email_addresses']);\n $email_addy = array_flip(array_flip($this->params['email_addresses']));\n $email_addy = array_map('trim', $email_addy);\n $email_addy = array_filter($email_addy);",
" $headers = array(\n \"MIME-Version\" => \"1.0\",\n \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n );",
" $mail = new expMail();",
"// foreach ($this->params['expFile']['attachments'] as $attach) {\n// $expFile = new expFile($attach);\n// if (!empty($expFile->id)) {\n// $mail->attach_file_on_disk($expFile->path, $expFile->mimetype);\n// }\n// }\n if (!empty($_FILES['attach']['size'])) {\n $dir = 'tmp';\n $filename = expFile::fixName(time() . '_' . $_FILES['attach']['name']);\n $dest = $dir . '/' . $filename;\n //Check to see if the directory exists. If not, create the directory structure.\n if (!file_exists(BASE.$dir)) expFile::makeDirectory($dir);\n // Move the temporary uploaded file into the destination directory, and change the name.\n $file = expFile::moveUploadedFile($_FILES['attach']['tmp_name'], BASE . $dest);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $ftype = finfo_file($finfo, BASE.$dest);\n// finfo_close($finfo);\n if (!empty($file)) $mail->attach_file_on_disk(BASE . $file, expFile::getMimeType(BASE . $file));\n }",
" $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickBatchSend(array(\n \t'headers'=>$headers,\n 'html_message'=> $this->params['email_message'],\n 'text_message'=> strip_tags(str_replace(\"<br>\", \"\\r\\n\", $this->params['email_message'])),\n 'to' => $email_addy,\n 'from' => $from,\n 'subject' => $this->params['email_subject']\n ));\n if (!empty($file)) unlink(BASE . $file); // delete temp file attachment\n flash('message', gt(\"You're email to event registrants has been sent.\"));\n expHistory::back();\n }",
" /**\n * function to return event registrations as calendar events\n *\n * @param $startdate\n * @param $enddate\n * @param string $color\n *\n * @return array\n */\n static function getRegEventsForDates($startdate, $enddate, $color=\"#FFFFFF\") {\n $er = new eventregistration();\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0');\n $pass_events = array();\n foreach ($events as $event) {\n if ($event->eventdate >= $startdate && $event->eventdate <= $enddate) {\n $newevent = new stdClass();\n $newevent->eventdate = new stdClass();\n $newevent->eventdate->date = $event->eventdate;\n $newevent->eventstart = $event->event_starttime + $event->eventdate;\n $newevent->eventend = $event->event_endtime + $event->eventdate;\n $newevent->title = $event->title;\n $newevent->body = $event->body;\n $newevent->location_data = 'eventregistration';\n $newevent->color = $color;\n $newevent->expFile = $event->expFile['mainimage'];\n $pass_events[$event->eventdate][] = $newevent;\n }\n }\n return $pass_events;\n }",
" /*\n * Helper function for the Calendar view\n */\n function getEventsForDates($edates, $sort_asc = true) {\n global $db;",
" $events = array();\n foreach ($edates as $edate) {\n// if (!isset($this->params['cat'])) {\n// if (isset($this->params['title']) && is_string($this->params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $this->params['title'] . \"'\");\n// } elseif (!empty($this->config['category'])) {\n// $default_id = $this->config['category'];\n// } elseif (ecomconfig::getConfig('show_first_category')) {\n// $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n// } else {\n// $default_id = 0;\n// }\n// }\n//\n// $parent = isset($this->params['cat']) ? intval($this->params['cat']) : $default_id;\n//\n// $category = new storeCategory($parent);",
" $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n// $sql .= 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 ';\n// $sql .= ' AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN ' . $category->lft . ' AND ' . $category->rgt . ')';\n// if ($category->hide_closed_events) {\n// $sql .= ' AND er.signup_cutoff > ' . time();\n// }\n// $sql .= ' AND er.id = ' . $edate->id;\n $sql .= ' AND er.id = ' . $edate->product_type_id;",
" $order = 'event_starttime';\n $dir = 'ASC';",
" $o = $db->selectObjectBySql($sql);\n $o->eventdate = $edate->eventdate;\n $o->eventstart = $edate->event_starttime + $edate->eventdate;\n $o->eventend = $edate->event_endtime + $edate->eventdate;\n $o->expFile = $edate->expFile;\n $events[] = $o;\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }",
" // create a pseudo global view_registrants permission\n public static function checkPermissions($permission,$location) {\n global $exponent_permissions_r, $router;",
" // only applies to the 'view_registrants' method\n if (empty($location->src) && empty($location->int) && $router->params['action'] == 'view_registrants') {\n if (!empty($exponent_permissions_r['eventregistration'])) foreach ($exponent_permissions_r['eventregistration'] as $page) {\n foreach ($page as $pageperm) {\n if (!empty($pageperm['view_registrants']) || !empty($pageperm['manage'])) return true;\n }\n }\n }\n return false;\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\nfunction compare($x, $y) {\n if ($x->eventdate == $y->eventdate)\n return 0;\n else if ($x->eventdate < $y->eventdate)\n return -1;\n else\n return 1;\n}",
"class eventregistrationController extends expController {\n public $basemodel_name = 'eventregistration';",
"",
" public $useractions = array(\n 'showall' => 'Show all events',\n 'eventsCalendar' => 'Calendar View',\n 'upcomingEvents' => 'Upcoming Events',\n// 'showByTitle' => \"Show events by title\",\n );",
" protected $add_permissions = array(\n// 'emailRegistrants'=> 'Email Registrants',\n );\n protected $manage_permissions = array(\n 'emailRegistrants'=> 'Email Registrants',\n );",
" // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"",
"\n static function displayname() {\n return gt(\"e-Commerce Online Event Registration\");\n }",
" static function description() {\n return gt(\"Manage event registrations on your website\");\n }",
" function showall() {\n global $user;",
" expHistory::set('viewable', $this->params);\n $limit = (!empty($this->config['limit'])) ? $this->config['limit'] : 10;",
" $pass_events = array();\n if (!empty($this->params['past']) && $user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate <= time() && $event->eventenddate <= time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n } else {\n if ($user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n } else {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\", $limit);\n }\n foreach ($events as $event) {\n if ($user->isAdmin()) {\n $endtime = $event->eventenddate;\n } else {\n $endtime = $event->signup_cutoff;\n }\n // $this->signup_cutoff > time()\n if ($event->eventdate > time() && $endtime > time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n }\n // echo \"<pre>\";\n // print_r($pass_events);\n // exit();\n // uasort($pass_events,'compare');\n //eDebug($this->config['limit'], true);\n $page = new expPaginator(array(\n 'records'=>$pass_events,\n 'limit'=>$limit,\n 'order'=>\"eventdate ASC\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view'],\n 'columns'=>array(\n gt('Event')=>'title',\n gt('Date')=>'eventdate',\n gt('Seats')=>'quantity'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'admin'=> $user->isAdmin(),\n 'past'=> !empty($this->params['past'])\n ));\n }",
" function eventsCalendar() {\n global $user;",
" expHistory::set('viewable', $this->params);",
" $time = isset($this->params['time']) ? $this->params['time'] : time();\n assign_to_template(array(\n 'time' => $time\n ));",
"// $monthly = array();\n// $counts = array();",
" $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;",
" $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = intval(date('W', $timefirst));\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);",
"// if ($infofirst['wday'] == 0) {\n// $monthly[$week] = array(); // initialize for non days\n// $counts[$week] = array();\n// }\n// for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {\n// $monthly[$week][$i] = array();\n// $counts[$week][$i] = -1;\n// }\n// $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);",
" for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;",
"// $dates = $db->selectObjects(\"eventregistration\", \"`eventdate` = $start\");\n// $dates = $db->selectObjects(\"eventregistration\", \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $er = new eventregistration();\n// $dates = $er->find('all', \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");",
" if ($user->isAdmin()) {\n $events = $er->find('all', 'product_type=\"eventregistration\"', \"title ASC\");\n } else {\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\");\n }\n $dates = array();",
" foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate >= expDateTime::startOfDayTimestamp($start) && $event->eventdate <= expDateTime::endOfDayTimestamp($start)) {\n $dates[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }",
" $monthly[$week][$i] = $this->getEventsForDates($dates);\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }",
" $this->params['time'] = $time;\n assign_to_template(array(\n 'currentweek' => $currentweek,\n 'monthly' => $monthly,\n 'counts' => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n 'now' => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params,\n 'daynames' => event::dayNames(),\n ));\n }",
" function upcomingEvents() {\n $sql = 'SELECT DISTINCT p.*, er.eventdate, er.event_starttime, er.signup_cutoff FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE er.signup_cutoff > ' . time() . ' AND er.eventdate > ' . time();",
" $limit = empty($this->config['limit']) ? 10 : $this->config['limit'];\n $order = 'eventdate';\n $dir = 'ASC';",
" $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));\n assign_to_template(array(\n 'page' => $page\n ));\n }",
" function show() {\n global $order, $user;",
" expHistory::set('viewable', $this->params);\n if (!empty($this->params['token'])) {\n $record = expSession::get(\"last_POST_Paypal\");\n } else {\n $record = expSession::get(\"last_POST\");\n }\n $id = isset($this->params['title']) ? addslashes($this->params['title']) : $this->params['id'];\n $product = new eventregistration($id);",
" //FIXME we only have 0=active & 2=inactive ???\n if ($product->active_type == 1) {\n $product->user_message = \"This event is temporarily unavailable for registration.\";\n } elseif ($product->active_type == 2) {\n if ($user->isAdmin()) {\n $product->user_message = $product->title . \" is currently marked as unavailable for open registration or display. Normal users will not see this event.\";\n } else {\n flash(\"error\", $product->title . \" \" . gt(\"registration is currently unavailable for registration.\"));\n expHistory::back();\n }\n }",
" $order_registrations = array();\n $count = 1;\n if (!empty($this->params['orderitem_id'])) { // editing an event already in the cart?\n $f = new forms($product->forms_id);\n $loc_data = new stdClass();\n $loc_data->order_id = $order->id;\n $loc_data->orderitem_id = $this->params['orderitem_id'];\n $loc_data->event_id = $product->id;\n $locdata = serialize($loc_data);\n// $order_registrations = $db->selectObjects('forms_' . $f->table_name, \"location_data='\" . $locdata . \"'\");\n $order_registrations = $f->getRecords(\"location_data='\" . $locdata . \"'\");",
"// $registrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order->id}' AND orderitem_id =\" . $this->params['orderitem_id'] . \" AND event_id =\" . $product->id);\n// if (!empty($registrants)) foreach ($registrants as $registrant) {\n// $order_registrations[] = expUnserialize($registrant->value);\n// }\n $item = $order->isItemInCart($product->id, $product->product_type, $this->params['orderitem_id']);\n if (!empty($item)) {\n $params['options'] = $item->opts;\n assign_to_template(array(\n 'params'=> $params,\n 'orderitem_id'=>$item->id\n ));\n $count = $item->quantity;\n }\n }",
" //eDebug($product, true);\n assign_to_template(array(\n 'product'=> $product,\n// 'record'=> $record,\n 'registered' => $order_registrations,\n 'count' => $count,\n ));\n }",
" function showByTitle() {\n global $order, $template, $user;\n expHistory::set('viewable', $this->params);\n if (!empty($this->params['token'])) {\n $record = expSession::get(\"last_POST_Paypal\");\n } else {\n $record = expSession::get(\"last_POST\");\n }\n $product = new eventregistration(addslashes($this->params['title']));",
" //TODO should we pull in an existing reservation already in the cart to edit? e.g., the registrants\n //FIXME we only have 0=active & 2=inactive ???\n if ($product->active_type == 1) {\n $product->user_message = \"This event is temporarily unavailable for registration.\";\n } elseif ($product->active_type == 2) {\n if ($user->isAdmin()) {\n $product->user_message = $product->title . \" is currently marked as unavailable for open registration or display. Normal users will not see this event.\";\n } else {\n flash(\"error\", $product->title . \" \" . gt(\"registration is currently unavailable.\"));\n expHistory::back();\n }\n }",
" //eDebug($product, true);\n assign_to_template(array(\n 'product'=> $product,\n 'record'=> $record\n ));\n }",
" function manage() {\n global $user;",
" expHistory::set('viewable', $this->params);\n $limit = (!empty($this->config['limit'])) ? $this->config['limit'] : 10;",
" $pass_events = array();\n if (!empty($this->params['past']) && $user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate <= time() && $event->eventenddate <= time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n } else {\n if ($user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n } else {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\", $limit);\n }\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($user->isAdmin()) {\n $endtime = $event->eventenddate;\n } else {\n $endtime = $event->signup_cutoff;\n }\n if ($event->eventdate > time() && $endtime > time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n }\n foreach ($pass_events as $key=>$pass_event) {\n $pass_events[$key]->number_of_registrants = $pass_event->countRegistrants();\n }\n // echo \"<pre>\";\n // print_r($pass_events);\n // exit();\n // uasort($pass_events,'compare');\n //eDebug($this->config['limit'], true);\n $page = new expPaginator(array(\n 'records'=>$pass_events,\n 'limit'=>$limit,\n 'order'=>\"eventdate ASC\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view'],\n 'columns'=>array(\n gt('Event')=>'title',\n gt('Date')=>'eventdate',\n gt('Seats')=>'quantity'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'admin'=> $user->isAdmin(),\n 'past'=> !empty($this->params['past'])\n ));\n }",
" function metainfo() {\n global $router;\n if (empty($router->params['action'])) return false;",
" // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'showall':\n case 'eventsCalendar':\n case 'upcomingEvents':\n $metainfo['title'] = gt('Event Registration') . ' - ' . $storename;\n $metainfo['keywords'] = gt('event registration online');\n $metainfo['description'] = gt(\"Make an event registration\");\n break;\n case 'show':\n case 'showByTitle':\n if (isset($router->params['id']) || isset($router->params['title'])) {\n $lookup = isset($router->params['id']) ? $router->params['id'] : $router->params['title'];\n $object = new eventregistration($lookup);\n // set the meta info\n if (!empty($object)) {\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n if (!empty($object->expTag)) {\n $keyw = '';\n foreach ($object->expTag as $tag) {\n if (!empty($keyw)) $keyw .= ', ';\n $keyw .= $tag->title;\n }\n } else {\n $keyw = SITE_KEYWORDS;\n }\n $metainfo['title'] = empty($object->meta_title) ? $object->title . \" - \" . $storename : $object->meta_title;\n $metainfo['keywords'] = empty($object->meta_keywords) ? $keyw : $object->meta_keywords;\n $metainfo['description'] = empty($object->meta_description) ? $desc : $object->meta_description;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical;\n $metainfo['canonical'] = empty($object->canonical) ? $router->plainPath() : $object->canonical;\n $metainfo['noindex'] = empty($object->meta_noindex) ? false : $object->meta_noindex;\n $metainfo['nofollow'] = empty($object->meta_nofollow) ? false : $object->meta_nofollow;\n }\n break;\n }\n default:\n $metainfo['title'] = self::displayname() . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }",
" return $metainfo;\n }",
" function eventregistration_process() { // FIXME only used by the eventregistration_form view (no method)\n global $db, $user, $order;",
" //Clear the cart first\n foreach ($order->orderitem as $orderItem) {\n $orderItem->delete();\n }\n $order->refresh();",
" eDebug($order, true);",
" expHistory::set('viewable', $this->params);\n expSession::set('last_POST_Paypal', $this->params);\n expSession::set('terms_and_conditions', $product->terms_and_condition); //FIXME $product doesn't exist\n expSession::set('paypal_link', makeLink(array('controller'=> 'eventregistration', 'action'=> 'show', 'title'=> $product->sef_url)));",
" //Validation for customValidation\n foreach ($this->params['event'] as $key => $value) {\n $expField = $db->selectObject(\"expDefinableFields\", \"name = '{$key}'\");\n $expFieldData = expUnserialize($expField->data);\n if (!empty($expFieldData->customvalidation)) {",
" $customValidation = \"is_valid_\" . $expFieldData->customvalidation;\n $fieldname = $expField->name;\n $obj = new stdClass();\n $obj->$fieldname = $value;\n if ($fieldname == \"email\") { //Change this to much more loose coding\n $ret = expValidator::$customValidation($fieldname, $this->params['event']['email'], $this->params['event']['email_confirm']);\n } else {\n $ret = expValidator::$customValidation($fieldname, $obj, $obj);\n }\n if (strlen($ret) > 1) {",
" expValidator::failAndReturnToForm($ret, $this->params);\n }\n }",
" if (@$expFieldData->minimum_size > 0 || @$expFieldData->maximum_size > 0) {\n $ret = expValidator::check_size_of($expFieldData->identifier, $value, $expFieldData->minimum_size, $expFieldData->maximum_size);",
" if (strlen($ret) > 1) {\n expValidator::failAndReturnToForm($ret, $this->params);\n }\n }\n }",
" $event = new eventregistration();\n //Validation for ticker types\n if (isset($this->params['ticket_types']) && empty($this->params['options'])) {\n expValidator::failAndReturnToForm(\"Invalid ticket types.\", $this->params);\n }",
"// if (!empty($this->params['event'])) {\n $sess_id = session_id();\n// $sess_id = expSession::getTicketString();\n// $data = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order->id}' AND event_id =\" . $this->params['eventregistration']['product_id']);\n $data = $event->getRecords(\"connector_id ='{$order->id}' AND event_id =\" . $this->params['eventregistration']['product_id']);\n //FIXME change this to forms table\n if (!empty($data)) {\n foreach ($data as $item) {\n if (!empty($this->params['event'][$item->control_name])) {\n $item->value = $this->params['event'][$item->control_name];\n// $db->updateObject($item, \"eventregistration_registrants\");\n $event->updateRecord($item);\n }\n }\n } else {\n if (!empty($this->params['event'])) foreach ($this->params['event'] as $key => $value) {\n $obj = new stdClass();\n $obj->event_id = $this->params['eventregistration']['product_id'];\n $obj->control_name = $key;\n $obj->value = $value;\n $obj->connector_id = $order->id;\n $obj->registered_date = time();\n// $db->insertObject($obj, \"eventregistration_registrants\");\n $event->insertRecord($obj);\n } else {\n $obj = new stdClass();\n $obj->event_id = $this->params['eventregistration']['product_id'];\n $obj->connector_id = $order->id;\n $obj->registered_date = time();\n// $db->insertObject($obj, \"eventregistration_registrants\");\n $event->insertRecord($obj);\n }\n }\n expSession::set('session_id', $sess_id);\n// }",
" //Add to Cart\n $product_id = $this->params['eventregistration']['product_id'];\n $product_type = \"eventregistration\";\n $product = new $product_type($product_id, true, true);",
" if ($this->params['options']) {\n $this->params['eventregistration']['options'] = $this->params['options'];\n $this->params['eventregistration']['options_quantity'] = $this->params['options_quantity'];\n $product->addToCart($this->params['eventregistration']);\n } else {\n $this->params['eventregistration']['qtyr'] = $this->params['theValue'] + 1;\n $product->addToCart($this->params['eventregistration']);\n }",
" $order->calculateGrandTotal();\n $order->setOrderType($this->params);\n $order->setOrderStatus($this->params);",
" $billing = new billing();\n $result = $billing->calculator->preprocess($billing->billingmethod, $opts, $this->params, $order); //FIXME $opts doesn't exist\n redirect_to(array('controller'=> 'cart', 'action'=> 'preprocess'));\n }",
" function delete() {\n redirect_to(array('controller'=> 'eventregistration', 'action'=> 'showall'));\n }",
" function view_registrants() {\n expHistory::set('viewable', $this->params);\n $event = new eventregistration($this->params['id']);\n //Get all the registrants in the event\n// $registrants = $event->getRegistrants();\n assign_to_template(array(\n 'event'=> $event,\n 'registrants'=> $event->getRegistrants(),\n 'count'=> $event->countRegistrants(),\n// 'header'=> $header,\n// 'body'=> $body,\n// 'email'=> $email\n ));",
"// $order_ids_complete = $db->selectColumn(\"eventregistration_registrants\", \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"registered_date\", true);\n// $orders = new order();\n// foreach ($order_ids_complete as $item) {\n// $connector = expUnserialize($item);\n//// $odr = $db->selectObject(\"orders\", \"id = {$item} and invoice_id <> 0\");\n//// $odr = $db->selectObject(\"orders\", \"id ='{$item}' and invoice_id <> 0\");\n// $odr = $orders->find(\"first\", \"id ='{$connector->order_id}' and invoice_id <> 0\");\n// if (!empty($odr) || strpos($connector->order_id, \"admin-created\") !== false) {\n// $order_ids[] = $connector->order_id;\n// }\n// }\n//\n// $header = array();\n// $control_names = array();\n// $header[] = 'Date Registered';\n// //Check if it has ticket types\n// if ($event->hasOptions()) {\n// $header[] = \"Types\"; //Add some configuration here\n// }\n// //Get the input labels as table headers\n// if (!empty($event->expDefinableField['registrant'])) foreach ($event->expDefinableField['registrant'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption;\n// } else {\n// $header[] = $field->name;\n// }\n// $control_names[] = $field->name;\n// }\n//\n// //Check if there are guests using expDefinableFields\n// if (!empty($event->num_guest_allowed)) {\n// for ($i = 1; $i <= $event->num_guest_allowed; $i++) {\n// if (!empty($event->expDefinableField['guest'])) foreach ($event->expDefinableField['guest'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption . \"_$i\";\n// } else {\n// $header[] = $field->name . \"_$i\";\n// }\n// $control_names[] = $field->name . \"_$i\";\n// }\n// }\n// }\n//\n// // new method to check for guests/registrants in eventregistration_registrants\n//// if (!empty($event->num_guest_allowed)) {\n// $registrants = array();\n// if (!empty($event->quantity)) {\n// $registered = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $newregistrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order_id}'\");\n// $registered = array_merge($registered,$newregistrants);\n// }\n// foreach ($registered as $person) {\n// $registrants[$person->id] = expUnserialize($person->value);\n// }\n// }\n//\n// //Get the data and registrant emails\n// $email = array();\n// $num_of_guest_fields = 0;\n// $num_of_guest = 0;\n// $num_of_guest_total = 0;\n//\n// $body = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $body[$order_id][] = date(\"M d, Y h:i a\", $db->selectValue(\"eventregistration_registrants\", \"registered_date\", \"event_id = {$event->id} AND connector_id = '{$order_id}'\"));\n// if ($event->hasOptions()) {\n// $or = new order($order_id);\n// $orderitem = new orderitem();\n// if (isset($or->orderitem[0])) {\n// $body[$order_id][] = $orderitem->getOption($or->orderitem[0]->options);\n// } else {\n// $body[$order_id][] = '';\n// }\n// }\n// foreach ($control_names as $control_name) {\n// $value = $db->selectValue(\"eventregistration_registrants\", \"value\", \"event_id = {$event->id} AND control_name ='{$control_name}' AND connector_id = '{$order_id}'\");\n// $body[$order_id][] = $value;\n// if (expValidator::isValidEmail($value) === true) {\n// $email[$value] = $value;\n// }\n// }\n//\n// if (!empty($order_id)) {\n// $num_of_guest_total += $db->countObjects(\"eventregistration_registrants\", \"event_id ={$event->id} AND control_name LIKE 'guest_%' AND connector_id = '{$order_id}'\");\n// }\n// } else $order_ids = array();\n//\n// // check numbers based on expDefinableFields\n// $num_of_guest_fields = $db->countObjects(\"content_expDefinableFields\", \"content_id ={$event->id} AND subtype='guest'\");\n// if ($num_of_guest_fields <> 0) {\n// $num_of_guest = $num_of_guest_total / $num_of_guest_fields;\n// } else {\n// $num_of_guest = 0;\n// }\n//\n// //Removed duplicate emails\n// $email = array_unique($email);\n//\n// $registered = count($order_ids) + $num_of_guest;\n// if (!empty($event->registrants)) {\n// $event->registrants = expUnserialize($event->registrants);\n// } else {\n// $event->registrants = array();\n// }\n//\n// $event->number_of_registrants = $registered;\n// assign_to_template(array(\n// 'event'=> $event,\n// 'registrants'=> $registrants,\n//// 'header'=> $header,\n//// 'body'=> $body,\n//// 'email'=> $email\n// ));\n }",
" public function delete_registrant() {\n// global $db;",
" $event = new eventregistration($this->params['event_id']);\n $f = new forms($event->forms_id);\n if (!empty($f->is_saved)) { // is there user input data\n// $db->delete('forms_' . $f->table_name, \"id='{$this->params['id']}'\");\n $f->deleteRecord($this->params['id']);\n } else {\n// $db->delete('eventregistration_registrants', \"id ='{$this->params['id']}'\");\n $event->deleteRecord($this->params['id']);\n }\n flash('message', gt(\"Registrant successfully deleted.\"));\n expHistory::back();\n }",
" public function edit_registrant() {\n// global $db;",
"// $event_id = $this->params['event_id'];\n// $connector_id = @$this->params['connector_id'];\n// if (empty($connector_id)) {\n// $connector_id = \"admin-created\" . mt_rand() . time(); //Meaning it is been added by admin\n// }\n// $reg_data = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$connector_id}'\");",
" $registrant = array();\n $event = new eventregistration($this->params['event_id']);\n if (!empty($this->params['id'])) {\n// $reg_data = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $f = new forms($event->forms_id);",
" // foreach ($reg_data as $item) {\n // $registrant[$item->control_name] = $item->value;\n // }\n// $registrant = expUnserialize($reg_data->value);\n if (!empty($f->is_saved)) {\n// $registrant = $db->selectObject('forms_' . $f->table_name, \"id ='{$this->params['id']}'\");\n $registrant = $f->getRecord($this->params['id']);\n// $registrant['id'] = $reg_data->id;\n// $eventid = $reg_data->event_id;\n// } else {\n// $eventid = $this->params['event_id'];\n } else {\n// $registrant = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $registrant = $event->getRecord($this->params['id']);\n }\n }",
" // eDebug($registrant, true);\n assign_to_template(array(\n 'registrant'=> $registrant,\n 'event'=> $event,\n// 'connector_id' => $connector_id\n ));\n }",
" public function update_registrant() {\n global $db, $user;",
" $event = new eventregistration($this->params['event_id']);\n // create a new order/invoice if needed\n if (empty($this->params['id'])) {\n //create new order\n $orderc= expModules::getController('order');\n $orderc->params = array(\n 'customer_type' => 1, // blank user/address\n 'addresses_id' => 0,\n 'order_status_id' => order::getDefaultOrderStatus(),\n 'order_type_id' => order::getDefaultOrderType(),\n 'no_redirect' => true,\n );\n $orderc_id = $orderc->save_new_order();\n //create new order item\n $orderc->params = array(\n 'orderid' => $orderc_id,\n 'product_id' => $event->id,\n 'product_type' => 'eventregistration',\n// 'products_price' => $event->getBasePrice(),\n// 'products_name' => $event->title,\n 'quantity' => $this->params['value'],\n 'no_redirect' => true,\n );\n $orderi_id = $orderc->save_order_item(); // will redirect us to the new order view\n }\n $f = new forms($event->forms_id);\n $registrant = new stdClass();\n// if (!empty($this->params['id'])) $registrant = $db->selectObject('forms_' . $f->table_name, \"id ='{$this->params['id']}'\");\n if (!empty($this->params['id'])) $registrant = $f->getRecord($this->params['id']);\n if (!empty($f->is_saved)) {\n $fc = new forms_control();\n $controls = $fc->find('all', \"forms_id=\" . $f->id . \" AND is_readonly=0\",'rank');\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, \"getFieldDefinition\"));\n if ($def != null) {\n $emailValue = htmlspecialchars_decode(call_user_func(array($control_type, 'parseData'), $c->name, $this->params['registrant'], true));\n $value = stripslashes(expString::escape($emailValue));\n $varname = $c->name;\n $registrant->$varname = $value;\n }\n }\n if (!empty($registrant->id)) {\n// $db->updateObject($registrant, 'forms_' . $f->table_name);\n $f->updateRecord($registrant);\n } else { // create new registrant record\n $loc_data = new stdClass();\n// $loc_data->order_id = 'admin-created';\n// $loc_data->orderitem_id = 'admin-created';\n $loc_data->order_id = $orderc_id;\n $loc_data->orderitem_id = $orderi_id;\n $loc_data->event_id = $this->params['event_id'];\n $locdata = serialize($loc_data);\n $registrant->ip = $_SERVER['REMOTE_ADDR'];\n $registrant->referrer = $this->params['event_id'];\n $registrant->timestamp = time();\n if (expSession::loggedIn()) {\n $registrant->user_id = $user->id;\n } else {\n $registrant->user_id = 0;\n }\n $registrant->location_data = $locdata;\n// $db->insertObject($registrant, 'forms_' . $f->table_name);\n $f->insertRecord($registrant);\n }\n } else {\n// $registrant = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $registrant = $event->getRecord($this->params['id']);\n if (!is_object($registrant)) $registrant = new stdClass();\n $registrant->control_name = $this->params['control_name'];\n //FIXME if $registrant->value != $this->params['value'] update order/invoice w/ new quantity???\n $registrant->value = $this->params['value'];\n if (!empty($registrant->id)) {\n// $db->updateObject($registrant, \"eventregistration_registrants\");\n $event->updateRecord($registrant);\n } else { // create new registrant record\n $registrant->event_id = $this->params['event_id'];\n// $registrant->connector_id = 'admin-created';\n// $registrant->orderitem_id = 'admin-created';\n $registrant->registered_date = time();\n $registrant->connector_id = $orderc_id;\n $registrant->orderitem_id = $orderi_id;\n// $db->insertObject($registrant, \"eventregistration_registrants\");\n $event->insertRecord($registrant);\n }\n }\n redirect_to(array('controller'=> 'eventregistration', 'action'=> 'view_registrants', 'id'=> $this->params['event_id']));\n }",
" public function export() {\n// global $db;",
" $event = new eventregistration($this->params['id']);",
" $registrants = $event->getRegistrants();\n $f = new forms($event->forms_id);\n// $registrants = array();\n// if (!empty($f->is_saved)) { // is there user input data\n// $registrants = $db->selectObjects('forms_' . $f->table_name, \"referrer = {$event->id}\", \"timestamp\");\n// } else {\n// $registrants = $db->selectObjects('eventregistration_registrants', \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"timestamp\");\n// }\n// foreach ($registrants as $key=>$registrant) {\n// $order_data = expUnserialize($registrant->location_data);\n// if (is_numeric($order_data->order_id)) {\n// $order = new order($order_data->order_id);\n// $billingstatus = expUnserialize($order->billingmethod[0]->billing_options);\n// $registrants[$key]->payment = !empty($billingstatus->payment_due) ? gt('payment due') : gt('paid');\n// } else {\n// $registrants[$key]->payment = '???';\n// }\n// }",
"// $sql = \"SELECT connector_id FROM \" . $db->prefix . \"eventregistration_registrants GROUP BY connector_id\";\n// $order_ids_complete = $db->selectColumn(\"eventregistration_registrants\", \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"registered_date\", true);\n//\n// $orders = new order();\n// foreach ($order_ids_complete as $item) {\n//// $odr = $db->selectObject(\"orders\", \"id = {$item} and invoice_id <> 0\");\n// $odr = $orders->find(\"first\", \"id ='{$item}' and invoice_id <> 0\");\n// if (!empty($odr) || strpos($item, \"admin-created\") !== false) {\n// $order_ids[] = $item;\n// }\n// }\n//\n// $header = array();\n// $control_names = array();\n// $header[] = '\"Date Registered\"';\n// //Check if it has ticket types\n// if ($event->hasOptions()) {\n// $header[] = '\"Ticket Types\"'; //Add some configuration here\n// }\n//\n// if (!empty($event->expDefinableField['registrant'])) foreach ($event->expDefinableField['registrant'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = '\"' . $data->caption . '\"';\n// } else {\n// $header[] = '\"' . $field->name . '\"';\n// }\n// $control_names[] = $field->name;\n// }",
" //FIXME we don't have a 'guest' definable field type\n// if ($event->num_guest_allowed > 0) {\n// for ($i = 1; $i <= $event->num_guest_allowed; $i++) {\n// if (!empty($event->expDefinableField['guest'])) foreach ($event->expDefinableField['guest'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption . \"_$i\";\n// } else {\n// $header[] = $field->name . \"_$i\";\n// }\n// $control_names[] = $field->name . \"_$i\";\n// }\n//\n// }\n// }",
" // new method to check for guests/registrants\n// if (!empty($event->num_guest_allowed)) {\n// if (!empty($event->quantity)) {\n// $registered = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $newregistrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order_id}'\");\n// $registered = array_merge($registered,$newregistrants);\n// }\n//// $registrants = array();\n// foreach ($registered as $key=>$person) {\n// $registered[$key]->person = expUnserialize($person->value);\n// }\n if (!empty($f->is_saved)) {\n $controls = $event->getAllControls();\n if ($f->column_names_list == '') {\n //define some default columns...\n foreach ($controls as $control) {\n $rpt_columns[$control->name] = $control->caption;\n }\n } else {\n $rpt_columns2 = explode(\"|!|\", $f->column_names_list);\n $fc = new forms_control();\n foreach ($rpt_columns2 as $column) {\n $control = $fc->find('first', \"forms_id=\" . $f->id . \" AND name = '\" . $column . \"' AND is_readonly = 0 AND is_static = 0\", \"rank\");\n if (!empty($control)) {\n $rpt_columns[$control->name] = $control->caption;\n } else {\n switch ($column) {\n case 'ip':\n $rpt_columns[$column] = gt('IP Address');\n break;\n case 'referrer':\n $rpt_columns[$column] = gt('Event ID');\n break;\n case 'user_id':\n $rpt_columns[$column] = gt('Posted by');\n break;\n case 'timestamp':\n $rpt_columns[$column] = gt('Registered');\n break;\n }\n }\n }\n }\n $rpt_columns['payment'] = gt('Paid?');\n $fc = new forms_control();\n foreach ($rpt_columns as $column_name=>$column_caption) {\n if ($column_name == \"ip\" || $column_name == \"referrer\" || $column_name == \"location_data\") {\n } elseif ($column_name == \"user_id\") {\n foreach ($registrants as $key => $item) {\n if ($item->$column_name != 0) {\n $locUser = user::getUserById($item->$column_name);\n $item->$column_name = $locUser->username;\n } else {\n $item->$column_name = '';\n }\n $registrants[$key] = $item;\n }\n } elseif ($column_name == \"timestamp\") {\n foreach ($registrants as $key => $item) {\n $item->$column_name = strftime(\"%m/%d/%y %T\", $item->$column_name); // needs to be in a machine readable format\n $registrants[$key] = $item;\n }\n } else {\n $control = $fc->find('first', \"name='\" . $column_name . \"' AND forms_id=\" . $this->params['id'],'rank');\n if ($control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n foreach ($registrants as $key => $item) {\n $item->$column_name = call_user_func(array($control_type, 'templateFormat'), $item->$column_name, $ctl);\n $registrants[$key] = $item;\n }\n }\n }\n }\n } else {\n $rpt_columns = array(\n 'user' => gt('Name'),\n 'qty' => gt('Quantity'),\n 'registered_date' => gt('Registered'),\n 'payment' => gt('Paid?'),\n );\n foreach ($registrants as $key=>$registrant) {\n $registrants[$key]->registered_date = strftime(DISPLAY_DATETIME_FORMAT, $registrants[$key]->registered_date);\n }\n }\n// $header = array(); //FIXME reset & pulled from above\n// $header[] = gt('IP Address'); //FIXME\n// $header[] = gt('Event');\n// $header[] = gt('Date Registered');\n// $header[] = gt('User');\n// $header[] = gt('Location');\n// foreach ($controls as $control) {\n// $header[] = $control->caption;\n// }\n// }",
" if (LANG_CHARSET == 'UTF-8') {\n $out = chr(0xEF).chr(0xBB).chr(0xBF); // add utf-8 signature to file to open appropriately in Excel, etc...\n } else {\n $out = \"\";\n }\n// $out .= implode(\",\", $header);\n// $out .= \"\\n\";\n// $body = '';\n// foreach ($order_ids as $order_id) {\n// $body .= '\"' . date(\"M d, Y h:i a\", $db->selectValue(\"eventregistration_registrants\", \"registered_date\", \"event_id = {$event->id} AND connector_id = '{$order_id}'\")) . '\",';\n//\n// if ($event->hasOptions()) {\n// $or = new order($order_id);\n// $orderitem = new orderitem();\n// if (isset($or->orderitem[0])) {\n// $body .= '\"' . str_replace(\"<br />\", \" \", $orderitem->getOption($or->orderitem[0]->options)) . '\",';\n// ;\n// } else {\n// $body .= '\"\",';\n// }\n// }\n//\n// foreach ($control_names as $control_name) {\n// $value = $db->selectValue(\"eventregistration_registrants\", \"value\", \"event_id = {$event->id} AND control_name ='{$control_name}' AND connector_id = '{$order_id}'\");\n// $body .= '\"' . iconv(\"UTF-8\", \"ISO-8859-1\", $value) . '\",';\n// }\n// $body = substr($body, 0, -1) . \"\\n\";\n// }\n// foreach ($registrants as $person) {\n// $body .= '\"' . date(\"M d, Y h:i a\", $person->registered_date) . '\",';\n// foreach ($person->person as $value) {\n//// $body .= '\"' . iconv(\"UTF-8\", \"ISO-8859-1\", $value) . '\",';\n// $body .= '\"' . $value . '\",';\n// }\n// $body = substr($body, 0, -1) . \"\\n\";\n// }\n// $out .= $body;\n $out .= formsController::sql2csv($registrants, $rpt_columns);",
" $fn = str_replace(' ', '_', $event->title) . '_' . gt('Roster') . '.csv';",
"\t\t// CREATE A TEMP FILE\n\t\t$tmpfname = tempnam(getcwd(), \"rep\"); // Rig",
"\t\t$handle = fopen($tmpfname, \"w\");\n\t\tfwrite($handle,$out);\n\t\tfclose($handle);",
"\t\tif(file_exists($tmpfname)) {\n // NO buffering from here on out or things break unexpectedly. - RAM\n ob_end_clean();",
" // This code was lifted from phpMyAdmin, but this is Open Source, right?\n // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n // It seems that other headers I've added make IE prefer octet-stream again. - RAM\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : 'text/comma-separated-values;';\n header('Content-Type: ' . $mime_type . ' charset=' . LANG_CHARSET. \"'\");\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Content-length: '.filesize($tmpfname));\n header('Content-Transfer-Encoding: binary');\n header('Content-Encoding:');\n header('Content-Disposition: attachment; filename=\"' . $fn . '\";');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }\n //Read the file out directly\n readfile($tmpfname);",
"// if (DEVELOPMENT == 0) exit();\n unlink($tmpfname);\n exit();\n }\n }",
" public function get_guest_controls($ajax = '') { //FIXME this is never used\n $id = $this->params['id'];\n $ctr = $this->params['counter'];\n $event = new eventregistration($id);",
" $str = \"\";\n foreach ($event->expDefinableField['guest'] as $field) {\n $str = $str . $event->showControl($field, $field->name . \"_\" . $ctr);\n }",
" echo $str;\n exit();\n }",
" function emailRegistrants() {",
" if (empty($this->params['email_addresses'])) {\n flash('error', gt('Please add at least one email.'));\n expHistory::back();\n }",
" if (empty($this->params['email_subject']) || empty($this->params['email_message'])) {\n flash('error', gt('Nothing to Send! Please enter subject and message.'));\n expHistory::back();\n }",
"// $email_arr = explode(\"|!|\", $this->params['email_addresses']);\n $email_addy = array_flip(array_flip($this->params['email_addresses']));\n $email_addy = array_map('trim', $email_addy);\n $email_addy = array_filter($email_addy);",
" $headers = array(\n \"MIME-Version\" => \"1.0\",\n \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n );",
" $mail = new expMail();",
"// foreach ($this->params['expFile']['attachments'] as $attach) {\n// $expFile = new expFile($attach);\n// if (!empty($expFile->id)) {\n// $mail->attach_file_on_disk($expFile->path, $expFile->mimetype);\n// }\n// }\n if (!empty($_FILES['attach']['size'])) {\n $dir = 'tmp';\n $filename = expFile::fixName(time() . '_' . $_FILES['attach']['name']);\n $dest = $dir . '/' . $filename;\n //Check to see if the directory exists. If not, create the directory structure.\n if (!file_exists(BASE.$dir)) expFile::makeDirectory($dir);\n // Move the temporary uploaded file into the destination directory, and change the name.\n $file = expFile::moveUploadedFile($_FILES['attach']['tmp_name'], BASE . $dest);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $ftype = finfo_file($finfo, BASE.$dest);\n// finfo_close($finfo);\n if (!empty($file)) $mail->attach_file_on_disk(BASE . $file, expFile::getMimeType(BASE . $file));\n }",
" $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickBatchSend(array(\n \t'headers'=>$headers,\n 'html_message'=> $this->params['email_message'],\n 'text_message'=> strip_tags(str_replace(\"<br>\", \"\\r\\n\", $this->params['email_message'])),\n 'to' => $email_addy,\n 'from' => $from,\n 'subject' => $this->params['email_subject']\n ));\n if (!empty($file)) unlink(BASE . $file); // delete temp file attachment\n flash('message', gt(\"You're email to event registrants has been sent.\"));\n expHistory::back();\n }",
" /**\n * function to return event registrations as calendar events\n *\n * @param $startdate\n * @param $enddate\n * @param string $color\n *\n * @return array\n */\n static function getRegEventsForDates($startdate, $enddate, $color=\"#FFFFFF\") {\n $er = new eventregistration();\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0');\n $pass_events = array();\n foreach ($events as $event) {\n if ($event->eventdate >= $startdate && $event->eventdate <= $enddate) {\n $newevent = new stdClass();\n $newevent->eventdate = new stdClass();\n $newevent->eventdate->date = $event->eventdate;\n $newevent->eventstart = $event->event_starttime + $event->eventdate;\n $newevent->eventend = $event->event_endtime + $event->eventdate;\n $newevent->title = $event->title;\n $newevent->body = $event->body;\n $newevent->location_data = 'eventregistration';\n $newevent->color = $color;\n $newevent->expFile = $event->expFile['mainimage'];\n $pass_events[$event->eventdate][] = $newevent;\n }\n }\n return $pass_events;\n }",
" /*\n * Helper function for the Calendar view\n */\n function getEventsForDates($edates, $sort_asc = true) {\n global $db;",
" $events = array();\n foreach ($edates as $edate) {\n// if (!isset($this->params['cat'])) {\n// if (isset($this->params['title']) && is_string($this->params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $this->params['title'] . \"'\");\n// } elseif (!empty($this->config['category'])) {\n// $default_id = $this->config['category'];\n// } elseif (ecomconfig::getConfig('show_first_category')) {\n// $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n// } else {\n// $default_id = 0;\n// }\n// }\n//\n// $parent = isset($this->params['cat']) ? intval($this->params['cat']) : $default_id;\n//\n// $category = new storeCategory($parent);",
" $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n// $sql .= 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 ';\n// $sql .= ' AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN ' . $category->lft . ' AND ' . $category->rgt . ')';\n// if ($category->hide_closed_events) {\n// $sql .= ' AND er.signup_cutoff > ' . time();\n// }\n// $sql .= ' AND er.id = ' . $edate->id;\n $sql .= ' AND er.id = ' . $edate->product_type_id;",
" $order = 'event_starttime';\n $dir = 'ASC';",
" $o = $db->selectObjectBySql($sql);\n $o->eventdate = $edate->eventdate;\n $o->eventstart = $edate->event_starttime + $edate->eventdate;\n $o->eventend = $edate->event_endtime + $edate->eventdate;\n $o->expFile = $edate->expFile;\n $events[] = $o;\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }",
" // create a pseudo global view_registrants permission\n public static function checkPermissions($permission,$location) {\n global $exponent_permissions_r, $router;",
" // only applies to the 'view_registrants' method\n if (empty($location->src) && empty($location->int) && $router->params['action'] == 'view_registrants') {\n if (!empty($exponent_permissions_r['eventregistration'])) foreach ($exponent_permissions_r['eventregistration'] as $page) {\n foreach ($page as $pageperm) {\n if (!empty($pageperm['view_registrants']) || !empty($pageperm['manage'])) return true;\n }\n }\n }\n return false;\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class orderController extends expController {",
" protected $add_permissions = array(",
" 'showall' => 'Manage',\n 'show' => 'View Orders',",
" 'setStatus' => 'Change Status',\n 'edit_payment_info' => 'Edit Payment Info',\n 'save_payment_info'=> 'Save Payment Info',\n 'edit_address' => 'Edit Address',\n 'save_address'=> 'Save Address',\n 'edit_order_item' => 'Edit Order Item',\n 'save_order_item'=> 'Save Order Item',\n 'add_order_item' => 'Add Order Item',\n 'save_new_order_item'=> 'Save New Order Item',\n 'edit_totals' => 'Edit Totals',\n 'save_totals'=> 'Save Totals',\n 'edit_invoice_id' => 'Edit Invoice Id',\n 'save_invoice_id'=> 'Save Invoice Id',\n 'update_sales_reps' => 'Manage Sales Reps',\n 'quickfinder'=> 'Do a quick order lookup',\n 'edit_shipping_method'=> 'Edit Shipping Method',\n 'save_shipping_method'=> 'Save Shipping Method',\n 'create_new_order' => 'Create A New Order',\n 'save_new_order'=> 'Save a new order',\n 'createReferenceOrder'=> 'Create Reference Order',\n 'save_reference_order'=> 'Save Reference Order'",
" );",
" static function displayname() {\n return gt(\"e-Commerce Order Manager\");\n }",
" static function description() {\n return gt(\"Use this module to manage the orders from your ecommerce store.\");\n }",
" function showall() {\n global $db;",
" expHistory::set('viewable', $this->params);",
" // remove abaondoned carts\n /*$count = $db->countObjects('orders', 'purchased=0');\n for($i=0; $i<$count; $i++) {\n // get the cart\n $cart = $db->selectObject('orders','purchased=0');",
" ",
" // check to make sure this isn't an active session\n $ticket = $db->selectObject('sessionticket', \"ticket='\".$cart->sessionticket_ticket.\"'\");\n if (empty($ticket)) {\n // delete all the order items for this cart and their shippingmethods\n foreach($db->selectObjects('orderitems', 'orders_id='.$cart->id) as $oi) {\n $db->delete('shippingmethods', 'id='.$oi->shippingmethods_id);",
" $db->delete('orderitems', 'orders_id='.$cart->id); ",
" }",
" ",
" // delete the billing methods for this cart.\n $db->delete('billingmethods', 'orders_id='.$cart->id);\n $db->delete('orders', 'id='.$cart->id);",
" } \n ",
" } */",
" // find orders with a \"closed\" status type\n// $closed_count = 0;\n if (empty($this->params['showclosed'])) {\n $closed_status = $db->selectColumn('order_status', 'id', 'treat_as_closed=1');\n $closed_status = implode(',',$closed_status);\n// $status_where = '';\n $status_where = ' AND order_status_id NOT IN (' . $closed_status . ')';",
"// foreach ($closed_status as $status) {\n// if (empty($status_where)) {\n// $status_where .= ' AND (order_status_id!=' . $status;\n// } else {\n// $status_where .= ' AND order_status_id!=' . $status;\n// }\n// $closed_count += $db->countObjects('orders', 'order_status_id=' . $status);\n// }\n $closed_count = $db->countObjects('orders', 'order_status_id IN (' . $closed_status . ')');\n } else {\n $status_where = '';\n $closed_count = -1;\n }",
" // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT o.*, b.firstname as firstname, b.billing_cost as total, b.transaction_state as paid, b.billingcalculator_id as method, b.middlename as middlename, b.lastname as lastname, os.title as status, ot.title as order_type ';\n $sql .= 'FROM ' . $db->prefix . 'orders o, ' . $db->prefix . 'billingmethods b, ';\n $sql .= $db->prefix . 'order_status os, ';\n $sql .= $db->prefix . 'order_type ot ';\n $sql .= 'WHERE o.id = b.orders_id AND o.order_status_id = os.id AND o.order_type_id = ot.id AND o.purchased > 0';\n //FIXME this sql isn't correct???\n// if (!empty($status_where)) {\n// $status_where .= ')';\n $sql .= $status_where;\n// }\n if (ECOM_LARGE_DB) {\n $limit = empty($this->config['limit']) ? 50 : $this->config['limit'];\n } else {\n $limit = 0; // we'll paginate on the page\n }\n //eDebug($sql, true);\n $page = new expPaginator(array(\n //'model'=>'order',\n 'sql' => $sql,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'limit' => $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Customer') => 'lastname',\n gt('Inv #') => 'invoice_id',\n gt('Total') => 'total',\n gt('Payment') => 'method',\n gt('Purchased') => 'purchased',\n gt('Type') => 'order_type_id',\n gt('Status') => 'order_status_id',\n gt('Ref') => 'orig_referrer',\n )\n ));\n //eDebug($page,true);\n assign_to_template(array(\n 'page' => $page,\n 'closed_count'=> $closed_count,\n 'new_order' => order::getDefaultOrderStatus()\n ));\n }",
" function show() {\n global $db, $user;\n//eDebug($_REQUEST);\n//eDebug($this->params,true);\n//if (!empty($this->params['printerfriendly'])) $_REQUEST['printerfriendly'] = 1;",
" expHistory::set('viewable', $this->params);",
" if (!empty($this->params['invoice']) && empty($this->params['id'])) {\n $ord = new order();\n $order = $ord->find('first', 'invoice_id=' . $this->params['invoice']);\n $this->params['id'] = $order->id;\n } elseif (!empty($this->params['id'])) {\n $order = new order($this->params['id']);\n }\n if (empty($order->id)) {\n flash('notice', gt('That order does not exist.'));\n expHistory::back();\n }",
" // We're forcing the location. Global store setting will always have this loc\n// $storeConfig = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));",
" $billing = new billing($this->params['id']);\n $status_messages = $db->selectObjects('order_status_messages');\n $order_type = $order->getOrderType();\n //eDebug($order->billingmethod[0]->billingtransaction);\n $order->billingmethod[0]->billingtransaction = array_reverse($order->billingmethod[0]->billingtransaction);\n if (empty($order->billingmethod[0]->billingtransaction[0]->billingcalculator_id)) {\n $calc_name = $order->billingmethod[0]->billingcalculator->calculator_name;\n $order->billingmethod[0]->billingtransaction[0]->billingcalculator = new $calc_name();\n }\n //eDebug($order->billingmethod[0]->billingtransaction);\n if (isset($this->params['printerfriendly']))\n $pf = $this->params['printerfriendly'];\n else\n $pf = 0;",
" $to_addresses[] = $order->billingmethod[0]->email;\n// $s = array_pop($order->shippingmethods); //FIXME we don't really want to 'pop' it off the object\n $s = reset($order->shippingmethods);\n if ($s->email != $order->billingmethod[0]->email) $to_addresses[] = $s->email;",
" $from_addresses = array();\n $from_addresses[SMTP_FROMADDRESS] = SMTP_FROMADDRESS;\n $from_addresses[ecomconfig::getConfig('from_address')] = ecomconfig::getConfig('from_address');\n $from_addresses[$user->email] = $user->email;\n $from_addresses['other'] = 'Other (enter below)';\n $from_addresses = array_filter($from_addresses);\n $from_default = ecomconfig::getConfig('from_address');\n $from_default = !empty($from_default) ? $from_default : SMTP_FROMADDRESS;",
" $email_subject = 'Message from ' . ecomconfig::getConfig('storename') . ' about your order (#' . $order->invoice_id . ')';",
" $order->setReferencingIds();",
" $css = file_get_contents(BASE . 'framework/modules/ecommerce/assets/css/print-invoice.css');",
" assign_to_template(array(\n 'css' => $css,\n 'pf' => $pf,\n 'order' => $order,\n 'order_user' => new user($order->user_id),\n// 'shipping' => $order->orderitem[0], //FIXME what about new orders with no items??\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n 'messages' => $status_messages,\n 'order_type' => $order_type,\n// 'storeConfig' => $storeConfig->config,\n 'sales_reps' => order::getSalesReps(),\n 'from_addresses' => $from_addresses,\n 'from_default' => $from_default,\n 'email_subject' => $email_subject,\n 'to_addresses' => implode(',', $to_addresses)\n ));\n if ($order->shipping_required) {\n assign_to_template(array(\n 'shipping' => $order->orderitem[0], //FIXME what about new orders with no items??\n ));\n }\n }",
" function myOrder() {\n global $user, $db;",
" $order = new order($this->params['id']);\n if ($order->purchased == 0)\n flashAndFlow('error', gt('You do not have permission to view this order.'));",
" $this->loc->src = \"@globalstoresettings\";",
" // We're forcing the location. Global store setting will always have this loc\n// $storeConfig = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));",
" //check here for the hash in the params, or session set w/ perms to view...shs = xaf7y0s87d7elshd70 etc\n //if present, prompt user for the order number and email address on the order\n //and if they pass, show the order to them. Need to maybe set something in the session then for subsequent",
" //viewing of the order? ",
" if ($user->id != $order->user_id) {\n if ($user->isAdmin()) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n } else {\n flashAndFlow('error', gt('You do not have permission to view this order.'));\n }\n }",
" expHistory::set('viewable', $this->params);",
" $billing = new billing($this->params['id']);\n $status_messages = $db->selectObjects('order_status_messages');\n $order_type = $order->getOrderType();\n $order->total_items = 0;\n foreach ($order->orderitem as $item) {\n $order->total_items += $item->quantity;\n $order->shipping_city = $item->shippingmethod->city;\n $order->shipping_state = $item->shippingmethod->state;\n }\n $state = new geoRegion($order->shipping_state);\n $country = new geoCountry($state->country_id);\n $order->shipping_country = $country->iso_code_3letter;\n $order->shipping_state = $state->name;",
" //eDebug($order,true);",
" $order->billingmethod[0]->billingtransaction = array_reverse($order->billingmethod[0]->billingtransaction);\n if (isset($this->params['printerfriendly'])) $pf = $this->params['printerfriendly'];\n else $pf = 0;\n $css = file_get_contents(BASE . 'framework/modules/ecommerce/assets/css/print-invoice.css');",
" $order->calculateGrandTotal();",
" $trackMe = false;\n if (isset($this->params['tc']) && $this->params['tc'] == 1) {\n if (expSession::is_set('orders_tracked')) {\n $trackingArray = expSession::get('orders_tracked');\n if (in_array($order->invoice_id, $trackingArray)) {\n $trackMe = false;\n } else {\n $trackMe = true;\n $trackingArray[] = $order->invoice_id;\n expSession::set('orders_tracked', $trackingArray);\n }\n } else {\n $trackMe = true;\n $trackingArray[] = $order->invoice_id;\n expSession::set('orders_tracked', $trackingArray);\n }\n }\n if (DEVELOPMENT != 0)\n $trackMe = false;\n assign_to_template(array(\n 'printerfriendly'=> $pf,\n 'css' => $css,\n 'order' => $order,\n 'shipping' => $order->orderitem[0],\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n 'order_type' => $order_type,\n// 'storeConfig' => $storeConfig->config,\n 'tc' => $trackMe,\n 'checkout' => !empty($this->params['tc']) //FIXME we'll use the tc param for now\n ));",
" }",
" function email() {\n global $template, $user;",
" // setup a template suitable for emailing\n $template = expTemplate::get_template_for_action($this, 'email_invoice', $this->loc);\n $order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n// if ($billing->calculator != null) {\n// $billinginfo = $billing->calculator->userView(unserialize($billing->billingmethod->billing_options));\n// } else {\n// if (empty($opts)) {\n// $billinginfo = false;\n// } else {\n// $billinginfo = gt(\"No Cost\");\n// if (!empty($opts->payment_due)) {\n// $billinginfo .= '<br>'.gt('Payment Due') . ': ' . expCore::getCurrencySymbol() . number_format($opts->payment_due, 2, \".\", \",\");\n// }\n// }\n// }\n $css = file_get_contents(BASE.'framework/modules/ecommerce/assets/css/print-invoice.css');\n assign_to_template(array(\n 'css' => $css,\n 'order' => $order,\n 'shipping' => $order->orderitem[0],\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n ));",
" // build the html and text versions of the message\n $html = $template->render();\n $txt = strip_tags($html);",
" // send email invoices to the admins if needed\n if (ecomconfig::getConfig('email_invoice') == true) {\n $addresses = explode(',', ecomconfig::getConfig('email_invoice_addresses'));\n foreach ($addresses as $address) {\n $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> $txt,\n 'to' => trim($address),\n 'from' => $from,\n 'subject' => 'An order was placed on the ' . ecomconfig::getConfig('storename'),\n ));\n }\n }",
" // email the invoice to the user if we need to\n if (ecomconfig::getConfig('email_invoice_to_user') == true && !empty($user->email)) {\n $usermsg = \"<p>\" . ecomconfig::getConfig('invoice_msg') . \"<p>\";\n $usermsg .= $html;\n// $usermsg .= ecomconfig::getConfig('ecomfooter');",
" $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $usermsg,\n 'text_message'=> $txt,\n 'to' => array(trim($user->email) => trim(user::getUserAttribution($user->id))),\n //'to'=>$order->billingmethod[0]->email,\n 'from' => $from,\n 'subject' => ecomconfig::getConfig('invoice_subject'),\n ));\n }\n }",
" function update_shipping() {\n $order = new order($this->params['id']);\n $this->params['shipped'] = datetimecontrol::parseData('shipped', $this->params);\n $order->update($this->params);\n flash('message', gt('Shipping information updated.'));\n expHistory::back();\n }",
" function getPDF($orders = null) {\n global $user, $timer;",
" $invoice = '<!DOCTYPE HTML><HTML><HEAD>';\n // the basic styles\n if (!bs3())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/normalize/normalize.css\" >';\n if (!bs())\n// $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/normalize/normalize.css\" >';\n if (bs2())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/bootstrap/css/bootstrap.css\" >';\n if (bs3())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/bootstrap3/css/bootstrap.css\" >';\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'framework/modules/ecommerce/assets/css/print-invoice.css\">\n <style>\n html{background:none;}\n #store-header{text-align:left;}\n </style>';\n $invoice .= '</HEAD><BODY>';\n if (is_array($orders)) {\n foreach ($orders as $order) {\n if ($user->isAdmin()) {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'show_printable', 'id'=> $order['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));",
" //eDebug($order['id'] . \": \" . $timer->mark()); ",
" } else {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'myOrder', 'view'=> 'show_printable', 'id'=> $order['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n }\n $invoice .= '<p style=\"page-break-before: always;\"></p>';\n }\n $invoice = substr($invoice, 0, (strlen($invoice) - 42));\n } else {\n if ($user->isAdmin()) {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'show_printable', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n } else {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'myOrder', 'view'=> 'show_printable', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n }\n }",
" $invoice .= \"</BODY></HTML>\";\n $invoice = mb_convert_encoding($invoice, 'HTML-ENTITIES', \"UTF-8\");\n // eDebug($invoice);\n $org_name = str_ireplace(\" \", \"_\", ORGANIZATION_NAME);",
" //eDebug(\"Here\",1);\n // Actually create/output the pdf file",
" /**\n * to do this same thing as below using html2pdf\n * //FIXME uncomment to implement, comment out above\n require_once(BASE.'external/html2pdf_v4.03/html2pdf.class.php');\n $html2pdf = new HTMLTPDF('P', 'LETTER', substr(LOCALE,0,2));\n $html2pdf->writeHTML($invoice);\n $html2pdf->Output($org_name . \"_Invoice\" . \".pdf\",HTMLTOPDF_OUTPUT?'D':'');\n exit();\n */\n /**\n * to do this same thing as below using dompdf\n * //FIXME uncomment to implement, comment out above\n require_once(BASE.'external/dompdf/dompdf_config.inc.php');\n $mypdf = new DOMPDF();\n $mypdf->load_html($invoice);\n $mypdf->set_paper('letter','portrait');\n $mypdf->render();\n $mypdf->stream($org_name . \"_Invoice\" . \".pdf\",array('Attachment'=>HTMLTOPDF_OUTPUT));\n exit();\n */\n /**\n * to do this same thing as below using expHtmlToPDF\n */\n $mypdf = new expHtmlToPDF('Letter','portrait',$invoice);\n $mypdf->createpdf('D',$org_name . \"_Invoice\" . \".pdf\");\n exit();",
" if (stristr(PHP_OS, 'Win')) {\n if (file_exists(HTMLTOPDF_PATH)) {\n do {\n $htmltopdftmp = HTMLTOPDF_PATH_TMP . mt_rand() . '.html';\n } while (file_exists($htmltopdftmp));\n }\n file_put_contents($htmltopdftmp, $invoice);",
" exec(HTMLTOPDF_PATH . \" \" . $htmltopdftmp . \" \" . HTMLTOPDF_PATH_TMP . $org_name . \"_Invoice.pdf\");\n $this->returnFile(HTMLTOPDF_PATH_TMP . $org_name . \"_Invoice.pdf\", $org_name . \"_Invoice.pdf\", \"pdf\");\n exit();\n } else {",
" //require_once(BASE.'external/tcpdf/config/lang/eng.php');\n //require_once(BASE.'external/tcpdf/tcpdf.php');",
" //----\n // create new PDF document\n /*$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);",
"// set document information\n$pdf->SetCreator(PDF_CREATOR);\n$pdf->SetAuthor('Nicola Asuni');\n$pdf->SetTitle('TCPDF Example 001');\n$pdf->SetSubject('TCPDF Tutorial');\n$pdf->SetKeywords('TCPDF, PDF, example, test, guide');",
"// set default header data\npdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);",
"// set header and footer fonts\n$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));\n$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));",
"// set default monospaced font\n$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);",
"//set margins\n$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);\n$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);\n$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);",
"// remove default header/footer\n$pdf->setPrintHeader(false);\n$pdf->setPrintFooter(false);",
"//set auto page breaks\n$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);",
"//set image scale factor\n$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);",
"//set some language-dependent strings\n$pdf->setLanguageArray($l);",
"// ---------------------------------------------------------",
"// set default font subsetting mode\n//$pdf->setFontSubsetting(true);",
"// Set font\n// dejavusans is a UTF-8 Unicode font, if you only need to\n// print standard ASCII chars, you can use core fonts like\n// helvetica or times to reduce file size.\n//$pdf->SetFont('helvetica', '', 14, '', true);",
"// Add a page\n// This method has several options, check the source code documentation for more information.\n$pdf->AddPage();\n//eDebug($invoice,1);\n// Print text using writeHTMLCell()\n//$pdf->writeHTML($w=0, $h=0, $x='', $y='', $invoice, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);\n$pdf->writeHTML($invoice);",
"// ---------------------------------------------------------",
"// Close and output PDF document\n// This method has several options, check the source code documentation for more information.\nob_clean();\n$pdf->Output('example_001.pdf', 'I');\nexit();\n//============================================================+\n// END OF FILE\n//============================================================+\n",
" ",
" // create new PDF document\n $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);",
" // set document information\n $pdf->SetCreator(PDF_CREATOR);\n $pdf->SetAuthor(ORGANIZATION_NAME);\n $pdf->SetTitle($org_name . \"_Invoice\");\n $pdf->SetSubject($org_name . \"_Invoice\");\n // remove default header/footer\n $pdf->setPrintHeader(false);\n $pdf->setPrintFooter(false);",
" // set default monospaced font\n $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);",
" //set margins\n $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);",
" //set auto page breaks\n $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);\n $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $invoice, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);\n $pdf->Output($org_name . \"_Invoice\" . \".pdf\", 'I');\n exit();*/\n eDebug(\"Done rendering invoice html. Starting PDF Generation: \" . $timer->mark());\n $pdfer = new expHtmlToPDF('Letter', 'Portrait', $invoice);\n// $pdfer->set_html($invoice);\n// $pdfer->set_orientation('Portrait');\n// $pdfer->set_page_size('Letter');\n $pdfer->set_grayscale(true);\n// $pdfer->render();\n eDebug(\"Done rendering PDF \" . $timer->mark());\n// exit();\n ob_clean();\n $pdfer->createpdf('D', $org_name . \"_Invoice\" . \".pdf\");\n exit();\n }\n }",
" private function returnFile($file, $name, $mime_type = '') {\n /*\n This function takes a path to a file to output ($file),\n the filename that the browser will see ($name) and\n the MIME type of the file ($mime_type, optional).",
" If you want to do something on download abort/finish,\n register_shutdown_function('function_name');\n */\n if (!is_readable($file)) die('File not found or inaccessible!');",
" $size = filesize($file);\n $name = rawurldecode($name);",
" /* Figure out the MIME type (if not specified) */\n $known_mime_types = array(\n \"pdf\" => \"application/pdf\",\n \"txt\" => \"text/plain\",\n \"html\" => \"text/html\",\n \"htm\" => \"text/html\",\n \"exe\" => \"application/octet-stream\",\n \"zip\" => \"application/zip\",\n \"doc\" => \"application/msword\",\n \"xls\" => \"application/vnd.ms-excel\",\n \"ppt\" => \"application/vnd.ms-powerpoint\",\n \"gif\" => \"image/gif\",\n \"png\" => \"image/png\",\n \"jpeg\" => \"image/jpg\",\n \"jpg\" => \"image/jpg\",\n \"php\" => \"text/plain\"\n );",
" if ($mime_type == '') {\n// $file_extension = strtolower(substr(strrchr($file, \".\"), 1));\n//\n// if (array_key_exists($file_extension, $known_mime_types)) {\n// $mime_type = $known_mime_types[$file_extension];\n// } else {\n// $mime_type = \"application/force-download\";\n// }\n $mime_type = expFile::getMimeType($file);\n }",
" //@ob_end_clean(); //turn off output buffering to decrease cpu usage\n // required for IE, otherwise Content-Disposition may be ignored\n if (ini_get('zlib.output_compression'))\n ini_set('zlib.output_compression', 'Off');",
" header('Content-Type: ' . $mime_type);\n header('Content-Disposition: attachment; filename=\"' . $name . '\"');\n header('Content-Transfer-Encoding: binary');\n header('Accept-Ranges: bytes');",
" /* The three lines below basically make the download non-cacheable */\n header('Cache-control: private');\n header('Pragma: private');\n// header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');",
" // multipart-download and download resuming support\n if (isset($_SERVER['HTTP_RANGE'])) {\n list($a, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);\n list($range) = explode(',', $range, 2);\n list($range, $range_end) = explode('-', $range);",
" $range = intval($range);",
" $range_end = (!$range_end) ? $size - 1 : intval($range_end);\n $new_length = $range_end - $range + 1;",
" header('HTTP/1.1 206 Partial Content');\n header('Content-Length: ' . $new_length);\n header('Content-Range: bytes ' . ($range - $range_end / $size));\n } else {\n $new_length = $size;",
" header('Content-Length: ' . $size);\n }",
" /* output the file itself */\n $chunksize = 1 * (1024 * 1024); //you may want to change this\n $bytes_send = 0;",
" if ($file = fopen($file, 'r')) {\n if (isset($_SERVER['HTTP_RANGE'])) fseek($file, $range);",
" while (!feof($file) && (!connection_aborted()) && ($bytes_send < $new_length)) {\n $buffer = fread($file, $chunksize);",
" print($buffer);\n flush();",
" $bytes_send += strlen($buffer);\n }",
" fclose($file);\n } else {\n die('Error - can not open file.');\n }\n }",
" function set_order_type() { //FIXME never used\n// global $db;",
" if (empty($this->params['id'])) expHistory::back();",
" // get the order and update the type\n $order = new order($this->params['id']);\n $order->order_type_id = $this->params['order_type_id'];\n $order->save();\n flash('message', gt('Invoice #') . $order->invoice_id . ' ' . gt('has been set to') . ' ' . $order->getOrderType());\n expHistory::back();\n }",
" /**\n * Change order status and email notification if necessary\n */\n function setStatus() {\n global $db, $template;",
" if (empty($this->params['id'])) expHistory::back();",
" // get the order and create a new order_Status_change\n $order = new order($this->params['id']);",
" //set order type\n if (isset($this->params['order_type_id'])) $order->order_type_id = $this->params['order_type_id'];",
" //only save the status change if it actually changed to something different\n if ($order->order_status_id != $this->params['order_status_id']) {\n if (empty($this->params['order_status_messages'])) {\n $comment = $this->params['comment'];\n } else {\n $comment = $this->params['order_status_messages'];\n }\n // save the order status change\n $change = new order_status_changes();\n $change->from_status_id = $order->order_status_id;\n $change->comment = $comment;\n $change->to_status_id = $this->params['order_status_id'];\n $change->orders_id = $order->id;\n $change->save();",
" // update the status of the order\n $order->order_status_id = $this->params['order_status_id'];",
" // Save the message for future use if that is what the user wanted.\n if (!empty($this->params['save_message']) && !empty($this->params['comment'])) {\n $message = new stdClass();\n $message->body = $this->params['comment'];\n $db->insertObject($message, 'order_status_messages');\n }",
" // email the user if we need to\n if (!empty($this->params['email_user'])) {\n $email_addy = $order->billingmethod[0]->email;\n if (!empty($email_addy)) {\n $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);\n $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);",
" if ($order->shippingmethod->carrier == 'UPS') {\n $carrierTrackingLink = \"http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=\";\n } elseif ($order->shippingmethod->carrier == 'FedEx') {\n $carrierTrackingLink = \"http://www.fedex.com/Tracking?action=track&tracknumbers=\";\n } elseif ($order->shippingmethod->carrier == 'USPS') {\n $carrierTrackingLink = \"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=\";\n }",
" assign_to_template(array(\n 'comment' => $change->comment,\n 'to_status' => $to_status,\n 'from_status' => $from_status,\n 'order' => $order,\n 'date' => date(\"F j, Y, g:i a\"),\n 'storename' => ecomconfig::getConfig('storename'),\n 'include_shipping'=> isset($this->params['include_shipping_info']) ? true : false,\n 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number,\n 'carrier' => $order->shippingmethod->carrier\n ));",
" $html = $template->render();\n $html .= ecomconfig::getConfig('ecomfooter');",
" $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => array($email_addy => $order->billingmethod[0]->firstname . ' ' . $order->billingmethod[0]->lastname),\n 'from' => $from,\n 'subject' => 'The status of your order (#' . $order->invoice_id . ') has been updated on ' . ecomconfig::getConfig('storename') . '.'\n ));\n } else {\n flash('error', gt('The email address was NOT send. An email address count not be found for this customer'));\n }\n }\n flash('message', gt('Order Type and/or Status Updated.'));\n } else {\n flash('message', gt('Order Type and/or Status was not changed.'));\n }",
" $order->save();\n expHistory::back();\n }",
" function emailCustomer() {\n //eDebug($this->params,true);\n global $db, $template, $user;",
" if (empty($this->params['id'])) expHistory::back();",
" // get the order\n $order = new order($this->params['id']);",
" if (empty($this->params['order_status_messages'])) {\n $email_message = $this->params['email_message'];\n } else {\n $email_message = $this->params['order_status_messages'];\n }",
" // Save the message for future use if that is what the user wanted.\n if (!empty($this->params['save_message']) && !empty($this->params['email_message'])) {\n $message = new stdClass();\n $message->body = $this->params['email_message'];\n $db->insertObject($message, 'order_status_messages');\n }",
" $email_addys = explode(',', $this->params['to_addresses']); //$order->billingmethod[0]->email;\n //eDebug($email_addy,true);\n if (!empty($email_addys)) {\n assign_to_template(array(\n 'message'=> $email_message\n ));\n $html = $template->render();\n if (!empty($this->params['include_invoice'])) {\n $html .= '<hr><br>';\n $html .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'email_invoice', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n } else {\n $html .= ecomconfig::getConfig('ecomfooter');\n }",
" //eDebug($html,true);\n if (isset($this->params['from_address'])) {\n if ($this->params['from_address'] == 'other') {\n $from = $this->params['other_from_address'];\n } else {\n $from = $this->params['from_address'];\n }\n } else {\n $from = ecomconfig::getConfig('from_address');\n }\n if (empty($from[0])) $from = SMTP_FROMADDRESS;",
" if (isset($this->params['email_subject'])) {\n $email_subject = $this->params['email_subject'];\n } else {\n $email_subject = gt('Message from') . ' ' . ecomconfig::getConfig('storename') . ' ' . gt('about your order') . ' (#' . $order->invoice_id . ')';\n }",
" $mail = new expMail();\n //FIXME Unless you need each mail sent separately, you can now set 'to'=>$email_addys and let expMail send a single email to all addresses\n foreach ($email_addys as $email_addy) {\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => $email_addy,\n 'from' => $from,\n 'subject' => $email_subject\n ));\n }\n $emailed_to = implode(',', $email_addys);",
" // manually add/attach an expSimpleNote to the order\n $note = new expSimpleNote();\n $note->body = \"<strong>[\" . gt('action') . \"]: \" . gt('Emailed message to') . \" \" . $emailed_to . \":</strong>\" . $email_message;\n $note->approved = 1;\n $note->name = $user->firstname . \" \" . $user->lastname;\n $note->email = $user->email;",
" $note->save();\n $note->refresh();\n// $noteObj = new stdClass();\n// $noteObj->expsimplenote_id = $note->id;\n// $noteObj->content_id = $order->id;\n// $noteObj->content_type = 'order';\n// $db->insertObject($noteObj, 'content_expSimpleNote');\n $note->attachNote('order', $order->id);\n",
" //eDebug($note,true); ",
" } else {\n flash('error', gt('The email was NOT sent. An email address was not found for this customer'));\n expHistory::back();\n }",
" flash('message', gt('Email sent.'));\n expHistory::back();\n }",
" function ordersbyuser() {\n global $user;",
" // if the user isn't logged in flash an error msg\n if (!$user->isLoggedIn()) expQueue::flashAndFlow('error', gt('You must be logged in to view past orders.'));",
" expHistory::set('viewable', $this->params);\n $page = new expPaginator(array(\n 'model' => 'order', //FIXME we should also be getting the order status name\n 'where' => 'purchased > 0 AND user_id=' . $user->id,\n 'limit' => 10,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Date Purchased')=> 'purchased',\n gt('Invoice #') => 'invoice_id',\n )\n ));\n assign_to_template(array(\n 'page'=> $page\n ));",
" }",
" function metainfo() {\n global $router;",
" if (empty($router->params['action'])) return false;\n",
" // figure out what metadata to pass back based on the action ",
" // we are in.\n $action = $router->params['action'];\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => true, 'nofollow' => true);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'myOrder':\n case 'show':\n case 'showByTitle':\n if (!empty($router->params['id'])) {\n $order = new order($router->params['id']);\n } elseif (!empty($router->params['invoice'])) {\n $order = $this->order->find('first', 'invoice_id=' . $router->params['invoice']);\n } else {\n $order = $this->order;\n }\n $metainfo['title'] = gt('Viewing Order') . ' #' . $order->invoice_id . ' - ' . $storename;\n $metainfo['keywords'] = empty($order->meta_keywords) ? SITE_KEYWORDS : $order->meta_keywords;\n $metainfo['description'] = empty($order->meta_description) ? SITE_DESCRIPTION : $order->meta_description;\n// $metainfo['canonical'] = empty($order->canonical) ? $router->plainPath() : $order->canonical;\n// $metainfo['noindex'] = empty($order->meta_noindex) ? false : $order->meta_noindex;\n// $metainfo['nofollow'] = empty($order->meta_nofollow) ? false : $order->meta_nofollow;\n break;\n case 'showall':\n case 'ordersbyuser':\n default:\n $metainfo['title'] = gt(\"Order Management\") . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }",
" return $metainfo;\n }",
" function captureAuthorization() {\n //eDebug($this->params,true);\n $order = new order($this->params['id']);",
" /*eDebug($this->params); ",
" //eDebug($order,true);*/\n //eDebug($order,true);\n //$billing = new billing();",
" //eDebug($billing, true);\n //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id);\n $calc = $order->billingmethod[0]->billingcalculator->calculator;\n $calc->config = $order->billingmethod[0]->billingcalculator->config;",
" //$calc = new $calc-\n //eDebug($calc,true);\n if (!method_exists($calc, 'delayed_capture')) {\n flash('error', gt('The Billing Calculator does not support delayed capture'));\n expHistory::back();\n }",
" $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order);",
" if (empty($result->errorCode)) {\n flash('message', gt('The authorized payment was successfully captured'));\n expHistory::back();",
" } else {\n flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }",
" function voidAuthorization() {\n $order = new order($this->params['id']);\n $billing = $order->billingmethod[0];",
" $calc = $order->billingmethod[0]->billingcalculator->calculator;\n $calc->config = $order->billingmethod[0]->billingcalculator->config;",
" if (!method_exists($calc, 'void_transaction')) {\n flash('error', gt('The Billing Calculator does not support void'));\n expHistory::back();\n }",
" $result = $calc->void_transaction($order->billingmethod[0], $order);",
" if (empty($result->errorCode)) {\n flash('message', gt('The transaction has been successfully voided'));\n expHistory::back();",
" } else {\n flash('error', gt('An error was encountered while voiding the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }",
" function creditTransaction() {\n $order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n //eDebug($this->params,true);\n $result = $billing->calculator->credit_transaction($billing->billingmethod, $this->params['capture_amt'],$order);",
" if ($result->errorCode == '0') {\n flash('message', gt('The transaction has been credited'));\n expHistory::back();",
" } else {\n flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }",
" function edit_payment_info() {\n //$order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n $opts = expUnserialize($billing->billingmethod->billing_options); //FIXME already unserialized???\n //eDebug($billing);\n// eDebug($opts);\n assign_to_template(array(\n 'orderid'=> $this->params['id'],\n 'opts' => $opts, //FIXME credit card doesn't have a result\n 'billing_cost' => $billing->billingmethod->billing_cost,\n 'transaction_state' => $billing->billingmethod->transaction_state\n ));\n }",
" function save_payment_info() {\n //need to save billing methods and billing options\n //$order = new order($this->params['id']);\n //eDebug($this->params, true);\n $res_obj = new stdClass();\n foreach ($this->params['result'] as $resultKey=> $resultItem) {\n $res_obj->$resultKey = $resultItem;\n }\n// $res = serialize($res_obj);\n $billing = new billing($this->params['id']);\n // eDebug($billing);\n $billingmethod = $billing->billingmethod;\n $billingtransaction = $billingmethod->billingtransaction[0];",
" // update billing method\n $billingmethod->billing_cost = $this->params['billing_cost'];\n $billingmethod->transaction_state = $this->params['transaction_state'];\n $bmopts = expUnserialize($billingmethod->billing_options);\n $bmopts->result = $res_obj;\n $billingmethod->billing_options = serialize($bmopts);\n// if (!empty($this->params['result']['payment_status']))\n// $billingmethod->transaction_state = $this->params['result']['payment_status']; //FIXME should this be discrete??\n $billingmethod->save();",
" // add new billing transaction\n $billingtransaction->billing_cost = $this->params['billing_cost'];\n $billingtransaction->transaction_state = $this->params['transaction_state'];\n $btopts = expUnserialize($billingtransaction->billing_options);\n $btopts->result = $res_obj;\n $billingtransaction->billing_options = serialize($btopts);\n// if (!empty($this->params['result']['payment_status']))\n// $billingtransaction->transaction_state = $this->params['result']['payment_status'];\n $billingtransaction->id = null; // force a new record by erasing the id, easy method to copy record\n// $order = new order($this->params['id']);\n// $billingtransaction->billing_cost = $order->grand_total; //FIXME should it always be the grand total???\n $billingtransaction->save();",
"// flashAndFlow('message', gt('Payment info updated.'));\n flash('message', gt('Payment info updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n }",
" function edit_shipping_method() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $order = new order($this->params['id']);\n $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $sm = new shippingmethod($s->id);\n //eDebug($sm);\n assign_to_template(array(\n 'orderid' => $this->params['id'],\n 'shipping'=> $sm\n ));\n }",
" function save_shipping_method() {\n if (!isset($this->params['id']) || !isset($this->params['sid']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['sid']);\n $sm->option_title = $this->params['shipping_method_title'];\n $sm->carrier = $this->params['shipping_method_carrier'];\n $sm->save();\n flashAndFlow('message', gt('Shipping method updated.'));\n }",
" function edit_parcel() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator(); // add calculator object\n assign_to_template(array(\n 'shipping'=> $sm\n ));\n }",
" function save_parcel() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n if (!isset($this->params['in_box']) || !isset($this->params['qty'])) {\n flashAndFlow('notice', gt('Nothing was included in the shipping package!'));\n } else {\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n// $sm_new = clone($sm); // prepare for another 'package' if needed since we didn't place everything in this one\n// $sm_new->id = null;\n// $sm_new->orderitem = array();\n //FIXME for now multiple shipping methods will crash ecom with shipping->__construct()\n foreach ($sm->orderitem as $key => $oi) {\n if (!array_key_exists($oi->id, $this->params['in_box'])) {\n // one of the items by type is not in this package and needs to be moved to another package\n// $tmp = 1;\n// $sm_new->update(); // we don't need to actually create a new shippingmethod until needed\n// $sm->orderitem[$key]->shippingmethods_id = $sm_new->id;\n// $sm->orderitem[$key]->update();\n// unset($sm->orderitem[$key]);\n //NOTE $sm_new->update(); ???\n } else {\n if ($oi->quantity != $this->params['qty'][$oi->id]) {\n // one of the items by quantity is not in this package and remaining items need to be moved another package\n// $tmp = 1;\n// $new_quantity = $oi->quantity - $this->params['qty'][$oi->id];\n// $sm->orderitem[$key]->quantity = $this->params['qty'][$oi->id]; // adjust to new quantity\n// $sm->orderitem[$key]->update();\n// $sm_new->update(); // we don't need to actually create a new shippingmethod until needed\n// $oi->id = null; // create a new orderitem copy\n// $oi->shippingmethods_id = $sm_new->id;\n// $oi->quantity = $new_quantity;\n// $oi->update();\n //NOTE $sm_new->update(); ???\n }\n }\n }\n // update $sm with the passed $this->params (package data)\n $sm->update($this->params); //NOTE will this update assoc orderitems???\n $msg = $sm->calculator->createLabel($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping package updated.'));\n } else {\n expHistory::back();\n }\n }\n }",
" function edit_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $method = explode(':', $sm->option);\n//FIXME check for existing rate, if not get next cheapest? (based on predefined package?)\n assign_to_template(array(\n 'shipping'=> $sm,\n 'cost' => $sm->shipping_options['shipment_rates'][$method[0]][$method[1]]['cost']\n ));\n }",
" function save_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->buyLabel($sm);\n// $sm->refresh(); //FIXME updated with new options we may need to take action on like tracking number?\n// $order->shipping_tracking_number = $sm->shipping_options['shipment_tracking_number'];\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label purchased.'));\n } else {\n expHistory::back();\n }\n }",
" function download_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $label = $sm->calculator->getLabel($sm);\n expHistory::back();\n }",
" function delete_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->cancelLabel($sm);\n // also need to cancel the pickup if created/purchased\n if (!is_string($msg) && ($sm->shipping_options['pickup_status'] == 'created' || $sm->shipping_options['pickup_status'] == 'purchased')) {\n $msg = $sm->calculator->cancelPickup($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label and pickup cancelled and refunded.'));\n }\n } else {\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label cancelled and refunded.'));\n }\n }\n expHistory::back();\n }",
" function edit_pickup()\n {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n assign_to_template(array(\n 'shipping'=> $sm,\n ));\n }",
" function edit_pickup2() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $this->params['pickupdate'] = strtotime($this->params['pickupdate']);\n $this->params['pickupenddate'] = strtotime($this->params['pickupenddate']);\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $pickup = $sm->calculator->createPickup($sm, $this->params['pickupdate'], $this->params['pickupenddate'], $this->params['instructions']);\n $sm->refresh();\n $pickup_rates = array();\n foreach ($sm->shipping_options['pickup_rates'] as $pu_rate) {\n $pickup_rates[$pu_rate['id']] = $pu_rate['id'] . ' - ' . expCore::getCurrency($pu_rate['cost']);\n }\n assign_to_template(array(\n 'shipping'=> $sm,\n 'rates' => $pickup_rates\n ));\n }",
" function save_pickup() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n //FIXME should we add the params to the $sm->shipping_options, or pass them??\n $msg = $sm->calculator->buyPickup($sm, $this->params['pickuprate']);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Package pickup ordered.'));\n } else {\n expHistory::back();\n }\n }",
" function delete_pickup() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->cancelPickup($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Package pickup cancelled.'));\n } else {\n expHistory::back();\n }\n }",
" function createReferenceOrder() {\n if (!isset($this->params['id'])) {\n flashAndFlow('error', gt('Unable to process request. Invalid order number.'));\n// expHistory::back();\n }\n $order = new order($this->params['id']);\n assign_to_template(array(\n 'order'=> $order\n ));\n }",
" function save_reference_order() {\n// global $user;",
" //eDebug($this->params,true);\n $order = new order($this->params['original_orderid']);",
" //eDebug($order,true); ",
" //x\n $newOrder = new order();\n $newOrder->order_status_id = $this->params['order_status_id'];\n $newOrder->order_type_id = $this->params['order_type_id'];\n //$newOrder->order_references = $order->id;\n $newOrder->reference_id = $order->id;\n $newOrder->user_id = $order->user_id;\n $newOrder->purchased = time();\n $newOrder->updated = time();\n $newOrder->invoice_id = $newOrder->getInvoiceNumber();\n $newOrder->orderitem = array();\n $newOrder->subtotal = $this->params['subtotal'];\n $newOrder->total_discounts = $this->params['total_discounts'];\n $newOrder->tax = $this->params['tax'];\n $newOrder->shipping_total = $this->params['shipping_total'];\n $newOrder->surcharge_total = $this->params['surcharge_total'];",
" if ($this->params['autocalc'] == true) {\n $newOrder->grand_total = ($newOrder->subtotal - $newOrder->total_discounts) + $newOrder->tax + $newOrder->shipping_total + $newOrder->surcharge_total;\n } else {\n $newOrder->grand_total = round($this->params['grand_total'], 2);\n }\n $newOrder->save();\n $newOrder->refresh();",
" // save initial order status\n $change = new order_status_changes();\n// $change->from_status_id = null;\n $change->to_status_id = $newOrder->order_status_id;\n $change->orders_id = $newOrder->id;\n $change->save();",
" $tObj = new stdClass();\n $tObj->result = new stdClass();\n $tObj->result->errorCode = 0;\n $tObj->result->message = \"Reference Order Pending\";\n $tObj->result->PNREF = \"Pending\";\n $tObj->result->authorization_code = \"Pending\";\n $tObj->result->AVSADDR = \"Pending\";\n $tObj->result->AVSZIP = \"Pending\";\n $tObj->result->CVV2MATCH = \"Pending\";\n $tObj->result->traction_type = \"Pending\";\n $tObj->result->payment_status = \"Pending\";",
" $newBillingMethod = $order->billingmethod[0];\n $newBillingMethod->id = null;\n $newBillingMethod->orders_id = $newOrder->id;\n// $newBillingMethod->billingcalculator_id = 6;\n $newBillingMethod->billingcalculator_id = billingcalculator::getDefault();\n $newBillingMethod->billing_cost = 0;\n $newBillingMethod->transaction_state = 'authorization pending';\n $newBillingMethod->billing_options = serialize($tObj);\n $newBillingMethod->save();\n",
" //eDebug(expUnserialize($order->billingmethod[0]->billing_options)); \n //eDebug(expUnserialize($order->billingmethod[0]->billingtransaction[0]->billing_options),true); ",
"\n $newBillingTransaction = new billingtransaction();\n// $newBillingTransaction->billingcalculator_id = 6; ///setting to manual/passthru\n $newBillingTransaction->billingcalculator_id = billingcalculator::getDefault();\n $newBillingTransaction->billing_cost = 0;\n $newBillingTransaction->billingmethods_id = $newBillingMethod->id;\n $newBillingTransaction->transaction_state = 'authorization pending';",
" $newBillingTransaction->billing_options = serialize($tObj);\n $newBillingTransaction->save();",
" $sid = $order->orderitem[0]->shippingmethods_id;\n $newShippingMethod = $order->shippingmethods[$sid];\n $newShippingMethod->id = null;\n $newShippingMethod->shipping_cost = 0;\n $newShippingMethod->save();\n $newShippingMethod->refresh();",
" foreach ($this->params['oi'] as $oikey=> $oi) {\n //eDebug($oikey);\n $newOi = new orderitem($oikey);\n $newOi->id = null;\n $newOi->quantity = $this->params['quantity'][$oikey];\n $newOi->orders_id = $newOrder->id;\n $newOi->products_name = $this->params['products_name'][$oikey];\n $newOi->products_price = $this->params['products_price'][$oikey];\n $newOi->products_price_adjusted = $this->params['products_price'][$oikey];",
" //$newOi->products_tax = 0; ",
" $newOi->shippingmethods_id = $newShippingMethod->id;\n $newOi->save();\n }",
" $newOrder->shippingmethod = $newShippingMethod;\n $newOrder->billingmethod = $newBillingMethod;\n $newOrder->update(); //FIXME do we need to do this?",
" flash('message', gt('Reference Order #') . $newOrder->invoice_id . \" \" . gt(\"created successfully.\"));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $newOrder->id));\n }",
" function create_new_order() {\n// $order = new order();\n// assign_to_template(array(\n// 'order'=> $order\n// ));\n }",
" function save_new_order() {\n //eDebug($this->params);\n /*addresses_id\n customer_type = 1 //new\n customer_type = 2 //existing Internal\n customer_type = 3 //existing external*/\n// global $user, $db;\n //eDebug($this->params,true);\n //$order = new order($this->params['original_orderid']);",
" //eDebug($order,true); ",
"\n $newAddy = new address();\n if ($this->params['customer_type'] == 1) {\n //blank order\n $newAddy->save(false);\n } else if ($this->params['customer_type'] == 2) {\n //internal customer\n $newAddy = new address($this->params['addresses_id']);\n } else if ($this->params['customer_type'] == 3) {\n //other customer\n $otherAddy = new external_address($this->params['addresses_id']);\n $newAddy->user_id = $otherAddy->user_id;\n $newAddy->firstname = $otherAddy->firstname;\n $newAddy->lastname = $otherAddy->lastname;\n $newAddy->organization = $otherAddy->organization;\n $newAddy->address1 = $otherAddy->address1;\n $newAddy->address2 = $otherAddy->address2;\n $newAddy->city = $otherAddy->city;\n $newAddy->state = $otherAddy->state;\n $newAddy->zip = $otherAddy->zip;\n $newAddy->phone = $otherAddy->phone;\n $newAddy->email = $otherAddy->email;\n $newAddy->save();\n }",
" $newOrder = new order();\n $newOrder->order_status_id = $this->params['order_status_id'];\n $newOrder->order_type_id = $this->params['order_type_id'];\n //$newOrder->order_references = $order->id;\n $newOrder->reference_id = 0;\n $newOrder->user_id = $newAddy->user_id;\n $newOrder->purchased = time();\n $newOrder->updated = time();\n $newOrder->invoice_id = $newOrder->getInvoiceNumber();\n $newOrder->orderitem = array();\n $newOrder->subtotal = 0;\n $newOrder->total_discounts = 0;\n $newOrder->tax = 0;\n $newOrder->shipping_total = 0;\n $newOrder->surcharge_total = 0;\n $newOrder->grand_total = 0;\n $newOrder->save();\n $newOrder->refresh();",
" // save initial order status\n $change = new order_status_changes();\n// $change->from_status_id = null;\n $change->to_status_id = $newOrder->order_status_id;\n $change->orders_id = $newOrder->id;\n $change->save();",
" $tObj = new stdClass();\n $tObj->result = new stdClass();\n $tObj->result->errorCode = 0;\n $tObj->result->message = \"Reference Order Pending\";\n $tObj->result->PNREF = \"Pending\";\n $tObj->result->authorization_code = \"Pending\";\n $tObj->result->AVSADDR = \"Pending\";\n $tObj->result->AVSZIP = \"Pending\";\n $tObj->result->CVV2MATCH = \"Pending\";\n $tObj->result->traction_type = \"Pending\";\n $tObj->result->payment_status = \"Pending\";",
" $newBillingMethod = new billingmethod();\n $newBillingMethod->addresses_id = $newAddy->id;\n $newBillingMethod->orders_id = $newOrder->id;\n// $newBillingMethod->billingcalculator_id = 6;\n $newBillingMethod->billingcalculator_id = billingcalculator::getDefault();\n $newBillingMethod->billing_cost = 0;\n $newBillingMethod->transaction_state = 'authorization pending';\n $newBillingMethod->billing_options = serialize($tObj);\n $newBillingMethod->firstname = $newAddy->firstname;\n $newBillingMethod->lastname = $newAddy->lastname;\n $newBillingMethod->organization = $newAddy->organization;\n $newBillingMethod->address1 = $newAddy->address1;\n $newBillingMethod->address2 = $newAddy->address2;\n $newBillingMethod->city = $newAddy->city;\n $newBillingMethod->state = $newAddy->state;\n $newBillingMethod->zip = $newAddy->zip;\n $newBillingMethod->phone = $newAddy->phone;\n $newBillingMethod->email = $newAddy->email;\n $newBillingMethod->save();\n",
" //eDebug(expUnserialize($order->billingmethod[0]->billing_options)); \n //eDebug(expUnserialize($order->billingmethod[0]->billingtransaction[0]->billing_options),true); ",
"\n $newBillingTransaction = new billingtransaction();\n// $newBillingTransaction->billingcalculator_id = 6; ///setting to manual/passthru\n $newBillingTransaction->billingcalculator_id = billingcalculator::getDefault();\n $newBillingTransaction->billing_cost = 0;\n $newBillingTransaction->billingmethods_id = $newBillingMethod->id;\n $newBillingTransaction->transaction_state = 'authorization pending';\n $newBillingTransaction->billing_options = serialize($tObj);\n $newBillingTransaction->save();",
" $newShippingMethod = new shippingmethod();\n $newShippingMethod->shipping_cost = 0;\n// $newShippingMethod->shippingcalculator_id = $db->selectValue('shippingcalculator', 'id', 'is_default=1');\n $newShippingMethod->shippingcalculator_id = shippingcalculator::getDefault();\n $newShippingMethod->addresses_id = $newAddy->id;\n $newShippingMethod->firstname = $newAddy->firstname;\n $newShippingMethod->lastname = $newAddy->lastname;\n $newShippingMethod->organization = $newAddy->organization;\n $newShippingMethod->address1 = $newAddy->address1;\n $newShippingMethod->address2 = $newAddy->address2;\n $newShippingMethod->city = $newAddy->city;\n $newShippingMethod->state = $newAddy->state;\n $newShippingMethod->zip = $newAddy->zip;\n $newShippingMethod->phone = $newAddy->phone;\n $newShippingMethod->email = $newAddy->email;\n $newShippingMethod->save();\n $newShippingMethod->refresh();",
" //FIXME add a fake item?\n// $oi = new orderitem();\n// $oi->orders_id = $newOrder->id;\n// $oi->product_id = 0;\n// $oi->product_type = 'product';\n// $oi->products_name = \"N/A\";\n// $oi->products_model = \"N/A\";\n// $oi->products_price = 0;\n// $oi->shippingmethods_id = $newShippingMethod->id;\n// $oi->save(false);",
" $newOrder->shippingmethod = $newShippingMethod;\n $newOrder->billingmethod = $newBillingMethod;\n $newOrder->update();",
" flash('message', gt('New Order #') . $newOrder->invoice_id . \" \" . gt(\"created successfully.\"));\n if (empty($this->params['no_redirect'])) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $newOrder->id));\n } else {\n return $newOrder->id;\n }\n }",
" function edit_address() {\n //if $type = 'b' - business\n //if $type = 's' - shipping\n //addresses_id\n $order = new order($this->params['id']);\n $same = false;",
" $sm = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n //$bm = array_pop($order->billingmethods);",
" //eDebug($sm->addresses_id);\n //eDebug($order->billingmethod[0]->addresses_id);\n if ($sm->addresses_id == $order->billingmethod[0]->addresses_id) {\n $same = true;\n // echo \"Yes\";\n //$addy = new address($sm->addresses_id);\n }",
" if ($this->params['type'] == 'b') {\n $type = 'billing';\n $addy = new address($order->billingmethod[0]->addresses_id);\n } else if ($this->params['type'] == 's') {\n $type = 'shipping';\n $addy = new address($sm->addresses_id);\n }\n /* eDebug($this->params);\n eDebug($addy);\n eDebug($order,true);*/\n $billingmethod = new billingmethod($this->params['id']);\n //eDebug($billingmethod,true);\n //$opts = expUnserialize($billing->billingmethod->billing_options);\n //eDebug($billing);\n //eDebug($opts);\n assign_to_template(array(\n 'orderid'=> $this->params['id'],\n 'record' => $addy,\n 'same' => $same,\n 'type' => $type\n ));\n }",
" function save_address() {\n global $db;",
" $order = new order($this->params['orderid']);\n $billing = new billing($this->params['orderid']);\n $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $shippingmethod = new shippingmethod($s->id);",
" //eDebug($order);\n //eDebug($this->params,true);\n //eDebug($shippingmethod);\n $billingmethod = $billing->billingmethod;\n /*\n eDebug($order);\n eDebug($shippingmethod);\n eDebug($billingmethod);*/",
" if ($this->params['save_option'] == 0) {\n //update existing\n //echo \"Update\";\n $addy = new address($this->params['addyid']);\n } else if ($this->params['save_option'] == 1) {\n //create new\n //echo \"New\";\n $oldaddy = new address($this->params['addyid']);\n $addy = new address();\n $addy->user_id = $oldaddy->user_id;\n }",
" //eDebug($addy,true);",
" foreach ($this->params['address'] as $key=> $val) {\n if ($key == 'address_country_id') {\n $key = 'country';\n }\n if ($key == 'address_region_id') {\n $key = 'state';\n }\n $addy->$key = $val;\n if (isset($billingmethod->$key)) $billingmethod->$key = $val;\n if (isset($shippingmethod->$key)) $shippingmethod->$key = $val;\n }\n $addy->is_billing = 0;\n $addy->is_shipping = 0;\n $addy->save();\n $addy->refresh();",
" if ($this->params['type'] == 'billing' || ($this->params['same'] == true && $this->params['save_option'] == 0)) {\n //echo \"Billing\";\n $billingmethod->addresses_id = $addy->id;\n $billingmethod->save();\n $addy->is_billing = 1;\n }",
" if ($this->params['type'] == 'shipping' || ($this->params['same'] == true && $this->params['save_option'] == 0)) {\n //eDebug(\"Shipping\",true);\n $shippingmethod->addresses_id = $addy->id;\n $shippingmethod->save();\n $addy->is_shipping = 1;\n }",
" $addy->save();\n if ($addy->is_default) $db->setUniqueFlag($addy, 'addresses', 'is_default', 'user_id=' . $addy->user_id);",
" //eDebug($shippingmethod,true);\n// flashAndFlow('message', gt('Address updated.'));\n flash('message', gt('Address updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n }",
" function edit_order_item() {\n $oi = new orderitem($this->params['id'], true, true);\n if (empty($oi->id)) {\n flash('error', gt('Order item doesn\\'t exist.'));\n expHistory::back();\n }\n $oi->user_input_fields = expUnserialize($oi->user_input_fields);\n $params['options'] = $oi->opts;\n $params['user_input_fields'] = $oi->user_input_fields;\n $oi->product = new product($oi->product->id, true, true);\n if ($oi->product->parent_id != 0) {\n $parProd = new product($oi->product->parent_id);",
" //$oi->product->optiongroup = $parProd->optiongroup; ",
" $oi->product = $parProd;\n }\n //FIXME we don't use selectedOpts?\n// $oi->selectedOpts = array();\n// if (!empty($oi->opts)) {\n// foreach ($oi->opts as $opt) {\n// $option = new option($opt[0]);\n// $og = new optiongroup($option->optiongroup_id);\n// if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id]))\n// $oi->selectedOpts[$og->id] = array($option->id);\n// else\n// array_push($oi->selectedOpts[$og->id], $option->id);\n// }\n// }\n //eDebug($oi->selectedOpts);",
" assign_to_template(array(\n 'oi' => $oi,\n 'params' => $params\n ));\n }",
" function delete_order_item() {\n $order = new order($this->params['orderid']);\n if (count($order->orderitem) <= 1) {\n flash('error', gt('You may not delete the only item on an order. Please edit this item, or add another item before removing this one.'));\n expHistory::back();\n }",
" $oi = new orderitem($this->params['id']);\n $oi->delete();",
" $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $sm = new shippingmethod($s->id);",
" $shippingCalc = new shippingcalculator($sm->shippingcalculator_id);\n $calcName = $shippingCalc->calculator_name;\n $calculator = new $calcName($shippingCalc->id);\n $pricelist = $calculator->getRates($order);",
" foreach ($pricelist as $rate) {\n if ($rate['id'] == $sm->option) {\n $sm->shipping_cost = $rate['cost'];\n }\n }\n $sm->save();",
" $order->refresh();\n $order->calculateGrandTotal();\n $order->save();",
"// flashAndFlow('message', gt('Order item removed and order totals updated.'));\n flash('message', gt('Order item removed and order totals updated.'));\n if (empty($this->params['no_redirect'])) redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }",
" function save_order_item() {\n if (!empty($this->params['id'])) {\n $oi = new orderitem($this->params['id']);\n } else {\n $oi = new orderitem($this->params);\n }\n //eDebug($this->params);",
" /*eDebug($oi);\n eDebug(expUnserialize($oi->options));\n eDebug(expUnserialize($oi->user_input_fields),true);*/\n if (!empty($this->params['products_price'])) $oi->products_price = expUtil::currency_to_float($this->params['products_price']);\n $oi->quantity = $this->params['quantity'];\n if (!empty($this->params['products_name'])) $oi->products_name = $this->params['products_name'];",
" if ($oi->product->parent_id != 0) {\n $oi->product = new product($oi->product->parent_id, true, false);\n } else {\n //reattach the product so we get the option fields and such\n $oi->product = new product($oi->product->id, true, false);\n }",
" if (isset($this->params['product_status_id'])) {\n $ps = new product_status($this->params['product_status_id']);\n $oi->products_status = $ps->title;\n }",
" $options = array();\n foreach ($oi->product->optiongroup as $og) {\n $isOptionEmpty = true;\n if (!empty($this->params['options'][$og->id])) {\n foreach ($this->params['options'][$og->id] as $opt) {\n if (!empty($opt)) $isOptionEmpty = false;\n }\n }\n if (!$isOptionEmpty) {\n foreach ($this->params['options'][$og->id] as $opt_id) {\n $selected_option = new option($opt_id);\n $cost = $selected_option->modtype == '$' ? $selected_option->amount : $this->getBasePrice() * ($selected_option->amount * .01);\n $cost = $selected_option->updown == '+' ? $cost : $cost * -1;\n $options[] = array($selected_option->id, $selected_option->title, $selected_option->modtype, $selected_option->updown, $selected_option->amount);\n }\n }\n }",
" eDebug($this->params);\n //eDebug($oi,true);",
" $user_input_info = array();\n //check user input fields\n //$this->user_input_fields = expUnserialize($this->user_input_fields);\n //eDebug($this,true);\n if (!empty($oi->product->user_input_fields)) foreach ($oi->product->user_input_fields as $uifkey=> $uif) {",
" /*if ($uif['is_required'] || (!$uif['is_required'] && strlen($params['user_input_fields'][$uifkey]) > 0)) ",
" {\n if (strlen($params['user_input_fields'][$uifkey]) < $uif['min_length'])\n {",
" //flash('error', 'test'); \n //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type)); ",
" $params['error'] .= $uif['name'].' field has a minimum requirement of ' . $uif['min_length'] . ' characters.<br/>';",
" ",
" }else if (strlen($params['user_input_fields'][$uifkey]) > $uif['max_length'] && $uif['max_length'] > 0)\n {",
" //flash('error', ); \n //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type)); ",
" $params['error'] .= $uif['name'].' field has a maximum requirement of ' . $uif['max_length'] . ' characters.<br/>';",
" } ",
" }*/\n $user_input_info[] = array($uif['name']=> $this->params['user_input_fields'][$uifkey]);\n }\n //eDebug($options);\n //eDebug($user_input_info,true);",
" $oi->options = serialize($options);\n $oi->user_input_fields = serialize($user_input_info);",
" //eDebug($oi); ",
" $oi->save();\n $oi->refresh();\n //eDebug($oi,true);",
" $order = new order($oi->orders_id);\n $order->calculateGrandTotal();",
" $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and thenremoving it\n eDebug($s);\n $sm = new shippingmethod($s->id);",
" $shippingCalc = new shippingcalculator($sm->shippingcalculator_id);\n $calcName = $shippingCalc->calculator_name;\n $calculator = new $calcName($shippingCalc->id);\n $pricelist = $calculator->getRates($order);",
" foreach ($pricelist as $rate) {\n if ($rate['id'] == $sm->option) {\n $sm->shipping_cost = $rate['cost'];\n break;\n }\n }\n $sm->save();\n $order->refresh();\n $order->calculateGrandTotal();\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Item edited in order');\n// $order->billingmethod[0]->update(array('billing_options' => serialize($bmopts), 'transaction_state' => $transaction_state));\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();",
"// flashAndFlow('message', gt('Order item updated and order totals recalculated.'));\n flash('message', gt('Order item updated and order totals recalculated.'));\n if (empty($this->params['no_redirect'])) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n } else {\n return $oi->id;\n }\n }",
" function add_order_item() {\n// eDebug($this->params);\n $product = new product($this->params['product_id']);\n $paramsArray = array('orderid'=> $this->params['orderid']);\n assign_to_template(array(\n 'product'=> $product,\n 'params' => $paramsArray\n ));\n }",
" function save_new_order_item() { //FIXME we need to be able to call this from program with $params also, addToOrder\n //eDebug($this->params,true);\n //check for multiple product adding\n $order = new order($this->params['orderid']);\n if (isset($this->params['prod-quantity'])) {\n //we are adding multiple children, so we approach a bit different",
" //we'll send over the product_id of the parent, along with id's and quantities of children we're adding ",
" foreach ($this->params['prod-quantity'] as $qkey=> &$quantity) {\n if (in_array($qkey, $this->params['prod-check'])) {\n $this->params['children'][$qkey] = $quantity;\n }\n if (isset($child)) $this->params['product_id'] = $child->parent_id;\n }\n }",
" $pt = $this->params['product_type'];\n $product = new $pt($this->params['product_id'], true, true); //need true here?",
" if ($product->addToCart($this->params, $this->params['orderid'])) {\n $order->refresh();\n $order->calculateGrandTotal();\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Item added to order');\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();\n// flashAndFlow('message', gt('Product added to order and order totals recalculated.'));\n flash('message', gt('Product added to order and order totals recalculated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }\n /*else\n {\n expHistory::back();\n }*/\n }",
" function edit_invoice_id() {\n if (!isset($this->params['id'])) flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $order = new order($this->params['id']);\n assign_to_template(array(\n 'orderid' => $this->params['id'],\n 'invoice_id'=> $order->invoice_id\n ));\n }",
" function save_invoice_id() {\n if (!isset($this->params['id'])) flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n if (empty($this->params['invoice_id']) || !is_numeric($this->params['invoice_id'])) flashAndFlow('error', gt('Unable to process request. Invoice ID #.'));\n $order = new order($this->params['id']);\n $order->invoice_id = $this->params['invoice_id'];\n $order->save(false);\n flashAndFlow('message', gt('Invoice # saved.'));\n }",
" function edit_totals() {\n //eDebug($this->params);\n $order = new order($this->params['orderid']);\n assign_to_template(array(\n// 'orderid'=>$this->params['id'],\n 'order'=> $order\n ));\n }",
" function save_totals() {\n //eDebug($this->params);\n //if(!is_numeric($this->params['subtotal']))\n $order = new order($this->params['orderid']);\n $order->subtotal = expUtil::currency_to_float($this->params['subtotal']);\n $order->total_discounts = expUtil::currency_to_float($this->params['total_discounts']);\n $order->total = round($order->subtotal - $order->total_discounts, 2);\n $order->tax = expUtil::currency_to_float($this->params['tax']);\n $order->shipping_total = expUtil::currency_to_float($this->params['shipping_total']);\n //note: the shippingmethod record will still reflect the ORIGINAL shipping amount for this order.\n $order->surcharge_total = expUtil::currency_to_float($this->params['surcharge_total']);",
" if ($this->params['autocalc'] == true) {\n $order->grand_total = round(($order->subtotal - $order->total_discounts) + $order->tax + $order->shipping_total + $order->surcharge_total, 2);\n } else {\n $order->grand_total = round(expUtil::currency_to_float($this->params['grand_total']), 2);\n }\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Totals Adjusted');\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();",
"// flashAndFlow('message', gt('Order totals updated.'));\n flash('message', gt('Order totals updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }",
" function update_sales_reps() {\n if (!isset($this->params['id'])) {\n flashAndFlow('error', gt('Unable to process request. Invalid order number.'));\n //expHistory::back();\n }\n $order = new order($this->params['id']);\n $order->sales_rep_1_id = $this->params['sales_rep_1_id'];\n $order->sales_rep_2_id = $this->params['sales_rep_2_id'];\n $order->sales_rep_3_id = $this->params['sales_rep_3_id'];\n $order->save();\n flashAndFlow('message', gt('Sales reps updated.'));\n }",
" function quickfinder() {\n global $db;",
" $search = $this->params['ordernum'];\n $searchInv = intval($search);",
" $sql = \"SELECT DISTINCT(o.id), o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title, ot.title as order_type\";\n $sql .= \" from \" . $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON ot.id = o.order_type_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";",
" $sqlwhere = \"WHERE o.purchased != 0\";\n if ($searchInv != 0) $sqlwhere .= \" AND (o.invoice_id LIKE '%\" . $searchInv . \"%' OR\";\n else $sqlwhere .= \" AND (\";\n $sqlwhere .= \" b.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.email LIKE '%\" . $search . \"%')\";",
" $limit = empty($this->config['limit']) ? 350 : $this->config['limit'];\n //eDebug($sql . $sqlwhere) ;\n $page = new expPaginator(array(\n 'sql' => $sql . $sqlwhere,\n 'limit' => $limit,\n 'order' => 'o.invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date')=> 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'term'=> $search\n ));",
" //eDebug($this->params);\n /*$o = new order();\n $b = new billingmethod();\n $s = new shippingmethod();",
" ",
" $search = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $orders = $o->find('all',\"invoice_id LIKE '%\".$oid.\"%'\");\n if(count($orders == 1))\n {",
" redirect_to(array('controller'=>'order','action'=>'show','id'=>$order[0]->id)); ",
" }\n else\n {\n flashAndFlow('message',\"Orders containing \" . $search . \" in the order number not found.\");\n }\n }\n else\n {\n //lookup just a customer\n $bms = $b->find('all', )\n }*/\n /*$o = new order();\n $oid = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $order = $o->find('first','invoice_id='.$oid);\n if(!empty($order->id))\n {",
" redirect_to(array('controller'=>'order','action'=>'show','id'=>$order->id)); ",
" }\n else\n {\n flashAndFlow('message',\"Order #\" . intval($this->params['ordernum']) . \" not found.\");\n }\n }\n else\n {",
" flashAndFlow('message','Invalid order number.'); ",
" }*/\n }",
" public function verifyReturnShopper() {\n// global $user, $order;",
" $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr)) {\n assign_to_template(array(\n 'firstname'=> $sessAr['firstname'],\n 'cid'=> $sessAr['cid']",
" ));\n /*eDebug(expSession::get('verify_shopper'));\n eDebug($this->params);\n eDebug(\"here\");\n eDebug($user);\n eDebug($order);*/\n }\n }",
" public function verifyAndRestoreCart() {\n// global $user, $order;",
" $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr) && isset($this->params['cid']) && $this->params['cid'] == $sessAr['cid']) {\n $tmpCart = new order($sessAr['cid']);\n if (isset($tmpCart->id)) {",
" //eDebug($tmpCart,true); ",
" $shippingMethod = $tmpCart->shippingmethod;\n $billingMethod = $tmpCart->billingmethod[0];",
" if (($this->params['lastname'] == $shippingMethod->lastname || $this->params['lastname'] == $billingMethod->lastname) &&\n ($this->params['email'] == $shippingMethod->email || $this->params['email'] == $billingMethod->email) &&\n ($this->params['zip_code'] == $shippingMethod->zip || $this->params['zip_code'] == $billingMethod->zip)\n ) {\n //validatio succeed, so restore order, login user and continue on to orig_path\n //eDebug(\"Validated\",true);\n $sessAr['validated'] = true;\n expSession::set('verify_shopper', $sessAr);\n redirect_to($sessAr['orig_path']);\n } else {\n //eDebug(\"Validated NOT\",true);\n //validation failed, so go back\n flash('error', gt(\"We're sorry, but we could not verify your information. Please try again, or start a new shopping cart.\"));\n redirect_to(array('controller'=> 'order', 'action'=> 'verifyReturnShopper', 'id'=> $sessAr['cid']));\n }\n } else {\n flash('error', gt('We were unable to restore the previous order, we apologize for the inconvenience. Please start a new shopping cart.'));\n $this->clearCart();\n }\n }\n }",
" public static function clearCartCookie() {\n expSession::un_set('verify_shopper');\n order::setCartCookie(null);\n }",
" public function clearCart() {\n global $order;",
" $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr)) {\n order::setCartCookie($order);\n $orig_path = $sessAr['orig_path'];\n expSession::un_set('verify_shopper');\n redirect_to($orig_path);\n } else {\n expHistory::back();\n }\n }",
" /**\n * AJAX search for internal (addressController) addresses\n *\n */\n public function search() {\n// global $db, $user;\n 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 \";\n $sql .= \" WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] .\n \"*' IN BOOLEAN MODE) \";\n $sql .= \"order by match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) ASC LIMIT 12\";\n $res = $db->selectObjectsBySql($sql);\n foreach ($res as $key=>$record) {\n $res[$key]->title = $record->firstname . ' ' . $record->lastname;\n }\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
" /**\n * Ajax search for external addresses\n *\n */\n public function search_external() {\n// global $db, $user;\n global $db;",
" $sql = \"select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email \";",
" $sql .= \"from \" . $db->prefix . \"external_addresses as a \"; //R JOIN \" . ",
" //$db->prefix . \"billingmethods as bm ON bm.addresses_id=a.id \";\n $sql .= \" WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] .\n \"*' IN BOOLEAN MODE) \";\n $sql .= \"order by match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) ASC LIMIT 12\";\n $res = $db->selectObjectsBySql($sql);\n foreach ($res as $key=>$record) {\n $res[$key]->title = $record->firstname . ' ' . $record->lastname;\n }\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class orderController extends expController {",
" protected $manage_permissions = array(\n 'add_order_item' => 'Add Order Item',\n 'download' => 'Download Label',\n// 'create_new_order' => 'Create A New Order',\n// 'createReferenceOrder'=> 'Create Reference Order',\n// 'edit_address' => 'Edit Address',\n// 'edit_invoice_id' => 'Edit Invoice Id',\n// 'edit_order_item' => 'Edit Order Item',\n// 'edit_payment_info' => 'Edit Payment Info',\n// 'edit_shipping_method'=> 'Edit Shipping Method',\n// 'edit_totals' => 'Edit Totals',\n 'email' => 'Send Email',\n 'quickfinder'=> 'Do a quick order lookup',\n 'save_payment_info'=> 'Save Payment Info',\n 'save_address'=> 'Save Address',\n 'save_order_item'=> 'Save Order Item',\n// 'save_new_order_item'=> 'Save New Order Item',\n 'save_totals'=> 'Save Totals',\n 'save_invoice_id'=> 'Save Invoice Id',\n 'save_shipping_method'=> 'Save Shipping Method',\n 'save_new_order'=> 'Save a new order',\n 'save_reference_order'=> 'Save Reference Order',\n 'set' => 'Change Status',",
" 'showall' => 'Manage',\n 'show' => 'View Orders',",
" 'update' => 'update order',",
" );",
" static function displayname() {\n return gt(\"e-Commerce Order Manager\");\n }",
" static function description() {\n return gt(\"Use this module to manage the orders from your ecommerce store.\");\n }",
" function showall() {\n global $db;",
" expHistory::set('viewable', $this->params);",
" // remove abaondoned carts\n /*$count = $db->countObjects('orders', 'purchased=0');\n for($i=0; $i<$count; $i++) {\n // get the cart\n $cart = $db->selectObject('orders','purchased=0');",
"",
" // check to make sure this isn't an active session\n $ticket = $db->selectObject('sessionticket', \"ticket='\".$cart->sessionticket_ticket.\"'\");\n if (empty($ticket)) {\n // delete all the order items for this cart and their shippingmethods\n foreach($db->selectObjects('orderitems', 'orders_id='.$cart->id) as $oi) {\n $db->delete('shippingmethods', 'id='.$oi->shippingmethods_id);",
" $db->delete('orderitems', 'orders_id='.$cart->id);",
" }",
"",
" // delete the billing methods for this cart.\n $db->delete('billingmethods', 'orders_id='.$cart->id);\n $db->delete('orders', 'id='.$cart->id);",
" }\n",
" } */",
" // find orders with a \"closed\" status type\n// $closed_count = 0;\n if (empty($this->params['showclosed'])) {\n $closed_status = $db->selectColumn('order_status', 'id', 'treat_as_closed=1');\n $closed_status = implode(',',$closed_status);\n// $status_where = '';\n $status_where = ' AND order_status_id NOT IN (' . $closed_status . ')';",
"// foreach ($closed_status as $status) {\n// if (empty($status_where)) {\n// $status_where .= ' AND (order_status_id!=' . $status;\n// } else {\n// $status_where .= ' AND order_status_id!=' . $status;\n// }\n// $closed_count += $db->countObjects('orders', 'order_status_id=' . $status);\n// }\n $closed_count = $db->countObjects('orders', 'order_status_id IN (' . $closed_status . ')');\n } else {\n $status_where = '';\n $closed_count = -1;\n }",
" // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT o.*, b.firstname as firstname, b.billing_cost as total, b.transaction_state as paid, b.billingcalculator_id as method, b.middlename as middlename, b.lastname as lastname, os.title as status, ot.title as order_type ';\n $sql .= 'FROM ' . $db->prefix . 'orders o, ' . $db->prefix . 'billingmethods b, ';\n $sql .= $db->prefix . 'order_status os, ';\n $sql .= $db->prefix . 'order_type ot ';\n $sql .= 'WHERE o.id = b.orders_id AND o.order_status_id = os.id AND o.order_type_id = ot.id AND o.purchased > 0';\n //FIXME this sql isn't correct???\n// if (!empty($status_where)) {\n// $status_where .= ')';\n $sql .= $status_where;\n// }\n if (ECOM_LARGE_DB) {\n $limit = empty($this->config['limit']) ? 50 : $this->config['limit'];\n } else {\n $limit = 0; // we'll paginate on the page\n }\n //eDebug($sql, true);\n $page = new expPaginator(array(\n //'model'=>'order',\n 'sql' => $sql,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'limit' => $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Customer') => 'lastname',\n gt('Inv #') => 'invoice_id',\n gt('Total') => 'total',\n gt('Payment') => 'method',\n gt('Purchased') => 'purchased',\n gt('Type') => 'order_type_id',\n gt('Status') => 'order_status_id',\n gt('Ref') => 'orig_referrer',\n )\n ));\n //eDebug($page,true);\n assign_to_template(array(\n 'page' => $page,\n 'closed_count'=> $closed_count,\n 'new_order' => order::getDefaultOrderStatus()\n ));\n }",
" function show() {\n global $db, $user;\n//eDebug($_REQUEST);\n//eDebug($this->params,true);\n//if (!empty($this->params['printerfriendly'])) $_REQUEST['printerfriendly'] = 1;",
" expHistory::set('viewable', $this->params);",
" if (!empty($this->params['invoice']) && empty($this->params['id'])) {\n $ord = new order();\n $order = $ord->find('first', 'invoice_id=' . $this->params['invoice']);\n $this->params['id'] = $order->id;\n } elseif (!empty($this->params['id'])) {\n $order = new order($this->params['id']);\n }\n if (empty($order->id)) {\n flash('notice', gt('That order does not exist.'));\n expHistory::back();\n }",
" // We're forcing the location. Global store setting will always have this loc\n// $storeConfig = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));",
" $billing = new billing($this->params['id']);\n $status_messages = $db->selectObjects('order_status_messages');\n $order_type = $order->getOrderType();\n //eDebug($order->billingmethod[0]->billingtransaction);\n $order->billingmethod[0]->billingtransaction = array_reverse($order->billingmethod[0]->billingtransaction);\n if (empty($order->billingmethod[0]->billingtransaction[0]->billingcalculator_id)) {\n $calc_name = $order->billingmethod[0]->billingcalculator->calculator_name;\n $order->billingmethod[0]->billingtransaction[0]->billingcalculator = new $calc_name();\n }\n //eDebug($order->billingmethod[0]->billingtransaction);\n if (isset($this->params['printerfriendly']))\n $pf = $this->params['printerfriendly'];\n else\n $pf = 0;",
" $to_addresses[] = $order->billingmethod[0]->email;\n// $s = array_pop($order->shippingmethods); //FIXME we don't really want to 'pop' it off the object\n $s = reset($order->shippingmethods);\n if ($s->email != $order->billingmethod[0]->email) $to_addresses[] = $s->email;",
" $from_addresses = array();\n $from_addresses[SMTP_FROMADDRESS] = SMTP_FROMADDRESS;\n $from_addresses[ecomconfig::getConfig('from_address')] = ecomconfig::getConfig('from_address');\n $from_addresses[$user->email] = $user->email;\n $from_addresses['other'] = 'Other (enter below)';\n $from_addresses = array_filter($from_addresses);\n $from_default = ecomconfig::getConfig('from_address');\n $from_default = !empty($from_default) ? $from_default : SMTP_FROMADDRESS;",
" $email_subject = 'Message from ' . ecomconfig::getConfig('storename') . ' about your order (#' . $order->invoice_id . ')';",
" $order->setReferencingIds();",
" $css = file_get_contents(BASE . 'framework/modules/ecommerce/assets/css/print-invoice.css');",
" assign_to_template(array(\n 'css' => $css,\n 'pf' => $pf,\n 'order' => $order,\n 'order_user' => new user($order->user_id),\n// 'shipping' => $order->orderitem[0], //FIXME what about new orders with no items??\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n 'messages' => $status_messages,\n 'order_type' => $order_type,\n// 'storeConfig' => $storeConfig->config,\n 'sales_reps' => order::getSalesReps(),\n 'from_addresses' => $from_addresses,\n 'from_default' => $from_default,\n 'email_subject' => $email_subject,\n 'to_addresses' => implode(',', $to_addresses)\n ));\n if ($order->shipping_required) {\n assign_to_template(array(\n 'shipping' => $order->orderitem[0], //FIXME what about new orders with no items??\n ));\n }\n }",
" function myOrder() {\n global $user, $db;",
" $order = new order($this->params['id']);\n if ($order->purchased == 0)\n flashAndFlow('error', gt('You do not have permission to view this order.'));",
" $this->loc->src = \"@globalstoresettings\";",
" // We're forcing the location. Global store setting will always have this loc\n// $storeConfig = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));",
" //check here for the hash in the params, or session set w/ perms to view...shs = xaf7y0s87d7elshd70 etc\n //if present, prompt user for the order number and email address on the order\n //and if they pass, show the order to them. Need to maybe set something in the session then for subsequent",
" //viewing of the order?",
" if ($user->id != $order->user_id) {\n if ($user->isAdmin()) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n } else {\n flashAndFlow('error', gt('You do not have permission to view this order.'));\n }\n }",
" expHistory::set('viewable', $this->params);",
" $billing = new billing($this->params['id']);\n $status_messages = $db->selectObjects('order_status_messages');\n $order_type = $order->getOrderType();\n $order->total_items = 0;\n foreach ($order->orderitem as $item) {\n $order->total_items += $item->quantity;\n $order->shipping_city = $item->shippingmethod->city;\n $order->shipping_state = $item->shippingmethod->state;\n }\n $state = new geoRegion($order->shipping_state);\n $country = new geoCountry($state->country_id);\n $order->shipping_country = $country->iso_code_3letter;\n $order->shipping_state = $state->name;",
" //eDebug($order,true);",
" $order->billingmethod[0]->billingtransaction = array_reverse($order->billingmethod[0]->billingtransaction);\n if (isset($this->params['printerfriendly'])) $pf = $this->params['printerfriendly'];\n else $pf = 0;\n $css = file_get_contents(BASE . 'framework/modules/ecommerce/assets/css/print-invoice.css');",
" $order->calculateGrandTotal();",
" $trackMe = false;\n if (isset($this->params['tc']) && $this->params['tc'] == 1) {\n if (expSession::is_set('orders_tracked')) {\n $trackingArray = expSession::get('orders_tracked');\n if (in_array($order->invoice_id, $trackingArray)) {\n $trackMe = false;\n } else {\n $trackMe = true;\n $trackingArray[] = $order->invoice_id;\n expSession::set('orders_tracked', $trackingArray);\n }\n } else {\n $trackMe = true;\n $trackingArray[] = $order->invoice_id;\n expSession::set('orders_tracked', $trackingArray);\n }\n }\n if (DEVELOPMENT != 0)\n $trackMe = false;\n assign_to_template(array(\n 'printerfriendly'=> $pf,\n 'css' => $css,\n 'order' => $order,\n 'shipping' => $order->orderitem[0],\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n 'order_type' => $order_type,\n// 'storeConfig' => $storeConfig->config,\n 'tc' => $trackMe,\n 'checkout' => !empty($this->params['tc']) //FIXME we'll use the tc param for now\n ));",
" }",
" function email() {\n global $template, $user;",
" // setup a template suitable for emailing\n $template = expTemplate::get_template_for_action($this, 'email_invoice', $this->loc);\n $order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n// if ($billing->calculator != null) {\n// $billinginfo = $billing->calculator->userView(unserialize($billing->billingmethod->billing_options));\n// } else {\n// if (empty($opts)) {\n// $billinginfo = false;\n// } else {\n// $billinginfo = gt(\"No Cost\");\n// if (!empty($opts->payment_due)) {\n// $billinginfo .= '<br>'.gt('Payment Due') . ': ' . expCore::getCurrencySymbol() . number_format($opts->payment_due, 2, \".\", \",\");\n// }\n// }\n// }\n $css = file_get_contents(BASE.'framework/modules/ecommerce/assets/css/print-invoice.css');\n assign_to_template(array(\n 'css' => $css,\n 'order' => $order,\n 'shipping' => $order->orderitem[0],\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n ));",
" // build the html and text versions of the message\n $html = $template->render();\n $txt = strip_tags($html);",
" // send email invoices to the admins if needed\n if (ecomconfig::getConfig('email_invoice') == true) {\n $addresses = explode(',', ecomconfig::getConfig('email_invoice_addresses'));\n foreach ($addresses as $address) {\n $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> $txt,\n 'to' => trim($address),\n 'from' => $from,\n 'subject' => 'An order was placed on the ' . ecomconfig::getConfig('storename'),\n ));\n }\n }",
" // email the invoice to the user if we need to\n if (ecomconfig::getConfig('email_invoice_to_user') == true && !empty($user->email)) {\n $usermsg = \"<p>\" . ecomconfig::getConfig('invoice_msg') . \"<p>\";\n $usermsg .= $html;\n// $usermsg .= ecomconfig::getConfig('ecomfooter');",
" $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $usermsg,\n 'text_message'=> $txt,\n 'to' => array(trim($user->email) => trim(user::getUserAttribution($user->id))),\n //'to'=>$order->billingmethod[0]->email,\n 'from' => $from,\n 'subject' => ecomconfig::getConfig('invoice_subject'),\n ));\n }\n }",
" function update_shipping() {\n $order = new order($this->params['id']);\n $this->params['shipped'] = datetimecontrol::parseData('shipped', $this->params);\n $order->update($this->params);\n flash('message', gt('Shipping information updated.'));\n expHistory::back();\n }",
" function getPDF($orders = null) {\n global $user, $timer;",
" $invoice = '<!DOCTYPE HTML><HTML><HEAD>';\n // the basic styles\n if (!bs3())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/normalize/normalize.css\" >';\n if (!bs())\n// $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/normalize/normalize.css\" >';\n if (bs2())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/bootstrap/css/bootstrap.css\" >';\n if (bs3())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/bootstrap3/css/bootstrap.css\" >';\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'framework/modules/ecommerce/assets/css/print-invoice.css\">\n <style>\n html{background:none;}\n #store-header{text-align:left;}\n </style>';\n $invoice .= '</HEAD><BODY>';\n if (is_array($orders)) {\n foreach ($orders as $order) {\n if ($user->isAdmin()) {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'show_printable', 'id'=> $order['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));",
" //eDebug($order['id'] . \": \" . $timer->mark());",
" } else {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'myOrder', 'view'=> 'show_printable', 'id'=> $order['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n }\n $invoice .= '<p style=\"page-break-before: always;\"></p>';\n }\n $invoice = substr($invoice, 0, (strlen($invoice) - 42));\n } else {\n if ($user->isAdmin()) {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'show_printable', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n } else {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'myOrder', 'view'=> 'show_printable', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n }\n }",
" $invoice .= \"</BODY></HTML>\";\n $invoice = mb_convert_encoding($invoice, 'HTML-ENTITIES', \"UTF-8\");\n // eDebug($invoice);\n $org_name = str_ireplace(\" \", \"_\", ORGANIZATION_NAME);",
" //eDebug(\"Here\",1);\n // Actually create/output the pdf file",
" /**\n * to do this same thing as below using html2pdf\n * //FIXME uncomment to implement, comment out above\n require_once(BASE.'external/html2pdf_v4.03/html2pdf.class.php');\n $html2pdf = new HTMLTPDF('P', 'LETTER', substr(LOCALE,0,2));\n $html2pdf->writeHTML($invoice);\n $html2pdf->Output($org_name . \"_Invoice\" . \".pdf\",HTMLTOPDF_OUTPUT?'D':'');\n exit();\n */\n /**\n * to do this same thing as below using dompdf\n * //FIXME uncomment to implement, comment out above\n require_once(BASE.'external/dompdf/dompdf_config.inc.php');\n $mypdf = new DOMPDF();\n $mypdf->load_html($invoice);\n $mypdf->set_paper('letter','portrait');\n $mypdf->render();\n $mypdf->stream($org_name . \"_Invoice\" . \".pdf\",array('Attachment'=>HTMLTOPDF_OUTPUT));\n exit();\n */\n /**\n * to do this same thing as below using expHtmlToPDF\n */\n $mypdf = new expHtmlToPDF('Letter','portrait',$invoice);\n $mypdf->createpdf('D',$org_name . \"_Invoice\" . \".pdf\");\n exit();",
" if (stristr(PHP_OS, 'Win')) {\n if (file_exists(HTMLTOPDF_PATH)) {\n do {\n $htmltopdftmp = HTMLTOPDF_PATH_TMP . mt_rand() . '.html';\n } while (file_exists($htmltopdftmp));\n }\n file_put_contents($htmltopdftmp, $invoice);",
" exec(HTMLTOPDF_PATH . \" \" . $htmltopdftmp . \" \" . HTMLTOPDF_PATH_TMP . $org_name . \"_Invoice.pdf\");\n $this->returnFile(HTMLTOPDF_PATH_TMP . $org_name . \"_Invoice.pdf\", $org_name . \"_Invoice.pdf\", \"pdf\");\n exit();\n } else {",
" //require_once(BASE.'external/tcpdf/config/lang/eng.php');\n //require_once(BASE.'external/tcpdf/tcpdf.php');",
" //----\n // create new PDF document\n /*$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);",
"// set document information\n$pdf->SetCreator(PDF_CREATOR);\n$pdf->SetAuthor('Nicola Asuni');\n$pdf->SetTitle('TCPDF Example 001');\n$pdf->SetSubject('TCPDF Tutorial');\n$pdf->SetKeywords('TCPDF, PDF, example, test, guide');",
"// set default header data\npdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);",
"// set header and footer fonts\n$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));\n$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));",
"// set default monospaced font\n$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);",
"//set margins\n$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);\n$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);\n$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);",
"// remove default header/footer\n$pdf->setPrintHeader(false);\n$pdf->setPrintFooter(false);",
"//set auto page breaks\n$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);",
"//set image scale factor\n$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);",
"//set some language-dependent strings\n$pdf->setLanguageArray($l);",
"// ---------------------------------------------------------",
"// set default font subsetting mode\n//$pdf->setFontSubsetting(true);",
"// Set font\n// dejavusans is a UTF-8 Unicode font, if you only need to\n// print standard ASCII chars, you can use core fonts like\n// helvetica or times to reduce file size.\n//$pdf->SetFont('helvetica', '', 14, '', true);",
"// Add a page\n// This method has several options, check the source code documentation for more information.\n$pdf->AddPage();\n//eDebug($invoice,1);\n// Print text using writeHTMLCell()\n//$pdf->writeHTML($w=0, $h=0, $x='', $y='', $invoice, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);\n$pdf->writeHTML($invoice);",
"// ---------------------------------------------------------",
"// Close and output PDF document\n// This method has several options, check the source code documentation for more information.\nob_clean();\n$pdf->Output('example_001.pdf', 'I');\nexit();\n//============================================================+\n// END OF FILE\n//============================================================+\n",
"",
" // create new PDF document\n $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);",
" // set document information\n $pdf->SetCreator(PDF_CREATOR);\n $pdf->SetAuthor(ORGANIZATION_NAME);\n $pdf->SetTitle($org_name . \"_Invoice\");\n $pdf->SetSubject($org_name . \"_Invoice\");\n // remove default header/footer\n $pdf->setPrintHeader(false);\n $pdf->setPrintFooter(false);",
" // set default monospaced font\n $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);",
" //set margins\n $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);",
" //set auto page breaks\n $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);\n $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $invoice, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);\n $pdf->Output($org_name . \"_Invoice\" . \".pdf\", 'I');\n exit();*/\n eDebug(\"Done rendering invoice html. Starting PDF Generation: \" . $timer->mark());\n $pdfer = new expHtmlToPDF('Letter', 'Portrait', $invoice);\n// $pdfer->set_html($invoice);\n// $pdfer->set_orientation('Portrait');\n// $pdfer->set_page_size('Letter');\n $pdfer->set_grayscale(true);\n// $pdfer->render();\n eDebug(\"Done rendering PDF \" . $timer->mark());\n// exit();\n ob_clean();\n $pdfer->createpdf('D', $org_name . \"_Invoice\" . \".pdf\");\n exit();\n }\n }",
" private function returnFile($file, $name, $mime_type = '') {\n /*\n This function takes a path to a file to output ($file),\n the filename that the browser will see ($name) and\n the MIME type of the file ($mime_type, optional).",
" If you want to do something on download abort/finish,\n register_shutdown_function('function_name');\n */\n if (!is_readable($file)) die('File not found or inaccessible!');",
" $size = filesize($file);\n $name = rawurldecode($name);",
" /* Figure out the MIME type (if not specified) */\n $known_mime_types = array(\n \"pdf\" => \"application/pdf\",\n \"txt\" => \"text/plain\",\n \"html\" => \"text/html\",\n \"htm\" => \"text/html\",\n \"exe\" => \"application/octet-stream\",\n \"zip\" => \"application/zip\",\n \"doc\" => \"application/msword\",\n \"xls\" => \"application/vnd.ms-excel\",\n \"ppt\" => \"application/vnd.ms-powerpoint\",\n \"gif\" => \"image/gif\",\n \"png\" => \"image/png\",\n \"jpeg\" => \"image/jpg\",\n \"jpg\" => \"image/jpg\",\n \"php\" => \"text/plain\"\n );",
" if ($mime_type == '') {\n// $file_extension = strtolower(substr(strrchr($file, \".\"), 1));\n//\n// if (array_key_exists($file_extension, $known_mime_types)) {\n// $mime_type = $known_mime_types[$file_extension];\n// } else {\n// $mime_type = \"application/force-download\";\n// }\n $mime_type = expFile::getMimeType($file);\n }",
" //@ob_end_clean(); //turn off output buffering to decrease cpu usage\n // required for IE, otherwise Content-Disposition may be ignored\n if (ini_get('zlib.output_compression'))\n ini_set('zlib.output_compression', 'Off');",
" header('Content-Type: ' . $mime_type);\n header('Content-Disposition: attachment; filename=\"' . $name . '\"');\n header('Content-Transfer-Encoding: binary');\n header('Accept-Ranges: bytes');",
" /* The three lines below basically make the download non-cacheable */\n header('Cache-control: private');\n header('Pragma: private');\n// header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');",
" // multipart-download and download resuming support\n if (isset($_SERVER['HTTP_RANGE'])) {\n list($a, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);\n list($range) = explode(',', $range, 2);\n list($range, $range_end) = explode('-', $range);",
" $range = intval($range);",
" $range_end = (!$range_end) ? $size - 1 : intval($range_end);\n $new_length = $range_end - $range + 1;",
" header('HTTP/1.1 206 Partial Content');\n header('Content-Length: ' . $new_length);\n header('Content-Range: bytes ' . ($range - $range_end / $size));\n } else {\n $new_length = $size;",
" header('Content-Length: ' . $size);\n }",
" /* output the file itself */\n $chunksize = 1 * (1024 * 1024); //you may want to change this\n $bytes_send = 0;",
" if ($file = fopen($file, 'r')) {\n if (isset($_SERVER['HTTP_RANGE'])) fseek($file, $range);",
" while (!feof($file) && (!connection_aborted()) && ($bytes_send < $new_length)) {\n $buffer = fread($file, $chunksize);",
" print($buffer);\n flush();",
" $bytes_send += strlen($buffer);\n }",
" fclose($file);\n } else {\n die('Error - can not open file.');\n }\n }",
" function set_order_type() { //FIXME never used\n// global $db;",
" if (empty($this->params['id'])) expHistory::back();",
" // get the order and update the type\n $order = new order($this->params['id']);\n $order->order_type_id = $this->params['order_type_id'];\n $order->save();\n flash('message', gt('Invoice #') . $order->invoice_id . ' ' . gt('has been set to') . ' ' . $order->getOrderType());\n expHistory::back();\n }",
" /**\n * Change order status and email notification if necessary\n */\n function setStatus() {\n global $db, $template;",
" if (empty($this->params['id'])) expHistory::back();",
" // get the order and create a new order_Status_change\n $order = new order($this->params['id']);",
" //set order type\n if (isset($this->params['order_type_id'])) $order->order_type_id = $this->params['order_type_id'];",
" //only save the status change if it actually changed to something different\n if ($order->order_status_id != $this->params['order_status_id']) {\n if (empty($this->params['order_status_messages'])) {\n $comment = $this->params['comment'];\n } else {\n $comment = $this->params['order_status_messages'];\n }\n // save the order status change\n $change = new order_status_changes();\n $change->from_status_id = $order->order_status_id;\n $change->comment = $comment;\n $change->to_status_id = $this->params['order_status_id'];\n $change->orders_id = $order->id;\n $change->save();",
" // update the status of the order\n $order->order_status_id = $this->params['order_status_id'];",
" // Save the message for future use if that is what the user wanted.\n if (!empty($this->params['save_message']) && !empty($this->params['comment'])) {\n $message = new stdClass();\n $message->body = $this->params['comment'];\n $db->insertObject($message, 'order_status_messages');\n }",
" // email the user if we need to\n if (!empty($this->params['email_user'])) {\n $email_addy = $order->billingmethod[0]->email;\n if (!empty($email_addy)) {\n $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);\n $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);",
" if ($order->shippingmethod->carrier == 'UPS') {\n $carrierTrackingLink = \"http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=\";\n } elseif ($order->shippingmethod->carrier == 'FedEx') {\n $carrierTrackingLink = \"http://www.fedex.com/Tracking?action=track&tracknumbers=\";\n } elseif ($order->shippingmethod->carrier == 'USPS') {\n $carrierTrackingLink = \"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=\";\n }",
" assign_to_template(array(\n 'comment' => $change->comment,\n 'to_status' => $to_status,\n 'from_status' => $from_status,\n 'order' => $order,\n 'date' => date(\"F j, Y, g:i a\"),\n 'storename' => ecomconfig::getConfig('storename'),\n 'include_shipping'=> isset($this->params['include_shipping_info']) ? true : false,\n 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number,\n 'carrier' => $order->shippingmethod->carrier\n ));",
" $html = $template->render();\n $html .= ecomconfig::getConfig('ecomfooter');",
" $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => array($email_addy => $order->billingmethod[0]->firstname . ' ' . $order->billingmethod[0]->lastname),\n 'from' => $from,\n 'subject' => 'The status of your order (#' . $order->invoice_id . ') has been updated on ' . ecomconfig::getConfig('storename') . '.'\n ));\n } else {\n flash('error', gt('The email address was NOT send. An email address count not be found for this customer'));\n }\n }\n flash('message', gt('Order Type and/or Status Updated.'));\n } else {\n flash('message', gt('Order Type and/or Status was not changed.'));\n }",
" $order->save();\n expHistory::back();\n }",
" function emailCustomer() {\n //eDebug($this->params,true);\n global $db, $template, $user;",
" if (empty($this->params['id'])) expHistory::back();",
" // get the order\n $order = new order($this->params['id']);",
" if (empty($this->params['order_status_messages'])) {\n $email_message = $this->params['email_message'];\n } else {\n $email_message = $this->params['order_status_messages'];\n }",
" // Save the message for future use if that is what the user wanted.\n if (!empty($this->params['save_message']) && !empty($this->params['email_message'])) {\n $message = new stdClass();\n $message->body = $this->params['email_message'];\n $db->insertObject($message, 'order_status_messages');\n }",
" $email_addys = explode(',', $this->params['to_addresses']); //$order->billingmethod[0]->email;\n //eDebug($email_addy,true);\n if (!empty($email_addys)) {\n assign_to_template(array(\n 'message'=> $email_message\n ));\n $html = $template->render();\n if (!empty($this->params['include_invoice'])) {\n $html .= '<hr><br>';\n $html .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'email_invoice', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n } else {\n $html .= ecomconfig::getConfig('ecomfooter');\n }",
" //eDebug($html,true);\n if (isset($this->params['from_address'])) {\n if ($this->params['from_address'] == 'other') {\n $from = $this->params['other_from_address'];\n } else {\n $from = $this->params['from_address'];\n }\n } else {\n $from = ecomconfig::getConfig('from_address');\n }\n if (empty($from[0])) $from = SMTP_FROMADDRESS;",
" if (isset($this->params['email_subject'])) {\n $email_subject = $this->params['email_subject'];\n } else {\n $email_subject = gt('Message from') . ' ' . ecomconfig::getConfig('storename') . ' ' . gt('about your order') . ' (#' . $order->invoice_id . ')';\n }",
" $mail = new expMail();\n //FIXME Unless you need each mail sent separately, you can now set 'to'=>$email_addys and let expMail send a single email to all addresses\n foreach ($email_addys as $email_addy) {\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => $email_addy,\n 'from' => $from,\n 'subject' => $email_subject\n ));\n }\n $emailed_to = implode(',', $email_addys);",
" // manually add/attach an expSimpleNote to the order\n $note = new expSimpleNote();\n $note->body = \"<strong>[\" . gt('action') . \"]: \" . gt('Emailed message to') . \" \" . $emailed_to . \":</strong>\" . $email_message;\n $note->approved = 1;\n $note->name = $user->firstname . \" \" . $user->lastname;\n $note->email = $user->email;",
" $note->save();\n $note->refresh();\n// $noteObj = new stdClass();\n// $noteObj->expsimplenote_id = $note->id;\n// $noteObj->content_id = $order->id;\n// $noteObj->content_type = 'order';\n// $db->insertObject($noteObj, 'content_expSimpleNote');\n $note->attachNote('order', $order->id);\n",
" //eDebug($note,true);",
" } else {\n flash('error', gt('The email was NOT sent. An email address was not found for this customer'));\n expHistory::back();\n }",
" flash('message', gt('Email sent.'));\n expHistory::back();\n }",
" function ordersbyuser() {\n global $user;",
" // if the user isn't logged in flash an error msg\n if (!$user->isLoggedIn()) expQueue::flashAndFlow('error', gt('You must be logged in to view past orders.'));",
" expHistory::set('viewable', $this->params);\n $page = new expPaginator(array(\n 'model' => 'order', //FIXME we should also be getting the order status name\n 'where' => 'purchased > 0 AND user_id=' . $user->id,\n 'limit' => 10,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Date Purchased')=> 'purchased',\n gt('Invoice #') => 'invoice_id',\n )\n ));\n assign_to_template(array(\n 'page'=> $page\n ));",
" }",
" function metainfo() {\n global $router;",
" if (empty($router->params['action'])) return false;\n",
" // figure out what metadata to pass back based on the action",
" // we are in.\n $action = $router->params['action'];\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => true, 'nofollow' => true);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'myOrder':\n case 'show':\n case 'showByTitle':\n if (!empty($router->params['id'])) {\n $order = new order($router->params['id']);\n } elseif (!empty($router->params['invoice'])) {\n $order = $this->order->find('first', 'invoice_id=' . $router->params['invoice']);\n } else {\n $order = $this->order;\n }\n $metainfo['title'] = gt('Viewing Order') . ' #' . $order->invoice_id . ' - ' . $storename;\n $metainfo['keywords'] = empty($order->meta_keywords) ? SITE_KEYWORDS : $order->meta_keywords;\n $metainfo['description'] = empty($order->meta_description) ? SITE_DESCRIPTION : $order->meta_description;\n// $metainfo['canonical'] = empty($order->canonical) ? $router->plainPath() : $order->canonical;\n// $metainfo['noindex'] = empty($order->meta_noindex) ? false : $order->meta_noindex;\n// $metainfo['nofollow'] = empty($order->meta_nofollow) ? false : $order->meta_nofollow;\n break;\n case 'showall':\n case 'ordersbyuser':\n default:\n $metainfo['title'] = gt(\"Order Management\") . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }",
" return $metainfo;\n }",
" function captureAuthorization() {\n //eDebug($this->params,true);\n $order = new order($this->params['id']);",
" /*eDebug($this->params);",
" //eDebug($order,true);*/\n //eDebug($order,true);\n //$billing = new billing();",
" //eDebug($billing, true);\n //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id);\n $calc = $order->billingmethod[0]->billingcalculator->calculator;\n $calc->config = $order->billingmethod[0]->billingcalculator->config;",
" //$calc = new $calc-\n //eDebug($calc,true);\n if (!method_exists($calc, 'delayed_capture')) {\n flash('error', gt('The Billing Calculator does not support delayed capture'));\n expHistory::back();\n }",
" $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order);",
" if (empty($result->errorCode)) {\n flash('message', gt('The authorized payment was successfully captured'));\n expHistory::back();",
" } else {\n flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }",
" function voidAuthorization() {\n $order = new order($this->params['id']);\n $billing = $order->billingmethod[0];",
" $calc = $order->billingmethod[0]->billingcalculator->calculator;\n $calc->config = $order->billingmethod[0]->billingcalculator->config;",
" if (!method_exists($calc, 'void_transaction')) {\n flash('error', gt('The Billing Calculator does not support void'));\n expHistory::back();\n }",
" $result = $calc->void_transaction($order->billingmethod[0], $order);",
" if (empty($result->errorCode)) {\n flash('message', gt('The transaction has been successfully voided'));\n expHistory::back();",
" } else {\n flash('error', gt('An error was encountered while voiding the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }",
" function creditTransaction() {\n $order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n //eDebug($this->params,true);\n $result = $billing->calculator->credit_transaction($billing->billingmethod, $this->params['capture_amt'],$order);",
" if ($result->errorCode == '0') {\n flash('message', gt('The transaction has been credited'));\n expHistory::back();",
" } else {\n flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }",
" function edit_payment_info() {\n //$order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n $opts = expUnserialize($billing->billingmethod->billing_options); //FIXME already unserialized???\n //eDebug($billing);\n// eDebug($opts);\n assign_to_template(array(\n 'orderid'=> $this->params['id'],\n 'opts' => $opts, //FIXME credit card doesn't have a result\n 'billing_cost' => $billing->billingmethod->billing_cost,\n 'transaction_state' => $billing->billingmethod->transaction_state\n ));\n }",
" function save_payment_info() {\n //need to save billing methods and billing options\n //$order = new order($this->params['id']);\n //eDebug($this->params, true);\n $res_obj = new stdClass();\n foreach ($this->params['result'] as $resultKey=> $resultItem) {\n $res_obj->$resultKey = $resultItem;\n }\n// $res = serialize($res_obj);\n $billing = new billing($this->params['id']);\n // eDebug($billing);\n $billingmethod = $billing->billingmethod;\n $billingtransaction = $billingmethod->billingtransaction[0];",
" // update billing method\n $billingmethod->billing_cost = $this->params['billing_cost'];\n $billingmethod->transaction_state = $this->params['transaction_state'];\n $bmopts = expUnserialize($billingmethod->billing_options);\n $bmopts->result = $res_obj;\n $billingmethod->billing_options = serialize($bmopts);\n// if (!empty($this->params['result']['payment_status']))\n// $billingmethod->transaction_state = $this->params['result']['payment_status']; //FIXME should this be discrete??\n $billingmethod->save();",
" // add new billing transaction\n $billingtransaction->billing_cost = $this->params['billing_cost'];\n $billingtransaction->transaction_state = $this->params['transaction_state'];\n $btopts = expUnserialize($billingtransaction->billing_options);\n $btopts->result = $res_obj;\n $billingtransaction->billing_options = serialize($btopts);\n// if (!empty($this->params['result']['payment_status']))\n// $billingtransaction->transaction_state = $this->params['result']['payment_status'];\n $billingtransaction->id = null; // force a new record by erasing the id, easy method to copy record\n// $order = new order($this->params['id']);\n// $billingtransaction->billing_cost = $order->grand_total; //FIXME should it always be the grand total???\n $billingtransaction->save();",
"// flashAndFlow('message', gt('Payment info updated.'));\n flash('message', gt('Payment info updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n }",
" function edit_shipping_method() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $order = new order($this->params['id']);\n $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $sm = new shippingmethod($s->id);\n //eDebug($sm);\n assign_to_template(array(\n 'orderid' => $this->params['id'],\n 'shipping'=> $sm\n ));\n }",
" function save_shipping_method() {\n if (!isset($this->params['id']) || !isset($this->params['sid']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['sid']);\n $sm->option_title = $this->params['shipping_method_title'];\n $sm->carrier = $this->params['shipping_method_carrier'];\n $sm->save();\n flashAndFlow('message', gt('Shipping method updated.'));\n }",
" function edit_parcel() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator(); // add calculator object\n assign_to_template(array(\n 'shipping'=> $sm\n ));\n }",
" function save_parcel() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n if (!isset($this->params['in_box']) || !isset($this->params['qty'])) {\n flashAndFlow('notice', gt('Nothing was included in the shipping package!'));\n } else {\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n// $sm_new = clone($sm); // prepare for another 'package' if needed since we didn't place everything in this one\n// $sm_new->id = null;\n// $sm_new->orderitem = array();\n //FIXME for now multiple shipping methods will crash ecom with shipping->__construct()\n foreach ($sm->orderitem as $key => $oi) {\n if (!array_key_exists($oi->id, $this->params['in_box'])) {\n // one of the items by type is not in this package and needs to be moved to another package\n// $tmp = 1;\n// $sm_new->update(); // we don't need to actually create a new shippingmethod until needed\n// $sm->orderitem[$key]->shippingmethods_id = $sm_new->id;\n// $sm->orderitem[$key]->update();\n// unset($sm->orderitem[$key]);\n //NOTE $sm_new->update(); ???\n } else {\n if ($oi->quantity != $this->params['qty'][$oi->id]) {\n // one of the items by quantity is not in this package and remaining items need to be moved another package\n// $tmp = 1;\n// $new_quantity = $oi->quantity - $this->params['qty'][$oi->id];\n// $sm->orderitem[$key]->quantity = $this->params['qty'][$oi->id]; // adjust to new quantity\n// $sm->orderitem[$key]->update();\n// $sm_new->update(); // we don't need to actually create a new shippingmethod until needed\n// $oi->id = null; // create a new orderitem copy\n// $oi->shippingmethods_id = $sm_new->id;\n// $oi->quantity = $new_quantity;\n// $oi->update();\n //NOTE $sm_new->update(); ???\n }\n }\n }\n // update $sm with the passed $this->params (package data)\n $sm->update($this->params); //NOTE will this update assoc orderitems???\n $msg = $sm->calculator->createLabel($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping package updated.'));\n } else {\n expHistory::back();\n }\n }\n }",
" function edit_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $method = explode(':', $sm->option);\n//FIXME check for existing rate, if not get next cheapest? (based on predefined package?)\n assign_to_template(array(\n 'shipping'=> $sm,\n 'cost' => $sm->shipping_options['shipment_rates'][$method[0]][$method[1]]['cost']\n ));\n }",
" function save_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->buyLabel($sm);\n// $sm->refresh(); //FIXME updated with new options we may need to take action on like tracking number?\n// $order->shipping_tracking_number = $sm->shipping_options['shipment_tracking_number'];\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label purchased.'));\n } else {\n expHistory::back();\n }\n }",
" function download_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $label = $sm->calculator->getLabel($sm);\n expHistory::back();\n }",
" function delete_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->cancelLabel($sm);\n // also need to cancel the pickup if created/purchased\n if (!is_string($msg) && ($sm->shipping_options['pickup_status'] == 'created' || $sm->shipping_options['pickup_status'] == 'purchased')) {\n $msg = $sm->calculator->cancelPickup($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label and pickup cancelled and refunded.'));\n }\n } else {\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label cancelled and refunded.'));\n }\n }\n expHistory::back();\n }",
" function edit_pickup()\n {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n assign_to_template(array(\n 'shipping'=> $sm,\n ));\n }",
" function edit_pickup2() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $this->params['pickupdate'] = strtotime($this->params['pickupdate']);\n $this->params['pickupenddate'] = strtotime($this->params['pickupenddate']);\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $pickup = $sm->calculator->createPickup($sm, $this->params['pickupdate'], $this->params['pickupenddate'], $this->params['instructions']);\n $sm->refresh();\n $pickup_rates = array();\n foreach ($sm->shipping_options['pickup_rates'] as $pu_rate) {\n $pickup_rates[$pu_rate['id']] = $pu_rate['id'] . ' - ' . expCore::getCurrency($pu_rate['cost']);\n }\n assign_to_template(array(\n 'shipping'=> $sm,\n 'rates' => $pickup_rates\n ));\n }",
" function save_pickup() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n //FIXME should we add the params to the $sm->shipping_options, or pass them??\n $msg = $sm->calculator->buyPickup($sm, $this->params['pickuprate']);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Package pickup ordered.'));\n } else {\n expHistory::back();\n }\n }",
" function delete_pickup() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->cancelPickup($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Package pickup cancelled.'));\n } else {\n expHistory::back();\n }\n }",
" function createReferenceOrder() {\n if (!isset($this->params['id'])) {\n flashAndFlow('error', gt('Unable to process request. Invalid order number.'));\n// expHistory::back();\n }\n $order = new order($this->params['id']);\n assign_to_template(array(\n 'order'=> $order\n ));\n }",
" function save_reference_order() {\n// global $user;",
" //eDebug($this->params,true);\n $order = new order($this->params['original_orderid']);",
" //eDebug($order,true);",
" //x\n $newOrder = new order();\n $newOrder->order_status_id = $this->params['order_status_id'];\n $newOrder->order_type_id = $this->params['order_type_id'];\n //$newOrder->order_references = $order->id;\n $newOrder->reference_id = $order->id;\n $newOrder->user_id = $order->user_id;\n $newOrder->purchased = time();\n $newOrder->updated = time();\n $newOrder->invoice_id = $newOrder->getInvoiceNumber();\n $newOrder->orderitem = array();\n $newOrder->subtotal = $this->params['subtotal'];\n $newOrder->total_discounts = $this->params['total_discounts'];\n $newOrder->tax = $this->params['tax'];\n $newOrder->shipping_total = $this->params['shipping_total'];\n $newOrder->surcharge_total = $this->params['surcharge_total'];",
" if ($this->params['autocalc'] == true) {\n $newOrder->grand_total = ($newOrder->subtotal - $newOrder->total_discounts) + $newOrder->tax + $newOrder->shipping_total + $newOrder->surcharge_total;\n } else {\n $newOrder->grand_total = round($this->params['grand_total'], 2);\n }\n $newOrder->save();\n $newOrder->refresh();",
" // save initial order status\n $change = new order_status_changes();\n// $change->from_status_id = null;\n $change->to_status_id = $newOrder->order_status_id;\n $change->orders_id = $newOrder->id;\n $change->save();",
" $tObj = new stdClass();\n $tObj->result = new stdClass();\n $tObj->result->errorCode = 0;\n $tObj->result->message = \"Reference Order Pending\";\n $tObj->result->PNREF = \"Pending\";\n $tObj->result->authorization_code = \"Pending\";\n $tObj->result->AVSADDR = \"Pending\";\n $tObj->result->AVSZIP = \"Pending\";\n $tObj->result->CVV2MATCH = \"Pending\";\n $tObj->result->traction_type = \"Pending\";\n $tObj->result->payment_status = \"Pending\";",
" $newBillingMethod = $order->billingmethod[0];\n $newBillingMethod->id = null;\n $newBillingMethod->orders_id = $newOrder->id;\n// $newBillingMethod->billingcalculator_id = 6;\n $newBillingMethod->billingcalculator_id = billingcalculator::getDefault();\n $newBillingMethod->billing_cost = 0;\n $newBillingMethod->transaction_state = 'authorization pending';\n $newBillingMethod->billing_options = serialize($tObj);\n $newBillingMethod->save();\n",
" //eDebug(expUnserialize($order->billingmethod[0]->billing_options));\n //eDebug(expUnserialize($order->billingmethod[0]->billingtransaction[0]->billing_options),true);",
"\n $newBillingTransaction = new billingtransaction();\n// $newBillingTransaction->billingcalculator_id = 6; ///setting to manual/passthru\n $newBillingTransaction->billingcalculator_id = billingcalculator::getDefault();\n $newBillingTransaction->billing_cost = 0;\n $newBillingTransaction->billingmethods_id = $newBillingMethod->id;\n $newBillingTransaction->transaction_state = 'authorization pending';",
" $newBillingTransaction->billing_options = serialize($tObj);\n $newBillingTransaction->save();",
" $sid = $order->orderitem[0]->shippingmethods_id;\n $newShippingMethod = $order->shippingmethods[$sid];\n $newShippingMethod->id = null;\n $newShippingMethod->shipping_cost = 0;\n $newShippingMethod->save();\n $newShippingMethod->refresh();",
" foreach ($this->params['oi'] as $oikey=> $oi) {\n //eDebug($oikey);\n $newOi = new orderitem($oikey);\n $newOi->id = null;\n $newOi->quantity = $this->params['quantity'][$oikey];\n $newOi->orders_id = $newOrder->id;\n $newOi->products_name = $this->params['products_name'][$oikey];\n $newOi->products_price = $this->params['products_price'][$oikey];\n $newOi->products_price_adjusted = $this->params['products_price'][$oikey];",
" //$newOi->products_tax = 0;",
" $newOi->shippingmethods_id = $newShippingMethod->id;\n $newOi->save();\n }",
" $newOrder->shippingmethod = $newShippingMethod;\n $newOrder->billingmethod = $newBillingMethod;\n $newOrder->update(); //FIXME do we need to do this?",
" flash('message', gt('Reference Order #') . $newOrder->invoice_id . \" \" . gt(\"created successfully.\"));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $newOrder->id));\n }",
" function create_new_order() {\n// $order = new order();\n// assign_to_template(array(\n// 'order'=> $order\n// ));\n }",
" function save_new_order() {\n //eDebug($this->params);\n /*addresses_id\n customer_type = 1 //new\n customer_type = 2 //existing Internal\n customer_type = 3 //existing external*/\n// global $user, $db;\n //eDebug($this->params,true);\n //$order = new order($this->params['original_orderid']);",
" //eDebug($order,true);",
"\n $newAddy = new address();\n if ($this->params['customer_type'] == 1) {\n //blank order\n $newAddy->save(false);\n } else if ($this->params['customer_type'] == 2) {\n //internal customer\n $newAddy = new address($this->params['addresses_id']);\n } else if ($this->params['customer_type'] == 3) {\n //other customer\n $otherAddy = new external_address($this->params['addresses_id']);\n $newAddy->user_id = $otherAddy->user_id;\n $newAddy->firstname = $otherAddy->firstname;\n $newAddy->lastname = $otherAddy->lastname;\n $newAddy->organization = $otherAddy->organization;\n $newAddy->address1 = $otherAddy->address1;\n $newAddy->address2 = $otherAddy->address2;\n $newAddy->city = $otherAddy->city;\n $newAddy->state = $otherAddy->state;\n $newAddy->zip = $otherAddy->zip;\n $newAddy->phone = $otherAddy->phone;\n $newAddy->email = $otherAddy->email;\n $newAddy->save();\n }",
" $newOrder = new order();\n $newOrder->order_status_id = $this->params['order_status_id'];\n $newOrder->order_type_id = $this->params['order_type_id'];\n //$newOrder->order_references = $order->id;\n $newOrder->reference_id = 0;\n $newOrder->user_id = $newAddy->user_id;\n $newOrder->purchased = time();\n $newOrder->updated = time();\n $newOrder->invoice_id = $newOrder->getInvoiceNumber();\n $newOrder->orderitem = array();\n $newOrder->subtotal = 0;\n $newOrder->total_discounts = 0;\n $newOrder->tax = 0;\n $newOrder->shipping_total = 0;\n $newOrder->surcharge_total = 0;\n $newOrder->grand_total = 0;\n $newOrder->save();\n $newOrder->refresh();",
" // save initial order status\n $change = new order_status_changes();\n// $change->from_status_id = null;\n $change->to_status_id = $newOrder->order_status_id;\n $change->orders_id = $newOrder->id;\n $change->save();",
" $tObj = new stdClass();\n $tObj->result = new stdClass();\n $tObj->result->errorCode = 0;\n $tObj->result->message = \"Reference Order Pending\";\n $tObj->result->PNREF = \"Pending\";\n $tObj->result->authorization_code = \"Pending\";\n $tObj->result->AVSADDR = \"Pending\";\n $tObj->result->AVSZIP = \"Pending\";\n $tObj->result->CVV2MATCH = \"Pending\";\n $tObj->result->traction_type = \"Pending\";\n $tObj->result->payment_status = \"Pending\";",
" $newBillingMethod = new billingmethod();\n $newBillingMethod->addresses_id = $newAddy->id;\n $newBillingMethod->orders_id = $newOrder->id;\n// $newBillingMethod->billingcalculator_id = 6;\n $newBillingMethod->billingcalculator_id = billingcalculator::getDefault();\n $newBillingMethod->billing_cost = 0;\n $newBillingMethod->transaction_state = 'authorization pending';\n $newBillingMethod->billing_options = serialize($tObj);\n $newBillingMethod->firstname = $newAddy->firstname;\n $newBillingMethod->lastname = $newAddy->lastname;\n $newBillingMethod->organization = $newAddy->organization;\n $newBillingMethod->address1 = $newAddy->address1;\n $newBillingMethod->address2 = $newAddy->address2;\n $newBillingMethod->city = $newAddy->city;\n $newBillingMethod->state = $newAddy->state;\n $newBillingMethod->zip = $newAddy->zip;\n $newBillingMethod->phone = $newAddy->phone;\n $newBillingMethod->email = $newAddy->email;\n $newBillingMethod->save();\n",
" //eDebug(expUnserialize($order->billingmethod[0]->billing_options));\n //eDebug(expUnserialize($order->billingmethod[0]->billingtransaction[0]->billing_options),true);",
"\n $newBillingTransaction = new billingtransaction();\n// $newBillingTransaction->billingcalculator_id = 6; ///setting to manual/passthru\n $newBillingTransaction->billingcalculator_id = billingcalculator::getDefault();\n $newBillingTransaction->billing_cost = 0;\n $newBillingTransaction->billingmethods_id = $newBillingMethod->id;\n $newBillingTransaction->transaction_state = 'authorization pending';\n $newBillingTransaction->billing_options = serialize($tObj);\n $newBillingTransaction->save();",
" $newShippingMethod = new shippingmethod();\n $newShippingMethod->shipping_cost = 0;\n// $newShippingMethod->shippingcalculator_id = $db->selectValue('shippingcalculator', 'id', 'is_default=1');\n $newShippingMethod->shippingcalculator_id = shippingcalculator::getDefault();\n $newShippingMethod->addresses_id = $newAddy->id;\n $newShippingMethod->firstname = $newAddy->firstname;\n $newShippingMethod->lastname = $newAddy->lastname;\n $newShippingMethod->organization = $newAddy->organization;\n $newShippingMethod->address1 = $newAddy->address1;\n $newShippingMethod->address2 = $newAddy->address2;\n $newShippingMethod->city = $newAddy->city;\n $newShippingMethod->state = $newAddy->state;\n $newShippingMethod->zip = $newAddy->zip;\n $newShippingMethod->phone = $newAddy->phone;\n $newShippingMethod->email = $newAddy->email;\n $newShippingMethod->save();\n $newShippingMethod->refresh();",
" //FIXME add a fake item?\n// $oi = new orderitem();\n// $oi->orders_id = $newOrder->id;\n// $oi->product_id = 0;\n// $oi->product_type = 'product';\n// $oi->products_name = \"N/A\";\n// $oi->products_model = \"N/A\";\n// $oi->products_price = 0;\n// $oi->shippingmethods_id = $newShippingMethod->id;\n// $oi->save(false);",
" $newOrder->shippingmethod = $newShippingMethod;\n $newOrder->billingmethod = $newBillingMethod;\n $newOrder->update();",
" flash('message', gt('New Order #') . $newOrder->invoice_id . \" \" . gt(\"created successfully.\"));\n if (empty($this->params['no_redirect'])) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $newOrder->id));\n } else {\n return $newOrder->id;\n }\n }",
" function edit_address() {\n //if $type = 'b' - business\n //if $type = 's' - shipping\n //addresses_id\n $order = new order($this->params['id']);\n $same = false;",
" $sm = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n //$bm = array_pop($order->billingmethods);",
" //eDebug($sm->addresses_id);\n //eDebug($order->billingmethod[0]->addresses_id);\n if ($sm->addresses_id == $order->billingmethod[0]->addresses_id) {\n $same = true;\n // echo \"Yes\";\n //$addy = new address($sm->addresses_id);\n }",
" if ($this->params['type'] == 'b') {\n $type = 'billing';\n $addy = new address($order->billingmethod[0]->addresses_id);\n } else if ($this->params['type'] == 's') {\n $type = 'shipping';\n $addy = new address($sm->addresses_id);\n }\n /* eDebug($this->params);\n eDebug($addy);\n eDebug($order,true);*/\n $billingmethod = new billingmethod($this->params['id']);\n //eDebug($billingmethod,true);\n //$opts = expUnserialize($billing->billingmethod->billing_options);\n //eDebug($billing);\n //eDebug($opts);\n assign_to_template(array(\n 'orderid'=> $this->params['id'],\n 'record' => $addy,\n 'same' => $same,\n 'type' => $type\n ));\n }",
" function save_address() {\n global $db;",
" $order = new order($this->params['orderid']);\n $billing = new billing($this->params['orderid']);\n $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $shippingmethod = new shippingmethod($s->id);",
" //eDebug($order);\n //eDebug($this->params,true);\n //eDebug($shippingmethod);\n $billingmethod = $billing->billingmethod;\n /*\n eDebug($order);\n eDebug($shippingmethod);\n eDebug($billingmethod);*/",
" if ($this->params['save_option'] == 0) {\n //update existing\n //echo \"Update\";\n $addy = new address($this->params['addyid']);\n } else if ($this->params['save_option'] == 1) {\n //create new\n //echo \"New\";\n $oldaddy = new address($this->params['addyid']);\n $addy = new address();\n $addy->user_id = $oldaddy->user_id;\n }",
" //eDebug($addy,true);",
" foreach ($this->params['address'] as $key=> $val) {\n if ($key == 'address_country_id') {\n $key = 'country';\n }\n if ($key == 'address_region_id') {\n $key = 'state';\n }\n $addy->$key = $val;\n if (isset($billingmethod->$key)) $billingmethod->$key = $val;\n if (isset($shippingmethod->$key)) $shippingmethod->$key = $val;\n }\n $addy->is_billing = 0;\n $addy->is_shipping = 0;\n $addy->save();\n $addy->refresh();",
" if ($this->params['type'] == 'billing' || ($this->params['same'] == true && $this->params['save_option'] == 0)) {\n //echo \"Billing\";\n $billingmethod->addresses_id = $addy->id;\n $billingmethod->save();\n $addy->is_billing = 1;\n }",
" if ($this->params['type'] == 'shipping' || ($this->params['same'] == true && $this->params['save_option'] == 0)) {\n //eDebug(\"Shipping\",true);\n $shippingmethod->addresses_id = $addy->id;\n $shippingmethod->save();\n $addy->is_shipping = 1;\n }",
" $addy->save();\n if ($addy->is_default) $db->setUniqueFlag($addy, 'addresses', 'is_default', 'user_id=' . $addy->user_id);",
" //eDebug($shippingmethod,true);\n// flashAndFlow('message', gt('Address updated.'));\n flash('message', gt('Address updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n }",
" function edit_order_item() {\n $oi = new orderitem($this->params['id'], true, true);\n if (empty($oi->id)) {\n flash('error', gt('Order item doesn\\'t exist.'));\n expHistory::back();\n }\n $oi->user_input_fields = expUnserialize($oi->user_input_fields);\n $params['options'] = $oi->opts;\n $params['user_input_fields'] = $oi->user_input_fields;\n $oi->product = new product($oi->product->id, true, true);\n if ($oi->product->parent_id != 0) {\n $parProd = new product($oi->product->parent_id);",
" //$oi->product->optiongroup = $parProd->optiongroup;",
" $oi->product = $parProd;\n }\n //FIXME we don't use selectedOpts?\n// $oi->selectedOpts = array();\n// if (!empty($oi->opts)) {\n// foreach ($oi->opts as $opt) {\n// $option = new option($opt[0]);\n// $og = new optiongroup($option->optiongroup_id);\n// if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id]))\n// $oi->selectedOpts[$og->id] = array($option->id);\n// else\n// array_push($oi->selectedOpts[$og->id], $option->id);\n// }\n// }\n //eDebug($oi->selectedOpts);",
" assign_to_template(array(\n 'oi' => $oi,\n 'params' => $params\n ));\n }",
" function delete_order_item() {\n $order = new order($this->params['orderid']);\n if (count($order->orderitem) <= 1) {\n flash('error', gt('You may not delete the only item on an order. Please edit this item, or add another item before removing this one.'));\n expHistory::back();\n }",
" $oi = new orderitem($this->params['id']);\n $oi->delete();",
" $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $sm = new shippingmethod($s->id);",
" $shippingCalc = new shippingcalculator($sm->shippingcalculator_id);\n $calcName = $shippingCalc->calculator_name;\n $calculator = new $calcName($shippingCalc->id);\n $pricelist = $calculator->getRates($order);",
" foreach ($pricelist as $rate) {\n if ($rate['id'] == $sm->option) {\n $sm->shipping_cost = $rate['cost'];\n }\n }\n $sm->save();",
" $order->refresh();\n $order->calculateGrandTotal();\n $order->save();",
"// flashAndFlow('message', gt('Order item removed and order totals updated.'));\n flash('message', gt('Order item removed and order totals updated.'));\n if (empty($this->params['no_redirect'])) redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }",
" function save_order_item() {\n if (!empty($this->params['id'])) {\n $oi = new orderitem($this->params['id']);\n } else {\n $oi = new orderitem($this->params);\n }\n //eDebug($this->params);",
" /*eDebug($oi);\n eDebug(expUnserialize($oi->options));\n eDebug(expUnserialize($oi->user_input_fields),true);*/\n if (!empty($this->params['products_price'])) $oi->products_price = expUtil::currency_to_float($this->params['products_price']);\n $oi->quantity = $this->params['quantity'];\n if (!empty($this->params['products_name'])) $oi->products_name = $this->params['products_name'];",
" if ($oi->product->parent_id != 0) {\n $oi->product = new product($oi->product->parent_id, true, false);\n } else {\n //reattach the product so we get the option fields and such\n $oi->product = new product($oi->product->id, true, false);\n }",
" if (isset($this->params['product_status_id'])) {\n $ps = new product_status($this->params['product_status_id']);\n $oi->products_status = $ps->title;\n }",
" $options = array();\n foreach ($oi->product->optiongroup as $og) {\n $isOptionEmpty = true;\n if (!empty($this->params['options'][$og->id])) {\n foreach ($this->params['options'][$og->id] as $opt) {\n if (!empty($opt)) $isOptionEmpty = false;\n }\n }\n if (!$isOptionEmpty) {\n foreach ($this->params['options'][$og->id] as $opt_id) {\n $selected_option = new option($opt_id);\n $cost = $selected_option->modtype == '$' ? $selected_option->amount : $this->getBasePrice() * ($selected_option->amount * .01);\n $cost = $selected_option->updown == '+' ? $cost : $cost * -1;\n $options[] = array($selected_option->id, $selected_option->title, $selected_option->modtype, $selected_option->updown, $selected_option->amount);\n }\n }\n }",
" eDebug($this->params);\n //eDebug($oi,true);",
" $user_input_info = array();\n //check user input fields\n //$this->user_input_fields = expUnserialize($this->user_input_fields);\n //eDebug($this,true);\n if (!empty($oi->product->user_input_fields)) foreach ($oi->product->user_input_fields as $uifkey=> $uif) {",
" /*if ($uif['is_required'] || (!$uif['is_required'] && strlen($params['user_input_fields'][$uifkey]) > 0))",
" {\n if (strlen($params['user_input_fields'][$uifkey]) < $uif['min_length'])\n {",
" //flash('error', 'test');\n //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type));",
" $params['error'] .= $uif['name'].' field has a minimum requirement of ' . $uif['min_length'] . ' characters.<br/>';",
"",
" }else if (strlen($params['user_input_fields'][$uifkey]) > $uif['max_length'] && $uif['max_length'] > 0)\n {",
" //flash('error', );\n //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type));",
" $params['error'] .= $uif['name'].' field has a maximum requirement of ' . $uif['max_length'] . ' characters.<br/>';",
" }",
" }*/\n $user_input_info[] = array($uif['name']=> $this->params['user_input_fields'][$uifkey]);\n }\n //eDebug($options);\n //eDebug($user_input_info,true);",
" $oi->options = serialize($options);\n $oi->user_input_fields = serialize($user_input_info);",
" //eDebug($oi);",
" $oi->save();\n $oi->refresh();\n //eDebug($oi,true);",
" $order = new order($oi->orders_id);\n $order->calculateGrandTotal();",
" $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and thenremoving it\n eDebug($s);\n $sm = new shippingmethod($s->id);",
" $shippingCalc = new shippingcalculator($sm->shippingcalculator_id);\n $calcName = $shippingCalc->calculator_name;\n $calculator = new $calcName($shippingCalc->id);\n $pricelist = $calculator->getRates($order);",
" foreach ($pricelist as $rate) {\n if ($rate['id'] == $sm->option) {\n $sm->shipping_cost = $rate['cost'];\n break;\n }\n }\n $sm->save();\n $order->refresh();\n $order->calculateGrandTotal();\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Item edited in order');\n// $order->billingmethod[0]->update(array('billing_options' => serialize($bmopts), 'transaction_state' => $transaction_state));\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();",
"// flashAndFlow('message', gt('Order item updated and order totals recalculated.'));\n flash('message', gt('Order item updated and order totals recalculated.'));\n if (empty($this->params['no_redirect'])) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n } else {\n return $oi->id;\n }\n }",
" function add_order_item() {\n// eDebug($this->params);\n $product = new product($this->params['product_id']);\n $paramsArray = array('orderid'=> $this->params['orderid']);\n assign_to_template(array(\n 'product'=> $product,\n 'params' => $paramsArray\n ));\n }",
" function save_new_order_item() { //FIXME we need to be able to call this from program with $params also, addToOrder\n //eDebug($this->params,true);\n //check for multiple product adding\n $order = new order($this->params['orderid']);\n if (isset($this->params['prod-quantity'])) {\n //we are adding multiple children, so we approach a bit different",
" //we'll send over the product_id of the parent, along with id's and quantities of children we're adding",
" foreach ($this->params['prod-quantity'] as $qkey=> &$quantity) {\n if (in_array($qkey, $this->params['prod-check'])) {\n $this->params['children'][$qkey] = $quantity;\n }\n if (isset($child)) $this->params['product_id'] = $child->parent_id;\n }\n }",
" $pt = $this->params['product_type'];\n $product = new $pt($this->params['product_id'], true, true); //need true here?",
" if ($product->addToCart($this->params, $this->params['orderid'])) {\n $order->refresh();\n $order->calculateGrandTotal();\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Item added to order');\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();\n// flashAndFlow('message', gt('Product added to order and order totals recalculated.'));\n flash('message', gt('Product added to order and order totals recalculated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }\n /*else\n {\n expHistory::back();\n }*/\n }",
" function edit_invoice_id() {\n if (!isset($this->params['id'])) flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $order = new order($this->params['id']);\n assign_to_template(array(\n 'orderid' => $this->params['id'],\n 'invoice_id'=> $order->invoice_id\n ));\n }",
" function save_invoice_id() {\n if (!isset($this->params['id'])) flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n if (empty($this->params['invoice_id']) || !is_numeric($this->params['invoice_id'])) flashAndFlow('error', gt('Unable to process request. Invoice ID #.'));\n $order = new order($this->params['id']);\n $order->invoice_id = $this->params['invoice_id'];\n $order->save(false);\n flashAndFlow('message', gt('Invoice # saved.'));\n }",
" function edit_totals() {\n //eDebug($this->params);\n $order = new order($this->params['orderid']);\n assign_to_template(array(\n// 'orderid'=>$this->params['id'],\n 'order'=> $order\n ));\n }",
" function save_totals() {\n //eDebug($this->params);\n //if(!is_numeric($this->params['subtotal']))\n $order = new order($this->params['orderid']);\n $order->subtotal = expUtil::currency_to_float($this->params['subtotal']);\n $order->total_discounts = expUtil::currency_to_float($this->params['total_discounts']);\n $order->total = round($order->subtotal - $order->total_discounts, 2);\n $order->tax = expUtil::currency_to_float($this->params['tax']);\n $order->shipping_total = expUtil::currency_to_float($this->params['shipping_total']);\n //note: the shippingmethod record will still reflect the ORIGINAL shipping amount for this order.\n $order->surcharge_total = expUtil::currency_to_float($this->params['surcharge_total']);",
" if ($this->params['autocalc'] == true) {\n $order->grand_total = round(($order->subtotal - $order->total_discounts) + $order->tax + $order->shipping_total + $order->surcharge_total, 2);\n } else {\n $order->grand_total = round(expUtil::currency_to_float($this->params['grand_total']), 2);\n }\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Totals Adjusted');\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();",
"// flashAndFlow('message', gt('Order totals updated.'));\n flash('message', gt('Order totals updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }",
" function update_sales_reps() {\n if (!isset($this->params['id'])) {\n flashAndFlow('error', gt('Unable to process request. Invalid order number.'));\n //expHistory::back();\n }\n $order = new order($this->params['id']);\n $order->sales_rep_1_id = $this->params['sales_rep_1_id'];\n $order->sales_rep_2_id = $this->params['sales_rep_2_id'];\n $order->sales_rep_3_id = $this->params['sales_rep_3_id'];\n $order->save();\n flashAndFlow('message', gt('Sales reps updated.'));\n }",
" function quickfinder() {\n global $db;",
" $search = $this->params['ordernum'];\n $searchInv = intval($search);",
" $sql = \"SELECT DISTINCT(o.id), o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title, ot.title as order_type\";\n $sql .= \" from \" . $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON ot.id = o.order_type_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";",
" $sqlwhere = \"WHERE o.purchased != 0\";\n if ($searchInv != 0) $sqlwhere .= \" AND (o.invoice_id LIKE '%\" . $searchInv . \"%' OR\";\n else $sqlwhere .= \" AND (\";\n $sqlwhere .= \" b.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.email LIKE '%\" . $search . \"%')\";",
" $limit = empty($this->config['limit']) ? 350 : $this->config['limit'];\n //eDebug($sql . $sqlwhere) ;\n $page = new expPaginator(array(\n 'sql' => $sql . $sqlwhere,\n 'limit' => $limit,\n 'order' => 'o.invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date')=> 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'term'=> $search\n ));",
" //eDebug($this->params);\n /*$o = new order();\n $b = new billingmethod();\n $s = new shippingmethod();",
"",
" $search = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $orders = $o->find('all',\"invoice_id LIKE '%\".$oid.\"%'\");\n if(count($orders == 1))\n {",
" redirect_to(array('controller'=>'order','action'=>'show','id'=>$order[0]->id));",
" }\n else\n {\n flashAndFlow('message',\"Orders containing \" . $search . \" in the order number not found.\");\n }\n }\n else\n {\n //lookup just a customer\n $bms = $b->find('all', )\n }*/\n /*$o = new order();\n $oid = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $order = $o->find('first','invoice_id='.$oid);\n if(!empty($order->id))\n {",
" redirect_to(array('controller'=>'order','action'=>'show','id'=>$order->id));",
" }\n else\n {\n flashAndFlow('message',\"Order #\" . intval($this->params['ordernum']) . \" not found.\");\n }\n }\n else\n {",
" flashAndFlow('message','Invalid order number.');",
" }*/\n }",
" public function verifyReturnShopper() {\n// global $user, $order;",
" $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr)) {\n assign_to_template(array(\n 'firstname'=> $sessAr['firstname'],\n 'cid'=> $sessAr['cid']",
" ));\n /*eDebug(expSession::get('verify_shopper'));\n eDebug($this->params);\n eDebug(\"here\");\n eDebug($user);\n eDebug($order);*/\n }\n }",
" public function verifyAndRestoreCart() {\n// global $user, $order;",
" $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr) && isset($this->params['cid']) && $this->params['cid'] == $sessAr['cid']) {\n $tmpCart = new order($sessAr['cid']);\n if (isset($tmpCart->id)) {",
" //eDebug($tmpCart,true);",
" $shippingMethod = $tmpCart->shippingmethod;\n $billingMethod = $tmpCart->billingmethod[0];",
" if (($this->params['lastname'] == $shippingMethod->lastname || $this->params['lastname'] == $billingMethod->lastname) &&\n ($this->params['email'] == $shippingMethod->email || $this->params['email'] == $billingMethod->email) &&\n ($this->params['zip_code'] == $shippingMethod->zip || $this->params['zip_code'] == $billingMethod->zip)\n ) {\n //validatio succeed, so restore order, login user and continue on to orig_path\n //eDebug(\"Validated\",true);\n $sessAr['validated'] = true;\n expSession::set('verify_shopper', $sessAr);\n redirect_to($sessAr['orig_path']);\n } else {\n //eDebug(\"Validated NOT\",true);\n //validation failed, so go back\n flash('error', gt(\"We're sorry, but we could not verify your information. Please try again, or start a new shopping cart.\"));\n redirect_to(array('controller'=> 'order', 'action'=> 'verifyReturnShopper', 'id'=> $sessAr['cid']));\n }\n } else {\n flash('error', gt('We were unable to restore the previous order, we apologize for the inconvenience. Please start a new shopping cart.'));\n $this->clearCart();\n }\n }\n }",
" public static function clearCartCookie() {\n expSession::un_set('verify_shopper');\n order::setCartCookie(null);\n }",
" public function clearCart() {\n global $order;",
" $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr)) {\n order::setCartCookie($order);\n $orig_path = $sessAr['orig_path'];\n expSession::un_set('verify_shopper');\n redirect_to($orig_path);\n } else {\n expHistory::back();\n }\n }",
" /**\n * AJAX search for internal (addressController) addresses\n *\n */\n public function search() {\n// global $db, $user;\n 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 \";\n $sql .= \" WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] .\n \"*' IN BOOLEAN MODE) \";\n $sql .= \"order by match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) ASC LIMIT 12\";\n $res = $db->selectObjectsBySql($sql);\n foreach ($res as $key=>$record) {\n $res[$key]->title = $record->firstname . ' ' . $record->lastname;\n }\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
" /**\n * Ajax search for external addresses\n *\n */\n public function search_external() {\n// global $db, $user;\n global $db;",
" $sql = \"select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email \";",
" $sql .= \"from \" . $db->prefix . \"external_addresses as a \"; //R JOIN \" .",
" //$db->prefix . \"billingmethods as bm ON bm.addresses_id=a.id \";\n $sql .= \" WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] .\n \"*' IN BOOLEAN MODE) \";\n $sql .= \"order by match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) ASC LIMIT 12\";\n $res = $db->selectObjectsBySql($sql);\n foreach ($res as $key=>$record) {\n $res[$key]->title = $record->firstname . ' ' . $record->lastname;\n }\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class order_statusController extends expController {",
"",
" static function displayname() { return gt(\"e-Commerce Order Statuses\"); }\n static function description() { return gt(\"Manage e-Commerce order status codes\"); }\n static function hasSources() { return false; }\n static function hasContent() { return false; }",
" ",
" public function manage() {\n expHistory::set('viewable', $this->params);",
" ",
" $page = new expPaginator(array(\n\t\t\t'model'=>'order_status',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n //'columns'=>array('Name'=>'title')\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }",
" ",
" public function manage_messages() {\n expHistory::set('manageable', $this->params);",
" ",
" $page = new expPaginator(array(\n\t\t\t'model'=>'order_status_messages',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'body',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n\t\t\t//'columns'=>array('Name'=>'title')\n ));",
" //eDebug($page);\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }",
" ",
" public function edit_message() {\n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $msg = new order_status_messages($id);\n assign_to_template(array(\n 'record'=>$msg\n ));\n //$msg->update($this->params);\n }",
" ",
" public function update_message() {\n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $msg = new order_status_messages($id);\n $msg->update($this->params);\n expHistory::back();\n }",
" ",
" public function delete_message() {\n if (empty($this->params['id'])) return false;\n $msg = new order_status_messages($this->params['id']);\n $msg->delete();\n expHistory::back();\n }",
" ",
" public function toggle_closed() {\n global $db;",
" $db->toggle('order_status', 'treat_as_closed', 'id='.$this->params['id']);\n expHistory::back();\n }",
" ",
" public function toggle_default() {\n global $db;",
" $order_status = new order_status($this->params['id']);\n $db->setUniqueFlag($order_status, 'order_status', 'is_default');\n expHistory::back();\n }",
" ",
" public function showall() {\n redirect_to(array('controller'=>'order_status', 'action'=>'manage'));\n// $this->manage();\n }",
" ",
" public function show() {\n redirect_to(array('controller'=>'order_status', 'action'=>'manage'));\n// $this->manage();\n }",
" ",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class order_statusController extends expController {",
" protected $manage_permissions = array(\n 'toggle'=>'Toggle Status'\n );",
" static function displayname() { return gt(\"e-Commerce Order Statuses\"); }\n static function description() { return gt(\"Manage e-Commerce order status codes\"); }\n static function hasSources() { return false; }\n static function hasContent() { return false; }",
"",
" public function manage() {\n expHistory::set('viewable', $this->params);",
"",
" $page = new expPaginator(array(\n\t\t\t'model'=>'order_status',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n //'columns'=>array('Name'=>'title')\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }",
"",
" public function manage_messages() {\n expHistory::set('manageable', $this->params);",
"",
" $page = new expPaginator(array(\n\t\t\t'model'=>'order_status_messages',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'body',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n\t\t\t//'columns'=>array('Name'=>'title')\n ));",
" //eDebug($page);\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }",
"",
" public function edit_message() {\n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $msg = new order_status_messages($id);\n assign_to_template(array(\n 'record'=>$msg\n ));\n //$msg->update($this->params);\n }",
"",
" public function update_message() {\n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $msg = new order_status_messages($id);\n $msg->update($this->params);\n expHistory::back();\n }",
"",
" public function delete_message() {\n if (empty($this->params['id'])) return false;\n $msg = new order_status_messages($this->params['id']);\n $msg->delete();\n expHistory::back();\n }",
"",
" public function toggle_closed() {\n global $db;",
" $db->toggle('order_status', 'treat_as_closed', 'id='.$this->params['id']);\n expHistory::back();\n }",
"",
" public function toggle_default() {\n global $db;",
" $order_status = new order_status($this->params['id']);\n $db->setUniqueFlag($order_status, 'order_status', 'is_default');\n expHistory::back();\n }",
"",
" public function showall() {\n redirect_to(array('controller'=>'order_status', 'action'=>'manage'));\n// $this->manage();\n }",
"",
" public function show() {\n redirect_to(array('controller'=>'order_status', 'action'=>'manage'));\n// $this->manage();\n }",
"",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class purchaseOrderController extends expController {",
"",
"",
"\tpublic $basemodel_name = 'purchase_order';\n\tprotected $add_permissions = array(\n 'manage'=>'Manage Purchase Orders',\n 'edit'=>'Edit Purchase Orders',\n 'manage_vendors'=>'Manage Vendors',\n 'show_vendor'=>'Show Vendor Details',\n 'edit_vendor'=>'Edit Vendor',\n 'update_vendor'=>'Update Vendor',\n 'delete_vendor'=>'Delete vendors',\n );\n\t",
" static function displayname() { return gt(\"e-Commerce Purchase Order Manager\"); }\n static function description() { return gt(\"Use this module to create and manage purchase orders for your ecommerce store.\"); }",
"\t",
"\tfunction manage () {\n\t expHistory::set('viewable', $this->params);",
"\t\t",
"\t\t$vendor = new vendor();\n\t\t$vendors = $vendor->find('all');\n\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}",
"\t\t",
"\t\tassign_to_template(array(\n 'purchase_orders'=>$purchase_orders,\n 'vendors' => $vendors,\n 'vendor_id' => @$this->params['vendor']\n ));\n\t}",
"\t",
"\tfunction edit () {\n//\t global $db;\n\t assign_to_template(array(\n 'record'=>$this->params\n ));\n\t}",
" ",
"\tfunction manage_vendors () {\n\t expHistory::set('viewable', $this->params);\n\t\t$vendor = new vendor();",
"\t\t",
"\t\t$vendors = $vendor->find('all');\n\t\tassign_to_template(array(\n 'vendors'=>$vendors\n ));\n\t}",
"\t",
"\tfunction show_vendor () {\n\t\t$vendor = new vendor();",
"\t\t",
"\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\t$vendor_title = $vendor->title;\n\t\t\t$state = new geoRegion($vendor->state);\n\t\t\t$vendor->state = $state->name;\n\t\t\t//Removed unnecessary fields\n\t\t\tunset(\n $vendor->title,\n $vendor->table,\n $vendor->tablename,\n $vendor->classname,\n $vendor->identifier\n );",
"\t\t",
"\t\t\tassign_to_template(array(\n 'vendor_title' => $vendor_title,\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}",
"\t",
"\tfunction edit_vendor() {\n\t\t$vendor = new vendor();",
"\t\t",
"\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\tassign_to_template(array(\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}",
"\t",
"\tfunction update_vendor() {\n\t\t$vendor = new vendor();",
"\t\t",
"\t\t$vendor->update($this->params['vendor']);\n expHistory::back();\n }",
"\t",
"\tfunction delete_vendor() {\n\t\tglobal $db;",
"\t\t",
" if (!empty($this->params['id'])){\n\t\t\t$db->delete('vendor', 'id =' .$this->params['id']);\n\t\t}\n expHistory::back();\n }",
"\t",
"\tpublic function getPurchaseOrderByJSON() {",
"\t\t",
"\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}",
"\t\t",
"\t\techo json_encode($purchase_orders);\n\t}",
" ",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class purchaseOrderController extends expController {",
"\tpublic $basemodel_name = 'purchase_order';\n\tprotected $manage_permissions = array(\n 'show_vendor'=>'Show Vendor Details',\n );",
"",
"",
" static function displayname() { return gt(\"e-Commerce Purchase Order Manager\"); }\n static function description() { return gt(\"Use this module to create and manage purchase orders for your ecommerce store.\"); }",
"",
"\tfunction manage () {\n\t expHistory::set('viewable', $this->params);",
"",
"\t\t$vendor = new vendor();\n\t\t$vendors = $vendor->find('all');\n\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}",
"",
"\t\tassign_to_template(array(\n 'purchase_orders'=>$purchase_orders,\n 'vendors' => $vendors,\n 'vendor_id' => @$this->params['vendor']\n ));\n\t}",
"",
"\tfunction edit () {\n//\t global $db;\n\t assign_to_template(array(\n 'record'=>$this->params\n ));\n\t}",
"",
"\tfunction manage_vendors () {\n\t expHistory::set('viewable', $this->params);\n\t\t$vendor = new vendor();",
"",
"\t\t$vendors = $vendor->find('all');\n\t\tassign_to_template(array(\n 'vendors'=>$vendors\n ));\n\t}",
"",
"\tfunction show_vendor () {\n\t\t$vendor = new vendor();",
"",
"\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\t$vendor_title = $vendor->title;\n\t\t\t$state = new geoRegion($vendor->state);\n\t\t\t$vendor->state = $state->name;\n\t\t\t//Removed unnecessary fields\n\t\t\tunset(\n $vendor->title,\n $vendor->table,\n $vendor->tablename,\n $vendor->classname,\n $vendor->identifier\n );",
"",
"\t\t\tassign_to_template(array(\n 'vendor_title' => $vendor_title,\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}",
"",
"\tfunction edit_vendor() {\n\t\t$vendor = new vendor();",
"",
"\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\tassign_to_template(array(\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}",
"",
"\tfunction update_vendor() {\n\t\t$vendor = new vendor();",
"",
"\t\t$vendor->update($this->params['vendor']);\n expHistory::back();\n }",
"",
"\tfunction delete_vendor() {\n\t\tglobal $db;",
"",
" if (!empty($this->params['id'])){\n\t\t\t$db->delete('vendor', 'id =' .$this->params['id']);\n\t\t}\n expHistory::back();\n }",
"",
"\tpublic function getPurchaseOrderByJSON() {",
"",
"\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}",
"",
"\t\techo json_encode($purchase_orders);\n\t}",
"",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class shippingController extends expController {",
" protected $add_permissions = array(\n 'toggle'=>'Enable/Disable Options'",
" );",
" static function displayname() { return gt(\"e-Commerce Shipping Controller\"); }\n static function description() { return \"\"; }\n\tstatic function hasSources() { return false; }\n static function hasContent() { return false; }",
" /**\n * Ajax method to return a shipping calculator object within a shipping object\n */\n\tfunction selectShippingCalculator() {\n\t global $db;",
"\t\t$shipping = new shipping();",
"\t\t",
"\t\t// update the shippingmethod\n\t\t$shipping->shippingmethod->update(array('shippingcalculator_id'=>$this->params['shippingcalculator_id'],'option'=>null,'option_title'=>null));",
"\t\t",
"\t\t// fetch the calculator\n\t\t$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['shippingcalculator_id']);\n\t\t//eDebug($this->params['shippingcalculator_id']);\n\t\t//eDebug($calcname);\n\t\t$shipping->calculator = new $calcname($this->params['shippingcalculator_id']);",
"\t\t",
"\t\t$ar = new expAjaxReply(200, 'ok', $shipping, array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
" /**\n * Ajax method to select/update a shipping method\n */\n\tfunction selectShippingOption() {\n\t global $order; //FIXME we do NOT want the global $order",
"\t\t$shipping = new shipping();\n\t\t$id = $this->params['option'];\n\t\t$rates = $shipping->calculator->getRates($order); //FIXME a lot of work just to get one set of data since we'll be doing it again for cart/checkout redisplay...maybe cache???\n\t\t$rate = $rates[$id];\n\t\t$shipping->shippingmethod->update(array('option'=>$id,'option_title'=>$rate['title'],'shipping_cost'=>$rate['cost']));\n\t\t$ar = new expAjaxReply(200, 'ok', array('title'=>$rate['title'], 'cost'=>number_format($rate['cost'], 2)), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
" /**\n * Ajax method to set a shipping address\n */\n\tfunction setAddress() {\n\t\t$shipping = new shipping();\n\t\t$shipping->shippingmethod->setAddress($this->params['shipping_address']);\n\t\t$shipping->refresh();\n\t\t$ar = new expAjaxReply(200, 'ok', new address($shipping->shippingmethod->addresses_id), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
"\t",
" /**\n * Ajax method to set a shipping 'gift' message\n */\n\tfunction leaveMessage() {\n\t\tif (!empty($this->params['shippingmessageid'])) {\n\t\t $sm = new shippingmethod($this->params['shippingmessageid']);",
"\t\t ",
"\t\t if ($this->params['nosave'] == false) {",
"\t\t $sm->to = empty($this->params['shpmessageto']) ? null : $this->params['shpmessageto']; \n\t\t $sm->from = empty($this->params['shpmessagefrom']) ? null : $this->params['shpmessagefrom']; \n\t\t $sm->message = empty($this->params['shpmessage']) ? null : $this->params['shpmessage']; ",
"\t\t $sm->save();\n\t\t }\n\t\t}",
"\t\t",
"\t\t$ar = new expAjaxReply(200, 'ok', $sm, array('controller'=>'cart', 'action'=>'checkout'),true);",
"\t\t$ar->send();\t\t\n\t}\n\t",
"\tfunction renderOptions() { //FIXME do we ever call this?\n//\t global $db, $order;\n global $order; //FIXME we do NOT want the global $order",
"\t $shipping = new shipping();\n //FIXME perhaps check for cached rates if calculator didn't change???\n $shipping->pricelist = $shipping->calculator->getRates($order);\n $shipping->multiple_carriers = $shipping->calculator->multiple_carriers;",
" if (empty($shipping->shippingmethod->option)) {\n if ($shipping->multiple_carriers) {\n $opt = current($shipping->pricelist[0]);\n } else {\n $opt = current($shipping->pricelist);\n }\n } else {\n if ($shipping->multiple_carriers) {\n $opt = $shipping->pricelist[0][$shipping->shippingmethod->option];\n } else {\n $opt = $shipping->pricelist[$shipping->shippingmethod->option];\n }\n }",
" ",
" $shipping->shippingmethod->update(array('option'=>$opt['id'],'option_title'=>$opt['title'],'shipping_cost'=>$opt['cost']));",
" ",
" assign_to_template(array(\n 'shipping'=>$shipping,\n 'order'=>$order\n ));\n\t}",
"\t",
" /**\n * Ajax method to return a shipping calculator object within a shipping object\n */\n\tfunction listPrices() {\n\t $shipping = new shipping(); //FIXME this model has no listPrices() method???\n\t $ar = new expAjaxReply(200, 'ok', $shipping->listPrices(), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
"\t",
"\tfunction manage() {\n\t global $db;",
"\t ",
"\t expHistory::set('manageable', $this->params);\n\t $calculators = array();\n $dir = BASE.\"framework/modules/ecommerce/shippingcalculators\";\n $default = false;\n $on = false;\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_file(\"$dir/$file\") && substr(\"$dir/$file\", -4) == \".php\") {\n include_once(\"$dir/$file\");\n $classname = substr($file, 0, -4);",
" $id = $db->selectValue('shippingcalculator', 'id', 'calculator_name=\"'.$classname.'\"'); ",
" if (empty($id)) {\n $calcobj = new $classname($this->params);",
" if ($calcobj->isSelectable() == true) { ",
" $calcobj->update(array('title'=>$calcobj->name(),'body'=>$calcobj->description(),'calculator_name'=>$classname,'enabled'=>false));\n }\n } else {\n $calcobj = new $classname($id);\n }\n $calculators[] = $calcobj;\n if (!$default) $default = $calcobj->is_default;\n if (!$on && $calcobj->enabled) $on = $calcobj->id;\n }\n }\n if (!$default && $on) {\n $db->toggle('shippingcalculator', 'is_default', 'id='.$on);\n foreach ($calculators as $idx=>$calc) {\n if ($calc->id == $on) $calculators[$idx]->is_default = 1;\n }\n }\n }\n assign_to_template(array(\n 'calculators'=>$calculators\n ));\n\t}",
"\t\n\t\t",
"\tpublic function toggle() {\n\t global $db;",
"\t if (isset($this->params['id'])) $db->toggle('shippingcalculator', 'enabled', 'id='.$this->params['id']);\n //FIXME we need to ensure our default calculator is still active...not sure this does it\n if ($db->selectValue('shippingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('shippingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('shippingcalculator', 'is_default', 'id='.$this->params['id']);\n }",
" $calc = new shippingcalculator($this->params['id']);\n $calc_obj = new $calc->calculator_name();\n if ($calc_obj->hasConfig() && empty($calc->config)) {\n flash('message', $calc_obj->name().' '.gt('requires configuration. Please do so now.'));\n redirect_to(array('controller'=>'shipping', 'action'=>'configure', 'id'=>$calc->id));\n }\n\t expHistory::back();\n\t}",
" public function toggle_default() {\n \t global $db;",
" $db->toggle('shippingcalculator',\"is_default\",'is_default=1');\n \t if (isset($this->params['id'])) {\n $active = $db->selectObject('shippingcalculator',\"id=\".$this->params['id']);\n $active->is_default = 1;\n $db->updateObject($active,'shippingcalculator',null,'id');\n }\n if ($db->selectValue('shippingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('shippingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('shippingcalculator', 'enabled', 'id='.$this->params['id']);\n }\n \t expHistory::back();\n \t}",
" public function configure() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc,\n 'title'=>static::displayname()\n ));\n }",
" ",
" public function saveconfig() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);",
" $conf = serialize($calc->parseConfig($this->params)); ",
" $calc->update(array('config'=>$conf));\n expHistory::back();\n }",
"\t",
"\tpublic function editspeed() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc\n ));",
"\t\t\n }\n\t",
"\tpublic function saveEditSpeed() {\n\t\tglobal $db;",
" $obj = new stdClass();\n\t\t$obj->speed = $this->params['speed'];\n\t\t$obj->shippingcalculator_id = $this->params['shippingcalculator_id'];\n\t\t$db->insertObject($obj, $this->params['table']);\n\t\tredirect_to(array('controller'=>'shipping', 'action'=>'configure', 'id'=>$this->params['shippingcalculator_id']));\n\t}",
"\t",
"\tpublic function deleteSpeed() {\n\t\tglobal $db;",
" if (empty($this->params['id'])) return false;\n\t\t$db->delete('shippingspeeds',' id =' . $this->params['id']);\n\t\texpHistory::back();\n\t}",
" public function tracker() {\n global $db;",
" // we ALWAYS assume this is coming from easypost webhook\n $calc_id = $db->selectValue('shippingcalculator','id','calculator_name=\"easypostcalculator\" AND enabled=1');\n if ($calc_id) {\n $ep = new easypostcalculator($calc_id);\n if ($ep->trackerEnabled()) {\n $ep->handleTracking();\n }\n }\n exit(); // graceful exit\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class shippingController extends expController {",
" protected $manage_permissions = array(\n 'editspeed'=>'Edit Shipping Speed',\n 'save'=>'Save Configuration',\n 'select'=>'Select Feature',\n 'toggle'=>'Enable/Disable Options',",
" );",
" static function displayname() { return gt(\"e-Commerce Shipping Controller\"); }\n static function description() { return \"\"; }\n\tstatic function hasSources() { return false; }\n static function hasContent() { return false; }",
" /**\n * Ajax method to return a shipping calculator object within a shipping object\n */\n\tfunction selectShippingCalculator() {\n\t global $db;",
"\t\t$shipping = new shipping();",
"",
"\t\t// update the shippingmethod\n\t\t$shipping->shippingmethod->update(array('shippingcalculator_id'=>$this->params['shippingcalculator_id'],'option'=>null,'option_title'=>null));",
"",
"\t\t// fetch the calculator\n\t\t$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['shippingcalculator_id']);\n\t\t//eDebug($this->params['shippingcalculator_id']);\n\t\t//eDebug($calcname);\n\t\t$shipping->calculator = new $calcname($this->params['shippingcalculator_id']);",
"",
"\t\t$ar = new expAjaxReply(200, 'ok', $shipping, array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
" /**\n * Ajax method to select/update a shipping method\n */\n\tfunction selectShippingOption() {\n\t global $order; //FIXME we do NOT want the global $order",
"\t\t$shipping = new shipping();\n\t\t$id = $this->params['option'];\n\t\t$rates = $shipping->calculator->getRates($order); //FIXME a lot of work just to get one set of data since we'll be doing it again for cart/checkout redisplay...maybe cache???\n\t\t$rate = $rates[$id];\n\t\t$shipping->shippingmethod->update(array('option'=>$id,'option_title'=>$rate['title'],'shipping_cost'=>$rate['cost']));\n\t\t$ar = new expAjaxReply(200, 'ok', array('title'=>$rate['title'], 'cost'=>number_format($rate['cost'], 2)), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
" /**\n * Ajax method to set a shipping address\n */\n\tfunction setAddress() {\n\t\t$shipping = new shipping();\n\t\t$shipping->shippingmethod->setAddress($this->params['shipping_address']);\n\t\t$shipping->refresh();\n\t\t$ar = new expAjaxReply(200, 'ok', new address($shipping->shippingmethod->addresses_id), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
"",
" /**\n * Ajax method to set a shipping 'gift' message\n */\n\tfunction leaveMessage() {\n\t\tif (!empty($this->params['shippingmessageid'])) {\n\t\t $sm = new shippingmethod($this->params['shippingmessageid']);",
"",
"\t\t if ($this->params['nosave'] == false) {",
"\t\t $sm->to = empty($this->params['shpmessageto']) ? null : $this->params['shpmessageto'];\n\t\t $sm->from = empty($this->params['shpmessagefrom']) ? null : $this->params['shpmessagefrom'];\n\t\t $sm->message = empty($this->params['shpmessage']) ? null : $this->params['shpmessage'];",
"\t\t $sm->save();\n\t\t }\n\t\t}",
"",
"\t\t$ar = new expAjaxReply(200, 'ok', $sm, array('controller'=>'cart', 'action'=>'checkout'),true);",
"\t\t$ar->send();\n\t}\n",
"\tfunction renderOptions() { //FIXME do we ever call this?\n//\t global $db, $order;\n global $order; //FIXME we do NOT want the global $order",
"\t $shipping = new shipping();\n //FIXME perhaps check for cached rates if calculator didn't change???\n $shipping->pricelist = $shipping->calculator->getRates($order);\n $shipping->multiple_carriers = $shipping->calculator->multiple_carriers;",
" if (empty($shipping->shippingmethod->option)) {\n if ($shipping->multiple_carriers) {\n $opt = current($shipping->pricelist[0]);\n } else {\n $opt = current($shipping->pricelist);\n }\n } else {\n if ($shipping->multiple_carriers) {\n $opt = $shipping->pricelist[0][$shipping->shippingmethod->option];\n } else {\n $opt = $shipping->pricelist[$shipping->shippingmethod->option];\n }\n }",
"",
" $shipping->shippingmethod->update(array('option'=>$opt['id'],'option_title'=>$opt['title'],'shipping_cost'=>$opt['cost']));",
"",
" assign_to_template(array(\n 'shipping'=>$shipping,\n 'order'=>$order\n ));\n\t}",
"",
" /**\n * Ajax method to return a shipping calculator object within a shipping object\n */\n\tfunction listPrices() {\n\t $shipping = new shipping(); //FIXME this model has no listPrices() method???\n\t $ar = new expAjaxReply(200, 'ok', $shipping->listPrices(), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}",
"",
"\tfunction manage() {\n\t global $db;",
"",
"\t expHistory::set('manageable', $this->params);\n\t $calculators = array();\n $dir = BASE.\"framework/modules/ecommerce/shippingcalculators\";\n $default = false;\n $on = false;\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_file(\"$dir/$file\") && substr(\"$dir/$file\", -4) == \".php\") {\n include_once(\"$dir/$file\");\n $classname = substr($file, 0, -4);",
" $id = $db->selectValue('shippingcalculator', 'id', 'calculator_name=\"'.$classname.'\"');",
" if (empty($id)) {\n $calcobj = new $classname($this->params);",
" if ($calcobj->isSelectable() == true) {",
" $calcobj->update(array('title'=>$calcobj->name(),'body'=>$calcobj->description(),'calculator_name'=>$classname,'enabled'=>false));\n }\n } else {\n $calcobj = new $classname($id);\n }\n $calculators[] = $calcobj;\n if (!$default) $default = $calcobj->is_default;\n if (!$on && $calcobj->enabled) $on = $calcobj->id;\n }\n }\n if (!$default && $on) {\n $db->toggle('shippingcalculator', 'is_default', 'id='.$on);\n foreach ($calculators as $idx=>$calc) {\n if ($calc->id == $on) $calculators[$idx]->is_default = 1;\n }\n }\n }\n assign_to_template(array(\n 'calculators'=>$calculators\n ));\n\t}",
"\n",
"\tpublic function toggle() {\n\t global $db;",
"\t if (isset($this->params['id'])) $db->toggle('shippingcalculator', 'enabled', 'id='.$this->params['id']);\n //FIXME we need to ensure our default calculator is still active...not sure this does it\n if ($db->selectValue('shippingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('shippingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('shippingcalculator', 'is_default', 'id='.$this->params['id']);\n }",
" $calc = new shippingcalculator($this->params['id']);\n $calc_obj = new $calc->calculator_name();\n if ($calc_obj->hasConfig() && empty($calc->config)) {\n flash('message', $calc_obj->name().' '.gt('requires configuration. Please do so now.'));\n redirect_to(array('controller'=>'shipping', 'action'=>'configure', 'id'=>$calc->id));\n }\n\t expHistory::back();\n\t}",
" public function toggle_default() {\n \t global $db;",
" $db->toggle('shippingcalculator',\"is_default\",'is_default=1');\n \t if (isset($this->params['id'])) {\n $active = $db->selectObject('shippingcalculator',\"id=\".$this->params['id']);\n $active->is_default = 1;\n $db->updateObject($active,'shippingcalculator',null,'id');\n }\n if ($db->selectValue('shippingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('shippingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('shippingcalculator', 'enabled', 'id='.$this->params['id']);\n }\n \t expHistory::back();\n \t}",
" public function configure() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc,\n 'title'=>static::displayname()\n ));\n }",
"",
" public function saveconfig() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);",
" $conf = serialize($calc->parseConfig($this->params));",
" $calc->update(array('config'=>$conf));\n expHistory::back();\n }",
"",
"\tpublic function editspeed() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc\n ));",
"\n }\n",
"\tpublic function saveEditSpeed() {\n\t\tglobal $db;",
" $obj = new stdClass();\n\t\t$obj->speed = $this->params['speed'];\n\t\t$obj->shippingcalculator_id = $this->params['shippingcalculator_id'];\n\t\t$db->insertObject($obj, $this->params['table']);\n\t\tredirect_to(array('controller'=>'shipping', 'action'=>'configure', 'id'=>$this->params['shippingcalculator_id']));\n\t}",
"",
"\tpublic function deleteSpeed() {\n\t\tglobal $db;",
" if (empty($this->params['id'])) return false;\n\t\t$db->delete('shippingspeeds',' id =' . $this->params['id']);\n\t\texpHistory::back();\n\t}",
" public function tracker() {\n global $db;",
" // we ALWAYS assume this is coming from easypost webhook\n $calc_id = $db->selectValue('shippingcalculator','id','calculator_name=\"easypostcalculator\" AND enabled=1');\n if ($calc_id) {\n $ep = new easypostcalculator($calc_id);\n if ($ep->trackerEnabled()) {\n $ep->handleTracking();\n }\n }\n exit(); // graceful exit\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class storeCategoryController extends expNestedNodeController {",
" static function displayname() {\n return gt(\"e-Commerce Category Manager\");\n }",
" static function description() {\n return gt(\"This module is for managing categories in your store.\");\n }",
" protected $add_permissions = array(",
" 'fix_categories' => 'to run this action.'\n );",
"",
" // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'module',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"",
"\n static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" public function edit() {\n global $db;",
" $id = empty($this->params['id']) ? null : $this->params['id'];\n $record = new storeCategoryFeeds($id);\n $site_page_default = ecomconfig::getConfig('pagination_default');\n $product_types = ecomconfig::getConfig('product_types');",
" //Declaration of array variables for product types bing and google\n $arr_product_type = ''; //A Multi-dimentional array to be passed in the view that contains the html of listbuildercontrol for product types like bing and google",
" if (!empty($product_types)) foreach ($product_types as $value) {",
" $product_type = $value . 's';\n $product_type_id = $value . 's_id';\n $product_type_list = $value . 's_list';\n $new_product_type = new $product_type;\n $f_recorded_product_types = '';\n $f_types = '';\n //Import product type records if it is empty\n if ($db->tableIsEmpty($product_type)) {\n $file = BASE . \"framework/modules/ecommerce/assets/sql/exponent_{$product_type}.sql\";\n if (is_readable($file)) {\n $templine = '';\n // Read in entire file\n $lines = file($file);\n // Loop through each line\n foreach ($lines as $line) {\n // Only continue if it's not a comment\n if (substr($line, 0, 2) != '--' && $line != '') {\n // Add this line to the current segment\n $templine .= $line;\n // If it has a semicolon at the end, it's the end of the query\n if (substr(trim($line), -1, 1) == ';') {\n //Query the sql statement making sure that it will not be escape since we are dummping data\n $db->sql($templine, false);\n // Reset temp variable to empty\n $templine = '';\n }\n }\n }\n }\n }",
" $recorded_product_type = $db->selectObjectsBySql(\"SELECT {$product_type_id}, title FROM \" . $db->prefix . \"{$value}s_storeCategories, \" . $db->prefix . \"{$product_type} WHERE {$product_type_id} = id and storecategories_id = \" . $id);",
" foreach ($db->selectFormattedNestedTree(\"{$product_type}\") as $item) {\n $f_types[$item->id] = $item->title;\n }",
" foreach ($recorded_product_type as $item) {\n $f_recorded_product_types[$item->$product_type_id] = trim($item->title);\n }\n $control = new listbuildercontrol(@$f_recorded_product_types, $f_types);\n $arr_product_type[$value] = $control->controlToHTML($product_type_list, \"copy\");\n }",
" assign_to_template(array(\n 'product_types' => $product_types,\n 'site_page_default' => $site_page_default,\n 'record' => $record,\n 'product_type' => $arr_product_type\n ));",
" parent::edit();\n }",
" function configure() {\n expHistory::set('editable', $this->params);",
" $cat = new storeCategoryFeeds($this->params['id']);\n // little bit of trickery so that that categories can have their own configs\n $this->loc->src = \"@store-\" . $this->params['id'];\n $config = new expConfig($this->loc);\n $this->config = $config->config;\n// $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $views = expTemplate::get_config_templates($this, $this->loc);\n assign_to_template(array(\n 'config' => $this->config,\n// 'pullable_modules' => $pullable_modules,\n 'views' => $views,\n// 'title'=>static::displayname()\n 'title' => gt('Store Category named') . ' ' . $cat->title\n ));\n }",
" function saveconfig() {\n // unset some unneeded params\n unset(\n $this->params['module'],\n $this->params['controller'],\n $this->params['src'],\n $this->params['int'],\n $this->params['id'],\n $this->params['action'],\n $this->params['PHPSESSID'],\n $this->params['__utma'],\n $this->params['__utmb'],\n $this->params['__utmc'],\n $this->params['__utmz'],\n $this->params['__utmt'],\n $this->params['__utmli'],\n $this->params['__cfduid']\n );",
" // setup and save the config\n $this->loc->src = \"@store-\" . $this->params['cat-id'];\n $config = new expConfig($this->loc);\n $config->update(array('config' => $this->params));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }",
" function manage_ranks() {\n global $db;",
" $rank = 1;\n $category = new storeCategory($this->params['id']);\n foreach ($this->params['rerank'] as $id) {\n $sql = \"SELECT DISTINCT sc.* FROM \" . $db->prefix . \"product_storeCategories sc JOIN \" . $db->prefix . \"product p ON p.id = sc.product_id WHERE p.id=\" . $id . \" AND sc.storecategories_id IN (SELECT id FROM \" . $db->prefix . \"storeCategories WHERE rgt BETWEEN \" . $category->lft . \" AND \" . $category->rgt . \") ORDER BY rank ASC\";\n $prod = $db->selectObjectBySQL($sql);\n $prod->rank = $rank;\n $db->updateObject($prod, \"product_storeCategories\", \"storecategories_id=\" . $prod->storecategories_id . \" AND product_id=\" . $id);\n $rank++;\n }",
" expHistory::back();\n }",
" function manage() {\n expHistory::set('viewable', $this->params);\n // $category = new storeCategory();\n // $categories = $category->getFullTree();",
" // ",
" // // foreach($categories as $i=>$val){\n // // if (!empty($this->values) && in_array($val->id,$this->values)) {\n // // $this->tags[$i]->value = true;\n // // } else {\n // // $this->tags[$i]->value = false;\n // // }",
" // // $this->tags[$i]->draggable = $this->draggable; \n // // $this->tags[$i]->checkable = $this->checkable; ",
" // // }\n //",
" // $obj = json_encode($categories); ",
" }",
" public function update() {\n $product_types = ecomconfig::getConfig('product_types');",
" foreach ($product_types as $value) {\n $this->params[\"{$value}s\"] = listbuildercontrol::parseData($this->params, \"{$value}s_list\");\n }",
" $curcat = new storeCategory($this->params);\n $children = $curcat->getChildren();\n foreach ($children as $child) {\n $chldcat = new storeCategory($child->id);\n $chldcat->is_active = $this->params['is_active'];\n $chldcat->save();\n }",
" foreach ($product_types as $value) {\n $type = $value . 's';\n $product_type = new $type();\n $product_type->saveCategories($this->params[\"{$type}\"], $curcat->id, $type);\n }",
" parent::update();\n }",
" function export() {\n $out = '\"storeCategory\"' . chr(13) . chr(10); //FIXME or should this simply be 'category'?\n $sc = new storeCategory();\n $cats = $sc->find('all');\n set_time_limit(0);\n foreach ($cats as $cat) {\n $out .= expString::outputField(storeCategory::buildCategoryString($cat->id, true), chr(13) . chr(10));\n }",
" $filename = 'storecategory_export_' . time() . '.csv';",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting\n }",
" function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }",
" function importCategory($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Store Category Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!in_array('storeCategory', $header)) { //FIXME or should this simply be 'category' and a rank?\n echo gt('Not a Store Category Import CSV File');\n return;\n }",
" $count = 1;\n $errorSet = array();",
" // read in the data lines\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $data = array_combine($header, $row);",
" if (empty($data['storeCategory'])) { //FIXME or should this simply be 'category' and a rank?\n $errorSet[$count] = gt(\"Is not a store category.\");\n continue;\n } else {\n $result = storeCategory::importCategoryString($data['storeCategory']);\n if ($result) {\n echo \"Successfully added row \" . $count . \", category: \" . $data['storeCategory'] . \"<br/>\";\n } else {\n echo \"Already existed row \" . $count . \", category: \" . $data['storeCategory'] . \"<br/>\";\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }\n }",
" function fix_categories() {\n //--Flat Structure--//\n// global $db;",
" $baseCat = new storeCategory();\n //$Nodes = $db->selectObjects('storeCategories');\n $Nodes = $baseCat->find('all', '', 'lft ASC');",
" //--This function converts flat structure into an array--//\n function BuildTree($TheNodes, $ID = 0, $depth = -1) {\n $Tree = array();\n if (is_array($TheNodes)) {\n foreach ($TheNodes as $Node) {\n if ($Node->parent_id == $ID) {\n array_push($Tree, $Node);\n }\n }\n $depth++;\n for ($x = 0, $xMax = count($Tree); $x < $xMax; $x++) {\n $Tree[$x]->depth = $depth;\n $Tree[$x]->kids = BuildTree($TheNodes, $Tree[$x]->id, $depth);\n //array_merge($test,$Tree[$x][\"kids\"]);\n }\n return ($Tree);\n }\n }",
" //--Call Build Tree (returns structured array)\n $TheTree = BuildTree($Nodes);",
" //eDebug($TheTree,true);\n // flattens a tree created by parent/child relationships",
" function recurseBuild(&$thisNode, &$thisLeft, &$thisRight) {\n $thisNode->lft = $thisLeft;\n if (count($thisNode->kids) > 0) {\n $thisLeft = $thisNode->lft + 1;\n foreach ($thisNode->kids as &$myKidNode) {\n $thisRight = $thisLeft + 1;\n recurseBuild($myKidNode, $thisLeft, $thisRight);\n $myKidNode->save();\n }\n $thisNode->rgt = $thisLeft;\n $thisLeft = $thisRight;\n } else {\n $thisNode->rgt = $thisRight;",
" $thisLeft = $thisRight + 1;\n }",
" $thisRight = $thisLeft + 1;\n $thisNode->save();\n }",
" //if kids, set lft, but not right\n //else set both and move down\n $newLeft = 1;\n $newRight = 2;\n foreach ($TheTree as &$myNode) {\n recurseBuild($myNode, $newLeft, $newRight);\n }\n //eDebug($TheTree,true);",
" echo \"Done\";",
" /*function flattenArray(array $array){\n $ret_array = array();\n $counter=0;\n foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key=>$value) {\n if ($key=='id') {\n $counter++;\n }\n $ret_array[$counter][$key] = $value;\n }\n return $ret_array;\n }*/",
" // takes a flat array with propper parent/child relationships in propper order\n // and adds the lft and rgt extents correctly for a nested set",
" /*function nestify($categories) {",
" // Trees mapped ",
" $trees = array();\n $trackParents = array();\n $depth=0;\n $counter=1;\n $prevDepth=0;",
" foreach ($categories as $key=>$val) {\n if ($counter==1) {\n # first in loop. We should only hit this once: first.\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']>$prevDepth) {\n # we have a child of the previous node\n $trackParents[] = $key-1;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']==$prevDepth) {\n # we have a sibling of the previous node\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else {\n # we have moved up in depth, but how far up?\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $l=count($trackParents);\n while($l > 0 && $trackParents[$l - 1]['depth'] >= $val['depth']) {\n $categories[$trackParents[$l - 1]]['rgt'] = $counter;\n array_pop($trackParents);\n $counter++;\n $l--;\n }",
" ",
" $categories[$key]['lft'] = $counter;\n //???$counter++;",
" } ",
" $prevDepth=$val['depth'];\n }",
" $categories[$key]['rgt'] = $counter;\n return $categories;\n } */",
" // takes a flat nested set formatted array and creates a multi-dimensional array from it",
" /*function toHierarchy($collection)\n {\n // Trees mapped\n $trees = array();\n $l = 0;",
" if (count($collection) > 0) {\n // Node Stack. Used to help building the hierarchy\n $stack = array();",
" foreach ($collection as $node) {\n $item = $node;\n $item['children'] = array();",
" // Number of stack items\n $l = count($stack);",
" // Check if we're dealing with different levels\n while($l > 0 && $stack[$l - 1]['depth'] >= $item['depth']) {\n array_pop($stack);\n $l--;\n }",
" // Stack is empty (we are inspecting the root)\n if ($l == 0) {\n // Assigning the root node\n $i = count($trees);\n $trees[$i] = $item;\n $stack[] = & $trees[$i];\n } else {\n // Add node to parent\n $i = count($stack[$l - 1]['children']);\n $stack[$l - 1]['children'][$i] = $item;\n $stack[] = & $stack[$l - 1]['children'][$i];\n }\n }\n }",
" return $trees;\n }*/",
" // this will test our data manipulation\n // eDebug(toHierarchy(nestify(flattenArray($TheTree))),1);",
" /*$flat_fixed_cats = nestify(flattenArray($TheTree));",
" ",
" foreach ($flat_fixed_cats as $k=>$v) {\n $cat = new storeCategory($v['id']);\n $cat->lft = $v['lft'];\n $cat->rgt = $v['rgt'];\n $cat->save();\n eDebug($cat);\n }\n */\n //-Show Array Structure--//\n // print_r($TheTree);",
" // \n // ",
" // //--Print the Categories, and send their children to DrawBranch--//\n // //--The code below allows you to keep track of what category you're currently drawing--//",
" // ",
" // printf(\"<ul>\");",
" // ",
" // foreach($TheTree as $MyNode) {\n // printf(\"<li>{$MyNode['Name']}</li>\");\n // if(is_array($MyNode[\"Children\"]) && !empty($MyNode[\"Children\"])) {\n // DrawBranch($MyNode[\"Children\"]);\n // }\n // }\n // printf(\"</ul>\");\n // //--Recursive printer, should draw a child, and any of its children--//",
" // ",
" // function DrawBranch($Node){\n // printf(\"<ul>\");",
" // ",
" // foreach($Node as $Entity) {\n // printf(\"<li>{$Entity['Name']}</li>\");",
" // ",
" // if(is_array($Entity[\"Children\"]) && !empty($Entity[\"Children\"])) {\n // DrawBranch($Entity[\"Children\"]);\n // }",
" // ",
" // printf(\"</ul>\");\n // }\n // }\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
0,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class storeCategoryController extends expNestedNodeController {",
" protected $manage_permissions = array(\n// 'import' => 'Import Category',\n// 'importCategory' => 'Import Category',",
" 'fix_categories' => 'to run this action.'\n );",
"",
" // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'module',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"\n static function displayname() {\n return gt(\"e-Commerce Category Manager\");\n }",
" static function description() {\n return gt(\"This module is for managing categories in your store.\");\n }",
"\n static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" public function edit() {\n global $db;",
" $id = empty($this->params['id']) ? null : $this->params['id'];\n $record = new storeCategoryFeeds($id);\n $site_page_default = ecomconfig::getConfig('pagination_default');\n $product_types = ecomconfig::getConfig('product_types');",
" //Declaration of array variables for product types bing and google\n $arr_product_type = ''; //A Multi-dimentional array to be passed in the view that contains the html of listbuildercontrol for product types like bing and google",
" if (!empty($product_types)) foreach ($product_types as $value) {",
" $product_type = $value . 's';\n $product_type_id = $value . 's_id';\n $product_type_list = $value . 's_list';\n $new_product_type = new $product_type;\n $f_recorded_product_types = '';\n $f_types = '';\n //Import product type records if it is empty\n if ($db->tableIsEmpty($product_type)) {\n $file = BASE . \"framework/modules/ecommerce/assets/sql/exponent_{$product_type}.sql\";\n if (is_readable($file)) {\n $templine = '';\n // Read in entire file\n $lines = file($file);\n // Loop through each line\n foreach ($lines as $line) {\n // Only continue if it's not a comment\n if (substr($line, 0, 2) != '--' && $line != '') {\n // Add this line to the current segment\n $templine .= $line;\n // If it has a semicolon at the end, it's the end of the query\n if (substr(trim($line), -1, 1) == ';') {\n //Query the sql statement making sure that it will not be escape since we are dummping data\n $db->sql($templine, false);\n // Reset temp variable to empty\n $templine = '';\n }\n }\n }\n }\n }",
" $recorded_product_type = $db->selectObjectsBySql(\"SELECT {$product_type_id}, title FROM \" . $db->prefix . \"{$value}s_storeCategories, \" . $db->prefix . \"{$product_type} WHERE {$product_type_id} = id and storecategories_id = \" . $id);",
" foreach ($db->selectFormattedNestedTree(\"{$product_type}\") as $item) {\n $f_types[$item->id] = $item->title;\n }",
" foreach ($recorded_product_type as $item) {\n $f_recorded_product_types[$item->$product_type_id] = trim($item->title);\n }\n $control = new listbuildercontrol(@$f_recorded_product_types, $f_types);\n $arr_product_type[$value] = $control->controlToHTML($product_type_list, \"copy\");\n }",
" assign_to_template(array(\n 'product_types' => $product_types,\n 'site_page_default' => $site_page_default,\n 'record' => $record,\n 'product_type' => $arr_product_type\n ));",
" parent::edit();\n }",
" function configure() {\n expHistory::set('editable', $this->params);",
" $cat = new storeCategoryFeeds($this->params['id']);\n // little bit of trickery so that that categories can have their own configs\n $this->loc->src = \"@store-\" . $this->params['id'];\n $config = new expConfig($this->loc);\n $this->config = $config->config;\n// $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $views = expTemplate::get_config_templates($this, $this->loc);\n assign_to_template(array(\n 'config' => $this->config,\n// 'pullable_modules' => $pullable_modules,\n 'views' => $views,\n// 'title'=>static::displayname()\n 'title' => gt('Store Category named') . ' ' . $cat->title\n ));\n }",
" function saveconfig() {\n // unset some unneeded params\n unset(\n $this->params['module'],\n $this->params['controller'],\n $this->params['src'],\n $this->params['int'],\n $this->params['id'],\n $this->params['action'],\n $this->params['PHPSESSID'],\n $this->params['__utma'],\n $this->params['__utmb'],\n $this->params['__utmc'],\n $this->params['__utmz'],\n $this->params['__utmt'],\n $this->params['__utmli'],\n $this->params['__cfduid']\n );",
" // setup and save the config\n $this->loc->src = \"@store-\" . $this->params['cat-id'];\n $config = new expConfig($this->loc);\n $config->update(array('config' => $this->params));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }",
" function manage_ranks() {\n global $db;",
" $rank = 1;\n $category = new storeCategory($this->params['id']);\n foreach ($this->params['rerank'] as $id) {\n $sql = \"SELECT DISTINCT sc.* FROM \" . $db->prefix . \"product_storeCategories sc JOIN \" . $db->prefix . \"product p ON p.id = sc.product_id WHERE p.id=\" . $id . \" AND sc.storecategories_id IN (SELECT id FROM \" . $db->prefix . \"storeCategories WHERE rgt BETWEEN \" . $category->lft . \" AND \" . $category->rgt . \") ORDER BY rank ASC\";\n $prod = $db->selectObjectBySQL($sql);\n $prod->rank = $rank;\n $db->updateObject($prod, \"product_storeCategories\", \"storecategories_id=\" . $prod->storecategories_id . \" AND product_id=\" . $id);\n $rank++;\n }",
" expHistory::back();\n }",
" function manage() {\n expHistory::set('viewable', $this->params);\n // $category = new storeCategory();\n // $categories = $category->getFullTree();",
" //",
" // // foreach($categories as $i=>$val){\n // // if (!empty($this->values) && in_array($val->id,$this->values)) {\n // // $this->tags[$i]->value = true;\n // // } else {\n // // $this->tags[$i]->value = false;\n // // }",
" // // $this->tags[$i]->draggable = $this->draggable;\n // // $this->tags[$i]->checkable = $this->checkable;",
" // // }\n //",
" // $obj = json_encode($categories);",
" }",
" public function update() {\n $product_types = ecomconfig::getConfig('product_types');",
" foreach ($product_types as $value) {\n $this->params[\"{$value}s\"] = listbuildercontrol::parseData($this->params, \"{$value}s_list\");\n }",
" $curcat = new storeCategory($this->params);\n $children = $curcat->getChildren();\n foreach ($children as $child) {\n $chldcat = new storeCategory($child->id);\n $chldcat->is_active = $this->params['is_active'];\n $chldcat->save();\n }",
" foreach ($product_types as $value) {\n $type = $value . 's';\n $product_type = new $type();\n $product_type->saveCategories($this->params[\"{$type}\"], $curcat->id, $type);\n }",
" parent::update();\n }",
" function export() {\n $out = '\"storeCategory\"' . chr(13) . chr(10); //FIXME or should this simply be 'category'?\n $sc = new storeCategory();\n $cats = $sc->find('all');\n set_time_limit(0);\n foreach ($cats as $cat) {\n $out .= expString::outputField(storeCategory::buildCategoryString($cat->id, true), chr(13) . chr(10));\n }",
" $filename = 'storecategory_export_' . time() . '.csv';",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting\n }",
" function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }",
" function importCategory($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Store Category Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!in_array('storeCategory', $header)) { //FIXME or should this simply be 'category' and a rank?\n echo gt('Not a Store Category Import CSV File');\n return;\n }",
" $count = 1;\n $errorSet = array();",
" // read in the data lines\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $data = array_combine($header, $row);",
" if (empty($data['storeCategory'])) { //FIXME or should this simply be 'category' and a rank?\n $errorSet[$count] = gt(\"Is not a store category.\");\n continue;\n } else {\n $result = storeCategory::importCategoryString($data['storeCategory']);\n if ($result) {\n echo \"Successfully added row \" . $count . \", category: \" . $data['storeCategory'] . \"<br/>\";\n } else {\n echo \"Already existed row \" . $count . \", category: \" . $data['storeCategory'] . \"<br/>\";\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }\n }",
" function fix_categories() {\n //--Flat Structure--//\n// global $db;",
" $baseCat = new storeCategory();\n //$Nodes = $db->selectObjects('storeCategories');\n $Nodes = $baseCat->find('all', '', 'lft ASC');",
" //--This function converts flat structure into an array--//\n function BuildTree($TheNodes, $ID = 0, $depth = -1) {\n $Tree = array();\n if (is_array($TheNodes)) {\n foreach ($TheNodes as $Node) {\n if ($Node->parent_id == $ID) {\n array_push($Tree, $Node);\n }\n }\n $depth++;\n for ($x = 0, $xMax = count($Tree); $x < $xMax; $x++) {\n $Tree[$x]->depth = $depth;\n $Tree[$x]->kids = BuildTree($TheNodes, $Tree[$x]->id, $depth);\n //array_merge($test,$Tree[$x][\"kids\"]);\n }\n return ($Tree);\n }\n }",
" //--Call Build Tree (returns structured array)\n $TheTree = BuildTree($Nodes);",
" //eDebug($TheTree,true);\n // flattens a tree created by parent/child relationships",
" function recurseBuild(&$thisNode, &$thisLeft, &$thisRight) {\n $thisNode->lft = $thisLeft;\n if (count($thisNode->kids) > 0) {\n $thisLeft = $thisNode->lft + 1;\n foreach ($thisNode->kids as &$myKidNode) {\n $thisRight = $thisLeft + 1;\n recurseBuild($myKidNode, $thisLeft, $thisRight);\n $myKidNode->save();\n }\n $thisNode->rgt = $thisLeft;\n $thisLeft = $thisRight;\n } else {\n $thisNode->rgt = $thisRight;",
" $thisLeft = $thisRight + 1;\n }",
" $thisRight = $thisLeft + 1;\n $thisNode->save();\n }",
" //if kids, set lft, but not right\n //else set both and move down\n $newLeft = 1;\n $newRight = 2;\n foreach ($TheTree as &$myNode) {\n recurseBuild($myNode, $newLeft, $newRight);\n }\n //eDebug($TheTree,true);",
" echo \"Done\";",
" /*function flattenArray(array $array){\n $ret_array = array();\n $counter=0;\n foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key=>$value) {\n if ($key=='id') {\n $counter++;\n }\n $ret_array[$counter][$key] = $value;\n }\n return $ret_array;\n }*/",
" // takes a flat array with propper parent/child relationships in propper order\n // and adds the lft and rgt extents correctly for a nested set",
" /*function nestify($categories) {",
" // Trees mapped",
" $trees = array();\n $trackParents = array();\n $depth=0;\n $counter=1;\n $prevDepth=0;",
" foreach ($categories as $key=>$val) {\n if ($counter==1) {\n # first in loop. We should only hit this once: first.\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']>$prevDepth) {\n # we have a child of the previous node\n $trackParents[] = $key-1;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']==$prevDepth) {\n # we have a sibling of the previous node\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else {\n # we have moved up in depth, but how far up?\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $l=count($trackParents);\n while($l > 0 && $trackParents[$l - 1]['depth'] >= $val['depth']) {\n $categories[$trackParents[$l - 1]]['rgt'] = $counter;\n array_pop($trackParents);\n $counter++;\n $l--;\n }",
"",
" $categories[$key]['lft'] = $counter;\n //???$counter++;",
" }",
" $prevDepth=$val['depth'];\n }",
" $categories[$key]['rgt'] = $counter;\n return $categories;\n } */",
" // takes a flat nested set formatted array and creates a multi-dimensional array from it",
" /*function toHierarchy($collection)\n {\n // Trees mapped\n $trees = array();\n $l = 0;",
" if (count($collection) > 0) {\n // Node Stack. Used to help building the hierarchy\n $stack = array();",
" foreach ($collection as $node) {\n $item = $node;\n $item['children'] = array();",
" // Number of stack items\n $l = count($stack);",
" // Check if we're dealing with different levels\n while($l > 0 && $stack[$l - 1]['depth'] >= $item['depth']) {\n array_pop($stack);\n $l--;\n }",
" // Stack is empty (we are inspecting the root)\n if ($l == 0) {\n // Assigning the root node\n $i = count($trees);\n $trees[$i] = $item;\n $stack[] = & $trees[$i];\n } else {\n // Add node to parent\n $i = count($stack[$l - 1]['children']);\n $stack[$l - 1]['children'][$i] = $item;\n $stack[] = & $stack[$l - 1]['children'][$i];\n }\n }\n }",
" return $trees;\n }*/",
" // this will test our data manipulation\n // eDebug(toHierarchy(nestify(flattenArray($TheTree))),1);",
" /*$flat_fixed_cats = nestify(flattenArray($TheTree));",
"",
" foreach ($flat_fixed_cats as $k=>$v) {\n $cat = new storeCategory($v['id']);\n $cat->lft = $v['lft'];\n $cat->rgt = $v['rgt'];\n $cat->save();\n eDebug($cat);\n }\n */\n //-Show Array Structure--//\n // print_r($TheTree);",
" //\n //",
" // //--Print the Categories, and send their children to DrawBranch--//\n // //--The code below allows you to keep track of what category you're currently drawing--//",
" //",
" // printf(\"<ul>\");",
" //",
" // foreach($TheTree as $MyNode) {\n // printf(\"<li>{$MyNode['Name']}</li>\");\n // if(is_array($MyNode[\"Children\"]) && !empty($MyNode[\"Children\"])) {\n // DrawBranch($MyNode[\"Children\"]);\n // }\n // }\n // printf(\"</ul>\");\n // //--Recursive printer, should draw a child, and any of its children--//",
" //",
" // function DrawBranch($Node){\n // printf(\"<ul>\");",
" //",
" // foreach($Node as $Entity) {\n // printf(\"<li>{$Entity['Name']}</li>\");",
" //",
" // if(is_array($Entity[\"Children\"]) && !empty($Entity[\"Children\"])) {\n // DrawBranch($Entity[\"Children\"]);\n // }",
" //",
" // printf(\"</ul>\");\n // }\n // }\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */",
"class storeController extends expController {\n public $basemodel_name = 'product';",
"",
" public $useractions = array(\n 'showall' => 'Products - All Products and Categories',\n 'showallFeaturedProducts' => 'Products - Only Featured',\n 'showallCategoryFeaturedProducts' => 'Products - Featured Products under current category',\n 'showallManufacturers' => 'Products - By Manufacturer',\n 'showTopLevel' => 'Product Categories Menu - Show Top Level',\n 'showFullTree' => 'Product Categories Menu - Show Full Tree', //FIXME image variant needs a separate method\n 'showallSubcategories' => 'Product Categories Menu - Subcategories of current category',\n// 'upcomingEvents' => 'Event Registration - Upcoming Events',\n// 'eventsCalendar' => 'Event Registration - Calendar View',\n 'ecomSearch' => 'Product Search - Autocomplete',\n 'searchByModel' => 'Product Search - By Model',\n 'quicklinks' => 'Links - User Links',\n 'showGiftCards' => 'Gift Cards UI',\n );",
"",
" // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n// 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"\n //protected $permissions = array_merge(array(\"test\"=>'Test'), array('copyProduct'=>\"Copy Product\"));\n protected $add_permissions = array(\n 'copyProduct' => \"Copy Product\",\n 'delete_children' => \"Delete Children\",\n 'reimport' => 'ReImport Products',\n 'findDupes' => 'Fix Duplicate SEF Names',\n 'manage_sales_reps' => 'Manage Sales Reps',\n 'batch_process' => 'Batch capture order transactions',\n 'process_orders' => 'Batch capture order transactions',\n 'import_external_addresses' => 'Import addresses from other sources',\n 'showallImpropercategorized' => 'View products in top level categories that should not be',\n 'showallUncategorized' => 'View all uncategorized products',\n 'nonUnicodeProducts' => 'View all non-unicode charset products',\n 'cleanNonUnicodeProducts' => 'Clean all non-unicode charset products',\n 'uploadModelAliases' => 'Upload model aliases',\n 'processModelAliases' => 'Process uploaded model aliases',\n 'saveModelAliases' => 'Save uploaded model aliases',\n 'deleteProcessedModelAliases' => 'Delete processed uploaded model aliases',\n 'delete_model_alias' => 'Process model aliases',\n 'update_model_alias' => 'Save model aliases',\n 'edit_model_alias' => 'Delete model aliases',\n 'import' => 'Import Products',\n 'export' => 'Export Products',\n );",
"\n static function displayname() {\n return gt(\"e-Commerce Store Front\");\n }",
" static function description() {\n return gt(\"Displays the products and categories in your store\");\n }",
" static function author() {\n return \"OIC Group, Inc\";\n }",
" static function isSearchable() {\n return true;\n }",
" public function searchName() {\n return gt('e-Commerce Item');\n }",
" static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" function __construct($src = null, $params = array()) {\n global $db, $router, $section, $user;\n// parent::__construct($src = null, $params);\n if (empty($params)) {\n $params = $router->params;\n }\n parent::__construct($src, $params);",
" // we're setting the config here from the module and globally\n $this->grabConfig();",
"// if (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == \"store\" && $router->url_parts[1] == \"showall\")) {\n if (!empty($params['action']) && ($params['controller'] == \"store\" && $params['action'] == \"showall\") ) {\n// if (isset($router->url_parts[array_search('title', $router->url_parts) + 1]) && is_string($router->url_parts[array_search('title', $router->url_parts) + 1])) {\n if (isset($params['title']) && is_string($params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n// $active = $db->selectValue('storeCategories', 'is_active', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $params['title'] . \"'\");\n $active = $db->selectValue('storeCategories', 'is_active', \"sef_url='\" . $params['title'] . \"'\");\n if (empty($active) && !$user->isAdmin()) {\n redirect_to(array(\"section\" => SITE_DEFAULT_SECTION)); // selected category is NOT active\n }\n } elseif (isset($this->config['category'])) { // the module category to display\n $default_id = $this->config['category'];\n } else {\n $default_id = 0;\n }\n// } elseif (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == \"store\" && ($router->url_parts[1] == \"show\" || $router->url_parts[1] == \"showByTitle\"))) {\n } elseif (!empty($params['action']) && ($params['controller'] == \"store\" && ($params['action'] == \"show\" || $params['action'] == \"showByTitle\" || $params['action'] == \"categoryBreadcrumb\"))) {\n// if (isset($router->url_parts[array_search('id', $router->url_parts) + 1]) && ($router->url_parts[array_search('id', $router->url_parts) + 1] != 0)) {\n if (!empty($params['id'])) {\n// $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $router->url_parts[array_search('id', $router->url_parts) + 1] . \"'\");\n $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $params['id'] . \"'\");\n } elseif (!empty($params['title'])) {\n// $prod_id = $db->selectValue('product', 'id', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n $prod_id = $db->selectValue('product', 'id', \"sef_url='\" . $params['title'] . \"'\");\n $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $prod_id . \"'\");\n }\n } elseif (isset($this->config['show_first_category']) || (!expTheme::inAction() && $section == SITE_DEFAULT_SECTION)) {\n if (!empty($this->config['show_first_category'])) {\n $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n } else {\n $default_id = null;\n// flash('error','store-show first category empty, but default seciton');\n }\n } elseif (!isset($this->config['show_first_category']) && !expTheme::inAction()) {\n $default_id = null;\n// flash('error','store-don\\'t show first category empty');\n } else {\n $default_id = null;\n }\n// if (empty($default_id)) $default_id = 0;\n if (!is_null($default_id)) expSession::set('catid', $default_id);",
" // figure out if we need to show all categories and products or default to showing the first category.\n // elseif (!empty($this->config['category'])) {\n // $default_id = $this->config['category'];\n // } elseif (ecomconfig::getConfig('show_first_category')) {\n // $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n // } else {\n // $default_id = 0;\n // }",
" $this->parent = expSession::get('catid');\n $this->category = new storeCategory($this->parent);\n if ($this->parent) { // we're setting the config here for the category\n $this->grabConfig($this->category);\n }\n }",
" function showall() {\n global $db, $user, $router;",
" expHistory::set('viewable', $this->params);",
" if (empty($this->category->is_events)) {\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c FROM ' . $db->prefix . 'product p ';",
" $sql_start = 'SELECT DISTINCT p.*, IF(base_price > special_price AND use_special_price=1,special_price, base_price) as price FROM ' . $db->prefix . 'product p ';\n $sql = 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'WHERE ';\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n $sql .= 'sc.storecategories_id IN (';\n $sql .= 'SELECT id FROM ' . $db->prefix . 'storeCategories WHERE rgt BETWEEN ' . $this->category->lft . ' AND ' . $this->category->rgt . ')';",
" $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;",
"// $order = 'title'; // $order = 'sc.rank'; //$this->config['orderby'];\n// $dir = 'ASC'; //$this->config['orderby_dir'];\n $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';\n } else { // this is an event category\n $sql_start = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n $sql = 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE sc.storecategories_id IN (';\n $sql .= 'SELECT id FROM ' . $db->prefix . 'storeCategories WHERE rgt BETWEEN ' . $this->category->lft . ' AND ' . $this->category->rgt . ')';\n if ($this->category->hide_closed_events) {\n $sql .= ' AND er.signup_cutoff > ' . time();\n }",
" $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;",
" $order = !empty($this->params['order']) ? $this->params['order'] : 'event_starttime';\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : 'ASC';\n }",
" if (empty($router->params['title'])) // we need to pass on the category for proper paging\n $router->params['title'] = $this->category->sef_url;\n $limit = !empty($this->config['limit']) ? $this->config['limit'] : (!empty($this->config['pagination_default']) ? $this->config['pagination_default'] : 10);\n if ($this->category->find('count') > 0) { // there are categories\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'count_sql' => $count_sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'price'\n ),\n ));\n } else { // there are no categories\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => 'SELECT * FROM ' . $db->prefix . 'product WHERE 1',\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'price'\n ),\n ));\n }",
" $ancestors = $this->category->pathToNode();\n $categories = ($this->parent == 0) ? $this->category->getTopLevel(null, false, true) : $this->category->getChildren(null, false, true);",
" $rerankSQL = \"SELECT DISTINCT p.* FROM \" . $db->prefix . \"product p JOIN \" . $db->prefix . \"product_storeCategories sc ON p.id = sc.product_id WHERE sc.storecategories_id=\" . $this->category->id . \" ORDER BY rank ASC\";\n //eDebug($router);\n $defaultSort = $router->current_url;",
" assign_to_template(array(\n 'page' => $page,\n 'defaultSort' => $defaultSort,\n 'ancestors' => $ancestors,\n 'categories' => $categories,\n 'current_category' => $this->category,\n 'rerankSQL' => $rerankSQL\n ));\n $this->categoryBreadcrumb();\n }",
" function grabConfig($category = null) {",
" // grab the configs for the passed category\n if (is_object($category)) {\n $catConfig = new expConfig(expCore::makeLocation(\"storeCategory\",\"@store-\" . $category->id,\"\"));\n } elseif (empty($this->config)) { // config not set yet\n $global_config = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));\n $this->config = $global_config->config;\n return;\n }",
" // grab the store general settings\n $config = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));",
" // $this->config currently holds the module settings - merge together with any cat config settings having priority\n $this->config = empty($catConfig->config) || @$catConfig->config['use_global'] == 1 ? @array_merge($config->config, $this->config) : @array_merge($config->config, $this->config, $catConfig->config);",
" //This is needed since in the first installation of ecom the value for this will be empty and we are doing % operation for this value\n //So we need to ensure if the value is = 0, we make it the default\n if (empty($this->config['images_per_row'])) {\n $this->config['images_per_row'] = 3;\n }\n }",
" /**\n * @deprecated 2.0.0 moved to eventregistration\n */\n function upcomingEvents() {\n $this->params['controller'] = 'eventregistration';\n redirect_to($this->params);",
" //fixme old code\n $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 AND er.signup_cutoff > ' . time();",
" $limit = empty($this->config['event_limit']) ? 10 : $this->config['event_limit'];\n $order = 'eventdate';\n $dir = 'ASC';",
" $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page\n ));\n }",
" /**\n * @deprecated 2.0.0 moved to eventregistration\n */\n function eventsCalendar() {\n $this->params['controller'] = 'eventregistration';\n redirect_to($this->params);",
" //fixme old code\n global $db, $user;",
" expHistory::set('viewable', $this->params);",
" $time = isset($this->params['time']) ? $this->params['time'] : time();\n assign_to_template(array(\n 'time' => $time\n ));",
"// $monthly = array();\n// $counts = array();",
" $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;",
" $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = intval(date('W', $timefirst));\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);",
"// if ($infofirst['wday'] == 0) {\n// $monthly[$week] = array(); // initialize for non days\n// $counts[$week] = array();\n// }\n// for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {\n// $monthly[$week][$i] = array();\n// $counts[$week][$i] = -1;\n// }\n// $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);",
" for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;",
"// $dates = $db->selectObjects(\"eventregistration\", \"`eventdate` = $start\");\n// $dates = $db->selectObjects(\"eventregistration\", \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $er = new eventregistration();\n// $dates = $er->find('all', \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");",
" if ($user->isAdmin()) {\n $events = $er->find('all', 'product_type=\"eventregistration\"', \"title ASC\");\n } else {\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\");\n }\n $dates = array();",
" foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate >= expDateTime::startOfDayTimestamp($start) && $event->eventdate <= expDateTime::endOfDayTimestamp($start)) {\n $dates[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }",
" $monthly[$week][$i] = $this->getEventsForDates($dates);\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }",
" $this->params['time'] = $time;\n assign_to_template(array(\n 'currentweek' => $currentweek,\n 'monthly' => $monthly,\n 'counts' => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n 'now' => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params,\n 'daynames' => event::dayNames(),\n ));\n }",
" /*\n * Helper function for the Calendar view\n * @deprecated 2.0.0 moved to eventregistration\n */\n function getEventsForDates($edates, $sort_asc = true) {\n global $db;\n $events = array();\n foreach ($edates as $edate) {\n// if (!isset($this->params['cat'])) {\n// if (isset($this->params['title']) && is_string($this->params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $this->params['title'] . \"'\");\n// } elseif (!empty($this->config['category'])) {\n// $default_id = $this->config['category'];\n// } elseif (ecomconfig::getConfig('show_first_category')) {\n// $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n// } else {\n// $default_id = 0;\n// }\n// }\n//\n// $parent = isset($this->params['cat']) ? intval($this->params['cat']) : $default_id;\n//\n// $category = new storeCategory($parent);",
" $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n// $sql .= 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 ';\n// $sql .= ' AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN ' . $category->lft . ' AND ' . $category->rgt . ')';\n// if ($category->hide_closed_events) {\n// $sql .= ' AND er.signup_cutoff > ' . time();\n// }\n// $sql .= ' AND er.id = ' . $edate->id;\n $sql .= ' AND er.id = ' . $edate->product_type_id;",
" $order = 'event_starttime';\n $dir = 'ASC';",
" $o = $db->selectObjectBySql($sql);\n $o->eventdate = $edate->eventdate;\n $o->eventstart = $edate->event_starttime + $edate->eventdate;\n $o->eventend = $edate->event_endtime + $edate->eventdate;\n $o->expFile = $edate->expFile;\n $events[] = $o;\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }",
" function categoryBreadcrumb() {\n// global $db, $router;",
" //eDebug($this->category);",
" /*if(isset($router->params['action']))\n {",
" $ancestors = $this->category->pathToNode(); ",
" }else if(isset($router->params['section']))\n {\n $current = $db->selectObject('section',' id= '.$router->params['section']);\n $ancestors[] = $current;\n if( $current->parent != -1 || $current->parent != 0 )",
" { ",
" while ($db->selectObject('section',' id= '.$router->params['section']);)\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n eDebug($sections);",
" $ancestors = $this->category->pathToNode(); ",
" }*/",
" $ancestors = $this->category->pathToNode();\n // eDebug($ancestors);\n assign_to_template(array(\n 'ancestors' => $ancestors\n ));\n }",
" function showallUncategorized() {\n expHistory::set('viewable', $this->params);",
"// $sql = 'SELECT p.* FROM ' . DB_TABLE_PREFIX . '_product p JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories ';\n// $sql .= 'sc ON p.id = sc.product_id WHERE sc.storecategories_id = 0 AND parent_id=0';\n $sql = 'SELECT p.* FROM ' . DB_TABLE_PREFIX . '_product p LEFT OUTER JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories ';\n $sql .= 'sc ON p.id = sc.product_id WHERE sc.product_id is null AND p.parent_id=0';",
" expSession::set('product_export_query', $sql);",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page,\n 'moduletitle' => 'Uncategorized Products'\n ));\n }",
" function manage() {\n expHistory::set('manageable', $this->params);",
" if (ECOM_LARGE_DB) {\n $limit = !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : 10;\n } else {\n $limit = 0; // we'll paginate on the page\n }\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => 'parent_id=0',\n 'limit' => $limit,\n 'order' => (isset($this->params['order']) ? $this->params['order'] : 'title'),\n 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'ASC'),\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Type') => 'product_type',\n gt('Product Name') => 'title',\n gt('Model #') => 'model',\n gt('Price') => 'base_price'\n )\n ));\n assign_to_template(array(\n 'page' => $page\n ));\n }",
" function showallImpropercategorized() {\n expHistory::set('viewable', $this->params);",
" //FIXME not sure this is the correct sql, not sure what we are trying to pull out\n $sql = 'SELECT DISTINCT(p.id),p.product_type FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories psc ON p.id = psc.product_id ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_storeCategories sc ON psc.storecategories_id = sc.parent_id ';\n $sql .= 'WHERE p.parent_id=0 AND sc.parent_id != 0';",
" expSession::set('product_export_query', $sql);",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page,\n 'moduletitle' => 'Improperly Categorized Products'\n ));\n }",
" function exportMe() {\n redirect_to(array('controller' => 'report', 'action' => 'batch_export', 'applytoall' => true));\n }",
" function export() {\n global $db;",
" $this->params['applytoall'] = 1; //FIXME we simply do all now",
" //eDebug($this->params);\n //$sql = \"SELECT * INTO OUTFILE '\" . BASE . \"tmp/export.csv' FIELDS TERMINATED BY ',' FROM exponent_product WHERE 1 LIMIT 10\";\n// $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"canonical\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\"' . chr(13) . chr(10);\n $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\",\"weight\",\"width\",\"height\",\"length\",\"image1\",\"image2\",\"image3\",\"image4\",\"image5\",\"companies_id\"' . chr(13) . chr(10);\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $sql = expSession::get('product_export_query');\n if (empty($sql)) $sql = 'SELECT DISTINCT(p.id) from ' . $db->prefix . 'product as p WHERE (product_type=\"product\")';\n //eDebug($sql);\n //expSession::set('product_export_query','');\n $prods = $db->selectArraysBySql($sql);\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $prod) {\n $prods[] = array('id' => $prod);\n }\n }\n set_time_limit(0);\n $baseProd = new product();",
" //$p = new product($pid['id'], false, false);\n foreach ($prods as $pid) {\n $except = array('company', 'crosssellItem', 'optiongroup');\n $p = $baseProd->find('first', 'id=' . $pid['id'], null, null, 0, true, true, $except, true);",
" //eDebug($p,true);\n $out .= expString::outputField($p->id);\n $out .= expString::outputField($p->parent_id);\n $out .= expString::outputField($p->child_rank);\n $out .= expString::outputField($p->title);\n $out .= expString::outputField(expString::stripLineEndings($p->body), \",\", true);\n $out .= expString::outputField($p->model);\n $out .= expString::outputField($p->warehouse_location);\n $out .= expString::outputField($p->sef_url);\n// $out .= expString::outputField($p->canonical); FIXME this is NOT in the import sequence\n $out .= expString::outputField($p->meta_title);\n $out .= expString::outputField($p->meta_keywords);\n $out .= expString::outputField($p->meta_description);\n $out .= expString::outputField($p->tax_class_id);\n $out .= expString::outputField($p->quantity);\n $out .= expString::outputField($p->availability_type);\n $out .= expString::outputField($p->base_price);\n $out .= expString::outputField($p->special_price);\n $out .= expString::outputField($p->use_special_price);\n $out .= expString::outputField($p->active_type);\n $out .= expString::outputField($p->product_status_id);",
" $rank = 0;\n //eDebug($p);\n for ($x = 0; $x < 12; $x++) {\n $this->catstring = '';\n if (isset($p->storeCategory[$x])) {\n $out .= expString::outputField(storeCategory::buildCategoryString($p->storeCategory[$x]->id, true));\n $rank = $db->selectValue('product_storeCategories', 'rank', 'product_id=' . $p->id . ' AND storecategories_id=' . $p->storeCategory[$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->surcharge);\n $out .= expString::outputField($rank); // no longer used\n $out .= expString::outputField($p->feed_title);\n $out .= expString::outputField($p->feed_body);\n $out .= expString::outputField($p->weight);\n $out .= expString::outputField($p->height);\n $out .= expString::outputField($p->width);\n $out .= expString::outputField($p->length);\n //output images\n if (isset($p->expFile['mainimage'][0])) {\n $out .= expString::outputField($p->expFile['mainimage'][0]->id);\n } else $out .= ',';\n for ($x = 0; $x < 3; $x++) {\n if (isset($p->expFile['images'][$x])) {\n $out .= expString::outputField($p->expFile['images'][$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->companies_id, chr(13) . chr(10)); //Removed the extra \",\" in the last element",
" foreach ($p->childProduct as $cp) {\n //$p = new product($pid['id'], true, false);\n //eDebug($p,true);\n $out .= expString::outputField($cp->id);\n $out .= expString::outputField($cp->parent_id);\n $out .= expString::outputField($cp->child_rank);\n $out .= expString::outputField($cp->title);\n $out .= expString::outputField(expString::stripLineEndings($cp->body));\n $out .= expString::outputField($cp->model);\n $out .= expString::outputField($cp->warehouse_location);\n $out .= expString::outputField($cp->sef_url);\n// $out .= expString::outputField($cp->canonical); FIXME this is NOT in the import sequence\n $out .= expString::outputField($cp->meta_title);\n $out .= expString::outputField($cp->meta_keywords);\n $out .= expString::outputField($cp->meta_description);\n $out .= expString::outputField($cp->tax_class_id);\n $out .= expString::outputField($cp->quantity);\n $out .= expString::outputField($cp->availability_type);\n $out .= expString::outputField($cp->base_price);\n $out .= expString::outputField($cp->special_price);\n $out .= expString::outputField($cp->use_special_price);\n $out .= expString::outputField($cp->active_type);\n $out .= expString::outputField($cp->product_status_id);\n $out .= ',,,,,,,,,,,,'; // for categories\n $out .= expString::outputField($cp->surcharge);\n $out .= ',,,'; //for rank, feed title, feed body\n $out .= expString::outputField($cp->weight);\n $out .= expString::outputField($cp->height);\n $out .= expString::outputField($cp->width);\n $out .= expString::outputField($cp->length);\n $out .= ',,,,,'; // for images\n $out .= expString::outputField($cp->companies_id, chr(13) . chr(10));",
" //echo($out);\n }",
" }",
"// $outFile = 'tmp/product_export_' . time() . '.csv';\n// $outHandle = fopen(BASE . $outFile, 'w');\n// fwrite($outHandle, $out);\n// fclose($outHandle);\n//\n// echo \"<br/><br/>Download the file here: <a href='\" . PATH_RELATIVE . $outFile . \"'>Product Export</a>\";",
" $filename = 'product_export_' . time() . '.csv';",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting",
" /*eDebug(BASE . \"tmp/export.csv\");\n $db->sql($sql);\n eDebug($db->error());*/\n /*OPTIONALLY ENCLOSED BY '\" . '\"' .\n \"' ESCAPED BY '\\\\'\n LINES TERMINATED BY '\" . '\\\\n' .\n \"' */\n }",
" /**\n * @deprecated 2.3.3 moved to company\n */\n function showallByManufacturer() {\n expHistory::set('viewable', $this->params);",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => 'companies_id=' . $this->params['id'] . ' AND parent_id=0',\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'default' => 'Product Name',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n )\n ));",
" $company = new company($this->params['id']);",
" assign_to_template(array(\n 'page' => $page,\n 'company' => $company\n ));\n }",
" /**\n * @deprecated 2.3.3 moved to company\n */\n function showallManufacturers() {\n global $db;\n expHistory::set('viewable', $this->params);\n $sql = 'SELECT comp.* FROM ' . $db->prefix . 'companies as comp JOIN ' . $db->prefix . 'product AS prod ON prod.companies_id = comp.id WHERE parent_id=0 GROUP BY comp.title ORDER BY comp.title;';\n $manufacturers = $db->selectObjectsBySql($sql);\n assign_to_template(array(\n 'manufacturers' => $manufacturers\n ));\n }",
" function showGiftCards() {\n expHistory::set('viewable', $this->params);\n //Get all giftcards\n $product_type = 'giftcard';\n $giftcard = new $product_type();\n $giftcards = $giftcard->find(\"all\", \"product_type = 'giftcard'\");",
" //Grab the global config\n $this->grabConfig();",
" //Set the needed config for the view\n $config['custom_message_product'] = $this->config['custom_message_product'];\n $config['minimum_gift_card_purchase'] = $this->config['minimum_gift_card_purchase'];\n $records = expSession::get('params');\n expSession::un_set('params');\n assign_to_template(array(\n 'giftcards' => $giftcards,\n 'config' => $config,\n 'records' => $records\n ));\n }",
" function show() {\n global $db, $order, $template, $user;",
" expHistory::set('viewable', $this->params);\n// $classname = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n// $product = new $classname($this->params['id'], true, true);",
" $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];\n $product = new product($id);\n $product_type = new $product->product_type($product->id);\n $product_type->title = expString::parseAndTrim($product_type->title, true);\n $product_type->image_alt_tag = expString::parseAndTrim($product_type->image_alt_tag, true);",
" //if we're trying to view a child product directly, then we redirect to it's parent show view\n //bunk URL, no product found\n if (empty($product->id)) {\n redirect_to(array('controller' => 'notfound', 'action' => 'page_not_found', 'title' => $this->params['title']));\n }\n // we do not display child products by themselves\n if (!empty($product->parent_id)) {\n $product = new product($product->parent_id);\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $product->sef_url));\n }\n if ($product->active_type == 1) {\n $product_type->user_message = \"This product is temporarily unavailable for purchase.\";\n } elseif ($product->active_type == 2 && !$user->isAdmin()) {\n flash(\"error\", $product->title . \" \" . gt(\"is currently unavailable.\"));\n expHistory::back();\n } elseif ($product->active_type == 2 && $user->isAdmin()) {\n $product_type->user_message = $product->title . \" is currently marked as unavailable for purchase or display. Normal users will not see this product.\";\n }",
" // pull in company attachable files\n if (!empty($product_type->companies_id)) {\n $product_type->company = new company($product_type->companies_id);\n }",
" if (!empty($product_type->crosssellItem)) foreach ($product_type->crosssellItem as &$csi) {\n $csi->getAttachableItems();\n }",
" $tpl = $product_type->getForm('show');",
" if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n $this->grabConfig(); // grab the global config",
" assign_to_template(array(\n 'config' => $this->config,\n 'asset_path' => $this->asset_path,\n// 'product' => $product,\n 'product' => $product_type,\n 'last_category' => !empty($order->lastcat) ? $order->lastcat : null,\n ));\n $this->categoryBreadcrumb();\n }",
" function showByTitle() {\n global $order, $template, $user;\n //need to add a check here for child product and redirect to parent if hit directly by ID\n expHistory::set('viewable', $this->params);",
" $product = new product(addslashes($this->params['title']));\n $product_type = new $product->product_type($product->id);\n $product_type->title = expString::parseAndTrim($product_type->title, true);\n $product_type->image_alt_tag = expString::parseAndTrim($product_type->image_alt_tag, true);",
" //if we're trying to view a child product directly, then we redirect to it's parent show view\n //bunk URL, no product found\n if (empty($product->id)) {\n redirect_to(array('controller' => 'notfound', 'action' => 'page_not_found', 'title' => $this->params['title']));\n }\n if (!empty($product->parent_id)) {\n $product = new product($product->parent_id);\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $product->sef_url));\n }\n if ($product->active_type == 1) {\n $product_type->user_message = \"This product is temporarily unavailable for purchase.\";\n } elseif ($product->active_type == 2 && !$user->isAdmin()) {\n flash(\"error\", $product->title . \" \" . gt(\"is currently unavailable.\"));\n expHistory::back();\n } elseif ($product->active_type == 2 && $user->isAdmin()) {\n $product_type->user_message = $product->title . \" is currently marked as unavailable for purchase or display. Normal users will not see this product.\";\n }\n if (!empty($product_type->crosssellItem)) foreach ($product_type->crosssellItem as &$csi) {\n $csi->getAttachableItems();\n }\n //eDebug($product->crosssellItem);",
" $tpl = $product_type->getForm('show');\n //eDebug($product);\n if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n $this->grabConfig(); // grab the global config",
" assign_to_template(array(\n 'config' => $this->config,\n 'product' => $product_type,\n 'last_category' => !empty($order->lastcat) ? $order->lastcat : null,\n ));\n }",
" function showByModel() {\n global $order, $template, $db;",
" expHistory::set('viewable', $this->params);\n $product = new product();\n $model = $product->find(\"first\", 'model=\"' . $this->params['model'] . '\"');\n //eDebug($model);\n $product_type = new $model->product_type($model->id);\n //eDebug($product_type);\n $tpl = $product_type->getForm('show');\n if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n //eDebug($template);\n $this->grabConfig(); // grab the global config\n assign_to_template(array(\n 'config' => $this->config,\n 'product' => $product_type,\n 'last_category' => $order->lastcat\n ));\n }",
" function showallSubcategories() {\n// global $db;",
" expHistory::set('viewable', $this->params);\n// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');\n $catid = expSession::get('catid');\n $parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0);\n $category = new storeCategory($parent);\n $categories = $category->getEcomSubcategories();\n $ancestors = $category->pathToNode();\n assign_to_template(array(\n 'categories' => $categories,\n 'ancestors' => $ancestors,\n 'category' => $category\n ));\n }",
" function showallFeaturedProducts() {\n expHistory::set('viewable', $this->params);\n $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';",
" $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => 'SELECT * FROM ' . DB_TABLE_PREFIX . '_product WHERE is_featured=1',\n 'limit' => ecomconfig::getConfig('pagination_default'),\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page\n ));\n }",
" function showallCategoryFeaturedProducts() {\n expHistory::set('viewable', $this->params);\n $curcat = $this->category;",
" $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';\n //FIXME bad sql statement needs to be a JOIN\n $sql = 'SELECT * FROM ' . DB_TABLE_PREFIX . '_product as p,' . DB_TABLE_PREFIX . '_product_storeCategories as sc WHERE sc.product_id = p.id and p.is_featured=1 and sc.storecategories_id =' . $curcat->id;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => ecomconfig::getConfig('pagination_default'),\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page\n ));\n }",
" function showTopLevel() {\n expHistory::set('viewable', $this->params);\n $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getTopLevel(null, false, true);\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;",
" assign_to_template(array(\n 'categories' => $categories,\n 'curcat' => $curcat,\n 'topcat' => @$ancestors[0]\n ));\n }",
" function showTopLevel_images() {\n global $user;",
" expHistory::set('viewable', $this->params);\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql_start = 'SELECT DISTINCT p.* FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql = 'JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'WHERE ';\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1)'; //' AND ' ;\n //$sql .= 'sc.storecategories_id IN (';\n //$sql .= 'SELECT id FROM '.DB_TABLE_PREFIX.'_storeCategories WHERE rgt BETWEEN '.$this->category->lft.' AND '.$this->category->rgt.')';",
" $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;",
" $order = 'sc.rank'; //$this->config['orderby'];\n $dir = 'ASC'; //$this->config['orderby_dir'];",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'count_sql' => $count_sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getTopLevel(null, false, true);\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;",
" assign_to_template(array(\n 'page' => $page,\n 'categories' => $categories\n ));\n }",
" function showFullTree() { //FIXME we also need a showFullTree_images method like above\n expHistory::set('viewable', $this->params);\n $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getFullTree();\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;",
" assign_to_template(array(\n 'categories' => $categories,\n 'curcat' => $curcat,\n 'topcat' => @$ancestors[0]\n ));\n }",
" function ecomSearch() {",
" }",
" function billing_config() {",
" }",
" /**\n * Add all products (products, event registrations, donations, & gift cards) to search index\n *\n * @return int\n */\n function addContentToSearch() {\n global $db, $router;",
" $model = new $this->basemodel_name();",
" $total = $db->countObjects($model->table);",
" $count = 0;\n for ($i = 0; $i < $total; $i += 100) {\n $orderby = 'id LIMIT ' . ($i) . ', 100';\n $content = $db->selectArrays($model->table, 'parent_id=0', $orderby);",
" foreach ($content as $cnt) {\n $origid = $cnt['id'];\n $prod = new product($cnt['id']);\n unset($cnt['id']);\n if (ecomconfig::getConfig('ecom_search_results') == '') {\n $cnt['title'] = (isset($prod->expFile['mainimage'][0]) ? '<img src=\"' . PATH_RELATIVE . 'thumb.php?id=' . $prod->expFile['mainimage'][0]->id . '&w=40&h=40&zc=1\" style=\"float:left;margin-right:5px;\" />' : '') . $cnt['title'] . (!empty($cnt['model']) ? ' - SKU#: ' . $cnt['model'] : '');\n }",
"// $search_record = new search($cnt, false, false);\n //build the search record and save it.\n $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->baseclassname . \"'\";\n $oldindex = $db->selectObject('search', $sql);\n if (!empty($oldindex)) {\n $search_record = new search($oldindex->id, false, false);\n $search_record->update($cnt);\n } else {\n $search_record = new search($cnt, false, false);\n }",
" $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];\n if ($cnt['product_type'] == 'giftcard') {\n $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => 'store', 'action' => 'showGiftCards')));\n } else {\n// $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $cnt['sef_url'])));\n $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => $cnt['product_type'], 'action' => 'show', 'title' => $cnt['sef_url'])));\n }\n// $search_record->ref_module = 'store';\n $search_record->ref_module = $this->baseclassname;\n// $search_record->ref_type = $this->basemodel_name;\n $search_record->ref_type = $cnt['product_type'];\n// $search_record->category = 'Products';\n $prod = new $search_record->ref_type($origid);\n $search_record->category = $prod->product_name;\n if ($search_record->ref_type == 'eventregistration') {\n $search_record->title .= ' - ' . expDateTime::format_date($prod->eventdate);\n }",
" $search_record->original_id = $origid;\n //$search_record->location_data = serialize($this->loc);\n $search_record->save();\n $count++;\n }\n }\n return $count;\n }",
" function searchByModel() {\n //do nothing...just show the view.\n }",
" function edit() {\n global $db;",
"// $expDefinableField = new expDefinableField();\n// $definablefields = $expDefinableField->find('all','1','rank');",
" //Make sure that the view is the edit.tpl and not any ajax views\n if (isset($this->params['view']) && $this->params['view'] == 'edit') {\n expHistory::set('editable', $this->params);\n }",
" // first we need to figure out what type of ecomm product we are dealing with\n if (!empty($this->params['id'])) {\n // if we have an id lets pull the product type from the products table.\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n if (empty($product_type)) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n } else {\n if (empty($this->params['product_type'])) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n $product_type = $this->params['product_type'];\n }",
" if (!empty($this->params['id'])) {\n $record = new $product_type($this->params['id']);\n if (!empty($this->user_input_fields) && !is_array($record->user_input_fields)) $record->user_input_fields = expUnserialize($record->user_input_fields);\n } else {\n $record = new $product_type();\n $record->user_input_fields = array();\n }",
"// if (!empty($this->params['parent_id']))",
" // get the product options and send them to the form\n $editable_options = array();\n //$og = new optiongroup();\n $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');\n //eDebug($mastergroups,true);\n foreach ($mastergroups as $mastergroup) {\n // if this optiongroup_master has already been made into an option group for this product\n // then we will grab that record now..if not, we will make a new one.\n $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);\n //if ($mastergroup->id == 9) eDebug($grouprec,true);\n //eDebug($grouprec);\n if (empty($grouprec)) {\n $grouprec['optiongroup_master_id'] = $mastergroup->id;\n $grouprec['title'] = $mastergroup->title;\n $group = new optiongroup($grouprec);\n } else {\n $group = new optiongroup($grouprec['id']);\n }",
" $editable_options[$group->title] = $group;",
" if (empty($group->option)) {\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n $editable_options[$group->title]->options[] = $opt;\n }",
" } else {\n if (count($group->option) == count($mastergroup->option_master)) {\n $editable_options[$group->title]->options = $group->option;\n } else {\n // check for any new options or deleted since the last time we edited this product\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . \" AND product_id=\" . $record->id);\n if (empty($opt_id)) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n } else {\n $opt = new option($opt_id);\n }",
" $editable_options[$group->title]->options[] = $opt;\n }\n }\n }",
" //eDebug($editable_options[$group->title]); ",
" }\n //die();",
" uasort($editable_options, array(\"optiongroup\", \"sortOptiongroups\"));",
" // get the shipping options and their methods\n// $shipping = new shipping();\n// foreach (shipping::listAvailableCalculators() as $calcid => $name) {\n foreach (shipping::listCalculators() as $calcid => $name) {\n // must make sure (custom) calculator exists\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }",
"# eDebug($shipping_services);\n# eDebug($shipping_methods);",
" if (!empty($this->params['product_type']) && ($this->params['product_type'] == \"product\" || $this->params['product_type'] == \"childProduct\")) {\n //if new record and it's a child, then well set the child rank to be at the end\n if (empty($record->id) && $record->isChild()) {\n $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;\n }\n //eDebug($record,true);\n }\n $view = '';\n $parent = null;\n if ((isset($this->params['parent_id']) && empty($record->id))) {\n //NEW child product\n $view = 'edit';\n $parent = new $product_type($this->params['parent_id'], false, true);\n $record->parent_id = $this->params['parent_id'];\n } elseif ((!empty($record->id) && $record->parent_id != 0)) {\n //EDIT child product\n $view = 'edit';\n $parent = new $product_type($record->parent_id, false, true);\n } else {\n $view = 'edit';\n }",
" $f = new forms();\n $forms_list = array();\n $forms_list[0] = '- '.gt('No User Input Required').' -';\n $forms = $f->find('all', 'is_saved=1');\n if (!empty($forms)) foreach ($forms as $frm) {\n if (!$db->countObjects('eventregistration', 'forms_id='.$frm->id) || (!empty($record->forms_id) && $record->forms_id == $frm->id))\n $forms_list[$frm->id] = $frm->title;\n }",
" assign_to_template(array(\n 'record' => $record,\n 'parent' => $parent,\n 'form' => $record->getForm($view),\n 'optiongroups' => $editable_options,\n// 'definablefields' => isset($definablefields) ? $definablefields : '',\n 'forms'=> $forms_list,\n 'shipping_services' => isset($shipping_services) ? $shipping_services : '', // Added implication since the shipping_services default value is a null\n 'shipping_methods' => isset($shipping_methods) ? $shipping_methods : '', // Added implication since the shipping_methods default value is a null\n 'product_types' => isset($this->config['product_types']) ? $this->config['product_types'] : ''\n //'status_display'=>$status_display->getStatusArray()\n ));\n }",
" function copyProduct() {\n global $db;",
" //expHistory::set('editable', $this->params);\n $f = new forms();\n $forms_list = array();\n $forms_list[0] = '- '.gt('No User Input Required').' -';\n $forms = $f->find('all', 'is_saved=1');\n if (!empty($forms)) foreach ($forms as $frm) {\n $forms_list[$frm->id] = $frm->title;\n }",
" // first we need to figure out what type of ecomm product we are dealing with\n if (!empty($this->params['id'])) {\n // if we have an id lets pull the product type from the products table.\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n } else {\n if (empty($this->params['product_type'])) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n $product_type = $this->params['product_type'];\n }",
" $record = new $product_type($this->params['id']);\n // get the product options and send them to the form\n $editable_options = array();",
" $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');\n foreach ($mastergroups as $mastergroup) {\n // if this optiongroup_master has already been made into an option group for this product\n // then we will grab that record now..if not, we will make a new one.\n $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);\n //eDebug($grouprec);\n if (empty($grouprec)) {\n $grouprec['optiongroup_master_id'] = $mastergroup->id;\n $grouprec['title'] = $mastergroup->title;\n $group = new optiongroup($grouprec);\n } else {\n $group = new optiongroup($grouprec['id']);\n }",
" $editable_options[$group->title] = $group;",
" if (empty($group->option)) {\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n $editable_options[$group->title]->options[] = $opt;\n }\n } else {\n if (count($group->option) == count($mastergroup->option_master)) {\n $editable_options[$group->title]->options = $group->option;\n } else {\n // check for any new options or deleted since the last time we edited this product\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . \" AND product_id=\" . $record->id);\n if (empty($opt_id)) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n } else {\n $opt = new option($opt_id);\n }",
" $editable_options[$group->title]->options[] = $opt;\n }\n }\n }\n }",
" // get the shipping options and their methods\n// $shipping = new shipping();\n// foreach (shipping::listAvailableCalculators() as $calcid => $name) {\n foreach (shipping::listCalculators() as $calcid => $name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }",
" $record->original_id = $record->id;\n $record->original_model = $record->model;\n $record->sef_url = NULL;\n $record->previous_id = NULL;\n $record->editor = NULL;",
" if ($record->isChild()) {\n $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;\n }",
" assign_to_template(array(\n 'copy' => true,\n 'record' => $record,\n 'parent' => new $product_type($record->parent_id, false, true),\n 'form' => $record->getForm($record->parent_id == 0 ? 'edit' : 'child_edit'),\n 'optiongroups' => $editable_options,\n 'forms'=> $forms_list,\n 'shipping_services' => $shipping_services,\n 'shipping_methods' => $shipping_methods\n ));\n }",
" function picktype() {\n $prodfiles = storeController::getProductTypes();\n $products = array();\n foreach ($prodfiles as $filepath => $classname) {\n $prodObj = new $classname();\n $products[$classname] = $prodObj->product_name;\n }\n assign_to_template(array(\n 'product_types' => $products\n ));\n }",
" function update() {\n// global $db;\n //Get the product type\n $product_type = isset($this->params['product_type']) ? $this->params['product_type'] : 'product';",
" $record = new $product_type();",
" $record->update($this->params);",
" if ($product_type == \"childProduct\" || $product_type == \"product\") {\n $record->addContentToSearch();\n //Create a flash message and redirect to the page accordingly\n if ($record->parent_id != 0) {\n $parent = new $product_type($record->parent_id, false, false);\n if (isset($this->params['original_id'])) {\n flash(\"message\", gt(\"Child product saved.\"));\n } else {\n flash(\"message\", gt(\"Child product copied and saved.\"));\n }\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $parent->sef_url));\n } elseif (isset($this->params['original_id'])) {\n flash(\"message\", gt(\"Product copied and saved. You are now viewing your new product.\"));\n } else {\n flash(\"message\", gt(\"Product saved.\"));\n }\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $record->sef_url));\n } elseif ($product_type == \"giftcard\") {\n flash(\"message\", gt(\"Giftcard saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n } elseif ($product_type == \"eventregistration\") {\n //FIXME shouldn't event registrations be added to search index?\n// $record->addContentToSearch(); //FIXME there is NO eventregistration::addContentToSearch() method\n flash(\"message\", gt(\"Event saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n } elseif ($product_type == \"donation\") {\n flash(\"message\", gt(\"Donation saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n }\n }",
" function delete() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n $product = new $product_type($this->params['id'], true, false);",
" //eDebug($product_type); ",
" //eDebug($product, true);\n //if (!empty($product->product_type_id)) {\n //$db->delete($product_type, 'id='.$product->product_id);\n //}",
" $db->delete('option', 'product_id=' . $product->id . \" AND optiongroup_id IN (SELECT id from \" . $db->prefix . \"optiongroup WHERE product_id=\" . $product->id . \")\");\n $db->delete('optiongroup', 'product_id=' . $product->id);\n //die();\n $db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type=\"' . $product_type . '\"');",
" if ($product->product_type == \"product\") {\n if ($product->hasChildren()) {\n $this->deleteChildren();\n }\n }",
" $product->delete();",
" flash('message', gt('Product deleted successfully.'));\n expHistory::back();\n }",
" function quicklinks() {\n global $order;",
" $oicount = !empty($order->item_count) ? $order->item_count : 0;\n //eDebug($itemcount);\n assign_to_template(array(\n \"oicount\" => $oicount,\n ));\n }",
" public static function getProductTypes() {\n $paths = array(\n BASE . 'framework/modules/ecommerce/products/models',\n );",
" $products = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path . '/' . $file) && substr($file, -4) == '.php' && $file != 'childProduct.php') {\n $classname = substr($file, 0, -4);\n $products[$path . '/' . $file] = $classname;\n }\n }\n }\n }",
" return $products;\n }",
" function metainfo() {\n global $router;",
" if (empty($router->params['action'])) return array();",
" // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'showall': //category page\n $cat = $this->category;\n if (!empty($cat)) {\n $metainfo['title'] = empty($cat->meta_title) ? $cat->title . ' ' . gt('Products') . ' - ' . $storename : $cat->meta_title;\n $metainfo['keywords'] = empty($cat->meta_keywords) ? $cat->title : strip_tags($cat->meta_keywords);\n $metainfo['description'] = empty($cat->meta_description) ? strip_tags($cat->body) : strip_tags($cat->meta_description);\n $metainfo['canonical'] = empty($cat->canonical) ? $router->plainPath() : strip_tags($cat->canonical);\n $metainfo['noindex'] = empty($cat->meta_noindex) ? false : $cat->meta_noindex;\n $metainfo['nofollow'] = empty($cat->meta_nofollow) ? false : $cat->meta_nofollow;\n }\n break;\n case 'show':\n case 'showByTitle':\n $prod = new product(isset($router->params['title']) ? expString::sanitize($router->params['title']) : intval($router->params['id']));\n if (!empty($prod)) {\n $metainfo['title'] = empty($prod->meta_title) ? $prod->title . \" - \" . $storename : $prod->meta_title;\n $metainfo['keywords'] = empty($prod->meta_keywords) ? $prod->title : strip_tags($prod->meta_keywords);\n $metainfo['description'] = empty($prod->meta_description) ? strip_tags($prod->body) : strip_tags($prod->meta_description);\n $metainfo['canonical'] = empty($prod->canonical) ? $router->plainPath() : strip_tags($prod->canonical);\n $metainfo['noindex'] = empty($prod->meta_noindex) ? false : $prod->meta_noindex;\n $metainfo['nofollow'] = empty($prod->meta_nofollow) ? false : $prod->meta_nofollow;\n if (!empty($prod->expFile['mainimage'][0]) && file_exists(BASE.$prod->expFile['mainimage'][0]->directory.$prod->expFile['mainimage'][0]->filename)) {\n $metainfo['rich'] = '<!--\n <PageMap>\n <DataObject type=\"thumbnail\">\n <Attribute name=\"src\" value=\"'.$prod->expFile['mainimage'][0]->url.'\"/>\n <Attribute name=\"width\" value=\"'.$prod->expFile['mainimage'][0]->image_width.'\"/>\n <Attribute name=\"height\" value=\"'.$prod->expFile['mainimage'][0]->image_width.'\"/>\n </DataObject>\n </PageMap>\n -->';\n }\n $metainfo['fb']['type'] = 'product';\n $metainfo['fb']['title'] = substr(empty($prod->meta_fb['title']) ? $prod->title : $prod->meta_fb['title'], 0, 87);\n $metainfo['fb']['description'] = substr(empty($prod->meta_fb['description']) ? $metainfo['description'] : $prod->meta_fb['description'], 0, 199);\n $metainfo['fb']['url'] = empty($prod->meta_fb['url']) ? $metainfo['canonical'] : $prod->meta_fb['url'];\n $metainfo['fb']['image'] = empty($prod->meta_fb['fbimage'][0]) ? '' : $prod->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['fb']['image'])) {\n if (!empty($prod->expFile['mainimage'][0]))\n $metainfo['fb']['image'] = $prod->expFile['mainimage'][0]->url;\n if (empty($metainfo['fb']['image']))\n $metainfo['fb']['image'] = URL_BASE . '/framework/modules/ecommerce/assets/images/no-image.jpg';\n }\n break;\n }\n default:\n $metainfo['title'] = gt(\"Shopping\") . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }",
" // Remove any quotes if there are any.\n// $metainfo['title'] = expString::parseAndTrim($metainfo['title'], true);\n// $metainfo['description'] = expString::parseAndTrim($metainfo['description'], true);\n// $metainfo['keywords'] = expString::parseAndTrim($metainfo['keywords'], true);\n// $metainfo['canonical'] = expString::parseAndTrim($metainfo['canonical'], true);\n// $metainfo['noindex'] = expString::parseAndTrim($metainfo['noindex'], true);\n// $metainfo['nofollow'] = expString::parseAndTrim($metainfo['nofollow'], true);",
" return $metainfo;\n }",
" /**\n * Configure the module\n */\n public function configure() {\n if (empty($this->config['enable_ratings_and_reviews'])) {\n $this->remove_configs[] = 'comments';\n }\n parent::configure();\n }",
" public function deleteChildren() {\n //eDebug($data[0],true);\n //if($id!=null) $this->params['id'] = $id;",
" //eDebug($this->params,true); ",
" $product = new product($this->params['id']);\n //$product = $product->find(\"first\", \"previous_id =\" . $previous_id);\n //eDebug($product, true);",
" if (empty($product->id)) // || empty($product->previous_id)) ",
" {\n flash('error', gt('There was an error deleting the child products.'));\n expHistory::back();\n }\n $childrenToDelete = $product->find('all', 'parent_id=' . $product->id);\n foreach ($childrenToDelete as $ctd) {",
" //fwrite($lfh, \"Deleting:\" . $ctd->id . \"\\n\"); ",
" $ctd->delete();\n }\n }",
" function searchByModelForm() {\n // get the search terms\n $terms = $this->params['search_string'];",
" $sql = \"model like '%\" . $terms . \"%'\";",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'order' => 'title',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page,\n 'terms' => $terms\n ));\n }",
" /**\n * AJAX search for products by model/sku\n */",
" function search_by_model() {\n global $db, $user;",
" $sql = \"select DISTINCT(p.id) as id, p.title, model from \" . $db->prefix . \"product as p WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';",
" //if first character of search is a -, then we do a wild card, else from beginning\n if ($this->params['query'][0] == '-') {\n $sql .= \" p.model LIKE '%\" . $this->params['query'];\n } else {\n $sql .= \" p.model LIKE '\" . $this->params['query'];\n }",
" $sql .= \"%' AND p.parent_id=0 GROUP BY p.id \";\n $sql .= \"order by p.model ASC LIMIT 30\";\n $res = $db->selectObjectsBySql($sql);\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
" /**\n * AJAX search for products by title, description, or model/sku\n *\n */\n public function search() {\n global $db, $user;",
" if (SAVE_SEARCH_QUERIES && INCLUDE_AJAX_SEARCH == 1) { // only to add search query record\n $qry = trim($this->params['query']);\n if (!empty($qry)) {\n if (INCLUDE_ANONYMOUS_SEARCH == 1 || $user->id <> 0) {\n $queryObj = new stdClass();\n $queryObj->user_id = $user->id;\n $queryObj->query = $qry;\n $queryObj->timestamp = time();",
" $db->insertObject($queryObj, 'search_queries');\n }\n }\n }\n //$this->params['query'] = str_ireplace('-','\\-',$this->params['query']);\n $terms = explode(\" \", $this->params['query']);\n $search_type = ecomconfig::getConfig('ecom_search_results');",
" // look for term in full text search\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, match (p.title,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) as score \";\n $sql .= \" from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" match (p.title,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) AND p.parent_id=0 GROUP BY p.id \";\n $sql .= \"order by score desc LIMIT 10\";",
" $firstObs = $db->selectObjectsBySql($sql);\n foreach ($firstObs as $set) {\n $set->weight = 1;\n unset($set->score);\n $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }",
" // look for specific term in fields\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" (p.model like '%\" . $this->params['query'] . \"%' \";\n $sql .= \" OR p.title like '%\" . $this->params['query'] . \"%') \";\n $sql .= \" AND p.parent_id=0 GROUP BY p.id LIMIT 10\";",
" $secondObs = $db->selectObjectsBySql($sql);\n foreach ($secondObs as $set) {\n $set->weight = 2;\n $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }",
" // look for begins with term in fields\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" (p.model like '\" . $this->params['query'] . \"%' \";\n $sql .= \" OR p.title like '\" . $this->params['query'] . \"%') \";\n $sql .= \" AND p.parent_id=0 GROUP BY p.id LIMIT 10\";",
" $thirdObs = $db->selectObjectsBySql($sql);\n foreach ($thirdObs as $set) {\n if (strcmp(strtolower(trim($this->params['query'])), strtolower(trim($set->model))) == 0)\n $set->weight = 10;\n else if (strcmp(strtolower(trim($this->params['query'])), strtolower(trim($set->title))) == 0)\n $set->weight = 9;\n else\n $set->weight = 3;",
" $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }",
" function sortSearch($a, $b) {\n return ($a->weight == $b->weight ? 0 : ($a->weight < $b->weight) ? 1 : -1);\n }",
" if (count($terms)) {\n foreach ($res as $r) {\n $index = !empty($r->model) ? $r->model : $r->sef_url;\n foreach ($terms as $term) {\n if (stristr($r->title, $term)) $res[$index]->weight = $res[$index]->weight + 1;\n }\n }\n }\n usort($res, 'sortSearch');",
" $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
" /**\n * AJAX search for products by title, description, or model/sku\n *\n */\n public function searchNew() {\n global $db, $user;\n //$this->params['query'] = str_ireplace('-','\\-',$this->params['query']);\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, \";\n $sql .= \"match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) as relevance, \";\n $sql .= \"CASE when p.model like '\" . $this->params['query'] . \"%' then 1 else 0 END as modelmatch, \";\n $sql .= \"CASE when p.title like '%\" . $this->params['query'] . \"%' then 1 else 0 END as titlematch \";\n $sql .= \"from \" . $db->prefix . \"product as p INNER JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n $sql .= \" match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) AND p.parent_id=0 \";\n $sql .= \" HAVING relevance > 0 \";",
" //$sql .= \"GROUP BY p.id \"; ",
" $sql .= \"order by modelmatch,titlematch,relevance desc LIMIT 10\";",
" eDebug($sql);\n $res = $db->selectObjectsBySql($sql);\n eDebug($res, true);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
" function batch_process() {\n $os = new order_status();\n $oss = $os->find('all',1,'rank');\n $order_status = array();\n $order_status[-1] = '';\n foreach ($oss as $status) {\n $order_status[$status->id] = $status->title;\n }\n assign_to_template(array(\n 'order_status' => $order_status\n ));\n }",
" function process_orders() {\n /*\n Testing\n */\n /*echo \"Here?\";\n $inv = 30234;",
" $req = 'a29f9shsgh32hsf80s7'; ",
" $amt = 101.00;\n for($count=1;$count<=25;$count+=2)",
" { ",
" $data[2] = $inv + $count;\n $amt += $count*$count;",
" $successSet[$count]['message'] = \"Sucessfully imported row \" . $count . \", order: \" . $data[2] . \"<br/>\"; ",
" $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $amt;\n $successSet[$count]['request_id'] = $req;\n $successSet[$count]['reference_id'] = $req;\n $successSet[$count]['authorization_code'] = $req;",
" $successSet[$count]['shipping_tracking_number'] = '1ZNF453937547'; ",
" $successSet[$count]['carrier'] = 'UPS';\n }\n for($count=2;$count<=25;$count+=2)",
" { \n $data[2] = $inv + $count; \n $amt += $count*$count; ",
" $errorSet[$count]['error_code'] = '42';\n $errorSet[$count]['message'] = \"No go for some odd reason. Try again.\";\n $errorSet[$count]['order_id'] = $data[2];\n $errorSet[$count]['amount'] = $amt;\n }",
" \n assign_to_template(array('errorSet'=>$errorSet, 'successSet'=>$successSet)); ",
" return;*/",
" ###########",
" global $db;\n $template = expTemplate::get_template_for_action(new orderController(), 'setStatus', $this->loc);",
" //eDebug($_FILES);",
" //eDebug($this->params,true); ",
" set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n if (!empty($_FILES['batch_upload_file']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'batch_process'));\n// $this->batch_process();\n }",
" $file = new stdClass();\n $file->path = $_FILES['batch_upload_file']['tmp_name'];\n echo \"Validating file...<br/>\";",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n $count = 1;\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>CSV File passed validation...<br/><br/>Detecting carrier type....<br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $data = fgetcsv($handle, 10000, \",\");",
" //eDebug($data); ",
"// $dataset = array();\n $carrier = '';\n if (trim($data[0]) == 'ShipmentInformationShipmentID') {\n echo \"Detected UPS file...<br/>\";\n $carrier = \"UPS\";\n $carrierTrackingLink = \"http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=\";\n } elseif (trim($data[0]) == 'PIC') {\n echo \"Detected United States Post Service file...<br/>\";\n $carrier = \"USPS\";\n $carrierTrackingLink = \"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=\";\n }",
" //eDebug($carrier);\n $count = 1;\n $errorSet = array();\n $successSet = array();",
" $oo = new order();",
" // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $originalOrderId = $data[2];\n $data[2] = intval($data[2]);\n $order = new stdClass();\n $bm = new stdClass();\n $transactionState = null;",
" //check for valid order number - if not present or not order, fail and continue with next record\n if (isset($data[2]) && !empty($data[2])) {\n $order = $oo->findBy('invoice_id', $data[2]);\n if (empty($order->id)) {\n $errorSet[$count]['message'] = $originalOrderId . \" is not a valid order in this system.\";\n $errorSet[$count]['order_id'] = $originalOrderId;\n continue;\n }\n } else {\n $errorSet[$count]['message'] = \"Row \" . $count . \" has no order number.\";\n $errorSet[$count]['order_id'] = \"N/A\";\n continue;\n }",
" /*we have a valid order, so let's see what we can do: */",
" //set status of order to var\n $currentStat = $order->order_status;\n //eDebug($currentStat,true);",
" //-- check the order for a closed status - if so, do NOT process or set shipping\n if ($currentStat->treat_as_closed == true) {\n $errorSet[$count]['message'] = \"This is currently a closed order. Not processing.\";\n $errorSet[$count]['order_id'] = $data[2];\n continue;\n }",
" //ok, if we made it here we have a valid order that is \"open\"\n //we'll try to capture the transaction if it's in an authorized state, but set shipping regardless\n if (isset($order->billingmethod[0])) {\n $bm = $order->billingmethod[0];\n $transactionState = $bm->transaction_state;\n } else {\n $bm = null;\n $transactionState = '';\n }",
" if ($transactionState == 'authorized') {\n //eDebug($order,true);\n $calc = $bm->billingcalculator->calculator;\n $calc->config = $bm->billingcalculator->config;\n if (method_exists($calc, 'delayed_capture')) {\n //$result = $calc->delayed_capture($bm,$bm->billing_cost);\n $result = $calc->delayed_capture($bm, $order->grand_total, $order);\n if ($result->errorCode == 0) {\n //we've succeeded. transaction already created and billing info updated.",
" //just need to set the order shipping info, check and see if we send user an email, and set statuses. \n //shipping info: ",
" $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['message'] = \"Sucessfully captured order \" . $data[2] . \" and set shipping information.\";\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['request_id'] = $result->request_id;\n $successSet[$count]['reference_id'] = $result->PNREF;\n $successSet[$count]['authorization_code'] = $result->AUTHCODE;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n } else {\n //failed capture, so we report the error but still set the shipping information\n //because it's already out the door",
" //$failMessage = \"Attempted to delay capture order \" . $data[2] . \" and it failed with the following error: \" . $result->errorCode . \" - \" .$result->message; ",
" //if the user seelected to set a different status for failed orders, set it here.\n /*if(isset($this->params['order_status_fail'][0]) && $this->params['order_status_fail'][0] > -1)\n {\n $change = new order_status_changes();\n // save the changes\n $change->from_status_id = $order->order_status_id;\n //$change->comment = $this->params['comment'];\n $change->to_status_id = $this->params['order_status_fail'][0];\n $change->orders_id = $order->id;\n $change->save();",
" ",
" // update the status of the order\n $order->order_status_id = $this->params['order_status_fail'][0];",
" $order->save(); ",
" }*/\n $errorSet[$count]['error_code'] = $result->errorCode;\n $errorSet[$count]['message'] = \"Capture failed: \" . $result->message . \"<br/>Setting shipping information.\";\n $errorSet[$count]['order_id'] = $data[2];\n $errorSet[$count]['amount'] = $order->grand_total;\n $errorSet[$count]['shipping_tracking_number'] = $data[0];\n $errorSet[$count]['carrier'] = $carrier;",
" //continue; ",
" }\n } else {",
" //dont suppose we do anything here, as it may be set to approved manually \n //$errorSet[$count] = \"Order \" . $data[2] . \" does not use a billing method with delayed capture ability.\"; ",
" $successSet[$count]['message'] = 'No capture processing available for order:' . $data[2] . '. Setting shipping information.';\n $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n }\n } //if we hit this else, it means we have an order that is not in an authorized state\n //so we do not try to process it = still set shipping though. //FIXME what about 'complete'?\n else {\n $successSet[$count]['message'] = 'No processing necessary for order:' . $data[2] . '. Setting shipping information.';\n $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n }",
" $order->shipped = time();\n $order->shipping_tracking_number = $data[0];\n $order->save();",
" $s = array_pop($order->shippingmethods);\n $sm = new shippingmethod($s->id);\n $sm->carrier = $carrier;\n $sm->save();",
" //statuses and email\n if (isset($this->params['order_status_success'][0]) && $this->params['order_status_success'][0] > -1) {\n $change = new order_status_changes();\n // save the changes\n $change->from_status_id = $order->order_status_id;\n //$change->comment = $this->params['comment'];\n $change->to_status_id = $this->params['order_status_success'][0];\n $change->orders_id = $order->id;\n $change->save();",
" // update the status of the order\n $order->order_status_id = $this->params['order_status_success'][0];\n $order->save();",
" // email the user if we need to\n if (!empty($this->params['email_customer'])) {\n $email_addy = $order->billingmethod[0]->email;\n if (!empty($email_addy)) {\n $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);\n $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);\n// $template->assign(\n assign_to_template(\n array(\n 'comment' => $change->comment,\n 'to_status' => $to_status,\n 'from_status' => $from_status,\n 'order' => $order,\n 'date' => date(\"F j, Y, g:i a\"),\n 'storename' => ecomconfig::getConfig('storename'),\n 'include_shipping' => true,\n 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number,\n 'carrier' => $carrier\n )\n );",
" $html = $template->render();\n $html .= ecomconfig::getConfig('ecomfooter');",
" $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n try {\n $mail = new expMail();\n $mail->quickSend(array(\n 'html_message' => $html,\n 'text_message' => str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => array($email_addy => $order->billingmethod[0]->firstname . ' ' . $order->billingmethod[0]->lastname),\n 'from' => $from,\n 'subject' => 'Your Order Has Been Shipped (#' . $order->invoice_id . ') - ' . ecomconfig::getConfig('storename')\n ));\n } catch (Exception $e) {\n //do nothing for now\n eDebug(\"Email error:\");\n eDebug($e);\n }\n }\n //else {\n // $errorSet[$count]['message'] .= \"<br/>Order \" . $data[2] . \" was captured successfully, however the email notification was not successful.\";\n //}\n }\n }\n",
" //eDebug($product); ",
" }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" assign_to_template(array(\n 'errorSet' => $errorSet,\n 'successSet' => $successSet\n ));\n }",
" function manage_sales_reps() {",
" }",
" function showHistory() {\n $h = new expHistory();\n// echo \"<xmp>\";\n echo \"<pre>\";\n print_r($h);\n// echo \"</xmp>\";\n echo \"</pre>\";\n }",
" function import_external_addresses() {\n $sources = array('mc' => 'MilitaryClothing.com', 'nt' => 'NameTapes.com', 'am' => 'Amazon');\n assign_to_template(array(\n 'sources' => $sources\n ));\n }",
" function process_external_addresses() {\n global $db;\n set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n eDebug($this->params);\n// eDebug($_FILES,true);\n if (!empty($_FILES['address_csv']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n// $this->import_external_addresses();\n }",
" $file = new stdClass();\n $file->path = $_FILES['address_csv']['tmp_name'];\n echo \"Validating file...<br/>\";",
" //replace tabs with commas\n /*if($this->params['type_of_address'][0] == 'am')\n {\n $checkhandle = fopen($file->path, \"w\");\n $oldFile = file_get_contents($file->path);\n $newFile = str_ireplace(chr(9),',',$oldFile);\n fwrite($checkhandle,$newFile);\n fclose($checkhandle);\n }*/",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n if ($this->params['type_of_address'][0] == 'am') {\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \"\\t\");\n $fieldCount = count($checkdata);\n } else {\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n }",
" $count = 1;\n if ($this->params['type_of_address'][0] == 'am') {\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \"\\t\")) !== FALSE) {\n $count++;\n //eDebug($checkdata);\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n } else {\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n }",
" fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line and discard it\n $data = fgetcsv($handle, 10000, \",\");",
" //eDebug($data); ",
"// $dataset = array();",
" //mc=1, nt=2, amm=3",
" if ($this->params['type_of_address'][0] == 'mc') {\n //militaryclothing\n $db->delete('external_addresses', 'source=1');",
" } else if ($this->params['type_of_address'][0] == 'nt') {\n //nametapes\n $db->delete('external_addresses', 'source=2');\n } else if ($this->params['type_of_address'][0] == 'am') {\n //amazon\n $db->delete('external_addresses', 'source=3');\n }",
" if ($this->params['type_of_address'][0] == 'am') {\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \"\\t\")) !== FALSE) {\n //eDebug($data,true);\n $extAddy = new external_address();",
" //eDebug($data);\n $extAddy->source = 3;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[15]);\n $extAddy->firstname = $name[0];\n if (isset($name[3])) {\n $extAddy->firstname .= ' ' . $name[1];\n $extAddy->middlename = $name[2];\n $extAddy->lastname = $name[3];\n } else if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[16];\n $extAddy->address2 = $data[17];\n $extAddy->city = $data[19];\n $state = new geoRegion();\n $state = $state->findBy('code', trim($data[20]));\n if (empty($state->id)) {\n $state = new geoRegion();\n $state = $state->findBy('name', trim($data[20]));\n }\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[21]);\n $extAddy->phone = $data[6];\n $extAddy->email = $data[4];\n //eDebug($extAddy);\n $extAddy->save();\n }\n } else {\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n eDebug($data);\n $extAddy = new external_address();\n if ($this->params['type_of_address'][0] == 'mc') {\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[3]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[8]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n //eDebug($extAddy);\n $extAddy->save();",
" //Check if the shipping add is same as the billing add\n if ($data[5] != $data[14]) {\n $extAddy = new external_address();\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[12]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];\n $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[17]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n // eDebug($extAddy, true);\n $extAddy->save();\n }\n }\n if ($this->params['type_of_address'][0] == 'nt') {\n //eDebug($data,true);\n $extAddy->source = 2;\n $extAddy->user_id = 0;\n $extAddy->firstname = $data[16];\n $extAddy->lastname = $data[17];\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[18];\n $extAddy->address2 = $data[19];\n $extAddy->city = $data[20];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[21]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[22]);\n $extAddy->phone = $data[23];\n $extAddy->email = $data[13];\n //eDebug($extAddy);\n $extAddy->save();\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n echo \"Done!\";\n }",
" function nonUnicodeProducts() {\n global $db, $user;",
" $products = $db->selectObjectsIndexedArray('product');\n $affected_fields = array();\n $listings = array();\n $listedProducts = array();\n $count = 0;\n //Get all the columns of the product table\n $columns = $db->getTextColumns('product');\n foreach ($products as $item) {",
" foreach ($columns as $column) {\n if ($column != 'body' && $column != 'summary' && $column != 'featured_body') {\n if (!expString::validUTF($item->$column) || strrpos($item->$column, '?')) {\n $affected_fields[] = $column;\n }\n } else {\n if (!expString::validUTF($item->$column)) {\n $affected_fields[] = $column;\n }\n }\n }",
" if (isset($affected_fields)) {\n if (count($affected_fields) > 0) {\n //Hard coded fields since this is only for displaying\n $listedProducts[$count]['id'] = $item->id;\n $listedProducts[$count]['title'] = $item->title;\n $listedProducts[$count]['model'] = $item->model;\n $listedProducts[$count]['sef_url'] = $item->sef_url;\n $listedProducts[$count]['nonunicode'] = implode(', ', $affected_fields);\n $count++;\n }\n }\n unset($affected_fields);\n }",
" assign_to_template(array(\n 'products' => $listedProducts,\n 'count' => $count\n ));\n }",
" function cleanNonUnicodeProducts() {\n global $db, $user;",
" $products = $db->selectObjectsIndexedArray('product');\n //Get all the columns of the product table\n $columns = $db->getTextColumns('product');\n foreach ($products as $item) {\n //Since body, summary, featured_body can have a ? intentionally such as a link with get parameter.\n //TO Improved\n foreach ($columns as $column) {\n if ($column != 'body' && $column != 'summary' && $column != 'featured_body') {\n if (!expString::validUTF($item->$column) || strrpos($item->$column, '?')) {\n $item->$column = expString::convertUTF($item->$column);\n }\n } else {\n if (!expString::validUTF($item->$column)) {\n $item->$column = expString::convertUTF($item->$column);\n }\n }\n }",
" $db->updateObject($item, 'product');\n }",
" redirect_to(array('controller' => 'store', 'action' => 'nonUnicodeProducts'));\n// $this->nonUnicodeProducts();\n }",
" //This function is being used in the uploadModelaliases page for showing the form upload\n function uploadModelAliases() {\n global $db;\n set_time_limit(0);",
" if (isset($_FILES['modelaliases']['tmp_name'])) {\n if (!empty($_FILES['modelaliases']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n//\t\t\t\tredirect_to(array('controller'=>'store','action'=>'uploadModelAliases'));\n $this->uploadModelAliases();\n }",
" $file = new stdClass();\n $file->path = $_FILES['modelaliases']['tmp_name'];\n echo \"Validating file...<br/>\";",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n $count = 1;",
" // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }",
" fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");\n // read in the header line\n $data = fgetcsv($handle, 10000, \",\");",
" //clear the db\n $db->delete('model_aliases_tmp');\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {",
" $tmp = new stdClass();\n $tmp->field1 = expString::onlyReadables($data[0]);\n $tmp->field2 = expString::onlyReadables($data[1]);\n $db->insertObject($tmp, 'model_aliases_tmp');\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases'));\n echo \"Done!\";\n }",
" //check if there are interrupted model alias in the db\n $res = $db->selectObjectsBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp WHERE is_processed = 0\");\n if (!empty($res)) {\n assign_to_template(array(\n 'continue' => '1'\n ));\n }\n }",
" // This function process the uploading of the model aliases in the uploadModelAliases page\n function processModelAliases($index = 0, $error = '') {\n global $db;",
" //Going next and delete the previous one\n if (isset($this->params['index'])) {\n $index = $this->params['index'];",
" //if go to the next processs\n if (isset($this->params['next'])) {\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT \" . ($index - 1) . \", 1\");\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n }\n }",
" $product_id = '';\n $autocomplete = '';",
" do {\n $count = $db->countObjects('model_aliases_tmp', 'is_processed=0');\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT {$index}, 1\");\n //Validation\n //Check the field one\n if (!empty($res)) {\n $product_field1 = $db->selectObject(\"product\", \"model='{$res->field1}'\");\n $product_field2 = $db->selectObject(\"product\", \"model='{$res->field2}'\");\n }\n if (!empty($product_field1)) {\n $product_id = $product_field1->id;\n //check the other field if it also being used by another product\n if (!empty($product_field2) && $product_field1->id != $product_field2->id) {\n $error = \"Both {$res->field1} and {$res->field2} are models of a product. <br />\";\n } else {\n //Check the field2 if it is already in the model alias\n $model_alias = $db->selectObject(\"model_aliases\", \"model='{$res->field2}'\");\n if (empty($model_alias) && @$model_alias->product_id != $product_field1->id) {\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product_field1->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product_field1->id;\n $db->insertObject($tmp, 'model_aliases');\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');",
" } else {\n $error = \"{$res->field2} has already a product alias. <br />\";\n }\n }\n } elseif (!empty($product_field2)) {\n $product_id = $product_field2->id;\n $model_alias = $db->selectObject(\"model_aliases\", \"model='{$res->field1}'\");\n if (empty($model_alias) && @$model_alias->product_id != $product_field2->id) {\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product_field2->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product_field2->id;\n $db->insertObject($tmp, 'model_aliases');\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n } else {\n $error = \"{$res->field1} has already a product alias. <br />\";\n }\n } else {\n $model_alias1 = $db->selectObject(\"model_aliases\", \"model='{$res->field1}'\");\n $model_alias2 = $db->selectObject(\"model_aliases\", \"model='{$res->field2}'\");",
" if (!empty($model_alias1) || !empty($model_alias2)) {\n $error = \"The {$res->field1} and {$res->field2} are already being used by another product.<br />\";\n } else {\n $error = gt(\"No product match found, please choose a product to be alias in the following models below\") . \":<br />\";\n $error .= $res->field1 . \"<br />\";\n $error .= $res->field2 . \"<br />\";\n $autocomplete = 1;\n }\n }\n $index++;\n } while (empty($error));\n assign_to_template(array(\n 'count' => $count,\n 'alias' => $res,\n 'index' => $index,\n 'product_id' => $product_id,\n 'autocomplete' => $autocomplete,\n 'error' => $error\n ));\n }",
" // This function save the uploaded processed model aliases in the uploadModelAliases page\n function saveModelAliases() {\n global $db;",
" $index = $this->params['index'];\n $title = expString::escape($this->params['product_title']);\n $product = $db->selectObject(\"product\", \"title='{$title}'\");",
" if (!empty($product->id)) {\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT \" . ($index - 1) . \", 1\");\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product->id;\n $db->insertObject($tmp, 'model_aliases');",
" //if the model is empty, update the product table so that it will used the field 1 as its primary model\n if (empty($product->model)) {\n $product->model = $res->field1;\n $db->updateObject($product, 'product');\n }",
" //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n flash(\"message\", gt(\"Product successfully Saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases', 'index' => $index));\n } else {\n flash(\"error\", gt(\"Product title is invalid.\"));\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases', 'index' => $index - 1, 'error' => 'Product title is invalid.'));\n }\n }",
" // This function delete all the already processed model aliases in the uploadModelAliases page\n function deleteProcessedModelAliases() {\n global $db;",
" $db->delete('model_aliases_tmp', 'is_processed=1');\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases'));\n }",
" // This function show the form of model alias to be edit or add in the product edit page\n function edit_model_alias() {\n global $db;",
" if (isset($this->params['id'])) {\n $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']);\n assign_to_template(array(\n 'model_alias' => $model_alias\n ));\n } else {\n assign_to_template(array(\n 'product_id' => $this->params['product_id']\n ));\n }\n }",
" // This function update or add the model alias in the product edit page\n function update_model_alias() {\n global $db;",
" if (empty($this->params['id'])) {\n $obj = new stdClass();\n $obj->model = $this->params['model'];\n $obj->product_id = $this->params['product_id'];\n $db->insertObject($obj, 'model_aliases');",
" } else {\n $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']);\n $model_alias->model = $this->params['model'];\n $db->updateObject($model_alias, 'model_aliases');\n }",
" expHistory::back();\n }",
" // This function delete the model alias in the product edit page\n function delete_model_alias() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $db->delete('model_aliases', 'id =' . $this->params['id']);",
" expHistory::back();\n }",
" function setup_wizard() {",
" }",
" function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }",
" function importProduct($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Product Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!($header[0] == 'id' || $header[0] == 'model')) {\n echo gt('Not a Product Import CSV File');\n return;\n }",
" $count = 1;\n $errorSet = array();\n $product = null;\n /* original order of columns\n 0=id\n 1=parent_id\n 2=child_rank\n 3=title\n 4=body\n 5=model\n 6=warehouse_location\n 7=sef_url\n//FIXME this is where canonical should be\n 8=meta_title\n 9=meta_keywords\n 10=meta_description\n 11=tax_class_id\n 12=quantity\n 13=availability_type\n 14=base_price\n 15=special_price\n 16=use_special_price\n 17=active_type\n 18=product_status_id\n 19=category1\n 20=category2\n 21=category3\n 22=category4\n ..\n 30=category12\n 31=surcharge\n 32=rank category_rank\n 33=feed_title\n 34=feed_body\n 35=weight\n 36=height\n 37=width\n 38=length\n 39=companies_id\n 40=image1 url to mainimage to download\n 41=image2 url to additional image to download\n ..\n 44=image5 url to additional image to download\n*/",
" // read in the data lines\n// while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $createCats = array();\n $createCatsRank = array();\n $data = array_combine($header, $row);",
" //eDebug($data, true);\n if ($header[0] == 'id') {\n if (isset($data['id']) && $data['id'] != 0) {\n $product = new product($data['id'], false, false);\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product ID.\");\n continue;\n }\n } else {\n //$errorSet[$count] = \"Product ID not supplied.\";\n //continue;\n $product = new product();\n //$product->save(false);\n }\n } elseif ($header[0] == 'model') {\n if (!empty($data['model'])) {\n $p = new product();\n $product = $p->find('first','model=\"' . $data['model'] . '\"');\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product SKU/Model.\");\n continue;\n }\n } else {\n $product = new product();\n }\n }\n if ($product->product_type != 'product') {\n $errorSet[$count] = gt(\"Existing product is wrong product type.\");\n continue;\n }",
" // new products must have a title\n if (empty($product->id)) { // new product require mandatory values\n $checkTitle = trim($data['title']);\n if (empty($checkTitle)) {\n $errorSet[$count] = gt(\"No product name (title) supplied.\");\n continue;\n }\n $product->minimum_order_quantity = 1;\n }",
" // parse $data columns\n foreach ($data as $key=>$value) {\n $value = trim($value);\n switch ($key) {\n case 'parent_id': // integer\n case 'child_rank':\n case 'tax_class_id':\n case 'quantity':\n case 'availability_type':\n case 'use_special_price':\n case 'active_type':\n case 'product_status_id':\n $product->$key = intval($value);\n break;\n case 'companies_id':\n if (is_numeric($value)) {\n $product->$key = intval($value);\n } elseif (!empty($value)) { // it's a company name, not a company id#\n $co = new company();\n $company = $co->find('first', 'title=' . $value);\n if (empty($company->id)) {\n $params['title'] = $value;\n $company->update();\n }\n $product->$key = $company->id;\n }\n break;\n case 'sef_url':\n $product->$key = stripslashes(stripslashes($value));\n if (!is_bool(expValidator::uniqueness_of('sef_url', $product, array()))) {\n $product->makeSefUrl();\n }\n break;\n case 'title': // string\n case 'model':\n case 'warehouse_location':\n case 'meta_title':\n case 'meta_keywords':\n case 'meta_description':\n case 'feed_title':\n case 'feed_body':\n $product->$key = stripslashes(stripslashes($value));\n break;\n case 'body':\n $product->$key = utf8_encode(stripslashes(expString::parseAndTrimImport(($value), true)));\n break;\n case 'base_price': // float\n case 'special_price':\n case 'surcharge':\n case 'weight':\n case 'height':\n case 'width':\n case 'length':\n $product->$key = floatval($value);\n break;\n case 'image1':\n case 'image2':\n case 'image3':\n case 'image4':\n case 'image5':\n if (!empty($value)) {\n $product->save(false);\n if (is_integer($value)) {\n $_objFile = new expFile ($value);\n } else {\n // import image from url\n $_destFile = basename($value); // get filename from end of url\n $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n $_destFullPath = BASE . $_destDir . $_destFile;\n if (file_exists($_destFullPath)) {\n $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }",
" expCore::saveData($value, $_destFullPath); // download the image",
" if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);",
" // Create a new expFile Object\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);\n $_objFile->save();\n }\n }\n // attach product images expFile object\n if (!empty($_objFile->id)) {\n if ($key == 'image1') {\n $product->attachItem($_objFile, 'mainimage');\n } else {\n $product->attachItem($_objFile, 'images', false);\n }\n }\n }\n break;\n case 'category1':\n case 'category2':\n case 'category3':\n case 'category4':\n case 'category5':\n case 'category6':\n case 'category7':\n case 'category8':\n case 'category9':\n case 'category10':\n case 'category11':\n case 'category12':\n if ($product->parent_id == 0) {\n// $rank = !empty($data['rank']) ? $data['rank'] : 1;\n $rank = intval(str_replace('category', '', $key));\n// if (!empty($value)) $result = storeCategory::parseCategory($value);\n if (!empty($value)) $result = storeCategory::importCategoryString($value);\n else continue;",
"// if (is_numeric($result)) {\n if ($result) {\n $createCats[] = $result;\n $createCatsRank[$result] = $rank;\n } else {\n $errorSet[$count][] = $result;\n continue 2;\n }\n }\n break;\n default:\n if (property_exists('product', $key)) {\n $product->key = $value;\n }\n }\n }",
"// $checkTitle = trim($data['title']);\n// if (empty($checkTitle)) {\n// $errorSet[$count] = gt(\"No product name (title) supplied, skipping this record...\");\n// continue;\n// }\n// $product->parent_id = $data[1];\n// $product->child_rank = $data[2];\n// $product->title = stripslashes(stripslashes($data[3]));\n// $product->body = utf8_encode(stripslashes(expString::parseAndTrimImport(($data[4]), true)));\n// //$product->body = utf8_encode(stripslashes(stripslashes(($data[4]))));\n// $product->model = stripslashes(stripslashes($data[5]));\n// $product->warehouse_location = stripslashes(stripslashes($data[6]));\n// $product->sef_url = stripslashes(stripslashes($data[7]));\n////FIXME this is where canonical should be\n// $product->meta_title = stripslashes(stripslashes($data[8]));\n// $product->meta_keywords = stripslashes(stripslashes($data[9]));\n// $product->meta_description = stripslashes(stripslashes($data[10]));\n//\n// $product->tax_class_id = $data[11];\n//\n// $product->quantity = $data[12];\n//\n// $product->availability_type = $data[13];\n//\n// $product->base_price = $data[14];\n// $product->special_price = $data[15];\n// $product->use_special_price = $data[16];\n// $product->active_type = $data[17];\n// $product->product_status_id = $data[18];\n//\n// $product->surcharge = $data[31];\n// $product->feed_title = stripslashes(stripslashes($data[33]));\n// $product->feed_body = stripslashes(stripslashes($data[34]));\n// if (!empty($data[35])) $product->weight = $data[35];\n// if (!empty($data[36])) $product->height = $data[36];\n// if (!empty($data[37])) $product->width = $data[37];\n// if (!empty($data[38])) $product->length = $data[38];\n// if (!empty($data[39])) $product->companies_id = $data[39];\n// if (!empty($data[40])) {\n// // import image from url\n// $_destFile = basename($data[40]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[40], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach/replace product main image with new expFile object\n// $product->attachItem($_objFile, 'mainimage');\n// }\n// }\n// for ($i=41; $i<=44; $i++) {\n// if (!empty($data[$i])) {\n// // import image from url\n// $_destFile = basename($data[$i]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[$i], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach product additional images with new expFile object\n// $product->attachItem($_objFile, 'images', false);\n// }\n// }\n// }\n//\n// if (empty($product->id)) $product->minimum_order_quantity = 1;\n//\n// if ($product->parent_id == 0) {\n// $createCats = array();\n// $createCatsRank = array();\n// for ($x = 19; $x <= 30; $x++) {\n// if (!empty($data[$x])) $result = storeCategory::parseCategory($data[$x]);\n// else continue;\n//\n// if (is_numeric($result)) {\n// $createCats[] = $result;\n// $createCatsRank[$result] = $data[32];\n// } else {\n// $errorSet[$count][] = $result;\n// continue 2;\n// }\n// }\n// }",
" //NOTE: we manipulate existing user input fields to store them properly?\n //eDebug($createCats,true);\n if (!empty($product->user_input_fields) && is_array($product->user_input_fields))\n $product->user_input_fields = serialize($product->user_input_fields);\n //eDebug($product->user_input_fields);",
" if (!empty($product->user_input_fields) && !is_array($product->user_input_fields))\n $product->user_input_fields = str_replace(\"'\", \"\\'\", $product->user_input_fields);",
" //eDebug($product->user_input_fields,true);\n $product->save(true);\n //eDebug($product->body);",
" //sort order and categories\n if ($product->parent_id == 0) {\n $product->saveCategories($createCats, $createCatsRank);\n //eDebug($createCatsRank);\n }\n echo \"Successfully imported/updated row \" . $count . \", product: \" . $product->title . \"<br/>\";\n //eDebug($product);",
" }",
" if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }",
" fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" // update search index\n $this->addContentToSearch();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */",
"class storeController extends expController {\n public $basemodel_name = 'product';",
"",
" public $useractions = array(\n 'showall' => 'Products - All Products and Categories',\n 'showallFeaturedProducts' => 'Products - Only Featured',\n 'showallCategoryFeaturedProducts' => 'Products - Featured Products under current category',\n 'showallManufacturers' => 'Products - By Manufacturer',\n 'showTopLevel' => 'Product Categories Menu - Show Top Level',\n 'showFullTree' => 'Product Categories Menu - Show Full Tree', //FIXME image variant needs a separate method\n 'showallSubcategories' => 'Product Categories Menu - Subcategories of current category',\n// 'upcomingEvents' => 'Event Registration - Upcoming Events',\n// 'eventsCalendar' => 'Event Registration - Calendar View',\n 'ecomSearch' => 'Product Search - Autocomplete',\n 'searchByModel' => 'Product Search - By Model',\n 'quicklinks' => 'Links - User Links',\n 'showGiftCards' => 'Gift Cards UI',\n );",
" protected $manage_permissions = array(\n 'batch_process' => 'Batch capture order transactions',\n 'cleanNonUnicodeProducts' => 'Clean all non-unicode charset products',\n 'copyProduct' => \"Copy Product\",\n// 'delete_children' => \"Delete Children\",\n 'reimport' => 'ReImport Products',\n 'findDupes' => 'Fix Duplicate SEF Names',\n// 'manage_sales_reps' => 'Manage Sales Reps',\n// 'import_external_addresses' => 'Import addresses from other sources',\n 'showallImpropercategorized' => 'View products in top level categories that should not be',\n 'showallUncategorized' => 'View all uncategorized products',\n 'nonUnicodeProducts' => 'View all non-unicode charset products',\n 'process_orders' => 'Batch capture order transactions',\n 'processModelAliases' => 'Process uploaded model aliases',\n 'saveModelAliases' => 'Save uploaded model aliases',\n// 'deleteProcessedModelAliases' => 'Delete processed uploaded model aliases',\n// 'delete_model_alias' => 'Process model aliases',\n// 'update_model_alias' => 'Save model aliases',\n// 'edit_model_alias' => 'Delete model aliases',\n// 'import' => 'Import Products',\n// 'importProduct' => 'Import Products',\n// 'export' => 'Export Products',\n 'uploadModelAliases' => 'Upload model aliases',\n );",
" // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n// 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)",
"",
"\n static function displayname() {\n return gt(\"e-Commerce Store Front\");\n }",
" static function description() {\n return gt(\"Displays the products and categories in your store\");\n }",
" static function author() {\n return \"OIC Group, Inc\";\n }",
" static function isSearchable() {\n return true;\n }",
" public function searchName() {\n return gt('e-Commerce Item');\n }",
" static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" function __construct($src = null, $params = array()) {\n global $db, $router, $section, $user;\n// parent::__construct($src = null, $params);\n if (empty($params)) {\n $params = $router->params;\n }\n parent::__construct($src, $params);",
" // we're setting the config here from the module and globally\n $this->grabConfig();",
"// if (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == \"store\" && $router->url_parts[1] == \"showall\")) {\n if (!empty($params['action']) && ($params['controller'] == \"store\" && $params['action'] == \"showall\") ) {\n// if (isset($router->url_parts[array_search('title', $router->url_parts) + 1]) && is_string($router->url_parts[array_search('title', $router->url_parts) + 1])) {\n if (isset($params['title']) && is_string($params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n// $active = $db->selectValue('storeCategories', 'is_active', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $params['title'] . \"'\");\n $active = $db->selectValue('storeCategories', 'is_active', \"sef_url='\" . $params['title'] . \"'\");\n if (empty($active) && !$user->isAdmin()) {\n redirect_to(array(\"section\" => SITE_DEFAULT_SECTION)); // selected category is NOT active\n }\n } elseif (isset($this->config['category'])) { // the module category to display\n $default_id = $this->config['category'];\n } else {\n $default_id = 0;\n }\n// } elseif (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == \"store\" && ($router->url_parts[1] == \"show\" || $router->url_parts[1] == \"showByTitle\"))) {\n } elseif (!empty($params['action']) && ($params['controller'] == \"store\" && ($params['action'] == \"show\" || $params['action'] == \"showByTitle\" || $params['action'] == \"categoryBreadcrumb\"))) {\n// if (isset($router->url_parts[array_search('id', $router->url_parts) + 1]) && ($router->url_parts[array_search('id', $router->url_parts) + 1] != 0)) {\n if (!empty($params['id'])) {\n// $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $router->url_parts[array_search('id', $router->url_parts) + 1] . \"'\");\n $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $params['id'] . \"'\");\n } elseif (!empty($params['title'])) {\n// $prod_id = $db->selectValue('product', 'id', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n $prod_id = $db->selectValue('product', 'id', \"sef_url='\" . $params['title'] . \"'\");\n $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $prod_id . \"'\");\n }\n } elseif (isset($this->config['show_first_category']) || (!expTheme::inAction() && $section == SITE_DEFAULT_SECTION)) {\n if (!empty($this->config['show_first_category'])) {\n $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n } else {\n $default_id = null;\n// flash('error','store-show first category empty, but default seciton');\n }\n } elseif (!isset($this->config['show_first_category']) && !expTheme::inAction()) {\n $default_id = null;\n// flash('error','store-don\\'t show first category empty');\n } else {\n $default_id = null;\n }\n// if (empty($default_id)) $default_id = 0;\n if (!is_null($default_id)) expSession::set('catid', $default_id);",
" // figure out if we need to show all categories and products or default to showing the first category.\n // elseif (!empty($this->config['category'])) {\n // $default_id = $this->config['category'];\n // } elseif (ecomconfig::getConfig('show_first_category')) {\n // $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n // } else {\n // $default_id = 0;\n // }",
" $this->parent = expSession::get('catid');\n $this->category = new storeCategory($this->parent);\n if ($this->parent) { // we're setting the config here for the category\n $this->grabConfig($this->category);\n }\n }",
" function showall() {\n global $db, $user, $router;",
" expHistory::set('viewable', $this->params);",
" if (empty($this->category->is_events)) {\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c FROM ' . $db->prefix . 'product p ';",
" $sql_start = 'SELECT DISTINCT p.*, IF(base_price > special_price AND use_special_price=1,special_price, base_price) as price FROM ' . $db->prefix . 'product p ';\n $sql = 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'WHERE ';\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n $sql .= 'sc.storecategories_id IN (';\n $sql .= 'SELECT id FROM ' . $db->prefix . 'storeCategories WHERE rgt BETWEEN ' . $this->category->lft . ' AND ' . $this->category->rgt . ')';",
" $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;",
"// $order = 'title'; // $order = 'sc.rank'; //$this->config['orderby'];\n// $dir = 'ASC'; //$this->config['orderby_dir'];\n $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';\n } else { // this is an event category\n $sql_start = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n $sql = 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE sc.storecategories_id IN (';\n $sql .= 'SELECT id FROM ' . $db->prefix . 'storeCategories WHERE rgt BETWEEN ' . $this->category->lft . ' AND ' . $this->category->rgt . ')';\n if ($this->category->hide_closed_events) {\n $sql .= ' AND er.signup_cutoff > ' . time();\n }",
" $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;",
" $order = !empty($this->params['order']) ? $this->params['order'] : 'event_starttime';\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : 'ASC';\n }",
" if (empty($router->params['title'])) // we need to pass on the category for proper paging\n $router->params['title'] = $this->category->sef_url;\n $limit = !empty($this->config['limit']) ? $this->config['limit'] : (!empty($this->config['pagination_default']) ? $this->config['pagination_default'] : 10);\n if ($this->category->find('count') > 0) { // there are categories\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'count_sql' => $count_sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'price'\n ),\n ));\n } else { // there are no categories\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => 'SELECT * FROM ' . $db->prefix . 'product WHERE 1',\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'price'\n ),\n ));\n }",
" $ancestors = $this->category->pathToNode();\n $categories = ($this->parent == 0) ? $this->category->getTopLevel(null, false, true) : $this->category->getChildren(null, false, true);",
" $rerankSQL = \"SELECT DISTINCT p.* FROM \" . $db->prefix . \"product p JOIN \" . $db->prefix . \"product_storeCategories sc ON p.id = sc.product_id WHERE sc.storecategories_id=\" . $this->category->id . \" ORDER BY rank ASC\";\n //eDebug($router);\n $defaultSort = $router->current_url;",
" assign_to_template(array(\n 'page' => $page,\n 'defaultSort' => $defaultSort,\n 'ancestors' => $ancestors,\n 'categories' => $categories,\n 'current_category' => $this->category,\n 'rerankSQL' => $rerankSQL\n ));\n $this->categoryBreadcrumb();\n }",
" function grabConfig($category = null) {",
" // grab the configs for the passed category\n if (is_object($category)) {\n $catConfig = new expConfig(expCore::makeLocation(\"storeCategory\",\"@store-\" . $category->id,\"\"));\n } elseif (empty($this->config)) { // config not set yet\n $global_config = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));\n $this->config = $global_config->config;\n return;\n }",
" // grab the store general settings\n $config = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));",
" // $this->config currently holds the module settings - merge together with any cat config settings having priority\n $this->config = empty($catConfig->config) || @$catConfig->config['use_global'] == 1 ? @array_merge($config->config, $this->config) : @array_merge($config->config, $this->config, $catConfig->config);",
" //This is needed since in the first installation of ecom the value for this will be empty and we are doing % operation for this value\n //So we need to ensure if the value is = 0, we make it the default\n if (empty($this->config['images_per_row'])) {\n $this->config['images_per_row'] = 3;\n }\n }",
" /**\n * @deprecated 2.0.0 moved to eventregistration\n */\n function upcomingEvents() {\n $this->params['controller'] = 'eventregistration';\n redirect_to($this->params);",
" //fixme old code\n $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 AND er.signup_cutoff > ' . time();",
" $limit = empty($this->config['event_limit']) ? 10 : $this->config['event_limit'];\n $order = 'eventdate';\n $dir = 'ASC';",
" $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page\n ));\n }",
" /**\n * @deprecated 2.0.0 moved to eventregistration\n */\n function eventsCalendar() {\n $this->params['controller'] = 'eventregistration';\n redirect_to($this->params);",
" //fixme old code\n global $db, $user;",
" expHistory::set('viewable', $this->params);",
" $time = isset($this->params['time']) ? $this->params['time'] : time();\n assign_to_template(array(\n 'time' => $time\n ));",
"// $monthly = array();\n// $counts = array();",
" $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;",
" $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = intval(date('W', $timefirst));\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);",
"// if ($infofirst['wday'] == 0) {\n// $monthly[$week] = array(); // initialize for non days\n// $counts[$week] = array();\n// }\n// for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {\n// $monthly[$week][$i] = array();\n// $counts[$week][$i] = -1;\n// }\n// $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);",
" for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;",
"// $dates = $db->selectObjects(\"eventregistration\", \"`eventdate` = $start\");\n// $dates = $db->selectObjects(\"eventregistration\", \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $er = new eventregistration();\n// $dates = $er->find('all', \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");",
" if ($user->isAdmin()) {\n $events = $er->find('all', 'product_type=\"eventregistration\"', \"title ASC\");\n } else {\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\");\n }\n $dates = array();",
" foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate >= expDateTime::startOfDayTimestamp($start) && $event->eventdate <= expDateTime::endOfDayTimestamp($start)) {\n $dates[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }",
" $monthly[$week][$i] = $this->getEventsForDates($dates);\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }",
" $this->params['time'] = $time;\n assign_to_template(array(\n 'currentweek' => $currentweek,\n 'monthly' => $monthly,\n 'counts' => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n 'now' => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params,\n 'daynames' => event::dayNames(),\n ));\n }",
" /*\n * Helper function for the Calendar view\n * @deprecated 2.0.0 moved to eventregistration\n */\n function getEventsForDates($edates, $sort_asc = true) {\n global $db;\n $events = array();\n foreach ($edates as $edate) {\n// if (!isset($this->params['cat'])) {\n// if (isset($this->params['title']) && is_string($this->params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $this->params['title'] . \"'\");\n// } elseif (!empty($this->config['category'])) {\n// $default_id = $this->config['category'];\n// } elseif (ecomconfig::getConfig('show_first_category')) {\n// $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n// } else {\n// $default_id = 0;\n// }\n// }\n//\n// $parent = isset($this->params['cat']) ? intval($this->params['cat']) : $default_id;\n//\n// $category = new storeCategory($parent);",
" $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n// $sql .= 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 ';\n// $sql .= ' AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN ' . $category->lft . ' AND ' . $category->rgt . ')';\n// if ($category->hide_closed_events) {\n// $sql .= ' AND er.signup_cutoff > ' . time();\n// }\n// $sql .= ' AND er.id = ' . $edate->id;\n $sql .= ' AND er.id = ' . $edate->product_type_id;",
" $order = 'event_starttime';\n $dir = 'ASC';",
" $o = $db->selectObjectBySql($sql);\n $o->eventdate = $edate->eventdate;\n $o->eventstart = $edate->event_starttime + $edate->eventdate;\n $o->eventend = $edate->event_endtime + $edate->eventdate;\n $o->expFile = $edate->expFile;\n $events[] = $o;\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }",
" function categoryBreadcrumb() {\n// global $db, $router;",
" //eDebug($this->category);",
" /*if(isset($router->params['action']))\n {",
" $ancestors = $this->category->pathToNode();",
" }else if(isset($router->params['section']))\n {\n $current = $db->selectObject('section',' id= '.$router->params['section']);\n $ancestors[] = $current;\n if( $current->parent != -1 || $current->parent != 0 )",
" {",
" while ($db->selectObject('section',' id= '.$router->params['section']);)\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n eDebug($sections);",
" $ancestors = $this->category->pathToNode();",
" }*/",
" $ancestors = $this->category->pathToNode();\n // eDebug($ancestors);\n assign_to_template(array(\n 'ancestors' => $ancestors\n ));\n }",
" function showallUncategorized() {\n expHistory::set('viewable', $this->params);",
"// $sql = 'SELECT p.* FROM ' . DB_TABLE_PREFIX . '_product p JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories ';\n// $sql .= 'sc ON p.id = sc.product_id WHERE sc.storecategories_id = 0 AND parent_id=0';\n $sql = 'SELECT p.* FROM ' . DB_TABLE_PREFIX . '_product p LEFT OUTER JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories ';\n $sql .= 'sc ON p.id = sc.product_id WHERE sc.product_id is null AND p.parent_id=0';",
" expSession::set('product_export_query', $sql);",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page,\n 'moduletitle' => 'Uncategorized Products'\n ));\n }",
" function manage() {\n expHistory::set('manageable', $this->params);",
" if (ECOM_LARGE_DB) {\n $limit = !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : 10;\n } else {\n $limit = 0; // we'll paginate on the page\n }\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => 'parent_id=0',\n 'limit' => $limit,\n 'order' => (isset($this->params['order']) ? $this->params['order'] : 'title'),\n 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'ASC'),\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Type') => 'product_type',\n gt('Product Name') => 'title',\n gt('Model #') => 'model',\n gt('Price') => 'base_price'\n )\n ));\n assign_to_template(array(\n 'page' => $page\n ));\n }",
" function showallImpropercategorized() {\n expHistory::set('viewable', $this->params);",
" //FIXME not sure this is the correct sql, not sure what we are trying to pull out\n $sql = 'SELECT DISTINCT(p.id),p.product_type FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories psc ON p.id = psc.product_id ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_storeCategories sc ON psc.storecategories_id = sc.parent_id ';\n $sql .= 'WHERE p.parent_id=0 AND sc.parent_id != 0';",
" expSession::set('product_export_query', $sql);",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page,\n 'moduletitle' => 'Improperly Categorized Products'\n ));\n }",
" function exportMe() {\n redirect_to(array('controller' => 'report', 'action' => 'batch_export', 'applytoall' => true));\n }",
" function export() {\n global $db;",
" $this->params['applytoall'] = 1; //FIXME we simply do all now",
" //eDebug($this->params);\n //$sql = \"SELECT * INTO OUTFILE '\" . BASE . \"tmp/export.csv' FIELDS TERMINATED BY ',' FROM exponent_product WHERE 1 LIMIT 10\";\n// $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"canonical\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\"' . chr(13) . chr(10);\n $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\",\"weight\",\"width\",\"height\",\"length\",\"image1\",\"image2\",\"image3\",\"image4\",\"image5\",\"companies_id\"' . chr(13) . chr(10);\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $sql = expSession::get('product_export_query');\n if (empty($sql)) $sql = 'SELECT DISTINCT(p.id) from ' . $db->prefix . 'product as p WHERE (product_type=\"product\")';\n //eDebug($sql);\n //expSession::set('product_export_query','');\n $prods = $db->selectArraysBySql($sql);\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $prod) {\n $prods[] = array('id' => $prod);\n }\n }\n set_time_limit(0);\n $baseProd = new product();",
" //$p = new product($pid['id'], false, false);\n foreach ($prods as $pid) {\n $except = array('company', 'crosssellItem', 'optiongroup');\n $p = $baseProd->find('first', 'id=' . $pid['id'], null, null, 0, true, true, $except, true);",
" //eDebug($p,true);\n $out .= expString::outputField($p->id);\n $out .= expString::outputField($p->parent_id);\n $out .= expString::outputField($p->child_rank);\n $out .= expString::outputField($p->title);\n $out .= expString::outputField(expString::stripLineEndings($p->body), \",\", true);\n $out .= expString::outputField($p->model);\n $out .= expString::outputField($p->warehouse_location);\n $out .= expString::outputField($p->sef_url);\n// $out .= expString::outputField($p->canonical); FIXME this is NOT in the import sequence\n $out .= expString::outputField($p->meta_title);\n $out .= expString::outputField($p->meta_keywords);\n $out .= expString::outputField($p->meta_description);\n $out .= expString::outputField($p->tax_class_id);\n $out .= expString::outputField($p->quantity);\n $out .= expString::outputField($p->availability_type);\n $out .= expString::outputField($p->base_price);\n $out .= expString::outputField($p->special_price);\n $out .= expString::outputField($p->use_special_price);\n $out .= expString::outputField($p->active_type);\n $out .= expString::outputField($p->product_status_id);",
" $rank = 0;\n //eDebug($p);\n for ($x = 0; $x < 12; $x++) {\n $this->catstring = '';\n if (isset($p->storeCategory[$x])) {\n $out .= expString::outputField(storeCategory::buildCategoryString($p->storeCategory[$x]->id, true));\n $rank = $db->selectValue('product_storeCategories', 'rank', 'product_id=' . $p->id . ' AND storecategories_id=' . $p->storeCategory[$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->surcharge);\n $out .= expString::outputField($rank); // no longer used\n $out .= expString::outputField($p->feed_title);\n $out .= expString::outputField($p->feed_body);\n $out .= expString::outputField($p->weight);\n $out .= expString::outputField($p->height);\n $out .= expString::outputField($p->width);\n $out .= expString::outputField($p->length);\n //output images\n if (isset($p->expFile['mainimage'][0])) {\n $out .= expString::outputField($p->expFile['mainimage'][0]->id);\n } else $out .= ',';\n for ($x = 0; $x < 3; $x++) {\n if (isset($p->expFile['images'][$x])) {\n $out .= expString::outputField($p->expFile['images'][$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->companies_id, chr(13) . chr(10)); //Removed the extra \",\" in the last element",
" foreach ($p->childProduct as $cp) {\n //$p = new product($pid['id'], true, false);\n //eDebug($p,true);\n $out .= expString::outputField($cp->id);\n $out .= expString::outputField($cp->parent_id);\n $out .= expString::outputField($cp->child_rank);\n $out .= expString::outputField($cp->title);\n $out .= expString::outputField(expString::stripLineEndings($cp->body));\n $out .= expString::outputField($cp->model);\n $out .= expString::outputField($cp->warehouse_location);\n $out .= expString::outputField($cp->sef_url);\n// $out .= expString::outputField($cp->canonical); FIXME this is NOT in the import sequence\n $out .= expString::outputField($cp->meta_title);\n $out .= expString::outputField($cp->meta_keywords);\n $out .= expString::outputField($cp->meta_description);\n $out .= expString::outputField($cp->tax_class_id);\n $out .= expString::outputField($cp->quantity);\n $out .= expString::outputField($cp->availability_type);\n $out .= expString::outputField($cp->base_price);\n $out .= expString::outputField($cp->special_price);\n $out .= expString::outputField($cp->use_special_price);\n $out .= expString::outputField($cp->active_type);\n $out .= expString::outputField($cp->product_status_id);\n $out .= ',,,,,,,,,,,,'; // for categories\n $out .= expString::outputField($cp->surcharge);\n $out .= ',,,'; //for rank, feed title, feed body\n $out .= expString::outputField($cp->weight);\n $out .= expString::outputField($cp->height);\n $out .= expString::outputField($cp->width);\n $out .= expString::outputField($cp->length);\n $out .= ',,,,,'; // for images\n $out .= expString::outputField($cp->companies_id, chr(13) . chr(10));",
" //echo($out);\n }",
" }",
"// $outFile = 'tmp/product_export_' . time() . '.csv';\n// $outHandle = fopen(BASE . $outFile, 'w');\n// fwrite($outHandle, $out);\n// fclose($outHandle);\n//\n// echo \"<br/><br/>Download the file here: <a href='\" . PATH_RELATIVE . $outFile . \"'>Product Export</a>\";",
" $filename = 'product_export_' . time() . '.csv';",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting",
" /*eDebug(BASE . \"tmp/export.csv\");\n $db->sql($sql);\n eDebug($db->error());*/\n /*OPTIONALLY ENCLOSED BY '\" . '\"' .\n \"' ESCAPED BY '\\\\'\n LINES TERMINATED BY '\" . '\\\\n' .\n \"' */\n }",
" /**\n * @deprecated 2.3.3 moved to company\n */\n function showallByManufacturer() {\n expHistory::set('viewable', $this->params);",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => 'companies_id=' . $this->params['id'] . ' AND parent_id=0',\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'default' => 'Product Name',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n )\n ));",
" $company = new company($this->params['id']);",
" assign_to_template(array(\n 'page' => $page,\n 'company' => $company\n ));\n }",
" /**\n * @deprecated 2.3.3 moved to company\n */\n function showallManufacturers() {\n global $db;\n expHistory::set('viewable', $this->params);\n $sql = 'SELECT comp.* FROM ' . $db->prefix . 'companies as comp JOIN ' . $db->prefix . 'product AS prod ON prod.companies_id = comp.id WHERE parent_id=0 GROUP BY comp.title ORDER BY comp.title;';\n $manufacturers = $db->selectObjectsBySql($sql);\n assign_to_template(array(\n 'manufacturers' => $manufacturers\n ));\n }",
" function showGiftCards() {\n expHistory::set('viewable', $this->params);\n //Get all giftcards\n $product_type = 'giftcard';\n $giftcard = new $product_type();\n $giftcards = $giftcard->find(\"all\", \"product_type = 'giftcard'\");",
" //Grab the global config\n $this->grabConfig();",
" //Set the needed config for the view\n $config['custom_message_product'] = $this->config['custom_message_product'];\n $config['minimum_gift_card_purchase'] = $this->config['minimum_gift_card_purchase'];\n $records = expSession::get('params');\n expSession::un_set('params');\n assign_to_template(array(\n 'giftcards' => $giftcards,\n 'config' => $config,\n 'records' => $records\n ));\n }",
" function show() {\n global $db, $order, $template, $user;",
" expHistory::set('viewable', $this->params);\n// $classname = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n// $product = new $classname($this->params['id'], true, true);",
" $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];\n $product = new product($id);\n $product_type = new $product->product_type($product->id);\n $product_type->title = expString::parseAndTrim($product_type->title, true);\n $product_type->image_alt_tag = expString::parseAndTrim($product_type->image_alt_tag, true);",
" //if we're trying to view a child product directly, then we redirect to it's parent show view\n //bunk URL, no product found\n if (empty($product->id)) {\n redirect_to(array('controller' => 'notfound', 'action' => 'page_not_found', 'title' => $this->params['title']));\n }\n // we do not display child products by themselves\n if (!empty($product->parent_id)) {\n $product = new product($product->parent_id);\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $product->sef_url));\n }\n if ($product->active_type == 1) {\n $product_type->user_message = \"This product is temporarily unavailable for purchase.\";\n } elseif ($product->active_type == 2 && !$user->isAdmin()) {\n flash(\"error\", $product->title . \" \" . gt(\"is currently unavailable.\"));\n expHistory::back();\n } elseif ($product->active_type == 2 && $user->isAdmin()) {\n $product_type->user_message = $product->title . \" is currently marked as unavailable for purchase or display. Normal users will not see this product.\";\n }",
" // pull in company attachable files\n if (!empty($product_type->companies_id)) {\n $product_type->company = new company($product_type->companies_id);\n }",
" if (!empty($product_type->crosssellItem)) foreach ($product_type->crosssellItem as &$csi) {\n $csi->getAttachableItems();\n }",
" $tpl = $product_type->getForm('show');",
" if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n $this->grabConfig(); // grab the global config",
" assign_to_template(array(\n 'config' => $this->config,\n 'asset_path' => $this->asset_path,\n// 'product' => $product,\n 'product' => $product_type,\n 'last_category' => !empty($order->lastcat) ? $order->lastcat : null,\n ));\n $this->categoryBreadcrumb();\n }",
" function showByTitle() {\n global $order, $template, $user;\n //need to add a check here for child product and redirect to parent if hit directly by ID\n expHistory::set('viewable', $this->params);",
" $product = new product(addslashes($this->params['title']));\n $product_type = new $product->product_type($product->id);\n $product_type->title = expString::parseAndTrim($product_type->title, true);\n $product_type->image_alt_tag = expString::parseAndTrim($product_type->image_alt_tag, true);",
" //if we're trying to view a child product directly, then we redirect to it's parent show view\n //bunk URL, no product found\n if (empty($product->id)) {\n redirect_to(array('controller' => 'notfound', 'action' => 'page_not_found', 'title' => $this->params['title']));\n }\n if (!empty($product->parent_id)) {\n $product = new product($product->parent_id);\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $product->sef_url));\n }\n if ($product->active_type == 1) {\n $product_type->user_message = \"This product is temporarily unavailable for purchase.\";\n } elseif ($product->active_type == 2 && !$user->isAdmin()) {\n flash(\"error\", $product->title . \" \" . gt(\"is currently unavailable.\"));\n expHistory::back();\n } elseif ($product->active_type == 2 && $user->isAdmin()) {\n $product_type->user_message = $product->title . \" is currently marked as unavailable for purchase or display. Normal users will not see this product.\";\n }\n if (!empty($product_type->crosssellItem)) foreach ($product_type->crosssellItem as &$csi) {\n $csi->getAttachableItems();\n }\n //eDebug($product->crosssellItem);",
" $tpl = $product_type->getForm('show');\n //eDebug($product);\n if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n $this->grabConfig(); // grab the global config",
" assign_to_template(array(\n 'config' => $this->config,\n 'product' => $product_type,\n 'last_category' => !empty($order->lastcat) ? $order->lastcat : null,\n ));\n }",
" function showByModel() {\n global $order, $template, $db;",
" expHistory::set('viewable', $this->params);\n $product = new product();\n $model = $product->find(\"first\", 'model=\"' . $this->params['model'] . '\"');\n //eDebug($model);\n $product_type = new $model->product_type($model->id);\n //eDebug($product_type);\n $tpl = $product_type->getForm('show');\n if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n //eDebug($template);\n $this->grabConfig(); // grab the global config\n assign_to_template(array(\n 'config' => $this->config,\n 'product' => $product_type,\n 'last_category' => $order->lastcat\n ));\n }",
" function showallSubcategories() {\n// global $db;",
" expHistory::set('viewable', $this->params);\n// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');\n $catid = expSession::get('catid');\n $parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0);\n $category = new storeCategory($parent);\n $categories = $category->getEcomSubcategories();\n $ancestors = $category->pathToNode();\n assign_to_template(array(\n 'categories' => $categories,\n 'ancestors' => $ancestors,\n 'category' => $category\n ));\n }",
" function showallFeaturedProducts() {\n expHistory::set('viewable', $this->params);\n $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';",
" $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => 'SELECT * FROM ' . DB_TABLE_PREFIX . '_product WHERE is_featured=1',\n 'limit' => ecomconfig::getConfig('pagination_default'),\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page\n ));\n }",
" function showallCategoryFeaturedProducts() {\n expHistory::set('viewable', $this->params);\n $curcat = $this->category;",
" $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';\n //FIXME bad sql statement needs to be a JOIN\n $sql = 'SELECT * FROM ' . DB_TABLE_PREFIX . '_product as p,' . DB_TABLE_PREFIX . '_product_storeCategories as sc WHERE sc.product_id = p.id and p.is_featured=1 and sc.storecategories_id =' . $curcat->id;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => ecomconfig::getConfig('pagination_default'),\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page\n ));\n }",
" function showTopLevel() {\n expHistory::set('viewable', $this->params);\n $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getTopLevel(null, false, true);\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;",
" assign_to_template(array(\n 'categories' => $categories,\n 'curcat' => $curcat,\n 'topcat' => @$ancestors[0]\n ));\n }",
" function showTopLevel_images() {\n global $user;",
" expHistory::set('viewable', $this->params);\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql_start = 'SELECT DISTINCT p.* FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql = 'JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'WHERE ';\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1)'; //' AND ' ;\n //$sql .= 'sc.storecategories_id IN (';\n //$sql .= 'SELECT id FROM '.DB_TABLE_PREFIX.'_storeCategories WHERE rgt BETWEEN '.$this->category->lft.' AND '.$this->category->rgt.')';",
" $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;",
" $order = 'sc.rank'; //$this->config['orderby'];\n $dir = 'ASC'; //$this->config['orderby_dir'];",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'count_sql' => $count_sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getTopLevel(null, false, true);\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;",
" assign_to_template(array(\n 'page' => $page,\n 'categories' => $categories\n ));\n }",
" function showFullTree() { //FIXME we also need a showFullTree_images method like above\n expHistory::set('viewable', $this->params);\n $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getFullTree();\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;",
" assign_to_template(array(\n 'categories' => $categories,\n 'curcat' => $curcat,\n 'topcat' => @$ancestors[0]\n ));\n }",
" function ecomSearch() {",
" }",
" function billing_config() {",
" }",
" /**\n * Add all products (products, event registrations, donations, & gift cards) to search index\n *\n * @return int\n */\n function addContentToSearch() {\n global $db, $router;",
" $model = new $this->basemodel_name();",
" $total = $db->countObjects($model->table);",
" $count = 0;\n for ($i = 0; $i < $total; $i += 100) {\n $orderby = 'id LIMIT ' . ($i) . ', 100';\n $content = $db->selectArrays($model->table, 'parent_id=0', $orderby);",
" foreach ($content as $cnt) {\n $origid = $cnt['id'];\n $prod = new product($cnt['id']);\n unset($cnt['id']);\n if (ecomconfig::getConfig('ecom_search_results') == '') {\n $cnt['title'] = (isset($prod->expFile['mainimage'][0]) ? '<img src=\"' . PATH_RELATIVE . 'thumb.php?id=' . $prod->expFile['mainimage'][0]->id . '&w=40&h=40&zc=1\" style=\"float:left;margin-right:5px;\" />' : '') . $cnt['title'] . (!empty($cnt['model']) ? ' - SKU#: ' . $cnt['model'] : '');\n }",
"// $search_record = new search($cnt, false, false);\n //build the search record and save it.\n $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->baseclassname . \"'\";\n $oldindex = $db->selectObject('search', $sql);\n if (!empty($oldindex)) {\n $search_record = new search($oldindex->id, false, false);\n $search_record->update($cnt);\n } else {\n $search_record = new search($cnt, false, false);\n }",
" $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];\n if ($cnt['product_type'] == 'giftcard') {\n $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => 'store', 'action' => 'showGiftCards')));\n } else {\n// $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $cnt['sef_url'])));\n $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => $cnt['product_type'], 'action' => 'show', 'title' => $cnt['sef_url'])));\n }\n// $search_record->ref_module = 'store';\n $search_record->ref_module = $this->baseclassname;\n// $search_record->ref_type = $this->basemodel_name;\n $search_record->ref_type = $cnt['product_type'];\n// $search_record->category = 'Products';\n $prod = new $search_record->ref_type($origid);\n $search_record->category = $prod->product_name;\n if ($search_record->ref_type == 'eventregistration') {\n $search_record->title .= ' - ' . expDateTime::format_date($prod->eventdate);\n }",
" $search_record->original_id = $origid;\n //$search_record->location_data = serialize($this->loc);\n $search_record->save();\n $count++;\n }\n }\n return $count;\n }",
" function searchByModel() {\n //do nothing...just show the view.\n }",
" function edit() {\n global $db;",
"// $expDefinableField = new expDefinableField();\n// $definablefields = $expDefinableField->find('all','1','rank');",
" //Make sure that the view is the edit.tpl and not any ajax views\n if (isset($this->params['view']) && $this->params['view'] == 'edit') {\n expHistory::set('editable', $this->params);\n }",
" // first we need to figure out what type of ecomm product we are dealing with\n if (!empty($this->params['id'])) {\n // if we have an id lets pull the product type from the products table.\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n if (empty($product_type)) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n } else {\n if (empty($this->params['product_type'])) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n $product_type = $this->params['product_type'];\n }",
" if (!empty($this->params['id'])) {\n $record = new $product_type($this->params['id']);\n if (!empty($this->user_input_fields) && !is_array($record->user_input_fields)) $record->user_input_fields = expUnserialize($record->user_input_fields);\n } else {\n $record = new $product_type();\n $record->user_input_fields = array();\n }",
"// if (!empty($this->params['parent_id']))",
" // get the product options and send them to the form\n $editable_options = array();\n //$og = new optiongroup();\n $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');\n //eDebug($mastergroups,true);\n foreach ($mastergroups as $mastergroup) {\n // if this optiongroup_master has already been made into an option group for this product\n // then we will grab that record now..if not, we will make a new one.\n $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);\n //if ($mastergroup->id == 9) eDebug($grouprec,true);\n //eDebug($grouprec);\n if (empty($grouprec)) {\n $grouprec['optiongroup_master_id'] = $mastergroup->id;\n $grouprec['title'] = $mastergroup->title;\n $group = new optiongroup($grouprec);\n } else {\n $group = new optiongroup($grouprec['id']);\n }",
" $editable_options[$group->title] = $group;",
" if (empty($group->option)) {\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n $editable_options[$group->title]->options[] = $opt;\n }",
" } else {\n if (count($group->option) == count($mastergroup->option_master)) {\n $editable_options[$group->title]->options = $group->option;\n } else {\n // check for any new options or deleted since the last time we edited this product\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . \" AND product_id=\" . $record->id);\n if (empty($opt_id)) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n } else {\n $opt = new option($opt_id);\n }",
" $editable_options[$group->title]->options[] = $opt;\n }\n }\n }",
" //eDebug($editable_options[$group->title]);",
" }\n //die();",
" uasort($editable_options, array(\"optiongroup\", \"sortOptiongroups\"));",
" // get the shipping options and their methods\n// $shipping = new shipping();\n// foreach (shipping::listAvailableCalculators() as $calcid => $name) {\n foreach (shipping::listCalculators() as $calcid => $name) {\n // must make sure (custom) calculator exists\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }",
"# eDebug($shipping_services);\n# eDebug($shipping_methods);",
" if (!empty($this->params['product_type']) && ($this->params['product_type'] == \"product\" || $this->params['product_type'] == \"childProduct\")) {\n //if new record and it's a child, then well set the child rank to be at the end\n if (empty($record->id) && $record->isChild()) {\n $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;\n }\n //eDebug($record,true);\n }\n $view = '';\n $parent = null;\n if ((isset($this->params['parent_id']) && empty($record->id))) {\n //NEW child product\n $view = 'edit';\n $parent = new $product_type($this->params['parent_id'], false, true);\n $record->parent_id = $this->params['parent_id'];\n } elseif ((!empty($record->id) && $record->parent_id != 0)) {\n //EDIT child product\n $view = 'edit';\n $parent = new $product_type($record->parent_id, false, true);\n } else {\n $view = 'edit';\n }",
" $f = new forms();\n $forms_list = array();\n $forms_list[0] = '- '.gt('No User Input Required').' -';\n $forms = $f->find('all', 'is_saved=1');\n if (!empty($forms)) foreach ($forms as $frm) {\n if (!$db->countObjects('eventregistration', 'forms_id='.$frm->id) || (!empty($record->forms_id) && $record->forms_id == $frm->id))\n $forms_list[$frm->id] = $frm->title;\n }",
" assign_to_template(array(\n 'record' => $record,\n 'parent' => $parent,\n 'form' => $record->getForm($view),\n 'optiongroups' => $editable_options,\n// 'definablefields' => isset($definablefields) ? $definablefields : '',\n 'forms'=> $forms_list,\n 'shipping_services' => isset($shipping_services) ? $shipping_services : '', // Added implication since the shipping_services default value is a null\n 'shipping_methods' => isset($shipping_methods) ? $shipping_methods : '', // Added implication since the shipping_methods default value is a null\n 'product_types' => isset($this->config['product_types']) ? $this->config['product_types'] : ''\n //'status_display'=>$status_display->getStatusArray()\n ));\n }",
" function copyProduct() {\n global $db;",
" //expHistory::set('editable', $this->params);\n $f = new forms();\n $forms_list = array();\n $forms_list[0] = '- '.gt('No User Input Required').' -';\n $forms = $f->find('all', 'is_saved=1');\n if (!empty($forms)) foreach ($forms as $frm) {\n $forms_list[$frm->id] = $frm->title;\n }",
" // first we need to figure out what type of ecomm product we are dealing with\n if (!empty($this->params['id'])) {\n // if we have an id lets pull the product type from the products table.\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n } else {\n if (empty($this->params['product_type'])) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n $product_type = $this->params['product_type'];\n }",
" $record = new $product_type($this->params['id']);\n // get the product options and send them to the form\n $editable_options = array();",
" $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');\n foreach ($mastergroups as $mastergroup) {\n // if this optiongroup_master has already been made into an option group for this product\n // then we will grab that record now..if not, we will make a new one.\n $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);\n //eDebug($grouprec);\n if (empty($grouprec)) {\n $grouprec['optiongroup_master_id'] = $mastergroup->id;\n $grouprec['title'] = $mastergroup->title;\n $group = new optiongroup($grouprec);\n } else {\n $group = new optiongroup($grouprec['id']);\n }",
" $editable_options[$group->title] = $group;",
" if (empty($group->option)) {\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n $editable_options[$group->title]->options[] = $opt;\n }\n } else {\n if (count($group->option) == count($mastergroup->option_master)) {\n $editable_options[$group->title]->options = $group->option;\n } else {\n // check for any new options or deleted since the last time we edited this product\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . \" AND product_id=\" . $record->id);\n if (empty($opt_id)) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n } else {\n $opt = new option($opt_id);\n }",
" $editable_options[$group->title]->options[] = $opt;\n }\n }\n }\n }",
" // get the shipping options and their methods\n// $shipping = new shipping();\n// foreach (shipping::listAvailableCalculators() as $calcid => $name) {\n foreach (shipping::listCalculators() as $calcid => $name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }",
" $record->original_id = $record->id;\n $record->original_model = $record->model;\n $record->sef_url = NULL;\n $record->previous_id = NULL;\n $record->editor = NULL;",
" if ($record->isChild()) {\n $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;\n }",
" assign_to_template(array(\n 'copy' => true,\n 'record' => $record,\n 'parent' => new $product_type($record->parent_id, false, true),\n 'form' => $record->getForm($record->parent_id == 0 ? 'edit' : 'child_edit'),\n 'optiongroups' => $editable_options,\n 'forms'=> $forms_list,\n 'shipping_services' => $shipping_services,\n 'shipping_methods' => $shipping_methods\n ));\n }",
" function picktype() {\n $prodfiles = storeController::getProductTypes();\n $products = array();\n foreach ($prodfiles as $filepath => $classname) {\n $prodObj = new $classname();\n $products[$classname] = $prodObj->product_name;\n }\n assign_to_template(array(\n 'product_types' => $products\n ));\n }",
" function update() {\n// global $db;\n //Get the product type\n $product_type = isset($this->params['product_type']) ? $this->params['product_type'] : 'product';",
" $record = new $product_type();",
" $record->update($this->params);",
" if ($product_type == \"childProduct\" || $product_type == \"product\") {\n $record->addContentToSearch();\n //Create a flash message and redirect to the page accordingly\n if ($record->parent_id != 0) {\n $parent = new $product_type($record->parent_id, false, false);\n if (isset($this->params['original_id'])) {\n flash(\"message\", gt(\"Child product saved.\"));\n } else {\n flash(\"message\", gt(\"Child product copied and saved.\"));\n }\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $parent->sef_url));\n } elseif (isset($this->params['original_id'])) {\n flash(\"message\", gt(\"Product copied and saved. You are now viewing your new product.\"));\n } else {\n flash(\"message\", gt(\"Product saved.\"));\n }\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $record->sef_url));\n } elseif ($product_type == \"giftcard\") {\n flash(\"message\", gt(\"Giftcard saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n } elseif ($product_type == \"eventregistration\") {\n //FIXME shouldn't event registrations be added to search index?\n// $record->addContentToSearch(); //FIXME there is NO eventregistration::addContentToSearch() method\n flash(\"message\", gt(\"Event saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n } elseif ($product_type == \"donation\") {\n flash(\"message\", gt(\"Donation saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n }\n }",
" function delete() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n $product = new $product_type($this->params['id'], true, false);",
" //eDebug($product_type);",
" //eDebug($product, true);\n //if (!empty($product->product_type_id)) {\n //$db->delete($product_type, 'id='.$product->product_id);\n //}",
" $db->delete('option', 'product_id=' . $product->id . \" AND optiongroup_id IN (SELECT id from \" . $db->prefix . \"optiongroup WHERE product_id=\" . $product->id . \")\");\n $db->delete('optiongroup', 'product_id=' . $product->id);\n //die();\n $db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type=\"' . $product_type . '\"');",
" if ($product->product_type == \"product\") {\n if ($product->hasChildren()) {\n $this->deleteChildren();\n }\n }",
" $product->delete();",
" flash('message', gt('Product deleted successfully.'));\n expHistory::back();\n }",
" function quicklinks() {\n global $order;",
" $oicount = !empty($order->item_count) ? $order->item_count : 0;\n //eDebug($itemcount);\n assign_to_template(array(\n \"oicount\" => $oicount,\n ));\n }",
" public static function getProductTypes() {\n $paths = array(\n BASE . 'framework/modules/ecommerce/products/models',\n );",
" $products = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path . '/' . $file) && substr($file, -4) == '.php' && $file != 'childProduct.php') {\n $classname = substr($file, 0, -4);\n $products[$path . '/' . $file] = $classname;\n }\n }\n }\n }",
" return $products;\n }",
" function metainfo() {\n global $router;",
" if (empty($router->params['action'])) return array();",
" // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'showall': //category page\n $cat = $this->category;\n if (!empty($cat)) {\n $metainfo['title'] = empty($cat->meta_title) ? $cat->title . ' ' . gt('Products') . ' - ' . $storename : $cat->meta_title;\n $metainfo['keywords'] = empty($cat->meta_keywords) ? $cat->title : strip_tags($cat->meta_keywords);\n $metainfo['description'] = empty($cat->meta_description) ? strip_tags($cat->body) : strip_tags($cat->meta_description);\n $metainfo['canonical'] = empty($cat->canonical) ? $router->plainPath() : strip_tags($cat->canonical);\n $metainfo['noindex'] = empty($cat->meta_noindex) ? false : $cat->meta_noindex;\n $metainfo['nofollow'] = empty($cat->meta_nofollow) ? false : $cat->meta_nofollow;\n }\n break;\n case 'show':\n case 'showByTitle':\n $prod = new product(isset($router->params['title']) ? expString::sanitize($router->params['title']) : intval($router->params['id']));\n if (!empty($prod)) {\n $metainfo['title'] = empty($prod->meta_title) ? $prod->title . \" - \" . $storename : $prod->meta_title;\n $metainfo['keywords'] = empty($prod->meta_keywords) ? $prod->title : strip_tags($prod->meta_keywords);\n $metainfo['description'] = empty($prod->meta_description) ? strip_tags($prod->body) : strip_tags($prod->meta_description);\n $metainfo['canonical'] = empty($prod->canonical) ? $router->plainPath() : strip_tags($prod->canonical);\n $metainfo['noindex'] = empty($prod->meta_noindex) ? false : $prod->meta_noindex;\n $metainfo['nofollow'] = empty($prod->meta_nofollow) ? false : $prod->meta_nofollow;\n if (!empty($prod->expFile['mainimage'][0]) && file_exists(BASE.$prod->expFile['mainimage'][0]->directory.$prod->expFile['mainimage'][0]->filename)) {\n $metainfo['rich'] = '<!--\n <PageMap>\n <DataObject type=\"thumbnail\">\n <Attribute name=\"src\" value=\"'.$prod->expFile['mainimage'][0]->url.'\"/>\n <Attribute name=\"width\" value=\"'.$prod->expFile['mainimage'][0]->image_width.'\"/>\n <Attribute name=\"height\" value=\"'.$prod->expFile['mainimage'][0]->image_width.'\"/>\n </DataObject>\n </PageMap>\n -->';\n }\n $metainfo['fb']['type'] = 'product';\n $metainfo['fb']['title'] = substr(empty($prod->meta_fb['title']) ? $prod->title : $prod->meta_fb['title'], 0, 87);\n $metainfo['fb']['description'] = substr(empty($prod->meta_fb['description']) ? $metainfo['description'] : $prod->meta_fb['description'], 0, 199);\n $metainfo['fb']['url'] = empty($prod->meta_fb['url']) ? $metainfo['canonical'] : $prod->meta_fb['url'];\n $metainfo['fb']['image'] = empty($prod->meta_fb['fbimage'][0]) ? '' : $prod->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['fb']['image'])) {\n if (!empty($prod->expFile['mainimage'][0]))\n $metainfo['fb']['image'] = $prod->expFile['mainimage'][0]->url;\n if (empty($metainfo['fb']['image']))\n $metainfo['fb']['image'] = URL_BASE . '/framework/modules/ecommerce/assets/images/no-image.jpg';\n }\n break;\n }\n default:\n $metainfo['title'] = gt(\"Shopping\") . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }",
" // Remove any quotes if there are any.\n// $metainfo['title'] = expString::parseAndTrim($metainfo['title'], true);\n// $metainfo['description'] = expString::parseAndTrim($metainfo['description'], true);\n// $metainfo['keywords'] = expString::parseAndTrim($metainfo['keywords'], true);\n// $metainfo['canonical'] = expString::parseAndTrim($metainfo['canonical'], true);\n// $metainfo['noindex'] = expString::parseAndTrim($metainfo['noindex'], true);\n// $metainfo['nofollow'] = expString::parseAndTrim($metainfo['nofollow'], true);",
" return $metainfo;\n }",
" /**\n * Configure the module\n */\n public function configure() {\n if (empty($this->config['enable_ratings_and_reviews'])) {\n $this->remove_configs[] = 'comments';\n }\n parent::configure();\n }",
" public function deleteChildren() {\n //eDebug($data[0],true);\n //if($id!=null) $this->params['id'] = $id;",
" //eDebug($this->params,true);",
" $product = new product($this->params['id']);\n //$product = $product->find(\"first\", \"previous_id =\" . $previous_id);\n //eDebug($product, true);",
" if (empty($product->id)) // || empty($product->previous_id))",
" {\n flash('error', gt('There was an error deleting the child products.'));\n expHistory::back();\n }\n $childrenToDelete = $product->find('all', 'parent_id=' . $product->id);\n foreach ($childrenToDelete as $ctd) {",
" //fwrite($lfh, \"Deleting:\" . $ctd->id . \"\\n\");",
" $ctd->delete();\n }\n }",
" function searchByModelForm() {\n // get the search terms\n $terms = $this->params['search_string'];",
" $sql = \"model like '%\" . $terms . \"%'\";",
" $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'order' => 'title',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));",
" assign_to_template(array(\n 'page' => $page,\n 'terms' => $terms\n ));\n }",
" /**\n * AJAX search for products by model/sku\n */",
" function search_by_model() {\n global $db, $user;",
" $sql = \"select DISTINCT(p.id) as id, p.title, model from \" . $db->prefix . \"product as p WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';",
" //if first character of search is a -, then we do a wild card, else from beginning\n if ($this->params['query'][0] == '-') {\n $sql .= \" p.model LIKE '%\" . $this->params['query'];\n } else {\n $sql .= \" p.model LIKE '\" . $this->params['query'];\n }",
" $sql .= \"%' AND p.parent_id=0 GROUP BY p.id \";\n $sql .= \"order by p.model ASC LIMIT 30\";\n $res = $db->selectObjectsBySql($sql);\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
" /**\n * AJAX search for products by title, description, or model/sku\n *\n */\n public function search() {\n global $db, $user;",
" if (SAVE_SEARCH_QUERIES && INCLUDE_AJAX_SEARCH == 1) { // only to add search query record\n $qry = trim($this->params['query']);\n if (!empty($qry)) {\n if (INCLUDE_ANONYMOUS_SEARCH == 1 || $user->id <> 0) {\n $queryObj = new stdClass();\n $queryObj->user_id = $user->id;\n $queryObj->query = $qry;\n $queryObj->timestamp = time();",
" $db->insertObject($queryObj, 'search_queries');\n }\n }\n }\n //$this->params['query'] = str_ireplace('-','\\-',$this->params['query']);\n $terms = explode(\" \", $this->params['query']);\n $search_type = ecomconfig::getConfig('ecom_search_results');",
" // look for term in full text search\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, match (p.title,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) as score \";\n $sql .= \" from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" match (p.title,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) AND p.parent_id=0 GROUP BY p.id \";\n $sql .= \"order by score desc LIMIT 10\";",
" $firstObs = $db->selectObjectsBySql($sql);\n foreach ($firstObs as $set) {\n $set->weight = 1;\n unset($set->score);\n $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }",
" // look for specific term in fields\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" (p.model like '%\" . $this->params['query'] . \"%' \";\n $sql .= \" OR p.title like '%\" . $this->params['query'] . \"%') \";\n $sql .= \" AND p.parent_id=0 GROUP BY p.id LIMIT 10\";",
" $secondObs = $db->selectObjectsBySql($sql);\n foreach ($secondObs as $set) {\n $set->weight = 2;\n $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }",
" // look for begins with term in fields\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" (p.model like '\" . $this->params['query'] . \"%' \";\n $sql .= \" OR p.title like '\" . $this->params['query'] . \"%') \";\n $sql .= \" AND p.parent_id=0 GROUP BY p.id LIMIT 10\";",
" $thirdObs = $db->selectObjectsBySql($sql);\n foreach ($thirdObs as $set) {\n if (strcmp(strtolower(trim($this->params['query'])), strtolower(trim($set->model))) == 0)\n $set->weight = 10;\n else if (strcmp(strtolower(trim($this->params['query'])), strtolower(trim($set->title))) == 0)\n $set->weight = 9;\n else\n $set->weight = 3;",
" $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }",
" function sortSearch($a, $b) {\n return ($a->weight == $b->weight ? 0 : ($a->weight < $b->weight) ? 1 : -1);\n }",
" if (count($terms)) {\n foreach ($res as $r) {\n $index = !empty($r->model) ? $r->model : $r->sef_url;\n foreach ($terms as $term) {\n if (stristr($r->title, $term)) $res[$index]->weight = $res[$index]->weight + 1;\n }\n }\n }\n usort($res, 'sortSearch');",
" $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
" /**\n * AJAX search for products by title, description, or model/sku\n *\n */\n public function searchNew() {\n global $db, $user;\n //$this->params['query'] = str_ireplace('-','\\-',$this->params['query']);\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, \";\n $sql .= \"match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) as relevance, \";\n $sql .= \"CASE when p.model like '\" . $this->params['query'] . \"%' then 1 else 0 END as modelmatch, \";\n $sql .= \"CASE when p.title like '%\" . $this->params['query'] . \"%' then 1 else 0 END as titlematch \";\n $sql .= \"from \" . $db->prefix . \"product as p INNER JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n $sql .= \" match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) AND p.parent_id=0 \";\n $sql .= \" HAVING relevance > 0 \";",
" //$sql .= \"GROUP BY p.id \";",
" $sql .= \"order by modelmatch,titlematch,relevance desc LIMIT 10\";",
" eDebug($sql);\n $res = $db->selectObjectsBySql($sql);\n eDebug($res, true);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
" function batch_process() {\n $os = new order_status();\n $oss = $os->find('all',1,'rank');\n $order_status = array();\n $order_status[-1] = '';\n foreach ($oss as $status) {\n $order_status[$status->id] = $status->title;\n }\n assign_to_template(array(\n 'order_status' => $order_status\n ));\n }",
" function process_orders() {\n /*\n Testing\n */\n /*echo \"Here?\";\n $inv = 30234;",
" $req = 'a29f9shsgh32hsf80s7';",
" $amt = 101.00;\n for($count=1;$count<=25;$count+=2)",
" {",
" $data[2] = $inv + $count;\n $amt += $count*$count;",
" $successSet[$count]['message'] = \"Sucessfully imported row \" . $count . \", order: \" . $data[2] . \"<br/>\";",
" $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $amt;\n $successSet[$count]['request_id'] = $req;\n $successSet[$count]['reference_id'] = $req;\n $successSet[$count]['authorization_code'] = $req;",
" $successSet[$count]['shipping_tracking_number'] = '1ZNF453937547';",
" $successSet[$count]['carrier'] = 'UPS';\n }\n for($count=2;$count<=25;$count+=2)",
" {\n $data[2] = $inv + $count;\n $amt += $count*$count;",
" $errorSet[$count]['error_code'] = '42';\n $errorSet[$count]['message'] = \"No go for some odd reason. Try again.\";\n $errorSet[$count]['order_id'] = $data[2];\n $errorSet[$count]['amount'] = $amt;\n }",
"\n assign_to_template(array('errorSet'=>$errorSet, 'successSet'=>$successSet));",
" return;*/",
" ###########",
" global $db;\n $template = expTemplate::get_template_for_action(new orderController(), 'setStatus', $this->loc);",
" //eDebug($_FILES);",
" //eDebug($this->params,true);",
" set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n if (!empty($_FILES['batch_upload_file']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'batch_process'));\n// $this->batch_process();\n }",
" $file = new stdClass();\n $file->path = $_FILES['batch_upload_file']['tmp_name'];\n echo \"Validating file...<br/>\";",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n $count = 1;\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>CSV File passed validation...<br/><br/>Detecting carrier type....<br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $data = fgetcsv($handle, 10000, \",\");",
" //eDebug($data);",
"// $dataset = array();\n $carrier = '';\n if (trim($data[0]) == 'ShipmentInformationShipmentID') {\n echo \"Detected UPS file...<br/>\";\n $carrier = \"UPS\";\n $carrierTrackingLink = \"http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=\";\n } elseif (trim($data[0]) == 'PIC') {\n echo \"Detected United States Post Service file...<br/>\";\n $carrier = \"USPS\";\n $carrierTrackingLink = \"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=\";\n }",
" //eDebug($carrier);\n $count = 1;\n $errorSet = array();\n $successSet = array();",
" $oo = new order();",
" // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $originalOrderId = $data[2];\n $data[2] = intval($data[2]);\n $order = new stdClass();\n $bm = new stdClass();\n $transactionState = null;",
" //check for valid order number - if not present or not order, fail and continue with next record\n if (isset($data[2]) && !empty($data[2])) {\n $order = $oo->findBy('invoice_id', $data[2]);\n if (empty($order->id)) {\n $errorSet[$count]['message'] = $originalOrderId . \" is not a valid order in this system.\";\n $errorSet[$count]['order_id'] = $originalOrderId;\n continue;\n }\n } else {\n $errorSet[$count]['message'] = \"Row \" . $count . \" has no order number.\";\n $errorSet[$count]['order_id'] = \"N/A\";\n continue;\n }",
" /*we have a valid order, so let's see what we can do: */",
" //set status of order to var\n $currentStat = $order->order_status;\n //eDebug($currentStat,true);",
" //-- check the order for a closed status - if so, do NOT process or set shipping\n if ($currentStat->treat_as_closed == true) {\n $errorSet[$count]['message'] = \"This is currently a closed order. Not processing.\";\n $errorSet[$count]['order_id'] = $data[2];\n continue;\n }",
" //ok, if we made it here we have a valid order that is \"open\"\n //we'll try to capture the transaction if it's in an authorized state, but set shipping regardless\n if (isset($order->billingmethod[0])) {\n $bm = $order->billingmethod[0];\n $transactionState = $bm->transaction_state;\n } else {\n $bm = null;\n $transactionState = '';\n }",
" if ($transactionState == 'authorized') {\n //eDebug($order,true);\n $calc = $bm->billingcalculator->calculator;\n $calc->config = $bm->billingcalculator->config;\n if (method_exists($calc, 'delayed_capture')) {\n //$result = $calc->delayed_capture($bm,$bm->billing_cost);\n $result = $calc->delayed_capture($bm, $order->grand_total, $order);\n if ($result->errorCode == 0) {\n //we've succeeded. transaction already created and billing info updated.",
" //just need to set the order shipping info, check and see if we send user an email, and set statuses.\n //shipping info:",
" $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['message'] = \"Sucessfully captured order \" . $data[2] . \" and set shipping information.\";\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['request_id'] = $result->request_id;\n $successSet[$count]['reference_id'] = $result->PNREF;\n $successSet[$count]['authorization_code'] = $result->AUTHCODE;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n } else {\n //failed capture, so we report the error but still set the shipping information\n //because it's already out the door",
" //$failMessage = \"Attempted to delay capture order \" . $data[2] . \" and it failed with the following error: \" . $result->errorCode . \" - \" .$result->message;",
" //if the user seelected to set a different status for failed orders, set it here.\n /*if(isset($this->params['order_status_fail'][0]) && $this->params['order_status_fail'][0] > -1)\n {\n $change = new order_status_changes();\n // save the changes\n $change->from_status_id = $order->order_status_id;\n //$change->comment = $this->params['comment'];\n $change->to_status_id = $this->params['order_status_fail'][0];\n $change->orders_id = $order->id;\n $change->save();",
"",
" // update the status of the order\n $order->order_status_id = $this->params['order_status_fail'][0];",
" $order->save();",
" }*/\n $errorSet[$count]['error_code'] = $result->errorCode;\n $errorSet[$count]['message'] = \"Capture failed: \" . $result->message . \"<br/>Setting shipping information.\";\n $errorSet[$count]['order_id'] = $data[2];\n $errorSet[$count]['amount'] = $order->grand_total;\n $errorSet[$count]['shipping_tracking_number'] = $data[0];\n $errorSet[$count]['carrier'] = $carrier;",
" //continue;",
" }\n } else {",
" //dont suppose we do anything here, as it may be set to approved manually\n //$errorSet[$count] = \"Order \" . $data[2] . \" does not use a billing method with delayed capture ability.\";",
" $successSet[$count]['message'] = 'No capture processing available for order:' . $data[2] . '. Setting shipping information.';\n $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n }\n } //if we hit this else, it means we have an order that is not in an authorized state\n //so we do not try to process it = still set shipping though. //FIXME what about 'complete'?\n else {\n $successSet[$count]['message'] = 'No processing necessary for order:' . $data[2] . '. Setting shipping information.';\n $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n }",
" $order->shipped = time();\n $order->shipping_tracking_number = $data[0];\n $order->save();",
" $s = array_pop($order->shippingmethods);\n $sm = new shippingmethod($s->id);\n $sm->carrier = $carrier;\n $sm->save();",
" //statuses and email\n if (isset($this->params['order_status_success'][0]) && $this->params['order_status_success'][0] > -1) {\n $change = new order_status_changes();\n // save the changes\n $change->from_status_id = $order->order_status_id;\n //$change->comment = $this->params['comment'];\n $change->to_status_id = $this->params['order_status_success'][0];\n $change->orders_id = $order->id;\n $change->save();",
" // update the status of the order\n $order->order_status_id = $this->params['order_status_success'][0];\n $order->save();",
" // email the user if we need to\n if (!empty($this->params['email_customer'])) {\n $email_addy = $order->billingmethod[0]->email;\n if (!empty($email_addy)) {\n $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);\n $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);\n// $template->assign(\n assign_to_template(\n array(\n 'comment' => $change->comment,\n 'to_status' => $to_status,\n 'from_status' => $from_status,\n 'order' => $order,\n 'date' => date(\"F j, Y, g:i a\"),\n 'storename' => ecomconfig::getConfig('storename'),\n 'include_shipping' => true,\n 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number,\n 'carrier' => $carrier\n )\n );",
" $html = $template->render();\n $html .= ecomconfig::getConfig('ecomfooter');",
" $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n try {\n $mail = new expMail();\n $mail->quickSend(array(\n 'html_message' => $html,\n 'text_message' => str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => array($email_addy => $order->billingmethod[0]->firstname . ' ' . $order->billingmethod[0]->lastname),\n 'from' => $from,\n 'subject' => 'Your Order Has Been Shipped (#' . $order->invoice_id . ') - ' . ecomconfig::getConfig('storename')\n ));\n } catch (Exception $e) {\n //do nothing for now\n eDebug(\"Email error:\");\n eDebug($e);\n }\n }\n //else {\n // $errorSet[$count]['message'] .= \"<br/>Order \" . $data[2] . \" was captured successfully, however the email notification was not successful.\";\n //}\n }\n }\n",
" //eDebug($product);",
" }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" assign_to_template(array(\n 'errorSet' => $errorSet,\n 'successSet' => $successSet\n ));\n }",
" function manage_sales_reps() {",
" }",
" function showHistory() {\n $h = new expHistory();\n// echo \"<xmp>\";\n echo \"<pre>\";\n print_r($h);\n// echo \"</xmp>\";\n echo \"</pre>\";\n }",
" function import_external_addresses() {\n $sources = array('mc' => 'MilitaryClothing.com', 'nt' => 'NameTapes.com', 'am' => 'Amazon');\n assign_to_template(array(\n 'sources' => $sources\n ));\n }",
" function process_external_addresses() {\n global $db;\n set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n eDebug($this->params);\n// eDebug($_FILES,true);\n if (!empty($_FILES['address_csv']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n// $this->import_external_addresses();\n }",
" $file = new stdClass();\n $file->path = $_FILES['address_csv']['tmp_name'];\n echo \"Validating file...<br/>\";",
" //replace tabs with commas\n /*if($this->params['type_of_address'][0] == 'am')\n {\n $checkhandle = fopen($file->path, \"w\");\n $oldFile = file_get_contents($file->path);\n $newFile = str_ireplace(chr(9),',',$oldFile);\n fwrite($checkhandle,$newFile);\n fclose($checkhandle);\n }*/",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n if ($this->params['type_of_address'][0] == 'am') {\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \"\\t\");\n $fieldCount = count($checkdata);\n } else {\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n }",
" $count = 1;\n if ($this->params['type_of_address'][0] == 'am') {\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \"\\t\")) !== FALSE) {\n $count++;\n //eDebug($checkdata);\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n } else {\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n }",
" fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line and discard it\n $data = fgetcsv($handle, 10000, \",\");",
" //eDebug($data);",
"// $dataset = array();",
" //mc=1, nt=2, amm=3",
" if ($this->params['type_of_address'][0] == 'mc') {\n //militaryclothing\n $db->delete('external_addresses', 'source=1');",
" } else if ($this->params['type_of_address'][0] == 'nt') {\n //nametapes\n $db->delete('external_addresses', 'source=2');\n } else if ($this->params['type_of_address'][0] == 'am') {\n //amazon\n $db->delete('external_addresses', 'source=3');\n }",
" if ($this->params['type_of_address'][0] == 'am') {\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \"\\t\")) !== FALSE) {\n //eDebug($data,true);\n $extAddy = new external_address();",
" //eDebug($data);\n $extAddy->source = 3;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[15]);\n $extAddy->firstname = $name[0];\n if (isset($name[3])) {\n $extAddy->firstname .= ' ' . $name[1];\n $extAddy->middlename = $name[2];\n $extAddy->lastname = $name[3];\n } else if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[16];\n $extAddy->address2 = $data[17];\n $extAddy->city = $data[19];\n $state = new geoRegion();\n $state = $state->findBy('code', trim($data[20]));\n if (empty($state->id)) {\n $state = new geoRegion();\n $state = $state->findBy('name', trim($data[20]));\n }\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[21]);\n $extAddy->phone = $data[6];\n $extAddy->email = $data[4];\n //eDebug($extAddy);\n $extAddy->save();\n }\n } else {\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n eDebug($data);\n $extAddy = new external_address();\n if ($this->params['type_of_address'][0] == 'mc') {\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[3]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[8]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n //eDebug($extAddy);\n $extAddy->save();",
" //Check if the shipping add is same as the billing add\n if ($data[5] != $data[14]) {\n $extAddy = new external_address();\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[12]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];\n $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[17]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n // eDebug($extAddy, true);\n $extAddy->save();\n }\n }\n if ($this->params['type_of_address'][0] == 'nt') {\n //eDebug($data,true);\n $extAddy->source = 2;\n $extAddy->user_id = 0;\n $extAddy->firstname = $data[16];\n $extAddy->lastname = $data[17];\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[18];\n $extAddy->address2 = $data[19];\n $extAddy->city = $data[20];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[21]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[22]);\n $extAddy->phone = $data[23];\n $extAddy->email = $data[13];\n //eDebug($extAddy);\n $extAddy->save();\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n echo \"Done!\";\n }",
" function nonUnicodeProducts() {\n global $db, $user;",
" $products = $db->selectObjectsIndexedArray('product');\n $affected_fields = array();\n $listings = array();\n $listedProducts = array();\n $count = 0;\n //Get all the columns of the product table\n $columns = $db->getTextColumns('product');\n foreach ($products as $item) {",
" foreach ($columns as $column) {\n if ($column != 'body' && $column != 'summary' && $column != 'featured_body') {\n if (!expString::validUTF($item->$column) || strrpos($item->$column, '?')) {\n $affected_fields[] = $column;\n }\n } else {\n if (!expString::validUTF($item->$column)) {\n $affected_fields[] = $column;\n }\n }\n }",
" if (isset($affected_fields)) {\n if (count($affected_fields) > 0) {\n //Hard coded fields since this is only for displaying\n $listedProducts[$count]['id'] = $item->id;\n $listedProducts[$count]['title'] = $item->title;\n $listedProducts[$count]['model'] = $item->model;\n $listedProducts[$count]['sef_url'] = $item->sef_url;\n $listedProducts[$count]['nonunicode'] = implode(', ', $affected_fields);\n $count++;\n }\n }\n unset($affected_fields);\n }",
" assign_to_template(array(\n 'products' => $listedProducts,\n 'count' => $count\n ));\n }",
" function cleanNonUnicodeProducts() {\n global $db, $user;",
" $products = $db->selectObjectsIndexedArray('product');\n //Get all the columns of the product table\n $columns = $db->getTextColumns('product');\n foreach ($products as $item) {\n //Since body, summary, featured_body can have a ? intentionally such as a link with get parameter.\n //TO Improved\n foreach ($columns as $column) {\n if ($column != 'body' && $column != 'summary' && $column != 'featured_body') {\n if (!expString::validUTF($item->$column) || strrpos($item->$column, '?')) {\n $item->$column = expString::convertUTF($item->$column);\n }\n } else {\n if (!expString::validUTF($item->$column)) {\n $item->$column = expString::convertUTF($item->$column);\n }\n }\n }",
" $db->updateObject($item, 'product');\n }",
" redirect_to(array('controller' => 'store', 'action' => 'nonUnicodeProducts'));\n// $this->nonUnicodeProducts();\n }",
" //This function is being used in the uploadModelaliases page for showing the form upload\n function uploadModelAliases() {\n global $db;\n set_time_limit(0);",
" if (isset($_FILES['modelaliases']['tmp_name'])) {\n if (!empty($_FILES['modelaliases']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n//\t\t\t\tredirect_to(array('controller'=>'store','action'=>'uploadModelAliases'));\n $this->uploadModelAliases();\n }",
" $file = new stdClass();\n $file->path = $_FILES['modelaliases']['tmp_name'];\n echo \"Validating file...<br/>\";",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n $count = 1;",
" // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }",
" fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");\n // read in the header line\n $data = fgetcsv($handle, 10000, \",\");",
" //clear the db\n $db->delete('model_aliases_tmp');\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {",
" $tmp = new stdClass();\n $tmp->field1 = expString::onlyReadables($data[0]);\n $tmp->field2 = expString::onlyReadables($data[1]);\n $db->insertObject($tmp, 'model_aliases_tmp');\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases'));\n echo \"Done!\";\n }",
" //check if there are interrupted model alias in the db\n $res = $db->selectObjectsBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp WHERE is_processed = 0\");\n if (!empty($res)) {\n assign_to_template(array(\n 'continue' => '1'\n ));\n }\n }",
" // This function process the uploading of the model aliases in the uploadModelAliases page\n function processModelAliases($index = 0, $error = '') {\n global $db;",
" //Going next and delete the previous one\n if (isset($this->params['index'])) {\n $index = $this->params['index'];",
" //if go to the next processs\n if (isset($this->params['next'])) {\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT \" . ($index - 1) . \", 1\");\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n }\n }",
" $product_id = '';\n $autocomplete = '';",
" do {\n $count = $db->countObjects('model_aliases_tmp', 'is_processed=0');\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT {$index}, 1\");\n //Validation\n //Check the field one\n if (!empty($res)) {\n $product_field1 = $db->selectObject(\"product\", \"model='{$res->field1}'\");\n $product_field2 = $db->selectObject(\"product\", \"model='{$res->field2}'\");\n }\n if (!empty($product_field1)) {\n $product_id = $product_field1->id;\n //check the other field if it also being used by another product\n if (!empty($product_field2) && $product_field1->id != $product_field2->id) {\n $error = \"Both {$res->field1} and {$res->field2} are models of a product. <br />\";\n } else {\n //Check the field2 if it is already in the model alias\n $model_alias = $db->selectObject(\"model_aliases\", \"model='{$res->field2}'\");\n if (empty($model_alias) && @$model_alias->product_id != $product_field1->id) {\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product_field1->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product_field1->id;\n $db->insertObject($tmp, 'model_aliases');\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');",
" } else {\n $error = \"{$res->field2} has already a product alias. <br />\";\n }\n }\n } elseif (!empty($product_field2)) {\n $product_id = $product_field2->id;\n $model_alias = $db->selectObject(\"model_aliases\", \"model='{$res->field1}'\");\n if (empty($model_alias) && @$model_alias->product_id != $product_field2->id) {\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product_field2->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product_field2->id;\n $db->insertObject($tmp, 'model_aliases');\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n } else {\n $error = \"{$res->field1} has already a product alias. <br />\";\n }\n } else {\n $model_alias1 = $db->selectObject(\"model_aliases\", \"model='{$res->field1}'\");\n $model_alias2 = $db->selectObject(\"model_aliases\", \"model='{$res->field2}'\");",
" if (!empty($model_alias1) || !empty($model_alias2)) {\n $error = \"The {$res->field1} and {$res->field2} are already being used by another product.<br />\";\n } else {\n $error = gt(\"No product match found, please choose a product to be alias in the following models below\") . \":<br />\";\n $error .= $res->field1 . \"<br />\";\n $error .= $res->field2 . \"<br />\";\n $autocomplete = 1;\n }\n }\n $index++;\n } while (empty($error));\n assign_to_template(array(\n 'count' => $count,\n 'alias' => $res,\n 'index' => $index,\n 'product_id' => $product_id,\n 'autocomplete' => $autocomplete,\n 'error' => $error\n ));\n }",
" // This function save the uploaded processed model aliases in the uploadModelAliases page\n function saveModelAliases() {\n global $db;",
" $index = $this->params['index'];\n $title = expString::escape($this->params['product_title']);\n $product = $db->selectObject(\"product\", \"title='{$title}'\");",
" if (!empty($product->id)) {\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT \" . ($index - 1) . \", 1\");\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product->id;\n $db->insertObject($tmp, 'model_aliases');",
" //if the model is empty, update the product table so that it will used the field 1 as its primary model\n if (empty($product->model)) {\n $product->model = $res->field1;\n $db->updateObject($product, 'product');\n }",
" //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n flash(\"message\", gt(\"Product successfully Saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases', 'index' => $index));\n } else {\n flash(\"error\", gt(\"Product title is invalid.\"));\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases', 'index' => $index - 1, 'error' => 'Product title is invalid.'));\n }\n }",
" // This function delete all the already processed model aliases in the uploadModelAliases page\n function deleteProcessedModelAliases() {\n global $db;",
" $db->delete('model_aliases_tmp', 'is_processed=1');\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases'));\n }",
" // This function show the form of model alias to be edit or add in the product edit page\n function edit_model_alias() {\n global $db;",
" if (isset($this->params['id'])) {\n $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']);\n assign_to_template(array(\n 'model_alias' => $model_alias\n ));\n } else {\n assign_to_template(array(\n 'product_id' => $this->params['product_id']\n ));\n }\n }",
" // This function update or add the model alias in the product edit page\n function update_model_alias() {\n global $db;",
" if (empty($this->params['id'])) {\n $obj = new stdClass();\n $obj->model = $this->params['model'];\n $obj->product_id = $this->params['product_id'];\n $db->insertObject($obj, 'model_aliases');",
" } else {\n $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']);\n $model_alias->model = $this->params['model'];\n $db->updateObject($model_alias, 'model_aliases');\n }",
" expHistory::back();\n }",
" // This function delete the model alias in the product edit page\n function delete_model_alias() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $db->delete('model_aliases', 'id =' . $this->params['id']);",
" expHistory::back();\n }",
" function setup_wizard() {",
" }",
" function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }",
" function importProduct($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Product Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!($header[0] == 'id' || $header[0] == 'model')) {\n echo gt('Not a Product Import CSV File');\n return;\n }",
" $count = 1;\n $errorSet = array();\n $product = null;\n /* original order of columns\n 0=id\n 1=parent_id\n 2=child_rank\n 3=title\n 4=body\n 5=model\n 6=warehouse_location\n 7=sef_url\n//FIXME this is where canonical should be\n 8=meta_title\n 9=meta_keywords\n 10=meta_description\n 11=tax_class_id\n 12=quantity\n 13=availability_type\n 14=base_price\n 15=special_price\n 16=use_special_price\n 17=active_type\n 18=product_status_id\n 19=category1\n 20=category2\n 21=category3\n 22=category4\n ..\n 30=category12\n 31=surcharge\n 32=rank category_rank\n 33=feed_title\n 34=feed_body\n 35=weight\n 36=height\n 37=width\n 38=length\n 39=companies_id\n 40=image1 url to mainimage to download\n 41=image2 url to additional image to download\n ..\n 44=image5 url to additional image to download\n*/",
" // read in the data lines\n// while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $createCats = array();\n $createCatsRank = array();\n $data = array_combine($header, $row);",
" //eDebug($data, true);\n if ($header[0] == 'id') {\n if (isset($data['id']) && $data['id'] != 0) {\n $product = new product($data['id'], false, false);\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product ID.\");\n continue;\n }\n } else {\n //$errorSet[$count] = \"Product ID not supplied.\";\n //continue;\n $product = new product();\n //$product->save(false);\n }\n } elseif ($header[0] == 'model') {\n if (!empty($data['model'])) {\n $p = new product();\n $product = $p->find('first','model=\"' . $data['model'] . '\"');\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product SKU/Model.\");\n continue;\n }\n } else {\n $product = new product();\n }\n }\n if ($product->product_type != 'product') {\n $errorSet[$count] = gt(\"Existing product is wrong product type.\");\n continue;\n }",
" // new products must have a title\n if (empty($product->id)) { // new product require mandatory values\n $checkTitle = trim($data['title']);\n if (empty($checkTitle)) {\n $errorSet[$count] = gt(\"No product name (title) supplied.\");\n continue;\n }\n $product->minimum_order_quantity = 1;\n }",
" // parse $data columns\n foreach ($data as $key=>$value) {\n $value = trim($value);\n switch ($key) {\n case 'parent_id': // integer\n case 'child_rank':\n case 'tax_class_id':\n case 'quantity':\n case 'availability_type':\n case 'use_special_price':\n case 'active_type':\n case 'product_status_id':\n $product->$key = intval($value);\n break;\n case 'companies_id':\n if (is_numeric($value)) {\n $product->$key = intval($value);\n } elseif (!empty($value)) { // it's a company name, not a company id#\n $co = new company();\n $company = $co->find('first', 'title=' . $value);\n if (empty($company->id)) {\n $params['title'] = $value;\n $company->update();\n }\n $product->$key = $company->id;\n }\n break;\n case 'sef_url':\n $product->$key = stripslashes(stripslashes($value));\n if (!is_bool(expValidator::uniqueness_of('sef_url', $product, array()))) {\n $product->makeSefUrl();\n }\n break;\n case 'title': // string\n case 'model':\n case 'warehouse_location':\n case 'meta_title':\n case 'meta_keywords':\n case 'meta_description':\n case 'feed_title':\n case 'feed_body':\n $product->$key = stripslashes(stripslashes($value));\n break;\n case 'body':\n $product->$key = utf8_encode(stripslashes(expString::parseAndTrimImport(($value), true)));\n break;\n case 'base_price': // float\n case 'special_price':\n case 'surcharge':\n case 'weight':\n case 'height':\n case 'width':\n case 'length':\n $product->$key = floatval($value);\n break;\n case 'image1':\n case 'image2':\n case 'image3':\n case 'image4':\n case 'image5':\n if (!empty($value)) {\n $product->save(false);\n if (is_integer($value)) {\n $_objFile = new expFile ($value);\n } else {\n // import image from url\n $_destFile = basename($value); // get filename from end of url\n $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n $_destFullPath = BASE . $_destDir . $_destFile;\n if (file_exists($_destFullPath)) {\n $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }",
" expCore::saveData($value, $_destFullPath); // download the image",
" if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);",
" // Create a new expFile Object\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);\n $_objFile->save();\n }\n }\n // attach product images expFile object\n if (!empty($_objFile->id)) {\n if ($key == 'image1') {\n $product->attachItem($_objFile, 'mainimage');\n } else {\n $product->attachItem($_objFile, 'images', false);\n }\n }\n }\n break;\n case 'category1':\n case 'category2':\n case 'category3':\n case 'category4':\n case 'category5':\n case 'category6':\n case 'category7':\n case 'category8':\n case 'category9':\n case 'category10':\n case 'category11':\n case 'category12':\n if ($product->parent_id == 0) {\n// $rank = !empty($data['rank']) ? $data['rank'] : 1;\n $rank = intval(str_replace('category', '', $key));\n// if (!empty($value)) $result = storeCategory::parseCategory($value);\n if (!empty($value)) $result = storeCategory::importCategoryString($value);\n else continue;",
"// if (is_numeric($result)) {\n if ($result) {\n $createCats[] = $result;\n $createCatsRank[$result] = $rank;\n } else {\n $errorSet[$count][] = $result;\n continue 2;\n }\n }\n break;\n default:\n if (property_exists('product', $key)) {\n $product->key = $value;\n }\n }\n }",
"// $checkTitle = trim($data['title']);\n// if (empty($checkTitle)) {\n// $errorSet[$count] = gt(\"No product name (title) supplied, skipping this record...\");\n// continue;\n// }\n// $product->parent_id = $data[1];\n// $product->child_rank = $data[2];\n// $product->title = stripslashes(stripslashes($data[3]));\n// $product->body = utf8_encode(stripslashes(expString::parseAndTrimImport(($data[4]), true)));\n// //$product->body = utf8_encode(stripslashes(stripslashes(($data[4]))));\n// $product->model = stripslashes(stripslashes($data[5]));\n// $product->warehouse_location = stripslashes(stripslashes($data[6]));\n// $product->sef_url = stripslashes(stripslashes($data[7]));\n////FIXME this is where canonical should be\n// $product->meta_title = stripslashes(stripslashes($data[8]));\n// $product->meta_keywords = stripslashes(stripslashes($data[9]));\n// $product->meta_description = stripslashes(stripslashes($data[10]));\n//\n// $product->tax_class_id = $data[11];\n//\n// $product->quantity = $data[12];\n//\n// $product->availability_type = $data[13];\n//\n// $product->base_price = $data[14];\n// $product->special_price = $data[15];\n// $product->use_special_price = $data[16];\n// $product->active_type = $data[17];\n// $product->product_status_id = $data[18];\n//\n// $product->surcharge = $data[31];\n// $product->feed_title = stripslashes(stripslashes($data[33]));\n// $product->feed_body = stripslashes(stripslashes($data[34]));\n// if (!empty($data[35])) $product->weight = $data[35];\n// if (!empty($data[36])) $product->height = $data[36];\n// if (!empty($data[37])) $product->width = $data[37];\n// if (!empty($data[38])) $product->length = $data[38];\n// if (!empty($data[39])) $product->companies_id = $data[39];\n// if (!empty($data[40])) {\n// // import image from url\n// $_destFile = basename($data[40]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[40], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach/replace product main image with new expFile object\n// $product->attachItem($_objFile, 'mainimage');\n// }\n// }\n// for ($i=41; $i<=44; $i++) {\n// if (!empty($data[$i])) {\n// // import image from url\n// $_destFile = basename($data[$i]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[$i], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach product additional images with new expFile object\n// $product->attachItem($_objFile, 'images', false);\n// }\n// }\n// }\n//\n// if (empty($product->id)) $product->minimum_order_quantity = 1;\n//\n// if ($product->parent_id == 0) {\n// $createCats = array();\n// $createCatsRank = array();\n// for ($x = 19; $x <= 30; $x++) {\n// if (!empty($data[$x])) $result = storeCategory::parseCategory($data[$x]);\n// else continue;\n//\n// if (is_numeric($result)) {\n// $createCats[] = $result;\n// $createCatsRank[$result] = $data[32];\n// } else {\n// $errorSet[$count][] = $result;\n// continue 2;\n// }\n// }\n// }",
" //NOTE: we manipulate existing user input fields to store them properly?\n //eDebug($createCats,true);\n if (!empty($product->user_input_fields) && is_array($product->user_input_fields))\n $product->user_input_fields = serialize($product->user_input_fields);\n //eDebug($product->user_input_fields);",
" if (!empty($product->user_input_fields) && !is_array($product->user_input_fields))\n $product->user_input_fields = str_replace(\"'\", \"\\'\", $product->user_input_fields);",
" //eDebug($product->user_input_fields,true);\n $product->save(true);\n //eDebug($product->body);",
" //sort order and categories\n if ($product->parent_id == 0) {\n $product->saveCategories($createCats, $createCatsRank);\n //eDebug($createCatsRank);\n }\n echo \"Successfully imported/updated row \" . $count . \", product: \" . $product->title . \"<br/>\";\n //eDebug($product);",
" }",
" if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }",
" fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" // update search index\n $this->addContentToSearch();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class taxController extends expController {\n public $basemodel_name = 'taxclass';",
"\n protected $add_permissions = array(\n 'manage_zones' => 'Manages Zones',\n 'edit_zone' => 'Add/Edit Zone',\n 'update_zone' => 'Update Zone',\n 'delete_zone' => 'Delete Zone'\n );",
"\n static function displayname() {\n return gt(\"e-Commerce Tax Class Manager\");\n }",
" static function description() {\n return gt(\"Manage tax classes for your e-Commerce store\");\n }",
"// static function canImportData() {\n// return true;\n// }\n//\n// static function canExportData() {\n// return true;\n// }",
" // tax rates",
" function manage() {\n expHistory::set('manageable', $this->params);\n $taxes = taxController::getTaxRates();\n assign_to_template(array(\n 'taxes' => $taxes\n ));\n }",
" static function getTaxRates() {\n global $db;",
" $sql = \"\n SELECT\n \" . $db->prefix . \"tax_rate.id,\n \" . $db->prefix . \"tax_zone.`name` AS zonename,\n \" . $db->prefix . \"tax_rate.rate as rate,\n \" . $db->prefix . \"tax_rate.shipping_taxed as shipping_taxed,\n \" . $db->prefix . \"tax_rate.origin_tax as origin_tax,\n \" . $db->prefix . \"tax_rate.inactive as inactive,\n \" . $db->prefix . \"tax_class.`name` AS classname,\n \" . $db->prefix . \"geo_country.`name` as country,\n \" . $db->prefix . \"geo_region.`name` as state\n FROM \" . $db->prefix . \"tax_class\n INNER JOIN \" . $db->prefix . \"tax_rate ON \" . $db->prefix . \"tax_class.id = \" . $db->prefix . \"tax_rate.class_id\n INNER JOIN \" . $db->prefix . \"tax_zone ON \" . $db->prefix . \"tax_rate.zone_id = \" . $db->prefix . \"tax_zone.id\n INNER JOIN \" . $db->prefix . \"tax_geo ON \" . $db->prefix . \"tax_geo.zone_id = \" . $db->prefix . \"tax_zone.id\n LEFT JOIN \" . $db->prefix . \"geo_country ON \" . $db->prefix . \"tax_geo.country_id = \" . $db->prefix . \"geo_country.id\n LEFT JOIN \" . $db->prefix . \"geo_region ON \" . $db->prefix . \"tax_geo.region_id = \" . $db->prefix . \"geo_region.id\n \";",
" return $db->selectObjectsBySql($sql);\n }",
" function edit() {\n global $db;",
" $record = '';\n if (!empty($this->params['id'])) {\n //Get the data from the 3 tables\n $tax_rate = $db->selectObject('tax_rate', 'id =' . $this->params['id']);\n $tax_class = $db->selectObject('tax_class', 'id =' . $tax_rate->class_id);\n// $tax_geo = $db->selectObject('tax_geo', 'zone_id =' . $tax_rate->zone_id);\n //Store it in a single object all the data needed\n $record = new stdClass();\n $record->id = $tax_rate->id;\n $record->class_id = $tax_rate->class_id;\n $record->classname = $tax_class->name;\n $record->rate = $tax_rate->rate;\n $record->shipping_taxed = $tax_rate->shipping_taxed;\n $record->origin_tax = $tax_rate->origin_tax;\n $record->inactive = $tax_rate->inactive;\n $record->zone = $tax_rate->zone_id;\n// $record->state = $tax_geo->region_id;\n// $record->country = $tax_geo->country_id;\n }",
" //Get the tax_zone\n $records = $db->selectObjects('tax_zone');\n $zones = array();\n foreach ($records as $item) {\n $zones[$item->id] = $item->name;\n }",
" $records = $db->selectObjects('tax_class');\n $classes = array();\n foreach ($records as $item) {\n $classes[$item->id] = $item->name;\n }",
" assign_to_template(array(\n 'classes' => $classes,\n 'zones' => $zones,\n 'record' => $record\n ));\n }",
" function update() {\n global $db;",
"// if (isset($this->params['address_country_id'])) {\n// $this->params['country'] = $this->params['address_country_id'];\n// unset($this->params['address_country_id']);\n// }\n// if (isset($this->params['address_region_id'])) {\n// $this->params['state'] = $this->params['address_region_id'];\n// unset($this->params['address_region_id']);\n// }",
" if (empty($this->params['id'])) {\n // Add data in tax class\n// $tax_class = new stdClass();\n// $tax_class->name = $this->params['name'];\n// $class_id = $db->insertObject($tax_class, 'tax_class');",
" // Add data in the tax rate\n $tax_rate = new stdClass();\n $tax_rate->zone_id = $this->params['zone'];\n $tax_rate->class_id = $this->params['class'];\n $tax_rate->rate = $this->params['rate'];\n $tax_rate->shipping_taxed = $this->params['shipping_taxed'];\n $tax_rate->origin_tax = $this->params['origin_tax'];\n $tax_rate->inactive = $this->params['inactive'];\n $db->insertObject($tax_rate, 'tax_rate');",
" // Add data in the tax geo\n// $tax_geo = new stdClass();\n// $tax_geo->zone_id = $this->params['zone'];\n// $tax_geo->country_id = $this->params['country'];\n// $tax_geo->region_id = $this->params['state'];\n// $db->insertObject($tax_geo, 'tax_geo');\n } else {\n // Update the Tax class table\n// $tax_class = $db->selectObject('tax_class', 'id =' . $this->params['id']);\n// $tax_class->name = $this->params['name'];\n// $db->updateObject($tax_class, 'tax_class');",
" // Update the Tax rate table\n $tax_rate = $db->selectObject('tax_rate', 'id =' . $this->params['id']);\n// $zone_id = $tax_rate->zone_id;\n $tax_rate->zone_id = $this->params['zone'];\n $tax_rate->class_id = $this->params['class'];\n $tax_rate->rate = $this->params['rate'];\n $tax_rate->shipping_taxed = $this->params['shipping_taxed'] == 1;\n $tax_rate->origin_tax = $this->params['origin_tax'] == 1;\n $tax_rate->inactive = $this->params['inactive'] == 1;\n $db->updateObject($tax_rate, 'tax_rate');",
" // Update the Tax geo table\n// $tax_geo = $db->selectObject('tax_geo', 'zone_id =' . $zone_id);\n// $tax_geo->zone_id = $this->params['zone'];\n// $tax_geo->country_id = $this->params['country'];\n// $tax_geo->region_id = $this->params['state'];\n// $db->updateObject($tax_geo, 'tax_geo');\n }",
" expHistory::returnTo('manageable');\n }",
" /**\n * Delete tax rate\n */\n function delete() {\n global $db;",
" if (empty($this->params['id'])) return false;\n// $zone = $db->selectObject('tax_zone', 'id =' . $this->params['id']);",
" //Get the data from the text rate to get the zone id\n// $rate = $db->selectObject('tax_rate', 'class_id=' . $this->params['id']);",
" //Delete record in tax rate\n $db->delete('tax_rate', 'class_id =' . $this->params['id']);",
" //Delete record in tax geo\n// $db->delete('tax_geo', 'zone_id =' . $rate->zone_id);",
" //Finally delete the record in tax class\n// $db->delete('tax_class', 'id =' . $this->params['id']);",
" expHistory::returnTo('manageable');\n }",
" // tax classes",
" function manage_classes() {\n global $db;",
" $back = expHistory::getLast('manageable');\n expHistory::set('manageable', $this->params);\n $classes = $db->selectObjects('tax_class');",
" assign_to_template(array(\n 'classes' => $classes,\n 'back' => $back\n ));\n }",
" /**\n * Edit tax class\n */\n function edit_class() {\n global $db;",
" if (isset($this->params['id'])) {\n $class = $db->selectObject('tax_class', 'id =' . $this->params['id']);",
" assign_to_template(array(\n 'class' => $class\n ));\n }\n }",
" /**\n * Update tax class\n */\n function update_class() {\n global $db;",
" if (empty($this->params['id'])) {\n // Add data in tax class\n $obj = new stdClass();\n $obj->name = $this->params['name'];\n $db->insertObject($obj, 'tax_class');\n } else {\n // Update the Tax class table\n $class = $db->selectObject('tax_class', 'id =' . $this->params['id']);\n $class->name = $this->params['name'];\n $db->updateObject($class, 'tax_class');\n }",
" expHistory::returnTo('manageable');\n }",
" /**\n * Delete tax class along with assoc. tax rates\n */\n function delete_class() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $db->delete('tax_rate', 'class_id =' . $this->params['id']);\n $db->delete('tax_class', 'id =' . $this->params['id']);",
" expHistory::returnTo('manageable');\n }",
" // tax zones",
" function manage_zones() {\n global $db;",
" $back = expHistory::getLast('manageable');\n expHistory::set('manageable', $this->params);\n// $zones = $db->selectObjects('tax_zone', null, 'name');\n $zones = taxController::getTaxZones();",
" assign_to_template(array(\n 'zones' => $zones,\n 'back' => $back\n ));\n }",
" static function getTaxZones() {\n global $db;",
" $sql = \"\n SELECT\n \" . $db->prefix . \"tax_zone.id,\n \" . $db->prefix . \"tax_zone.`name` AS name,\n \" . $db->prefix . \"geo_country.`name` as country,\n \" . $db->prefix . \"geo_region.`name` as state\n FROM \" . $db->prefix . \"tax_zone\n INNER JOIN \" . $db->prefix . \"tax_geo ON \" . $db->prefix . \"tax_geo.zone_id = \" . $db->prefix . \"tax_zone.id\n LEFT JOIN \" . $db->prefix . \"geo_country ON \" . $db->prefix . \"tax_geo.country_id = \" . $db->prefix . \"geo_country.id\n LEFT JOIN \" . $db->prefix . \"geo_region ON \" . $db->prefix . \"tax_geo.region_id = \" . $db->prefix . \"geo_region.id\n \";",
" return $db->selectObjectsBySql($sql);\n }",
" /**\n * Edit tax zone and tax geo\n */\n function edit_zone() {\n global $db;",
" if (isset($this->params['id'])) {\n $zone = $db->selectObject('tax_zone', 'id =' . $this->params['id']);",
" $tax_geo = $db->selectObject('tax_geo', 'zone_id =' . $zone->id);\n //Store it in a single object all the data needed\n $zone->state = $tax_geo->region_id;\n $zone->country = $tax_geo->country_id;",
" assign_to_template(array(\n 'zone' => $zone\n ));\n }\n }",
" /**\n * Update tax zone and assoc. tax geo\n */\n function update_zone() {\n global $db;",
" if (isset($this->params['address_country_id'])) {\n $this->params['country'] = $this->params['address_country_id'];\n unset($this->params['address_country_id']);\n }\n if (isset($this->params['address_region_id'])) {\n $this->params['state'] = $this->params['address_region_id'];\n unset($this->params['address_region_id']);\n }",
" if (empty($this->params['id'])) {\n // Add data in tax zone\n $obj = new stdClass();\n $obj->name = $this->params['name'];\n $zone_id = $db->insertObject($obj, 'tax_zone');",
" // Add data in the tax geo\n $tax_geo = new stdClass();\n $tax_geo->zone_id = $zone_id;\n $tax_geo->country_id = $this->params['country'];\n $tax_geo->region_id = $this->params['state'];\n $db->insertObject($tax_geo, 'tax_geo');\n } else {\n // Update the Tax zone table\n $zone = $db->selectObject('tax_zone', 'id =' . $this->params['id']);\n $zone->name = $this->params['name'];\n $db->updateObject($zone, 'tax_zone');",
" // Update the Tax geo table\n $tax_geo = $db->selectObject('tax_geo', 'zone_id =' . $zone->id);\n// $tax_geo->zone_id = $this->params['id'];\n $tax_geo->country_id = $this->params['country'];\n $tax_geo->region_id = $this->params['state'];\n $db->updateObject($tax_geo, 'tax_geo');\n }",
" expHistory::returnTo('manageable');\n }",
" /**\n * Delete tax zone alone with assoc. tax classes & tax rates\n */\n function delete_zone() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $db->delete('tax_geo', 'zone_id =' . $this->params['id']);\n $rates = $db->selectObjects('tax_rate', 'zone_id =' . $this->params['id']);\n foreach ($rates as $rate) {\n $db->delete('tax_class', 'id =' . $rate->id);\n }\n $db->delete('tax_rate', 'zone_id =' . $this->params['id']);\n $db->delete('tax_zone', 'id =' . $this->params['id']);",
" expHistory::returnTo('manageable');\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class taxController extends expController {\n public $basemodel_name = 'taxclass';",
"",
"\n static function displayname() {\n return gt(\"e-Commerce Tax Class Manager\");\n }",
" static function description() {\n return gt(\"Manage tax classes for your e-Commerce store\");\n }",
"// static function canImportData() {\n// return true;\n// }\n//\n// static function canExportData() {\n// return true;\n// }",
" // tax rates",
" function manage() {\n expHistory::set('manageable', $this->params);\n $taxes = taxController::getTaxRates();\n assign_to_template(array(\n 'taxes' => $taxes\n ));\n }",
" static function getTaxRates() {\n global $db;",
" $sql = \"\n SELECT\n \" . $db->prefix . \"tax_rate.id,\n \" . $db->prefix . \"tax_zone.`name` AS zonename,\n \" . $db->prefix . \"tax_rate.rate as rate,\n \" . $db->prefix . \"tax_rate.shipping_taxed as shipping_taxed,\n \" . $db->prefix . \"tax_rate.origin_tax as origin_tax,\n \" . $db->prefix . \"tax_rate.inactive as inactive,\n \" . $db->prefix . \"tax_class.`name` AS classname,\n \" . $db->prefix . \"geo_country.`name` as country,\n \" . $db->prefix . \"geo_region.`name` as state\n FROM \" . $db->prefix . \"tax_class\n INNER JOIN \" . $db->prefix . \"tax_rate ON \" . $db->prefix . \"tax_class.id = \" . $db->prefix . \"tax_rate.class_id\n INNER JOIN \" . $db->prefix . \"tax_zone ON \" . $db->prefix . \"tax_rate.zone_id = \" . $db->prefix . \"tax_zone.id\n INNER JOIN \" . $db->prefix . \"tax_geo ON \" . $db->prefix . \"tax_geo.zone_id = \" . $db->prefix . \"tax_zone.id\n LEFT JOIN \" . $db->prefix . \"geo_country ON \" . $db->prefix . \"tax_geo.country_id = \" . $db->prefix . \"geo_country.id\n LEFT JOIN \" . $db->prefix . \"geo_region ON \" . $db->prefix . \"tax_geo.region_id = \" . $db->prefix . \"geo_region.id\n \";",
" return $db->selectObjectsBySql($sql);\n }",
" function edit() {\n global $db;",
" $record = '';\n if (!empty($this->params['id'])) {\n //Get the data from the 3 tables\n $tax_rate = $db->selectObject('tax_rate', 'id =' . $this->params['id']);\n $tax_class = $db->selectObject('tax_class', 'id =' . $tax_rate->class_id);\n// $tax_geo = $db->selectObject('tax_geo', 'zone_id =' . $tax_rate->zone_id);\n //Store it in a single object all the data needed\n $record = new stdClass();\n $record->id = $tax_rate->id;\n $record->class_id = $tax_rate->class_id;\n $record->classname = $tax_class->name;\n $record->rate = $tax_rate->rate;\n $record->shipping_taxed = $tax_rate->shipping_taxed;\n $record->origin_tax = $tax_rate->origin_tax;\n $record->inactive = $tax_rate->inactive;\n $record->zone = $tax_rate->zone_id;\n// $record->state = $tax_geo->region_id;\n// $record->country = $tax_geo->country_id;\n }",
" //Get the tax_zone\n $records = $db->selectObjects('tax_zone');\n $zones = array();\n foreach ($records as $item) {\n $zones[$item->id] = $item->name;\n }",
" $records = $db->selectObjects('tax_class');\n $classes = array();\n foreach ($records as $item) {\n $classes[$item->id] = $item->name;\n }",
" assign_to_template(array(\n 'classes' => $classes,\n 'zones' => $zones,\n 'record' => $record\n ));\n }",
" function update() {\n global $db;",
"// if (isset($this->params['address_country_id'])) {\n// $this->params['country'] = $this->params['address_country_id'];\n// unset($this->params['address_country_id']);\n// }\n// if (isset($this->params['address_region_id'])) {\n// $this->params['state'] = $this->params['address_region_id'];\n// unset($this->params['address_region_id']);\n// }",
" if (empty($this->params['id'])) {\n // Add data in tax class\n// $tax_class = new stdClass();\n// $tax_class->name = $this->params['name'];\n// $class_id = $db->insertObject($tax_class, 'tax_class');",
" // Add data in the tax rate\n $tax_rate = new stdClass();\n $tax_rate->zone_id = $this->params['zone'];\n $tax_rate->class_id = $this->params['class'];\n $tax_rate->rate = $this->params['rate'];\n $tax_rate->shipping_taxed = $this->params['shipping_taxed'];\n $tax_rate->origin_tax = $this->params['origin_tax'];\n $tax_rate->inactive = $this->params['inactive'];\n $db->insertObject($tax_rate, 'tax_rate');",
" // Add data in the tax geo\n// $tax_geo = new stdClass();\n// $tax_geo->zone_id = $this->params['zone'];\n// $tax_geo->country_id = $this->params['country'];\n// $tax_geo->region_id = $this->params['state'];\n// $db->insertObject($tax_geo, 'tax_geo');\n } else {\n // Update the Tax class table\n// $tax_class = $db->selectObject('tax_class', 'id =' . $this->params['id']);\n// $tax_class->name = $this->params['name'];\n// $db->updateObject($tax_class, 'tax_class');",
" // Update the Tax rate table\n $tax_rate = $db->selectObject('tax_rate', 'id =' . $this->params['id']);\n// $zone_id = $tax_rate->zone_id;\n $tax_rate->zone_id = $this->params['zone'];\n $tax_rate->class_id = $this->params['class'];\n $tax_rate->rate = $this->params['rate'];\n $tax_rate->shipping_taxed = $this->params['shipping_taxed'] == 1;\n $tax_rate->origin_tax = $this->params['origin_tax'] == 1;\n $tax_rate->inactive = $this->params['inactive'] == 1;\n $db->updateObject($tax_rate, 'tax_rate');",
" // Update the Tax geo table\n// $tax_geo = $db->selectObject('tax_geo', 'zone_id =' . $zone_id);\n// $tax_geo->zone_id = $this->params['zone'];\n// $tax_geo->country_id = $this->params['country'];\n// $tax_geo->region_id = $this->params['state'];\n// $db->updateObject($tax_geo, 'tax_geo');\n }",
" expHistory::returnTo('manageable');\n }",
" /**\n * Delete tax rate\n */\n function delete() {\n global $db;",
" if (empty($this->params['id'])) return false;\n// $zone = $db->selectObject('tax_zone', 'id =' . $this->params['id']);",
" //Get the data from the text rate to get the zone id\n// $rate = $db->selectObject('tax_rate', 'class_id=' . $this->params['id']);",
" //Delete record in tax rate\n $db->delete('tax_rate', 'class_id =' . $this->params['id']);",
" //Delete record in tax geo\n// $db->delete('tax_geo', 'zone_id =' . $rate->zone_id);",
" //Finally delete the record in tax class\n// $db->delete('tax_class', 'id =' . $this->params['id']);",
" expHistory::returnTo('manageable');\n }",
" // tax classes",
" function manage_classes() {\n global $db;",
" $back = expHistory::getLast('manageable');\n expHistory::set('manageable', $this->params);\n $classes = $db->selectObjects('tax_class');",
" assign_to_template(array(\n 'classes' => $classes,\n 'back' => $back\n ));\n }",
" /**\n * Edit tax class\n */\n function edit_class() {\n global $db;",
" if (isset($this->params['id'])) {\n $class = $db->selectObject('tax_class', 'id =' . $this->params['id']);",
" assign_to_template(array(\n 'class' => $class\n ));\n }\n }",
" /**\n * Update tax class\n */\n function update_class() {\n global $db;",
" if (empty($this->params['id'])) {\n // Add data in tax class\n $obj = new stdClass();\n $obj->name = $this->params['name'];\n $db->insertObject($obj, 'tax_class');\n } else {\n // Update the Tax class table\n $class = $db->selectObject('tax_class', 'id =' . $this->params['id']);\n $class->name = $this->params['name'];\n $db->updateObject($class, 'tax_class');\n }",
" expHistory::returnTo('manageable');\n }",
" /**\n * Delete tax class along with assoc. tax rates\n */\n function delete_class() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $db->delete('tax_rate', 'class_id =' . $this->params['id']);\n $db->delete('tax_class', 'id =' . $this->params['id']);",
" expHistory::returnTo('manageable');\n }",
" // tax zones",
" function manage_zones() {\n global $db;",
" $back = expHistory::getLast('manageable');\n expHistory::set('manageable', $this->params);\n// $zones = $db->selectObjects('tax_zone', null, 'name');\n $zones = taxController::getTaxZones();",
" assign_to_template(array(\n 'zones' => $zones,\n 'back' => $back\n ));\n }",
" static function getTaxZones() {\n global $db;",
" $sql = \"\n SELECT\n \" . $db->prefix . \"tax_zone.id,\n \" . $db->prefix . \"tax_zone.`name` AS name,\n \" . $db->prefix . \"geo_country.`name` as country,\n \" . $db->prefix . \"geo_region.`name` as state\n FROM \" . $db->prefix . \"tax_zone\n INNER JOIN \" . $db->prefix . \"tax_geo ON \" . $db->prefix . \"tax_geo.zone_id = \" . $db->prefix . \"tax_zone.id\n LEFT JOIN \" . $db->prefix . \"geo_country ON \" . $db->prefix . \"tax_geo.country_id = \" . $db->prefix . \"geo_country.id\n LEFT JOIN \" . $db->prefix . \"geo_region ON \" . $db->prefix . \"tax_geo.region_id = \" . $db->prefix . \"geo_region.id\n \";",
" return $db->selectObjectsBySql($sql);\n }",
" /**\n * Edit tax zone and tax geo\n */\n function edit_zone() {\n global $db;",
" if (isset($this->params['id'])) {\n $zone = $db->selectObject('tax_zone', 'id =' . $this->params['id']);",
" $tax_geo = $db->selectObject('tax_geo', 'zone_id =' . $zone->id);\n //Store it in a single object all the data needed\n $zone->state = $tax_geo->region_id;\n $zone->country = $tax_geo->country_id;",
" assign_to_template(array(\n 'zone' => $zone\n ));\n }\n }",
" /**\n * Update tax zone and assoc. tax geo\n */\n function update_zone() {\n global $db;",
" if (isset($this->params['address_country_id'])) {\n $this->params['country'] = $this->params['address_country_id'];\n unset($this->params['address_country_id']);\n }\n if (isset($this->params['address_region_id'])) {\n $this->params['state'] = $this->params['address_region_id'];\n unset($this->params['address_region_id']);\n }",
" if (empty($this->params['id'])) {\n // Add data in tax zone\n $obj = new stdClass();\n $obj->name = $this->params['name'];\n $zone_id = $db->insertObject($obj, 'tax_zone');",
" // Add data in the tax geo\n $tax_geo = new stdClass();\n $tax_geo->zone_id = $zone_id;\n $tax_geo->country_id = $this->params['country'];\n $tax_geo->region_id = $this->params['state'];\n $db->insertObject($tax_geo, 'tax_geo');\n } else {\n // Update the Tax zone table\n $zone = $db->selectObject('tax_zone', 'id =' . $this->params['id']);\n $zone->name = $this->params['name'];\n $db->updateObject($zone, 'tax_zone');",
" // Update the Tax geo table\n $tax_geo = $db->selectObject('tax_geo', 'zone_id =' . $zone->id);\n// $tax_geo->zone_id = $this->params['id'];\n $tax_geo->country_id = $this->params['country'];\n $tax_geo->region_id = $this->params['state'];\n $db->updateObject($tax_geo, 'tax_geo');\n }",
" expHistory::returnTo('manageable');\n }",
" /**\n * Delete tax zone alone with assoc. tax classes & tax rates\n */\n function delete_zone() {\n global $db;",
" if (empty($this->params['id'])) return false;\n $db->delete('tax_geo', 'zone_id =' . $this->params['id']);\n $rates = $db->selectObjects('tax_rate', 'zone_id =' . $this->params['id']);\n foreach ($rates as $rate) {\n $db->delete('tax_class', 'id =' . $rate->id);\n }\n $db->delete('tax_rate', 'zone_id =' . $this->params['id']);\n $db->delete('tax_zone', 'id =' . $this->params['id']);",
" expHistory::returnTo('manageable');\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Models\n * @package Modules\n */",
"class donation extends product {\n public $table = 'product';\n //public $has_and_belongs_to_many = array('storeCategory');",
" public $product_name = 'Online Donation';\n public $product_type = 'donation';\n public $requiresShipping = false;\n public $requiresBilling = true;\n public $isQuantityAdjustable = false;",
" protected $attachable_item_types = array(\n// 'content_expCats'=>'expCat',\n// 'content_expComments'=>'expComment',\n// 'content_expDefinableFields'=> 'expDefinableField',\n 'content_expFiles' => 'expFile',\n// 'content_expRatings'=>'expRating',\n// 'content_expSimpleNote'=>'expSimpleNote',\n// 'content_expTags'=>'expTag',\n );",
" public function hasOptions() {\n return false;\n }",
" public function hasUserInputFields() {\n return true;\n }",
" public function __construct($params = array(), $get_assoc = true, $get_attached = true) {\n parent::__construct($params, $get_assoc, $get_attached);\n//\t\t$this->price = '';\n $this->price = $this->base_price;\n }",
" public function find($range = 'all', $where = null, $order = null, $limit = null, $limitstart = 0, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n global $db;",
" if (is_numeric($range)) {\n $where = 'id=' . intval($range); // If we hit this then we are expecting just a simple id\n $range = 'first';\n }",
" $sql = \"product_type='donation'\";\n if (!empty($where)) $sql .= $where;",
" $sql .= empty($order) ? '' : ' ORDER BY ' . $order;",
"\n if (strcasecmp($range, 'all') == 0) {",
" $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;",
" return $db->selectExpObjects($this->tablename, $sql, $this->classname);\n } elseif (strcasecmp($range, 'first') == 0) {\n $sql .= ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, $sql, $this->classname);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'bytitle') == 0) {\n $records = $db->selectExpObjects($this->tablename, \"title='\" . $where . \"' OR sef_url='\" . $where . \"'\", $this->classname);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'count') == 0) {\n return $db->countObjects($this->tablename, $sql);\n } elseif (strcasecmp($range, 'in') == 0) {\n if (!is_array($where)) return array();\n foreach ($where as $id) $records[] = new $this->classname($id);\n return $records;\n } elseif (strcasecmp($range, 'bytag') == 0) {\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->table . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expTags ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.exptags_id=' . $where . \" AND ct.content_type='\" . $this->classname . \"'\";\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n }\n }",
" public function cartSummary($item) {\n $view = new controllertemplate($this, $this->getForm('cartSummary'));\n $view->assign('product', $this);\n $view->assign('item', $item);",
" // grab all the registrants\n// $message = expUnserialize($item->extra_data);\n// $view->assign('message', $message);",
" return $view->render();\n }",
" function getPrice($orderitem = null) {\n return 1;\n }",
" function addToCart($params, $orderid = null) {\n if (empty($params['quick']) && empty($params['options_shown'])) { //get user input if needed\n $this->displayForm('addToCart', $params);\n return false;\n }",
" $item = new orderitem($params);\n if (empty($params['dollar_amount'])) $params['dollar_amount'] = $this->price;\n $item->products_price = expUtil::currency_to_float($params['dollar_amount']);",
" $product = new product($params['product_id']);\n//\t $item->products_name = $params['dollar_amount'].' '.$this->product_name.' to '.$product->title;\n $item->products_name = $this->product_name . ' to ' . $product->title;",
" // we need to unset the orderitem's ID to force a new entry..other wise we will overwrite any\n // other giftcards in the cart already\n $item->id = null;\n $item->quantity = $this->getDefaultQuantity();\n $item->save();\n return true;\n }",
" public function getSEFURL() {\n if (!empty($this->sef_url)) return $this->sef_url;\n $parent = new product($this->parent_id, false, false);\n return $parent->sef_url;\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Models\n * @package Modules\n */",
"class donation extends product {\n public $table = 'product';\n //public $has_and_belongs_to_many = array('storeCategory');",
" public $product_name = 'Online Donation';\n public $product_type = 'donation';\n public $requiresShipping = false;\n public $requiresBilling = true;\n public $isQuantityAdjustable = false;",
" protected $attachable_item_types = array(\n// 'content_expCats'=>'expCat',\n// 'content_expComments'=>'expComment',\n// 'content_expDefinableFields'=> 'expDefinableField',\n 'content_expFiles' => 'expFile',\n// 'content_expRatings'=>'expRating',\n// 'content_expSimpleNote'=>'expSimpleNote',\n// 'content_expTags'=>'expTag',\n );",
" public function hasOptions() {\n return false;\n }",
" public function hasUserInputFields() {\n return true;\n }",
" public function __construct($params = array(), $get_assoc = true, $get_attached = true) {\n parent::__construct($params, $get_assoc, $get_attached);\n//\t\t$this->price = '';\n $this->price = $this->base_price;\n }",
" public function find($range = 'all', $where = null, $order = null, $limit = null, $limitstart = 0, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n global $db;",
" if (is_numeric($range)) {\n $where = 'id=' . intval($range); // If we hit this then we are expecting just a simple id\n $range = 'first';\n }",
" $sql = \"product_type='donation'\";\n if (!empty($where)) $sql .= $where;",
" $sql .= empty($order) ? '' : ' ORDER BY ' . expString::escape($order);",
"\n if (strcasecmp($range, 'all') == 0) {",
" $sql .= empty($limit) ? '' : ' LIMIT ' . intval($limitstart) . ',' . intval($limit);",
" return $db->selectExpObjects($this->tablename, $sql, $this->classname);\n } elseif (strcasecmp($range, 'first') == 0) {\n $sql .= ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, $sql, $this->classname);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'bytitle') == 0) {\n $records = $db->selectExpObjects($this->tablename, \"title='\" . $where . \"' OR sef_url='\" . $where . \"'\", $this->classname);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'count') == 0) {\n return $db->countObjects($this->tablename, $sql);\n } elseif (strcasecmp($range, 'in') == 0) {\n if (!is_array($where)) return array();\n foreach ($where as $id) $records[] = new $this->classname($id);\n return $records;\n } elseif (strcasecmp($range, 'bytag') == 0) {\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->table . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expTags ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.exptags_id=' . $where . \" AND ct.content_type='\" . $this->classname . \"'\";\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n }\n }",
" public function cartSummary($item) {\n $view = new controllertemplate($this, $this->getForm('cartSummary'));\n $view->assign('product', $this);\n $view->assign('item', $item);",
" // grab all the registrants\n// $message = expUnserialize($item->extra_data);\n// $view->assign('message', $message);",
" return $view->render();\n }",
" function getPrice($orderitem = null) {\n return 1;\n }",
" function addToCart($params, $orderid = null) {\n if (empty($params['quick']) && empty($params['options_shown'])) { //get user input if needed\n $this->displayForm('addToCart', $params);\n return false;\n }",
" $item = new orderitem($params);\n if (empty($params['dollar_amount'])) $params['dollar_amount'] = $this->price;\n $item->products_price = expUtil::currency_to_float($params['dollar_amount']);",
" $product = new product($params['product_id']);\n//\t $item->products_name = $params['dollar_amount'].' '.$this->product_name.' to '.$product->title;\n $item->products_name = $this->product_name . ' to ' . $product->title;",
" // we need to unset the orderitem's ID to force a new entry..other wise we will overwrite any\n // other giftcards in the cart already\n $item->id = null;\n $item->quantity = $this->getDefaultQuantity();\n $item->save();\n return true;\n }",
" public function getSEFURL() {\n if (!empty($this->sef_url)) return $this->sef_url;\n $parent = new product($this->parent_id, false, false);\n return $parent->sef_url;\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\r\n\r\n##################################################\r\n#\r\n# Copyright (c) 2004-2016 OIC Group, Inc.\r\n#\r\n# This file is part of Exponent\r\n#\r\n# Exponent is free software; you can redistribute\r\n# it and/or modify it under the terms of the GNU\r\n# General Public License as published by the Free\r\n# Software Foundation; either version 2 of the\r\n# License, or (at your option) any later version.\r\n#\r\n# GPL: http://www.gnu.org/licenses/gpl.txt\r\n#\r\n##################################################\r\n\r\n/**\r\n * @subpackage Controllers\r\n * @package Modules\r\n */\r\n\r\nclass eventController extends expController {\r\n// public $basemodel_name = 'event';\r\n public $useractions = array(\r\n 'showall' => 'Show Calendar',\r\n );\r\n// public $codequality = 'beta';\r\n\r\n public $remove_configs = array(\r\n 'comments',\r\n 'ealerts',\r\n// 'facebook',\r\n 'files',\r\n 'pagination',\r\n 'rss',\r\n// 'twitter',\r\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)\r\n\r\n static function displayname() {\r\n return \"Events\";\r\n }\r\n\r\n static function description() {\r\n return \"Manage events and schedules, and optionally publish them.\";\r\n }\r\n\r\n static function author() {\r\n return \"Dave Leffler\";\r\n }\r\n\r\n static function isSearchable() {\r\n return true;\r\n }\r\n\r\n function searchName() {\r\n return gt(\"Calendar Event\");\r\n }\r\n\r\n function searchCategory() {\r\n return gt('Event');\r\n }\r\n\r\n /**\r\n * can this module import data?\r\n *\r\n * @return bool\r\n */\r\n public static function canImportData() {\r\n return true;\r\n }\r\n\r\n function showall() {\r\n global $user;\r\n\r\n expHistory::set('viewable', $this->params);\r\n $locsql = $this->aggregateWhereClause();\r\n $time = (isset($this->params['time']) ? $this->params['time'] : time());\r\n assign_to_template(array(\r\n 'time' => $time,\r\n 'daynames' => event::dayNames(),\r\n ));\r\n\r\n $regcolor = !empty($this->config['registrations_color']) ? $this->config['registrations_color'] : null;\r\n\r\n $ed = new eventdate();\r\n $viewtype = 'default';\r\n $viewrange = 'all';\r\n $view = !empty($this->params['view']) ? $this->params['view'] : 'showall';\r\n switch ($view) {\r\n case 'showall_Administration':\r\n $viewtype = \"administration\";\r\n break;\r\n case 'showall_Past Events':\r\n $viewrange = \"past\";\r\n break;\r\n case 'showall_Monthly Summary':\r\n case 'showall_Mini-Calendar':\r\n case 'minical':\r\n $viewtype = \"minical\";\r\n break;\r\n case 'showall_Monthly List':\r\n case 'showall_List':\r\n case 'monthlist':\r\n $viewtype = \"byday\";\r\n $viewrange = \"month\";\r\n break;\r\n case 'showall_Week':\r\n case 'week':\r\n $viewtype = \"byday\";\r\n $viewrange = \"week\";\r\n break;\r\n case 'showall_Day':\r\n case 'day':\r\n $viewtype = \"byday\";\r\n $viewrange = \"day\";\r\n break;\r\n case 'showall_announcement':\r\n case 'showall_Upcoming Events':\r\n case 'showall_Upcoming Events - Headlines':\r\n $viewrange = \"upcoming\";\r\n break;\r\n case 'showall':\r\n case 'month':\r\n $viewtype = \"monthly\";\r\n break;\r\n default :\r\n $view_params = explode('_',$view);\r\n if (!empty($view_params[1])) $viewtype = $view_params[1];\r\n if (!empty($view_params[2])) $viewrange = $view_params[2];\r\n } // end switch $view\r\n\r\n switch ($viewtype) {\r\n case \"minical\":\r\n $monthly = expDateTime::monthlyDaysTimestamp($time);\r\n $info = getdate($time);\r\n $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\r\n $now = getdate(time());\r\n $currentday = $now['mday'];\r\n $endofmonth = date('t', $time);\r\n foreach ($monthly as $weekNum => $week) {\r\n foreach ($week as $dayNum => $day) {\r\n if ($dayNum == $now['mday']) {\r\n $currentweek = $weekNum;\r\n }\r\n if ($dayNum <= $endofmonth) {\r\n// $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $db->countObjects(\"eventdate\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($day['ts']) . \" AND date <= \" . expDateTime::endOfDayTimestamp($day['ts'])) : -1;\r\n $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $ed->find(\"count\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($day['ts']) . \" AND date <= \" . expDateTime::endOfDayTimestamp($day['ts'])) : -1;\r\n }\r\n }\r\n }\r\n $prevmonth = mktime(0, 0, 0, date(\"m\", $timefirst) - 1, date(\"d\", $timefirst) + 10, date(\"Y\", $timefirst));\r\n $nextmonth = mktime(0, 0, 0, date(\"m\", $timefirst) + 1, date(\"d\", $timefirst) + 10, date(\"Y\", $timefirst));\r\n assign_to_template(array(\r\n \"monthly\" => $monthly,\r\n \"currentweek\" => $currentweek,\r\n \"currentday\" => $currentday,\r\n \"now\" => $timefirst,\r\n \"prevmonth\" => $prevmonth,\r\n \"thismonth\" => $timefirst,\r\n \"nextmonth\" => $nextmonth,\r\n ));\r\n break; // end switch $viewtype minicalendar\r\n case \"byday\": //note aggregates events by groups of days\r\n // Remember this is the code for weekly view and monthly listview\r\n // Test your fixes on both views\r\n // \t\t$startperiod = 0;\r\n //\t\t\t$totaldays = 0;\r\n switch ($viewrange) {\r\n case \"day\":\r\n $startperiod = expDateTime::startOfDayTimestamp($time);\r\n $totaldays = 1;\r\n $next = expDateTime::endOfDayTimestamp($startperiod);\r\n if (!empty($this->config['starttype'])) $startperiod = $time;\r\n $this->params['time'] = $time;\r\n assign_to_template(array(\r\n \"prev_timestamp3\" => strtotime('-3 days', $startperiod),\r\n \"prev_timestamp2\" => strtotime('-2 days', $startperiod),\r\n \"prev_timestamp\" => strtotime('-1 days', $startperiod),\r\n \"next_timestamp\" => strtotime('+1 days', $startperiod),\r\n \"next_timestamp2\" => strtotime('+2 days', $startperiod),\r\n \"next_timestamp3\" => strtotime('+3 days', $startperiod),\r\n 'params' => $this->params\r\n ));\r\n break;\r\n case \"week\":\r\n $startperiod = expDateTime::startOfWeekTimestamp($time);\r\n $totaldays = 7;\r\n $next = strtotime('+7 days', $startperiod);\r\n// $next = expDateTime::endOfWeekTimestamp($startperiod);\r\n if (!empty($this->config['starttype'])) $startperiod = $time;\r\n $this->params['time'] = $time;\r\n assign_to_template(array(\r\n \"prev_timestamp3\" => strtotime('-21 days', $startperiod),\r\n \"prev_timestamp2\" => strtotime('-14 days', $startperiod),\r\n \"prev_timestamp\" => strtotime('-7 days', $startperiod),\r\n \"next_timestamp\" => $next,\r\n \"next_timestamp2\" => strtotime('+14 days', $startperiod),\r\n \"next_timestamp3\" => strtotime('+21 days', $startperiod),\r\n 'params' => $this->params\r\n ));\r\n break;\r\n case \"twoweek\":\r\n $startperiod = expDateTime::startOfWeekTimestamp($time);\r\n $totaldays = 14;\r\n $next = strtotime('+14 days', $startperiod);\r\n if (!empty($this->config['starttype'])) $startperiod = $time;\r\n assign_to_template(array(\r\n \"prev_timestamp3\" => strtotime('-42 days', $startperiod),\r\n \"prev_timestamp2\" => strtotime('-28 days', $startperiod),\r\n \"prev_timestamp\" => strtotime('-14 days', $startperiod),\r\n \"next_timestamp\" => $next,\r\n \"next_timestamp2\" => strtotime('+28 days', $startperiod),\r\n \"next_timestamp3\" => strtotime('+42 days', $startperiod),\r\n ));\r\n break;\r\n case \"month\":\r\n default: // range = month\r\n $startperiod = expDateTime::startOfMonthTimestamp($time);\r\n $totaldays = date('t', $time);\r\n $next = strtotime('+1 months', $startperiod);\r\n// $next = expDateTime::endOfMonthTimestamp($startperiod);\r\n $this->params['time'] = $time;\r\n assign_to_template(array(\r\n \"prev_timestamp3\" => strtotime('-3 months', $startperiod),\r\n \"prev_timestamp2\" => strtotime('-2 months', $startperiod),\r\n \"prev_timestamp\" => strtotime('-1 months', $startperiod),\r\n \"next_timestamp\" => $next,\r\n \"next_timestamp2\" => strtotime('+2 months', $startperiod),\r\n \"next_timestamp3\" => strtotime('+3 months', $startperiod),\r\n 'params' => $this->params\r\n ));\r\n break;\r\n } // end switch $viewrange\r\n\r\n // $days = array();\r\n // added per Ignacio\r\n //\t\t\t$endofmonth = date('t', $time);\r\n $extitems = $this->getExternalEvents($startperiod, $next);\r\n if (!empty($this->config['aggregate_registrations'])) \r\n $regitems = eventregistrationController::getRegEventsForDates($startperiod, $next, $regcolor);\r\n for ($i = 1; $i <= $totaldays; $i++) {\r\n // $info = getdate($time);\r\n // switch ($viewrange) {\r\n // case \"week\":\r\n // $start = mktime(0,0,0,$info['mon'],$i,$info['year']); //FIXME this can't be right?\r\n // break;\r\n // case \"twoweek\":\r\n //// $start = mktime(0,0,0,$info['mon'],$info['mday']+($i-1),$info['year']); //FIXME this can't be right?\r\n // \t\t $start = $startperiod + ($i*86400);\r\n // break;\r\n // default: // range = month\r\n // $start = mktime(0,0,0,$info['mon'],$i,$info['year']);\r\n // }\r\n $start = expDateTime::startOfDayTimestamp($startperiod + ($i * 86400) - 86400);\r\n $edates = $ed->find(\"all\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($start) . \" AND date <= \" . expDateTime::endOfDayTimestamp($start));\r\n// $days[$start] = $this->getEventsForDates($edates, true, isset($this->config['only_featured']) ? true : false);\r\n $days[$start] = $this->event->getEventsForDates($edates, true, isset($this->config['only_featured']) ? true : false);\r\n // for ($j = 0; $j < count($days[$start]); $j++) {\r\n // $thisloc = expCore::makeLocation($this->loc->mod,$this->loc->src,$days[$start][$j]->id);\r\n // $days[$start][$j]->permissions = array(\r\n // \"manage\"=>(expPermissions::check(\"manage\",$thisloc) || expPermissions::check(\"manage\",$this->loc)),\r\n // \"edit\"=>(expPermissions::check(\"edit\",$thisloc) || expPermissions::check(\"edit\",$this->loc)),\r\n // \"delete\"=>(expPermissions::check(\"delete\",$thisloc) || expPermissions::check(\"delete\",$this->loc))\r\n // );\r\n // }\r\n if (!empty($extitems[$start]))\r\n $days[$start] = array_merge($extitems[$start], $days[$start]);\r\n if (!empty($regitems[$start]))\r\n $days[$start] = array_merge($regitems[$start], $days[$start]);\r\n $days[$start] = expSorter::sort(array('array' => $days[$start], 'sortby' => 'eventstart', 'order' => 'ASC'));\r\n }\r\n assign_to_template(array(\r\n \"time\" => $startperiod,\r\n 'days' => $days,\r\n \"now\" => $startperiod,\r\n ));\r\n break; // end switch $viewtype byday\r\n case \"monthly\": //note this is a simply array of events for the requested month\r\n // build a month array of weeks with an array of days\r\n // $monthly = array();\r\n // $counts = array();\r\n $info = getdate($time);\r\n $nowinfo = getdate(time());\r\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\r\n // Grab non-day numbers only (before end of month)\r\n// $week = 0;\r\n $currentweek = -1;\r\n $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\r\n $week = (int)date('W',$timefirst);\r\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\r\n $infofirst = getdate($timefirst);\r\n $monthly[$week] = array(); // initialize for non days\r\n $counts[$week] = array();\r\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\r\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\r\n $monthly[$week][$i] = array();\r\n $counts[$week][$i] = -1;\r\n }\r\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\r\n } else {\r\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\r\n $monthly[$week][$i] = array();\r\n $counts[$week][$i] = -1;\r\n }\r\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\r\n }\r\n // Grab day counts\r\n $endofmonth = date('t', $time);\r\n $extitems = $this->getExternalEvents($timefirst, expDateTime::endOfMonthTimestamp($timefirst));\r\n if (!empty($this->config['aggregate_registrations'])) \r\n $regitems = eventregistrationController::getRegEventsForDates($timefirst, expDateTime::endOfMonthTimestamp($timefirst), $regcolor);\r\n for ($i = 1; $i <= $endofmonth; $i++) {\r\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\r\n if ($i == $nowinfo['mday']) $currentweek = $week;\r\n $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfDayTimestamp($start) . \" AND date <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\r\n// $monthly[$week][$i] = $this->getEventsForDates($dates, true, isset($this->config['only_featured']) ? true : false);\r\n $monthly[$week][$i] = $this->event->getEventsForDates($dates, true, isset($this->config['only_featured']) ? true : false);\r\n if (!empty($extitems[$start]))\r\n $monthly[$week][$i] = array_merge($extitems[$start], $monthly[$week][$i]);\r\n if (!empty($regitems[$start]))\r\n $monthly[$week][$i] = array_merge($regitems[$start], $monthly[$week][$i]);\r\n $monthly[$week][$i] = expSorter::sort(array('array' => $monthly[$week][$i], 'sortby' => 'eventstart', 'order' => 'ASC'));\r\n $counts[$week][$i] = count($monthly[$week][$i]);\r\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\r\n $week++;\r\n $monthly[$week] = array(); // allocate an array for the next week\r\n $counts[$week] = array();\r\n $weekday = DISPLAY_START_OF_WEEK;\r\n } else $weekday++;\r\n }\r\n // Grab non-day numbers only (after end of month)\r\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\r\n $monthly[$week][$i + $endofmonth] = array();\r\n $counts[$week][$i + $endofmonth] = -1;\r\n }\r\n $this->params['time'] = $time;\r\n assign_to_template(array(\r\n \"currentweek\" => $currentweek,\r\n \"monthly\" => $monthly,\r\n \"counts\" => $counts,\r\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\r\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\r\n \"prevmonth\" => strtotime('-1 months', $timefirst),\r\n \"nextmonth\" => strtotime('+1 months', $timefirst),\r\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\r\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\r\n \"now\" => $timefirst,\r\n \"today\" => expDateTime::startOfDayTimestamp(time()),\r\n 'params' => $this->params\r\n ));\r\n break; // end switch $viewtype monthly\r\n case \"administration\": //note a simple list of all upcoming events, except no external nor registration events\r\n // Check perms and return if cant view\r\n if (!$user) return;\r\n $continue = (expPermissions::check(\"manage\", $this->loc) ||\r\n expPermissions::check(\"create\", $this->loc) ||\r\n expPermissions::check(\"edit\", $this->loc) ||\r\n expPermissions::check(\"delete\", $this->loc)\r\n ) ? 1 : 0;\r\n $dates = $ed->find(\"all\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp(time()));\r\n// $items = $this->getEventsForDates($dates);\r\n $items = $this->event->getEventsForDates($dates);\r\n // if (!$continue) {\r\n // foreach ($items as $i) {\r\n // $iloc = expCore::makeLocation($this->loc->mod,$this->loc->src,$i->id);\r\n // if (expPermissions::check(\"edit\",$iloc) ||\r\n // expPermissions::check(\"delete\",$iloc) ||\r\n // expPermissions::check(\"manage\",$iloc)\r\n // ) {\r\n // $continue = true;\r\n // }\r\n // }\r\n // }\r\n if (!$continue) return;\r\n // for ($i = 0; $i < count($items); $i++) {\r\n // $thisloc = expCore::makeLocation($this->loc->mod,$this->loc->src,$items[$i]->id);\r\n // //\t\t\t\tif ($user && $items[$i]->poster == $user->id) $canviewapproval = 1;\r\n // $items[$i]->permissions = array(\r\n // \"manage\"=>(expPermissions::check(\"manage\",$thisloc) || expPermissions::check(\"manage\",$this->loc)),\r\n // \"edit\"=>(expPermissions::check(\"edit\",$thisloc) || expPermissions::check(\"edit\",$this->loc)),\r\n // \"delete\"=>(expPermissions::check(\"delete\",$thisloc) || expPermissions::check(\"delete\",$this->loc))\r\n // );\r\n // }\r\n $items = expSorter::sort(array('array' => $items, 'sortby' => 'eventstart', 'order' => 'ASC'));\r\n assign_to_template(array(\r\n 'items' => $items,\r\n ));\r\n break; // end switch $viewtype administration\r\n case \"default\": //note a simple list of events based on $viewrange\r\n default;\r\n // $items = null;\r\n // $dates = null;\r\n $day = expDateTime::startOfDayTimestamp(time());\r\n $sort_asc = true; // For the getEventsForDates call\r\n // $moreevents = false;\r\n switch ($viewrange) {\r\n case \"upcoming\": // events in the future\r\n if (!empty($this->config['enable_ical']) && !empty($this->config['rss_limit']) && $this->config['rss_limit'] > 0) {\r\n $eventlimit = \" AND date <= \" . ($day + ($this->config['rss_limit'] * 86400));\r\n } else {\r\n $eventlimit = \"\";\r\n }\r\n $dates = $ed->find(\"all\", $locsql . \" AND date >= \" . $day . $eventlimit . \" ORDER BY date ASC \");\r\n $begin = $day;\r\n $end = null;\r\n //\t\t\t\t\t$moreevents = count($dates) < $db->countObjects(\"eventdate\",$locsql.\" AND date >= $day\");\r\n break;\r\n case \"past\": // events in the past\r\n $dates = $ed->find(\"all\", $locsql . \" AND date < $day ORDER BY date DESC \");\r\n //\t\t\t\t\t$moreevents = count($dates) < $db->countObjects(\"eventdate\",$locsql.\" AND date < $day\");\r\n $sort_asc = false;\r\n $begin = null;\r\n $end = $day;\r\n break;\r\n case \"today\": // events occuring today\r\n $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfDayTimestamp($day) . \" AND date <= \" . expDateTime::endOfDayTimestamp($day) . \")\");\r\n $begin = $day;\r\n $end = expDateTime::endOfDayTimestamp($day);\r\n break;\r\n case \"day\": // events for a specific day (same as byday day?)\r\n $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfDayTimestamp($time) . \" AND date <= \" . expDateTime::endOfDayTimestamp($time) . \")\");\r\n $begin = expDateTime::startOfDayTimestamp($time);\r\n $end = expDateTime::endOfDayTimestamp($time);\r\n break;\r\n case \"next\": // future events\r\n $dates = array($ed->find(\"all\", $locsql . \" AND date >= $time\"));\r\n $begin = expDateTime::startOfDayTimestamp($time);\r\n $end = null;\r\n break;\r\n case \"month\": // events for a specific month (same as monthly?)\r\n// $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfMonthTimestamp(time()) . \" AND date <= \" . expDateTime::endOfMonthTimestamp(time()) . \")\");\r\n $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfMonthTimestamp($time) . \" AND date <= \" . expDateTime::endOfMonthTimestamp($time) . \")\");\r\n $begin = expDateTime::startOfMonthTimestamp($time);\r\n $end = expDateTime::endOfMonthTimestamp($time);\r\n break;\r\n case \"all\": // all events\r\n default;\r\n $dates = $ed->find(\"all\", $locsql);\r\n $begin = null;\r\n $end = null;\r\n }\r\n// $items = $this->getEventsForDates($dates, $sort_asc, isset($this->config['only_featured']) ? true : false, true);\r\n $items = $this->event->getEventsForDates($dates, $sort_asc, isset($this->config['only_featured']) ? true : false, true);\r\n if ($viewrange != 'past') {\r\n $extitems = $this->getExternalEvents($begin, $end);\r\n // we need to flatten these down to simple array of events\r\n $extitem = array();\r\n foreach ($extitems as $days) {\r\n foreach ($days as $event) {\r\n if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time()))\r\n break;\r\n if (empty($event->eventstart))\r\n $event->eventstart = $event->eventdate->date;\r\n $extitem[] = $event;\r\n }\r\n }\r\n $items = array_merge($items, $extitem);\r\n \r\n if (!empty($this->config['aggregate_registrations']))\r\n $regitems = eventregistrationController::getRegEventsForDates($begin, $end, $regcolor);\r\n // we need to flatten these down to simple array of events\r\n $regitem = array();\r\n if (!empty($regitems)) foreach ($regitems as $days) {\r\n foreach ($days as $value) {\r\n $regitem[] = $value;\r\n }\r\n }\r\n $items = array_merge($items, $regitem);\r\n\r\n // remove today's events that have already ended\r\n if ($viewtype == 'default' && $viewrange == 'upcoming') {\r\n foreach ($items as $key=>$item) {\r\n if (!$item->is_allday && $item->eventend < time()) {\r\n //fixme we've left events ending earlier in the day, but already cancelled out tomorrow's event\r\n unset($items[$key]);\r\n } else {\r\n break; // they are chronological so we can end\r\n }\r\n }\r\n }\r\n }\r\n $items = expSorter::sort(array('array' => $items, 'sortby' => 'eventstart', 'order' => 'ASC'));\r\n // Upcoming events can be configured to show a specific number of events.\r\n // The previous call gets all events in the future from today\r\n // If configured, cut the array to the configured number of events\r\n //\t\t\tif ($template->viewconfig['num_events']) {\r\n //\t\t\t\tswitch ($viewrange) {\r\n //\t\t\t\t\tcase \"upcoming\":\r\n //\t\t\t\t\tcase \"past\":\r\n //\t\t\t\t\t\t$moreevents = $template->viewconfig['num_events'] < count($items);\r\n //\t\t\t\t\t\tbreak;\r\n //\t\t\t\t}\r\n //\t\t\t\t$items = array_slice($items, 0, $template->viewconfig['num_events']);\r\n //\t\t\t}\r\n // for ($i = 0; $i < count($items); $i++) {\r\n // $thisloc = expCore::makeLocation($this->loc->mod,$this->loc->src,$items[$i]->id);\r\n // $items[$i]->permissions = array(\r\n // 'manage'=>(expPermissions::check('manage',$thisloc) || expPermissions::check('manage',$this->loc)),\r\n // 'edit'=>(expPermissions::check('edit',$thisloc) || expPermissions::check('edit',$this->loc)),\r\n // 'delete'=>(expPermissions::check('delete',$thisloc) || expPermissions::check('delete',$this->loc))\r\n // );\r\n // }\r\n assign_to_template(array(\r\n 'items' => $items,\r\n \"now\" => $day,\r\n ));\r\n }\r\n }\r\n\r\n /**\r\n * default view for individual item\r\n */\r\n function show() {\r\n expHistory::set('viewable', $this->params);\r\n if (!empty($this->params['date_id'])) { // specific event instance\r\n $eventdate = new eventdate($this->params['date_id']);\r\n $eventdate->event = new event($eventdate->event_id);\r\n } else { // we'll default to the first event of this series\r\n $event = new event($this->params['id']);\r\n $eventdate = new eventdate($event->eventdate[0]->id);\r\n }\r\n if (empty($eventdate->id))\r\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>'event'));\r\n\r\n if (!empty($eventdate->event->feedback_form) && $eventdate->event->feedback_form != 'Disallow Feedback') {\r\n assign_to_template(array(\r\n 'feedback_form' => $eventdate->event->feedback_form,\r\n ));\r\n }\r\n\r\n assign_to_template(array(\r\n 'event' => $eventdate,\r\n ));\r\n }\r\n\r\n function edit() {\r\n global $template;\r\n\r\n parent::edit();\r\n $allforms = array();\r\n $allforms[\"\"] = gt('Disallow Feedback');\r\n // calculate which event date is the one being edited\r\n $event_key = 0;\r\n foreach ($template->tpl->tpl_vars['record']->value->eventdate as $key=>$d) {\r\n \t if ($d->id == $this->params['date_id']) $event_key = $key;\r\n \t}\r\n\r\n assign_to_template(array(\r\n 'allforms' => array_merge($allforms, expTemplate::buildNameList(\"forms\", \"event/email\", \"tpl\", \"[!_]*\")),\r\n 'checked_date' => !empty($this->params['date_id']) ? $this->params['date_id'] : null,\r\n 'event_key' => $event_key,\r\n ));\r\n }\r\n\r\n /**\r\n * Delete a recurring event by asking for which event dates to delete\r\n *\r\n */\r\n function delete_recurring() {\r\n $item = $this->event->find('first', 'id=' . $this->params['id']);\r\n if ($item->is_recurring == 1) { // need to give user options\r\n expHistory::set('editable', $this->params);\r\n assign_to_template(array(\r\n 'checked_date' => $this->params['date_id'],\r\n 'event' => $item,\r\n ));\r\n } else { // Process a regular delete\r\n $item->delete();\r\n }\r\n }\r\n\r\n /**\r\n * Delete selected event dates for a recurring event and event if all event dates deleted\r\n *\r\n */\r\n function delete_selected() {\r\n $item = $this->event->find('first', 'id=' . $this->params['id']);\r\n if ($item && $item->is_recurring == 1) {\r\n $event_remaining = false;\r\n $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id);\r\n foreach ($eventdates as $ed) {\r\n if (array_key_exists($ed->id, $this->params['dates'])) {\r\n $ed->delete();\r\n } else {\r\n $event_remaining = true;\r\n }\r\n }\r\n if (!$event_remaining) {\r\n $item->delete(); // model will also ensure we delete all event dates\r\n }\r\n expHistory::back();\r\n } else {\r\n notfoundController::handle_not_found();\r\n }\r\n }\r\n\r\n function delete_all_past() {\r\n $locsql = $this->aggregateWhereClause();\r\n $ed = new eventdate();\r\n $dates = $ed->find(\"all\", $locsql . \" AND date < \" . strtotime('-1 months', time()));\r\n foreach ($dates as $date) {\r\n $date->delete(); // event automatically deleted if all assoc eventdates are deleted\r\n }\r\n expHistory::back();\r\n }\r\n\r\n /**\r\n \t * get the metainfo for this module\r\n \t * @return array\r\n \t */\r\n \tfunction metainfo() {\r\n global $router;\r\n\r\n $action = $router->params['action'];\r\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\r\n // look for event date_id which expController::metainfo won't detect\r\n// if (!empty($router->params['action']) && $router->params['action'] == 'show' && !isset($router->params['id']) && isset($router->params['date_id'])) {\r\n switch ($action) {\r\n case 'show':\r\n if (!isset($router->params['id']) && isset($router->params['date_id'])) {\r\n // look up the record.\r\n $object = new eventdate((int)$router->params['date_id']);\r\n // set the meta info\r\n if (!empty($object)) {\r\n if (!empty($object->event->body)) {\r\n $desc = str_replace('\"',\"'\",expString::summarize($object->event->body,'html','para'));\r\n } else {\r\n $desc = SITE_DESCRIPTION;\r\n }\r\n if (!empty($object->expTag)) {\r\n $keyw = '';\r\n foreach ($object->expTag as $tag) {\r\n if (!empty($keyw)) $keyw .= ', ';\r\n $keyw .= $tag->title;\r\n }\r\n } else {\r\n $keyw = SITE_KEYWORDS;\r\n }\r\n $metainfo['title'] = empty($object->event->meta_title) ? $object->event->title : $object->event->meta_title;\r\n $metainfo['keywords'] = empty($object->event->meta_keywords) ? $keyw : $object->event->meta_keywords;\r\n $metainfo['description'] = empty($object->event->meta_description) ? $desc : $object->event->meta_description;\r\n $metainfo['canonical'] = empty($object->event->canonical) ? $router->plainPath() : $object->event->canonical;\r\n $metainfo['noindex'] = empty($object->event->meta_noindex) ? false : $object->event->meta_noindex;\r\n $metainfo['nofollow'] = empty($object->event->meta_nofollow) ? false : $object->event->meta_nofollow;\r\n return $metainfo;\r\n break;\r\n }\r\n }\r\n default:\r\n return parent::metainfo();\r\n }\r\n }\r\n\r\n /**\r\n * function to build a string to pull in all events within requested date range\r\n */\r\n function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) {\r\n if (empty($endtimestamp)) {\r\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($timestamp) . \")\";\r\n } else {\r\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($endtimestamp) . \")\";\r\n }\r\n if ($multiday)\r\n $date_sql .= \" OR (\" . expDateTime::startOfDayTimestamp($timestamp) . \" BETWEEN \".$field.\" AND dateFinished)\";\r\n $date_sql .= \")\";\r\n return $date_sql;\r\n }\r\n\r\n function send_feedback() {\r\n $success = false;\r\n if (isset($this->params['id'])) {\r\n $ed = new eventdate($this->params['id']);\r\n// $email_addrs = array();\r\n if ($ed->event->feedback_email != '') {\r\n $msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . $this->params['formname'], $this->loc);\r\n $msgtemplate->assign('params', $this->params);\r\n $msgtemplate->assign('event', $ed);\r\n $email_addrs = explode(',', $ed->event->feedback_email);\r\n //This is an easy way to remove duplicates\r\n $email_addrs = array_flip(array_flip($email_addrs));\r\n $email_addrs = array_map('trim', $email_addrs);\r\n $mail = new expMail();\r\n $success += $mail->quickSend(array(\r\n \"text_message\" => $msgtemplate->render(),\r\n 'to' => $email_addrs,\r\n 'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS),\r\n 'subject' => $this->params['subject'],\r\n ));\r\n }\r\n }\r\n\r\n if ($success) {\r\n flashAndFlow('message', gt('Your feedback was successfully sent.'));\r\n } else {\r\n flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.'));\r\n }\r\n }\r\n\r\n function ical() {\r\n if (isset($this->params['date_id']) || isset($this->params['title']) || isset($this->params['src'])) {\r\n $cfg = new expConfig();\r\n $configs = $cfg->find('all', \"location_data LIKE '%event%'\"); // get all event module configs\r\n foreach ($configs as $config) {\r\n $loc = expUnserialize($config->location_data);\r\n if (!empty($this->params['title'])) {\r\n if ($this->params['title'] == $config->config['feed_sef_url']) {\r\n $this->config = $config->config;\r\n break;\r\n }\r\n } elseif (!empty($this->params['src'])) {\r\n if ($this->params['src'] == $loc->src) {\r\n $this->config = $config->config;\r\n break;\r\n }\r\n }\r\n }\r\n $this->loc = $loc;\r\n\r\n if ($this->config['enable_ical']) {\r\n $ed = new eventdate();\r\n if (isset($this->params['date_id'])) { // get single specific event only\r\n// $dates = array($db->selectObject(\"eventdate\",\"id=\".$this->params['date_id']));\r\n $dates = $ed->find('first', \"id=\" . $this->params['date_id']);\r\n $Filename = \"Event-\" . $this->params['date_id'];\r\n } else {\r\n $locsql = $this->aggregateWhereClause();\r\n\r\n $day = expDateTime::startOfDayTimestamp(time());\r\n if (!empty($this->config['enable_ical']) && isset($this->config['rss_limit']) && ($this->config['rss_limit'] > 0)) {\r\n $rsslimit = \" AND date <= \" . ($day + ($this->config['rss_limit'] * 86400));\r\n } else {\r\n $rsslimit = \"\";\r\n }\r\n\r\n if (isset($this->params['time'])) {\r\n $time = $this->params['time']; // get current month's events\r\n// $dates = $db->selectObjects(\"eventdate\",$locsql.\" AND (date >= \".expDateTime::startOfMonthTimestamp($time).\" AND date <= \".expDateTime::endOfMonthTimestamp($time).\")\");\r\n $dates = $ed->find('all', $locsql . \" AND (date >= \" . expDateTime::startOfMonthTimestamp($time) . \" AND date <= \" . expDateTime::endOfMonthTimestamp($time) . \")\");\r\n } else {\r\n $time = date('U', strtotime(\"midnight -1 month\", time())); // previous month also\r\n// $dates = $db->selectObjects(\"eventdate\",$locsql.\" AND date >= \".expDateTime::startOfDayTimestamp($time).$rsslimit);\r\n $dates = $ed->find('all', $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($time) . $rsslimit);\r\n }\r\n //\t\t\t$title = $db->selectValue('container', 'title', \"internal='\".serialize($loc).\"'\");\r\n $title = $this->config['feed_title'];\r\n $Filename = preg_replace('/\\s+/', '', $title); // without whitespace\r\n }\r\n\r\n if (!function_exists(\"quoted_printable_encode\")) { // function added in php v5.3.0\r\n function quoted_printable_encode($input, $line_max = 75) {\r\n $hex = array('0', '1', '2', '3', '4', '5', '6', '7',\r\n '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');\r\n $lines = preg_split(\"/(?:\\r\\n|\\r|\\n)/\", $input);\r\n $linebreak = \"=0D=0A=\\r\\n\";\r\n /* the linebreak also counts as characters in the mime_qp_long_line\r\n * rule of spam-assassin */\r\n $line_max = $line_max - strlen($linebreak);\r\n $escape = \"=\";\r\n $output = \"\";\r\n $cur_conv_line = \"\";\r\n $length = 0;\r\n $whitespace_pos = 0;\r\n $addtl_chars = 0;\r\n\r\n // iterate lines\r\n for ($j = 0, $jMax = count($lines); $j < $jMax; $j++) {\r\n $line = $lines[$j];\r\n $linlen = strlen($line);\r\n\r\n // iterate chars\r\n for ($i = 0; $i < $linlen; $i++) {\r\n $c = substr($line, $i, 1);\r\n $dec = ord($c);\r\n\r\n $length++;\r\n\r\n if ($dec == 32) {\r\n // space occurring at end of line, need to encode\r\n if (($i == ($linlen - 1))) {\r\n $c = \"=20\";\r\n $length += 2;\r\n }\r\n\r\n $addtl_chars = 0;\r\n $whitespace_pos = $i;\r\n } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) {\r\n $h2 = floor($dec / 16);\r\n $h1 = floor($dec % 16);\r\n $c = $escape . $hex[\"$h2\"] . $hex[\"$h1\"];\r\n $length += 2;\r\n $addtl_chars += 2;\r\n }\r\n\r\n // length for wordwrap exceeded, get a newline into the text\r\n if ($length >= $line_max) {\r\n $cur_conv_line .= $c;\r\n\r\n // read only up to the whitespace for the current line\r\n $whitesp_diff = $i - $whitespace_pos + $addtl_chars;\r\n\r\n /* the text after the whitespace will have to be read\r\n * again ( + any additional characters that came into\r\n * existence as a result of the encoding process after the whitespace)\r\n *\r\n * Also, do not start at 0, if there was *no* whitespace in\r\n * the whole line */\r\n if (($i + $addtl_chars) > $whitesp_diff) {\r\n $output .= substr($cur_conv_line, 0, (strlen($cur_conv_line) -\r\n $whitesp_diff)) . $linebreak;\r\n $i = $i - $whitesp_diff + $addtl_chars;\r\n } else {\r\n $output .= $cur_conv_line . $linebreak;\r\n }\r\n\r\n $cur_conv_line = \"\";\r\n $length = 0;\r\n $whitespace_pos = 0;\r\n } else {\r\n // length for wordwrap not reached, continue reading\r\n $cur_conv_line .= $c;\r\n }\r\n } // end of for\r\n\r\n $length = 0;\r\n $whitespace_pos = 0;\r\n $output .= $cur_conv_line;\r\n $cur_conv_line = \"\";\r\n\r\n if ($j <= count($lines) - 1) {\r\n $output .= $linebreak;\r\n }\r\n } // end for\r\n\r\n return trim($output);\r\n } // end quoted_printable_encode\r\n }\r\n\r\n $tz = DISPLAY_DEFAULT_TIMEZONE;\r\n $msg = \"BEGIN:VCALENDAR\\n\";\r\n $msg .= \"VERSION:2.0\\n\"; // version for iCalendar files vs vCalendar files\r\n $msg .= \"CALSCALE:GREGORIAN\\n\";\r\n $msg .= \"METHOD: PUBLISH\\n\";\r\n $msg .= \"PRODID:<-//ExponentCMS//EN>\\n\";\r\n if (isset($this->config['rss_cachetime']) && ($this->config['rss_cachetime'] > 0)) {\r\n $msg .= \"X-PUBLISHED-TTL:PT\" . $this->config['rss_cachetime'] . \"M\\n\";\r\n }\r\n $msg .= \"X-WR-CALNAME:$Filename\\n\";\r\n\r\n// $items = $this->getEventsForDates($dates);\r\n $items = $this->event->getEventsForDates($dates);\r\n\r\n for ($i = 0, $iMax = count($items); $i < $iMax; $i++) {\r\n\r\n // Convert events stored in local time to GMT\r\n $eventstart = new DateTime(date('r', $items[$i]->eventstart), new DateTimeZone($tz));\r\n $eventstart->setTimezone(new DateTimeZone('GMT'));\r\n $eventend = new DateTime(date('r', $items[$i]->eventend), new DateTimeZone($tz));\r\n $eventend->setTimezone(new DateTimeZone('GMT'));\r\n if ($items[$i]->is_allday) {\r\n $dtstart = \"DTSTART;VALUE=DATE:\" . date(\"Ymd\", $items[$i]->eventstart) . \"\\n\";\r\n $dtend = \"DTEND;VALUE=DATE:\" . date(\"Ymd\", strtotime(\"midnight +1 day\", $items[$i]->eventstart)) . \"\\n\";\r\n } else {\r\n $dtstart = \"DTSTART;VALUE=DATE-TIME:\" . $eventstart->format(\"Ymd\\THi00\") . \"Z\\n\";\r\n if ($items[$i]->eventend) {\r\n $dtend = \"DTEND;VALUE=DATE-TIME:\" . $eventend->format(\"Ymd\\THi00\") . \"Z\\n\";\r\n } else {\r\n $dtend = \"DTEND;VALUE=DATE-TIME:\" . $eventstart->format(\"Ymd\\THi00\") . \"Z\\n\";\r\n }\r\n }\r\n\r\n $body = trim(strip_tags(str_replace(array(\"<br />\", \"<br>\", \"br/>\", \"</p>\"), \"\\n\", $items[$i]->body)));\r\n if ($items[$i]->is_cancelled) $body = gt('This Event Has Been Cancelled') . ' - ' . $body;\r\n $body = str_replace(array(\"\\r\"), \"\", $body);\r\n $body = str_replace(array(\" \"), \" \", $body);\r\n $body = expString::convertSmartQuotes($body);\r\n if (!isset($this->params['style'])) {\r\n // it's going to Outlook so remove all formatting from body text\r\n $body = quoted_printable_encode($body);\r\n } elseif ($this->params['style'] == \"g\") {\r\n // It's going to Google (doesn't like quoted-printable, but likes html breaks)\r\n $body = str_replace(array(\"\\n\"), \"<br />\", $body);\r\n } else {\r\n // It's going elsewhere (doesn't like quoted-printable)\r\n $body = str_replace(array(\"\\n\"), \" -- \", $body);\r\n }\r\n $title = $items[$i]->title;\r\n\r\n $msg .= \"BEGIN:VEVENT\\n\";\r\n $msg .= $dtstart . $dtend;\r\n $msg .= \"UID:\" . $items[$i]->date_id . \"\\n\";\r\n $msg .= \"DTSTAMP:\" . date(\"Ymd\\THis\", time()) . \"Z\\n\";\r\n if ($title) {\r\n $msg .= \"SUMMARY:$title\\n\";\r\n }\r\n if ($body) {\r\n $msg .= \"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:\" . $body . \"\\n\";\r\n }\r\n //\tif($link_url) { $msg .= \"URL: $link_url\\n\";}\r\n if (!empty($this->config['usecategories'])) {\r\n if (!empty($items[$i]->expCat[0]->title)) {\r\n $msg .= \"CATEGORIES:\".$items[$i]->expCat[0]->title.\"\\n\";\r\n } else {\r\n $msg .= \"CATEGORIES:\".$this->config['uncat'].\"\\n\";\r\n }\r\n }\r\n $msg .= \"END:VEVENT\\n\";\r\n }\r\n $msg .= \"END:VCALENDAR\";\r\n\r\n // Kick it out as a file download\r\n ob_end_clean();\r\n\r\n //\t$mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : \"text/x-vCalendar\";\r\n //\t$mime_type = \"text/x-vCalendar\";\r\n $mime_type = 'text/Calendar';\r\n header('Content-Type: ' . $mime_type);\r\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\r\n header('Content-length: ' . strlen($msg));\r\n header('Content-Transfer-Encoding: binary');\r\n header('Content-Encoding:');\r\n //\theader(\"Content-Disposition: inline; filename=\".$Filename.\".ics\");\r\n header('Content-Disposition: attachment; filename=\"' . $Filename . '.ics\"');\r\n // IE need specific headers\r\n //\tif (EXPONENT_USER_BROWSER == 'IE') {\r\n header('Cache-Control: no-cache, must-revalidate');\r\n header('Pragma: public');\r\n header('Vary: User-Agent');\r\n //\t} else {\r\n header('Pragma: no-cache');\r\n //\t}\r\n echo $msg;\r\n exit();\r\n } else {\r\n notfoundController::handle_not_found();\r\n }\r\n } else {\r\n notfoundController::handle_not_found();\r\n }\r\n }\r\n\r\n function send_reminders() {\r\n if (isset($this->params['title']) || isset($this->params['src'])) {\r\n $cfg = new expConfig();\r\n $configs = $cfg->find('all', \"location_data LIKE '%event%'\"); // get all event module configs\r\n foreach ($configs as $config) {\r\n $loc = expUnserialize($config->location_data);\r\n if (!empty($this->params['title'])) {\r\n if ($this->params['title'] == $config->config['feed_sef_url']) {\r\n $this->config = $config->config;\r\n break;\r\n }\r\n } elseif (!empty($this->params['src'])) {\r\n if ($this->params['src'] == $loc->src) {\r\n $this->config = $config->config;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (empty($this->config['reminder_active'])) {\r\n notfoundController::handle_not_found();\r\n return;\r\n }\r\n if (!empty($this->config['reminder_code']) && (empty($this->params['code']) || ($this->params['code'] != $this->config['reminder_code']))) {\r\n notfoundController::handle_not_authorized();\r\n return;\r\n }\r\n\r\n $this->loc = $loc;\r\n $locsql = $this->aggregateWhereClause();\r\n\r\n $view = (isset($this->params['view']) ? $this->params['view'] : '');\r\n if ($view == \"\") {\r\n $view = \"send_reminders\"; // default reminder view\r\n }\r\n\r\n// $template = expTemplate::get_template_for_action($this, $view, $this->loc);\r\n global $template;\r\n\r\n $title = $this->config['feed_title'];\r\n $template->assign('moduletitle', $title);\r\n\r\n $time = (isset($this->params['time']) ? $this->params['time'] : time());\r\n $time = (int)$time;\r\n\r\n $template->assign(\"time\", $time);\r\n\r\n $startperiod = expDateTime::startOfDayTimestamp($time);\r\n if (!empty($this->params['days'])) {\r\n $totaldays = $this->params['days'];\r\n } else {\r\n $totaldays = 7; // default 7 days of events\r\n }\r\n\r\n $count = 0;\r\n $info = getdate($startperiod);\r\n for ($i = 0; $i < $totaldays; $i++) {\r\n $start = mktime(0, 0, 0, $info['mon'], $info['mday'] + $i, $info['year']);\r\n $ed = new eventdate();\r\n $edates = $ed->find('all', $locsql . \" AND (date >= \" . expDateTime::startOfDayTimestamp($start) . \" AND date <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\r\n $days[$start] = array();\r\n// $days[$start] = $this->getEventsForDates($edates);\r\n $days[$start] = $this->event->getEventsForDates($edates);\r\n for ($j = 0, $jMax = count($days[$start]); $j < $jMax; $j++) {\r\n $thisloc = expCore::makeLocation($loc->mod, $loc->src, $days[$start][$j]->id);\r\n $days[$start][$j]->permissions = array(\r\n \"manage\" => (expPermissions::check(\"manage\", $thisloc) || expPermissions::check(\"manage\", $loc)),\r\n \"edit\" => (expPermissions::check(\"edit\", $thisloc) || expPermissions::check(\"edit\", $loc)),\r\n \"delete\" => (expPermissions::check(\"delete\", $thisloc) || expPermissions::check(\"delete\", $loc))\r\n );\r\n }\r\n $counts[$start] = count($days[$start]);\r\n $count += count($days[$start]);\r\n $days[$start] = expSorter::sort(array('array' => $days[$start], 'sortby' => 'eventstart', 'order' => 'ASC'));\r\n }\r\n $template->assign(\"days\", $days);\r\n $template->assign(\"counts\", $counts);\r\n $template->assign(\"start\", $startperiod);\r\n $template->assign(\"totaldays\", $totaldays);\r\n\r\n if ($count == 0) {\r\n flash('error',gt('No Events to Send!'));\r\n echo show_msg_queue('error');\r\n return;\r\n }\r\n\r\n if (bs3())\r\n $css = file_get_contents(BASE . \"external/bootstrap3/css/bootstrap.css\");\r\n elseif (bs2())\r\n $css = file_get_contents(BASE . \"external/bootstrap/css/bootstrap.css\");\r\n else\r\n $css = file_get_contents(BASE . \"framework/modules/events/assets/css/calendar.css\");\r\n $template->assign(\"css\", $css);\r\n $template->assign(\"config\", $this->config);\r\n $template->assign(\"src\", $loc->src);\r\n\r\n // format and send email\r\n $subject = $this->config['email_title_reminder'] . \" - $title\";\r\n $from_addr = $this->config['email_address_reminder'];\r\n $headers = array(\r\n \"From\" => $from = $this->config['email_from_reminder'],\r\n \"Reply-to\" => $reply = $this->config['email_reply_reminder']\r\n );\r\n\r\n // set up the html message\r\n $template->assign(\"showdetail\", !empty($this->config['email_showdetail']));\r\n $htmlmsg = $template->render();\r\n\r\n // now the same thing for the text message\r\n $msg = preg_replace('/(<script[^>]*>.+?<\\/script>|<style[^>]*>.+?<\\/style>)/s', '', $htmlmsg); // remove any script or style blocks\r\n $msg = trim(strip_tags(str_replace(array(\"<br />\", \"<br>\", \"br/>\"), \"\\n\", $msg)));\r\n\r\n // Saved. do notifs\r\n $emails = array();\r\n if (!empty($this->config['user_list'])) foreach ($this->config['user_list'] as $c) {\r\n $u = user::getUserById($c);\r\n $emails[$u->email] = trim(user::getUserAttribution($u->id));\r\n }\r\n if (!empty($this->config['group_list'])) foreach ($this->config['group_list'] as $c) {\r\n $grpusers = group::getUsersInGroup($c);\r\n foreach ($grpusers as $u) {\r\n $emails[$u->email] = trim(user::getUserAttribution($u->id));\r\n }\r\n }\r\n if (!empty($this->config['address_list'])) foreach ($this->config['address_list'] as $c) {\r\n $emails[] = $c;\r\n }\r\n if (empty($emails)) {\r\n flash('error',gt('No One to Send Reminders to!'));\r\n echo show_msg_queue('error');\r\n return;\r\n }\r\n\r\n $emails = array_flip(array_flip($emails));\r\n $emails = array_map('trim', $emails);\r\n// $headers = array(\r\n// \"MIME-Version\" => \"1.0\",\r\n// \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\r\n// );\r\n $mail = new expMail();\r\n $mail->quickSend(array(\r\n// 'headers' => $headers,\r\n 'html_message' => $htmlmsg,\r\n \"text_message\" => $msg,\r\n 'to' => $emails,\r\n 'from' => array(trim($this->config['email_address_reminder']) => $this->config['email_from_reminder']),\r\n 'subject' => $subject,\r\n ));\r\n\r\n flash('message',gt('The following reminder was sent via email'));\r\n echo show_msg_queue();\r\n// echo($htmlmsg);\r\n } else {\r\n flash('error',gt('No Calendar Selected!'));\r\n echo show_msg_queue('error');\r\n }\r\n }\r\n\r\n /** @deprecated moved to event model\r\n * @param $edates\r\n * @param bool $sort_asc\r\n * @param bool $featuredonly\r\n * @param bool $condense\r\n * @return array\r\n */\r\n function getEventsForDates($edates, $sort_asc = true, $featuredonly = false, $condense = false) {\r\n global $eventid;\r\n\r\n $events = array();\r\n $featuresql = \"\";\r\n if ($featuredonly) $featuresql = \" AND is_featured=1\";\r\n foreach ($edates as $edate) {\r\n $evs = $this->event->find('all', \"id=\" . $edate->event_id . $featuresql);\r\n foreach ($evs as $key=>$event) {\r\n if ($condense) {\r\n $eventid = $event->id;\r\n $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;'));\r\n if (!empty($multiday_event)) {\r\n unset($evs[$key]);\r\n continue;\r\n }\r\n }\r\n $evs[$key]->eventstart += $edate->date;\r\n $evs[$key]->eventend += $edate->date;\r\n $evs[$key]->date_id = $edate->id;\r\n if (!empty($event->expCat)) {\r\n $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color);\r\n// if (substr($catcolor,0,1)=='#') $catcolor = '\" style=\"color:'.$catcolor.';';\r\n $evs[$key]->color = $catcolor;\r\n }\r\n }\r\n if (count($events) < 500) { // magic number to not crash loop?\r\n $events = array_merge($events, $evs);\r\n } else {\r\n// $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!');\r\n// $events = array_merge($events, $evs);\r\n flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'));\r\n break; // keep from breaking system by too much data\r\n }\r\n }\r\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\r\n return $events;\r\n }\r\n\r\n function getExternalEvents($startdate, $enddate, $multiday = false) {\r\n global $db;\r\n\r\n $extevents = array();\r\n $dy = 0; // index of events array\r\n if (!empty($this->config['pull_gcal'])) foreach ($this->config['pull_gcal'] as $key=>$extgcalurl) {\r\n// $dy = count($extevents); // index of events array\r\n $cache_hit = false;\r\n $gcal_cname = str_replace(array(\"/\",\":\",\"&\",\"?\"),\"_\",$extgcalurl);\r\n $cache_fname = BASE.'tmp/cache/'.$gcal_cname.\".cache\";\r\n if (file_exists($cache_fname)) {\r\n $cache = unserialize(file_get_contents($cache_fname));\r\n if ($startdate >= $cache['start_date'] || $startdate >= $cache['first_date']) {\r\n $events = $db->selectObjects('event_cache','feed=\"'.$extgcalurl.'\" AND ' . self::build_daterange_sql($startdate,$enddate,'eventdate',true));\r\n foreach ($events as $event) {\r\n if ($multiday) {\r\n $extevents[$event->eventdate][$dy] = $event;\r\n $extevents[$event->eventdate][$dy]->feedkey = $key;\r\n $extevents[$event->eventdate][$dy]->location_data = 'gcalevent' . $key;\r\n $extevents[$event->eventdate][$dy]->color = !empty($this->config['pull_gcal_color'][$key]) ? $this->config['pull_gcal_color'][$key] : null;\r\n if ($event->is_allday) {\r\n $extevents[$event->eventdate][$dy]->eventstart = $event->eventdate;\r\n }\r\n $dy++;\r\n } else {\r\n $endit = !empty($event->dateFinished) ? $event->dateFinished : $event->eventdate;\r\n// for ($i = $startdate; $i < $enddate; $i += 86400) {\r\n for ($i = $event->eventdate; $i <= $endit; $i += 86400) {\r\n if ((!empty($event->dateFinished) && $i > $event->dateFinished) || (empty($event->dateFinished) && $i > $event->eventdate)) {\r\n break;\r\n } else {\r\n $extevents[$i][$dy] = clone($event);\r\n $extevents[$i][$dy]->eventdate = (int)$i;\r\n $extevents[$i][$dy]->eventstart = ($event->eventstart - $event->eventdate);\r\n $extevents[$i][$dy]->eventend = ($event->eventend - (!empty($event->dateFinished)?$event->dateFinished:$event->eventdate));\r\n $extevents[$i][$dy]->eventstart = ($extevents[$i][$dy]->eventstart) + $i;\r\n $extevents[$i][$dy]->eventend = ($extevents[$i][$dy]->eventend) + $i;\r\n $extevents[$i][$dy]->feedkey = $key;\r\n $extevents[$i][$dy]->location_data = 'gcalevent' . $key;\r\n $extevents[$i][$dy]->color = !empty($this->config['pull_gcal_color'][$key]) ? $this->config['pull_gcal_color'][$key] : null;\r\n $dy++;\r\n }\r\n }\r\n }\r\n }\r\n $cache_hit = true;\r\n }\r\n }\r\n if (!$cache_hit) { // pull in the external events\r\n foreach ($this->get_gcal_events($extgcalurl, $startdate, $enddate, $dy, $key, $multiday) as $date=>$events) {\r\n foreach ($events as $event) {\r\n $extevents[$date][] = $event;\r\n }\r\n }\r\n }\r\n }\r\n if (!empty($this->config['pull_ical'])) foreach ($this->config['pull_ical'] as $key=>$exticalurl) {\r\n// $dy = count($extevents); // index of events array\r\n $cache_hit = false;\r\n $ical_cname = str_replace(array(\"/\",\":\",\"&\",\"?\"),\"_\",$exticalurl);\r\n $cache_fname = BASE.'tmp/cache/'.$ical_cname.\".cache\";\r\n if (file_exists($cache_fname)) {\r\n $cache = unserialize(file_get_contents($cache_fname));\r\n if ($startdate >= $cache['start_date'] || $startdate >= $cache['first_date']) {\r\n $events = $db->selectObjects('event_cache','feed=\"'.$exticalurl.'\" AND ' . self::build_daterange_sql($startdate,$enddate,'eventdate',true));\r\n foreach ($events as $event) {\r\n $extevents[$event->eventdate][$dy] = $event;\r\n $extevents[$event->eventdate][$dy]->location_data = 'icalevent' . $key;\r\n $extevents[$event->eventdate][$dy]->color = !empty($this->config['pull_ical_color'][$key]) ? $this->config['pull_ical_color'][$key] : null;\r\n $dy++;\r\n }\r\n $cache_hit = true;\r\n }\r\n }\r\n if (!$cache_hit) { // pull in the external events\r\n foreach ($this->get_ical_events($exticalurl, $startdate, $enddate, $dy, $key, $multiday) as $date=>$events) {\r\n foreach ($events as $event) {\r\n $extevents[$date][] = $event;\r\n }\r\n }\r\n }\r\n }\r\n return $extevents;\r\n }\r\n\r\n public function get_gcal_events($extgcalurl, $startdate, $enddate=null, &$dy=0, $key=0, $multiday=false) {\r\n $extevents = array();\r\n if (!empty($startdate)) $begin = date(\"Y-m-d\\Th:i:sP\", expDateTime::startOfDayTimestamp($startdate));\r\n if (!empty($enddate)) $end = date(\"Y-m-d\\Th:i:sP\", expDateTime::endOfDayTimestamp($enddate));\r\n else $end = date(\"Y-m-d\\Th:i:sP\", (expDateTime::endOfDayTimestamp($startdate + ((3600*24)*30))));\r\n\r\n if (substr($extgcalurl, -5) == 'basic') {\r\n $extgcalurl = substr($extgcalurl, 0, - 5) . 'full';\r\n }\r\n $feed = $extgcalurl . \"?orderby=starttime&singleevents=true\";\r\n if (!empty($startdate)) $feed .= \"&start-min=\" . $begin;\r\n if (!empty($enddate)) $feed .= \"&start-max=\" . $end;\r\n\r\n // XML method\r\n// $s = simplexml_load_file($feed);\r\n// foreach ($s->entry as $item) {\r\n// $gd = $item->children('http://schemas.google.com/g/2005');\r\n// if (!empty($gd->when)) {\r\n// $dtstart = $gd->when->attributes()->startTime;\r\n// } elseif (!empty($gd->recurrence)){\r\n// $dtstart = $gd->recurrence->when->attributes()->startTime;\r\n// } else {\r\n// $dtstart = $item->attributes()->When;\r\n// }\r\n// //FIXME must convert $dtstart timezone\r\n// $eventdate = expDateTime::startOfDayTimestamp(strtotime($dtstart));\r\n// $ourtzoffsets = (int)(date('O',$eventdate)) * 36;\r\n// $theirtzoffset = -((int)(substr($dtstart,-5,2)) * 3600);\r\n// $tzoffset = $ourtzoffsets - $theirtzoffset;\r\n// $extevents[$eventdate][$dy] = new stdClass();\r\n// $extevents[$eventdate][$dy]->eventdate = $eventdate;\r\n// $extevents[$eventdate][$dy]->eventstart += strtotime($dtstart) + $tzoffset;\r\n// if (!empty($gd->when)) {\r\n// $dtend = $gd->when->attributes()->endTime;\r\n// } elseif (!empty($gd->recurrence)) {\r\n// $dtend = $gd->recurrence->when->attributes()->endTime;\r\n// }\r\n// //FIXME must convert $dtend timezone\r\n// if (!empty($dtend)) $extevents[$eventdate][$dy]->eventend += strtotime($dtend) + $tzoffset;\r\n// // dtstart required, one occurrence, (orig. start date)\r\n// $extevents[$eventdate][$dy]->title = $item->title;\r\n// $extevents[$eventdate][$dy]->body = $item->content;\r\n // End XML method\r\n\r\n // DOM method\r\n $doc = new DOMDocument();\r\n $doc->load($feed);\r\n $entries = $doc->getElementsByTagName(\"entry\");\r\n foreach ($entries as $item) {\r\n $times = $item->getElementsByTagName(\"when\");\r\n $dtstart = $times->item(0)->getAttributeNode(\"startTime\")->value;\r\n $eventdate = expDateTime::startOfDayTimestamp(strtotime($dtstart));\r\n $extevents[$eventdate][$dy] = new stdClass();\r\n $extevents[$eventdate][$dy]->eventdate = $eventdate;\r\n $dtend = @$times->item(0)->getAttributeNode(\"endTime\")->value;\r\n $ourtzoffsets = (int)date('O',$eventdate) * 36;\r\n $theirtzoffset = -((int)substr($dtstart,-5,2) * 3600);\r\n $tzoffset = $ourtzoffsets - $theirtzoffset;\r\n if (strlen($dtstart) > 10) {\r\n $extevents[$eventdate][$dy]->eventstart = ((int)substr($dtstart, 11, 2) * 3600) + ((int)substr($dtstart, 14, 2) * 60) + $tzoffset;\r\n// if (date(\"I\", $eventdate)) $extevents[$eventdate][$dy]->eventstart += 3600;\r\n $extevents[$eventdate][$dy]->eventend = ((int)substr($dtend, 11, 2) * 3600) + ((int)substr($dtend, 14, 2) * 60) + $tzoffset;\r\n// if (date(\"I\", $eventdate)) $extevents[$eventdate][$dy]->eventend += 3600;\r\n } else {\r\n $extevents[$eventdate][$dy]->eventstart = null;\r\n $extevents[$eventdate][$dy]->is_allday = 1;\r\n }\r\n $extevents[$eventdate][$dy]->eventstart += $eventdate;\r\n $extevents[$eventdate][$dy]->eventend += $eventdate;\r\n if (empty($dtend)) $extevents[$eventdate][$dy]->eventend = $extevents[$eventdate][$dy]->eventstart;\r\n\r\n $titles = $item->getElementsByTagName(\"title\");\r\n $extevents[$eventdate][$dy]->title = $titles->item(0)->nodeValue;\r\n $contents = $item->getElementsByTagName(\"content\");\r\n $extevents[$eventdate][$dy]->body = $contents->item(0)->nodeValue;\r\n // End DOM method\r\n\r\n// $extevents[$eventdate][$dy]->location_data = serialize(expCore::makeLocation('extevent',$extcal->id));\r\n $extevents[$eventdate][$dy]->location_data = 'gcalevent' . $key;\r\n $extevents[$eventdate][$dy]->color = !empty($this->config['pull_gcal_color'][$key]) ? $this->config['pull_gcal_color'][$key] : null;\r\n $dy++;\r\n }\r\n return $extevents;\r\n }\r\n\r\n public function get_ical_events($exticalurl, $startdate=null, $enddate=null, &$dy=0, $key=0, $multiday=false) {\r\n $extevents = array();\r\n// require_once BASE . 'external/iCalcreator.class.php';\r\n require_once BASE . 'external/iCalcreator-2.22/iCalcreator.php';\r\n $v = new vcalendar(); // initiate new CALENDAR\r\n if (stripos($exticalurl, 'http') === 0) {\r\n $v->setConfig('url', $exticalurl);\r\n } else {\r\n $v->setConfig('directory', dirname($exticalurl));\r\n $v->setConfig('filename', basename($exticalurl));\r\n }\r\n $v->parse();\r\n if ($startdate === null) {\r\n $startYear = false;\r\n $startMonth = false;\r\n $startDay = false;\r\n } else {\r\n $startYear = date('Y', $startdate);\r\n $startMonth = date('n', $startdate);\r\n $startDay = date('j', $startdate);\r\n }\r\n if ($enddate === null) {\r\n $endYear = $startYear+1;\r\n $endMonth = $startMonth;\r\n $endDay = $startDay;\r\n } else {\r\n $endYear = date('Y', $enddate);\r\n $endMonth = date('n', $enddate);\r\n $endDay = date('j', $enddate);\r\n }\r\n // get all events within period split out recurring events as single events per each day\r\n $eventArray = $v->selectComponents($startYear, $startMonth, $startDay, $endYear, $endMonth, $endDay, 'vevent');\r\n // Set the timezone to GMT\r\n @date_default_timezone_set('GMT');\r\n $tzarray = getTimezonesAsDateArrays($v);\r\n // Set the default timezone\r\n @date_default_timezone_set(DISPLAY_DEFAULT_TIMEZONE);\r\n if (!empty($eventArray)) foreach ($eventArray as $year => $yearArray) {\r\n if (!empty($yearArray)) foreach ($yearArray as $month => $monthArray) {\r\n if (!empty($monthArray)) foreach ($monthArray as $day => $dailyEventsArray) {\r\n if (!empty($dailyEventsArray)) foreach ($dailyEventsArray as $vevent) {\r\n // process each event\r\n $yesterday = false;\r\n $currdate = $vevent->getProperty('x-current-dtstart');\r\n $thisday = explode('-', $currdate[1]);\r\n $thisday2 = substr($thisday[2], 0, 2);\r\n // if member of a recurrence set,\r\n // returns array( 'x-current-dtstart', <DATE>)\r\n // <DATE> = (string) date(\"Y-m-d [H:i:s][timezone/UTC offset]\")\r\n $dtstart = $vevent->getProperty('dtstart', false, true);\r\n $dtend = $vevent->getProperty('dtend', false, true);\r\n if (empty($dtend))\r\n $dtend = $dtstart;\r\n\r\n // calculate the cumulative timezone offset in seconds to convert to local/system time\r\n $tzoffsets = array();\r\n $date_tzoffset = 0;\r\n if (!empty($tzarray)) {\r\n// $ourtzoffsets = -(iCalUtilityFunctions::_tz2offset(date('O',time())));\r\n $ourtzoffsets = -(iCalUtilityFunctions::_tz2offset(date('O',self::_date2timestamp($dtstart['value']))));\r\n // Set the timezone to GMT\r\n @date_default_timezone_set('GMT');\r\n if (!empty($dtstart['params']['TZID'])) $tzoffsets = getTzOffsetForDate($tzarray, $dtstart['params']['TZID'], $dtstart['value']);\r\n // Set the default timezone\r\n @date_default_timezone_set(DISPLAY_DEFAULT_TIMEZONE);\r\n if (isset($tzoffsets['offsetSec'])) $date_tzoffset = $ourtzoffsets + $tzoffsets['offsetSec'];\r\n }\r\n if (empty($tzoffsets)) {\r\n $date_tzoffset = -(iCalUtilityFunctions::_tz2offset(date('O',self::_date2timestamp($dtstart['value']))));\r\n }\r\n //FIXME we must have the real timezone offset for the date by this point\r\n\r\n //FIXME this is for the google ical feed which is bad!\r\n if ($dtstart['value']['day'] != (int)$thisday2 && (isset($dtstart['value']['day']) && isset($dtend['value']['hour']))&&\r\n !((int)$dtstart['value']['hour'] == 0 && (int)$dtstart['value']['min'] == 0 && (int)$dtstart['value']['sec'] == 0\r\n && (int)$dtend['value']['hour'] == 0 && (int)$dtend['value']['min'] == 0 && (int)$dtend['value']['sec'] == 0\r\n && ((((int)$dtstart['value']['day'] - (int)$dtend['value']['day']) == -1) || (((int)$dtstart['value']['month'] - (int)$dtend['value']['month']) == -1) || (((int)$dtstart['value']['month'] - (int)$dtend['value']['month']) == -11)))) {\r\n $dtst = strtotime($currdate[1]);\r\n $dtst1 = iCalUtilityFunctions::_timestamp2date($dtst);\r\n $dtstart['value']['year'] = $dtst1['year'];\r\n $dtstart['value']['month'] = $dtst1['month'];\r\n $dtstart['value']['day'] = $dtst1['day'];\r\n $currenddate = $vevent->getProperty('x-current-dtend');\r\n $dtet = strtotime($currenddate[1]);\r\n $dtet1 = iCalUtilityFunctions::_timestamp2date($dtet);\r\n $dtend['value']['year'] = $dtet1['year'];\r\n $dtend['value']['month'] = $dtet1['month'];\r\n $dtend['value']['day'] = $dtet1['day'];\r\n// $date_tzoffset = 0;\r\n }\r\n\r\n if (!empty($dtstart['value']['hour']) && !((int)$dtstart['value']['hour'] == 0 && (int)$dtstart['value']['min'] == 0 && (int)$dtstart['value']['sec'] == 0\r\n && (int)$dtend['value']['hour'] == 0 && (int)$dtend['value']['min'] == 0 && (int)$dtend['value']['sec'] == 0\r\n && ((((int)$dtstart['value']['day'] - (int)$dtend['value']['day']) == -1) || (((int)$dtstart['value']['month'] - (int)$dtend['value']['month']) == -1) || (((int)$dtstart['value']['month'] - (int)$dtend['value']['month']) == -11)))) {\r\n $eventdate = expDateTime::startOfDayTimestamp(self::_date2timestamp($dtstart['value']) - $date_tzoffset);\r\n// $eventend = expDateTime::startOfDayTimestamp(self::_date2timestamp($dtend['value']) - $date_tzoffset);\r\n $extevents[$eventdate][$dy] = new stdClass();\r\n $extevents[$eventdate][$dy]->eventdate = new stdClass();\r\n $extevents[$eventdate][$dy]->eventdate->date = $eventdate;\r\n// if ((int)($dtstart['value']['hour']) == 0 && (int)($dtstart['value']['min']) == 0 && (int)($dtstart['value']['sec']) == 0\r\n// && (int)($dtend['value']['hour']) == 0 && (int)($dtend['value']['min']) == 0 && (int)($dtend['value']['sec']) == 0\r\n// && ((((int)($dtstart['value']['day']) - (int)($dtend['value']['day'])) == -1) || (((int)($dtstart['value']['month']) - (int)($dtend['value']['month'])) == -1) || (((int)($dtstart['value']['month']) - (int)($dtend['value']['month'])) == -11))) {\r\n//// if ($dtstart['value']['day'] != (int)($thisday2)) {\r\n// if (date('d',$eventdate) != $thisday2) {\r\n//// if (date('d',$eventdate) != date('d',$eventend)) {\r\n// $yesterday = true;\r\n// } else {\r\n// $extevents[$eventdate][$dy]->eventstart = null;\r\n// $extevents[$eventdate][$dy]->is_allday = 1;\r\n// }\r\n// } else {\r\n if (date('d',$eventdate) != $thisday2) {\r\n// if (date('d',$eventdate) != date('d',$eventend)) {\r\n $yesterday = true;\r\n } else {\r\n $extevents[$eventdate][$dy]->eventstart = ($dtstart['value']['hour'] * 3600) + ($dtstart['value']['min'] * 60) - $date_tzoffset;\r\n// if (date(\"I\", $eventdate)) $extevents[$eventdate][$dy]->eventstart += 3600; // adjust for daylight savings time\r\n }\r\n// }\r\n } else {\r\n // this is an all day event\r\n $eventdate = expDateTime::startOfDayTimestamp(self::_date2timestamp($dtstart['value']));\r\n// $eventend = expDateTime::startOfDayTimestamp(self::_date2timestamp($dtend['value']));\r\n $extevents[$eventdate][$dy] = new stdClass();\r\n $extevents[$eventdate][$dy]->eventdate = new stdClass();\r\n $extevents[$eventdate][$dy]->eventdate->date = $eventdate;\r\n// if ($dtstart['value']['day'] != (int)($thisday2)) {\r\n if (date('d',$eventdate) != $thisday2) {\r\n// if (date('d',$eventdate) != date('d',$eventend)) {\r\n $yesterday = true;\r\n } else {\r\n $extevents[$eventdate][$dy]->eventstart = null;\r\n $extevents[$eventdate][$dy]->is_allday = 1;\r\n }\r\n }\r\n\r\n // set the end time if needed\r\n if (!$yesterday && isset($dtend['value']['hour']) && empty($extevents[$eventdate][$dy]->is_allday)) {\r\n// if ($dtend['value']['day'] != (int)($thisday2)) {\r\n// if ((date('d',$eventend) != $thisday2)) {\r\n// $yesterday = true;\r\n// } else {\r\n $extevents[$eventdate][$dy]->eventend = ($dtend['value']['hour'] * 3600) + ($dtend['value']['min'] * 60) - $date_tzoffset;\r\n// if (date(\"I\", $eventdate)) $extevents[$eventdate][$dy]->eventend += 3600; // adjust for daylight savings time\r\n// }\r\n }\r\n\r\n // convert the start and end times to a full date\r\n if (isset($extevents[$eventdate][$dy]->eventstart) && $extevents[$eventdate][$dy]->eventstart != null)\r\n $extevents[$eventdate][$dy]->eventstart += $eventdate;\r\n if (isset($extevents[$eventdate][$dy]->eventend))\r\n $extevents[$eventdate][$dy]->eventend += $eventdate;\r\n\r\n // dtstart required, one occurrence, (orig. start date)\r\n $extevents[$eventdate][$dy]->title = $vevent->getProperty('summary');\r\n $body = $vevent->getProperty('description');\r\n // convert end of lines\r\n $body = nl2br(str_replace(\"\\\\n\",\" <br>\\n\",$body));\r\n $body = str_replace(\"\\n\",\" <br>\\n\",$body);\r\n $body = str_replace(array('==0A','=0A','=C2=A0'),\" <br>\\n\",$body);\r\n $extevents[$eventdate][$dy]->body = $body;\r\n $extevents[$eventdate][$dy]->location_data = 'icalevent' . $key;\r\n $extevents[$eventdate][$dy]->color = !empty($this->config['pull_ical_color'][$key]) ? $this->config['pull_ical_color'][$key] : null;\r\n if (!$yesterday && $eventdate >= $startdate) {\r\n $dy++;\r\n } else {\r\n unset($extevents[$eventdate][$dy]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return $extevents;\r\n }\r\n\r\n public static function _date2timestamp( $datetime, $wtz=null ) {\r\n if( !isset( $datetime['hour'] )) $datetime['hour'] = 0;\r\n if( !isset( $datetime['min'] )) $datetime['min'] = 0;\r\n if( !isset( $datetime['sec'] )) $datetime['sec'] = 0;\r\n if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || empty( $datetime['tz'] )))\r\n return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );\r\n $output = $offset = 0;\r\n if( empty( $wtz )) {\r\n if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) {\r\n $offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1;\r\n $wtz = 'UTC';\r\n }\r\n else\r\n $wtz = $datetime['tz'];\r\n }\r\n if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz )))\r\n $wtz = 'UTC';\r\n try {\r\n $strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] );\r\n $d = new DateTime( $strdate, new DateTimeZone( $wtz ));\r\n if( 0 != $offset ) // adjust for offset\r\n $d->modify( $offset.' seconds' );\r\n $output = $d->format( 'U' );\r\n unset( $d );\r\n }\r\n catch( Exception $e ) {\r\n $output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );\r\n }\r\n return $output;\r\n }\r\n\r\n /**\r\n * build/update the external event cache\r\n *\r\n */\r\n public function build_cache() {\r\n global $db;\r\n\r\n // get our requested config\r\n $cfg = new expConfig();\r\n $configs = $cfg->find('all', \"location_data LIKE '%event%'\"); // get all event module configs\r\n foreach ($configs as $config) {\r\n $loc = expUnserialize($config->location_data);\r\n if (!empty($this->params['title'])) {\r\n if ($this->params['title'] == $config->config['feed_sef_url']) {\r\n $this->config = $config->config;\r\n break;\r\n }\r\n } elseif (!empty($this->params['src'])) {\r\n if ($this->params['src'] == $loc->src) {\r\n $this->config = $config->config;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // next loop through our config pull urls\r\n\r\n // google xml pull\r\n if (!empty($this->config['pull_gcal'])) foreach ($this->config['pull_gcal'] as $key=>$extgcalurl) {\r\n $start = expDateTime::startOfMonthTimestamp(time());\r\n $gcal_cname = str_replace(array(\"/\",\":\",\"&\",\"?\"),\"_\",$extgcalurl);\r\n $cache_fname = BASE.'tmp/cache/'.$gcal_cname.\".cache\";\r\n $db->delete('event_cache', \"feed='\" . $extgcalurl . \"' AND eventdate > \" . $start); // replace future events\r\n // loop through 12 months, 1 month at a time\r\n for ($i=1; $i < 13; $i++) {\r\n $end = expDateTime::endOfMonthTimestamp($start);\r\n $tmp = 0;\r\n $extevents = $this->get_gcal_events($extgcalurl, $start, $end, $tmp, 0, true);\r\n// $extevents = $this->get_gcal_events($extgcalurl, null, null, 0, 0, 0, true);\r\n foreach ($extevents as $day) {\r\n foreach ($day as $extevent) {\r\n $event_cache = new stdClass();\r\n $event_cache->feed = $extgcalurl;\r\n $event_cache->event_id = $extevent->event_id;\r\n $event_cache->title = $extevent->title;\r\n $event_cache->body = $extevent->body;\r\n $event_cache->eventdate = $extevent->eventdate->date;\r\n if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)\r\n $event_cache->dateFinished = $extevent->dateFinished;\r\n if (isset($extevent->eventstart))\r\n $event_cache->eventstart = $extevent->eventstart;\r\n if (isset($extevent->eventend))\r\n $event_cache->eventend = $extevent->eventend;\r\n if (isset($extevent->is_allday))\r\n $event_cache->is_allday = $extevent->is_allday;\r\n $found = false;\r\n if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries\r\n $found = $db->selectObject('event_cache','feed=\"'.$extgcalurl.'\" AND event_id=\"'.$event_cache->event_id.'\" AND eventdate='.$event_cache->eventdate);\r\n if (!$found)\r\n $db->insertObject($event_cache,'event_cache');\r\n }\r\n }\r\n $start = expDateTime::startOfMonthTimestamp($end + 1024);\r\n }\r\n $cache_contents = serialize(array('start_date'=>$start,'first_date'=>(int)$db->selectValue('event_cache','eventdate','feed=\"'.$extgcalurl.'\" ORDER BY eventdate'),'refresh_date'=>time()));\r\n file_put_contents($cache_fname, $cache_contents);\r\n }\r\n\r\n // ical pull\r\n $start = expDateTime::startOfMonthTimestamp(time());\r\n if (!empty($this->config['pull_ical'])) foreach ($this->config['pull_ical'] as $key=>$exticalurl) {\r\n $ical_cname = str_replace(array(\"/\",\":\",\"&\",\"?\"),\"_\",$exticalurl);\r\n $cache_fname = BASE.'tmp/cache/'.$ical_cname.\".cache\";\r\n $db->delete('event_cache', \"feed='\" . $exticalurl . \"' AND eventdate > \" . $start);\r\n // get 1 years worth of events\r\n $extevents = $this->get_ical_events($exticalurl, $start);\r\n foreach ($extevents as $day) {\r\n foreach ($day as $extevent) {\r\n $event_cache = new stdClass();\r\n $event_cache->feed = $exticalurl;\r\n $event_cache->title = $extevent->title;\r\n $event_cache->body = $extevent->body;\r\n $event_cache->eventdate = $extevent->eventdate->date;\r\n if (isset($extevent->dateFinished))\r\n $event_cache->dateFinished = $extevent->dateFinished;\r\n $event_cache->eventstart = $extevent->eventstart;\r\n if (isset($extevent->eventend))\r\n $event_cache->eventend = $extevent->eventend;\r\n if (isset($extevent->is_allday))\r\n $event_cache->is_allday = $extevent->is_allday;\r\n $db->insertObject($event_cache, 'event_cache');\r\n }\r\n }\r\n $cache_contents = serialize(array('start_date'=>$start,'first_date'=>(int)$db->selectValue('event_cache','eventdate','feed=\"'.$exticalurl.'\" ORDER BY eventdate'),'refresh_date'=>time()));\r\n file_put_contents($cache_fname, $cache_contents);\r\n }\r\n flash('message', gt('External Calendar Event cache updated'));\r\n echo show_msg_queue();\r\n }\r\n\r\n function import() {\r\n $pullable_modules = expModules::listInstalledControllers($this->baseclassname);\r\n $modules = new expPaginator(array(\r\n 'records' => $pullable_modules,\r\n 'controller' => $this->loc->mod,\r\n 'action' => $this->params['action'],\r\n 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\r\n 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\r\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\r\n 'columns' => array(\r\n gt('Title') => 'title',\r\n gt('Page') => 'section'\r\n ),\r\n ));\r\n\r\n assign_to_template(array(\r\n 'modules' => $modules,\r\n ));\r\n }\r\n\r\n function import_select()\r\n {\r\n if (empty($this->params['import_aggregate'])) {\r\n expValidator::setErrorField('import_aggregate[]');\r\n expValidator::failAndReturnToForm(gt('You must select a module.'), $this->params);\r\n }\r\n $extevents = array();\r\n unset(\r\n $this->params['begin'],\r\n $this->params['end']\r\n ); // always use date value\r\n $begin = yuidatetimecontrol::parseData('begin', $this->params);\r\n $end = yuidatetimecontrol::parseData('end', $this->params);\r\n if ($this->params['file_type'] == 'file') {\r\n //Get the temp directory to put the uploaded file\r\n $directory = \"tmp\";\r\n\r\n //Get the file save it to the temp directory\r\n if (!empty($_FILES[\"import_file\"]) && $_FILES[\"import_file\"][\"error\"] == UPLOAD_ERR_OK) {\r\n $file = expFile::fileUpload(\r\n \"import_file\",\r\n false,\r\n false,\r\n time() . \"_\" . $_FILES['import_file']['name'],\r\n $directory . '/'\r\n );\r\n if ($file === null) {\r\n switch ($_FILES[\"import_file\"][\"error\"]) {\r\n case UPLOAD_ERR_INI_SIZE:\r\n case UPLOAD_ERR_FORM_SIZE:\r\n $this->params['_formError'] = gt(\r\n 'The file you attempted to upload is too large. Contact your system administrator if this is a problem.'\r\n );\r\n break;\r\n case UPLOAD_ERR_PARTIAL:\r\n $this->params['_formError'] = gt('The file was only partially uploaded.');\r\n break;\r\n case UPLOAD_ERR_NO_FILE:\r\n $this->params['_formError'] = gt('No file was uploaded.');\r\n break;\r\n default:\r\n $this->params['_formError'] = gt(\r\n 'A strange internal error has occurred. Please contact the Exponent Developers.'\r\n );\r\n break;\r\n }\r\n expSession::set(\"last_POST\", $this->params);\r\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\r\n exit(\"\");\r\n } else {\r\n $extevents = $this->get_ical_events($directory . \"/\" . $file->filename, $begin, $end);\r\n }\r\n } else {\r\n expValidator::setErrorField('import_file');\r\n expValidator::failAndReturnToForm(gt('File failed to upload.'), $this->params); // file upload error\r\n }\r\n } else {\r\n if (empty($this->params['ext_feed'])) {\r\n expValidator::setErrorField('ext_feed');\r\n expValidator::failAndReturnToForm(gt('You must enter a feed url.'), $this->params);\r\n }\r\n $extevents = $this->get_ical_events($this->params['ext_feed'], $begin, $end);\r\n }\r\n\r\n $src = $this->params['import_aggregate'][0];\r\n $count = 0;\r\n foreach ($extevents as $day) {\r\n foreach ($day as $extevent) {\r\n $event = array();\r\n $event['title'] = $extevent->title;\r\n $event['body'] = $extevent->body;\r\n $event['eventdate'] = $extevent->eventdate->date;\r\n $event['eventstart'] = $extevent->eventstart;\r\n $event['eventstart'] -= $event['eventdate'];\r\n if (isset($extevent->eventend))\r\n $event['eventend'] = $extevent->eventend;\r\n else\r\n $event['eventend'] = $extevent->eventstart;\r\n $event['eventend'] -= $event['eventdate'];\r\n if (isset($extevent->is_allday))\r\n $event['is_allday'] = $extevent->is_allday;\r\n $event['module'] = 'event';\r\n $event['src'] = $src;\r\n $item = new event(); // create new populated record to auto-set things\r\n $item->update($event);\r\n $count++;\r\n }\r\n }\r\n\r\n unlink($directory . \"/\" . $file->filename);\r\n\r\n // update search index\r\n $this->addContentToSearch();\r\n\r\n flashAndFlow('message', $count . ' ' . gt('events were imported.'));\r\n }\r\n\r\n /** @deprecated\r\n * function to build a control requested via ajax\r\n * we the html just like the control smarty function\r\n * @deprecated\r\n */\r\n public function buildControl() {\r\n $control = new colorcontrol();\r\n if (!empty($this->params['value'])) $control->value = $this->params['value'];\r\n if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value'];\r\n $control->default = $this->params['value'];\r\n if (!empty($this->params['hide'])) $control->hide = $this->params['hide'];\r\n if (isset($this->params['flip'])) $control->flip = $this->params['flip'];\r\n $this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : '';\r\n $control->name = $this->params['name'];\r\n $this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : '';\r\n $control->id = isset($this->params['id']) && $this->params['id'] != \"\" ? $this->params['id'] : \"\";\r\n //echo $control->id;\r\n if (empty($control->id)) $control->id = $this->params['name'];\r\n if (empty($control->name)) $control->name = $this->params['id'];\r\n\r\n // attempt to translate the label\r\n if (!empty($this->params['label'])) {\r\n $this->params['label'] = gt($this->params['label']);\r\n } else {\r\n $this->params['label'] = null;\r\n }\r\n echo $control->toHTML($this->params['label'], $this->params['name']);\r\n// $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code)));\r\n// $ar->send();\r\n }\r\n\r\n}\r\n\r",
"?>"
] |
[
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class eventController extends expController {\n// public $basemodel_name = 'event';\n public $useractions = array(\n 'showall' => 'Show Calendar',\n );\n// protected $manage_permissions = array(\n// 'import' => 'Import Calendar',\n// );\n public $remove_configs = array(\n 'comments',\n 'ealerts',\n// 'facebook',\n 'files',\n 'pagination',\n 'rss',\n// 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" static function displayname() {\n return \"Events\";\n }",
" static function description() {\n return \"Manage events and schedules, and optionally publish them.\";\n }",
" static function author() {\n return \"Dave Leffler\";\n }",
" static function isSearchable() {\n return true;\n }",
" function searchName() {\n return gt(\"Calendar Event\");\n }",
" function searchCategory() {\n return gt('Event');\n }",
" /**\n * can this module import data?\n *\n * @return bool\n */\n public static function canImportData() {\n return true;\n }",
" function showall() {\n global $user;",
" expHistory::set('viewable', $this->params);\n $locsql = $this->aggregateWhereClause();\n $time = (isset($this->params['time']) ? intval($this->params['time']) : time());\n assign_to_template(array(\n 'time' => $time,\n 'daynames' => event::dayNames(),\n ));",
" $regcolor = !empty($this->config['registrations_color']) ? $this->config['registrations_color'] : null;",
" $ed = new eventdate();\n $viewtype = 'default';\n $viewrange = 'all';\n $view = !empty($this->params['view']) ? $this->params['view'] : 'showall';\n switch ($view) {\n case 'showall_Administration':\n $viewtype = \"administration\";\n break;\n case 'showall_Past Events':\n $viewrange = \"past\";\n break;\n case 'showall_Monthly Summary':\n case 'showall_Mini-Calendar':\n case 'minical':\n $viewtype = \"minical\";\n break;\n case 'showall_Monthly List':\n case 'showall_List':\n case 'monthlist':\n $viewtype = \"byday\";\n $viewrange = \"month\";\n break;\n case 'showall_Week':\n case 'week':\n $viewtype = \"byday\";\n $viewrange = \"week\";\n break;\n case 'showall_Day':\n case 'day':\n $viewtype = \"byday\";\n $viewrange = \"day\";\n break;\n case 'showall_announcement':\n case 'showall_Upcoming Events':\n case 'showall_Upcoming Events - Headlines':\n $viewrange = \"upcoming\";\n break;\n case 'showall':\n case 'month':\n $viewtype = \"monthly\";\n break;\n default :\n $view_params = explode('_',$view);\n if (!empty($view_params[1])) $viewtype = $view_params[1];\n if (!empty($view_params[2])) $viewrange = $view_params[2];\n } // end switch $view",
" switch ($viewtype) {\n case \"minical\":\n $monthly = expDateTime::monthlyDaysTimestamp($time);\n $info = getdate($time);\n $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $now = getdate(time());\n $currentday = $now['mday'];\n $endofmonth = date('t', $time);\n foreach ($monthly as $weekNum => $week) {\n foreach ($week as $dayNum => $day) {\n if ($dayNum == $now['mday']) {\n $currentweek = $weekNum;\n }\n if ($dayNum <= $endofmonth) {\n// $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $db->countObjects(\"eventdate\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($day['ts']) . \" AND date <= \" . expDateTime::endOfDayTimestamp($day['ts'])) : -1;\n $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $ed->find(\"count\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($day['ts']) . \" AND date <= \" . expDateTime::endOfDayTimestamp($day['ts'])) : -1;\n }\n }\n }\n $prevmonth = mktime(0, 0, 0, date(\"m\", $timefirst) - 1, date(\"d\", $timefirst) + 10, date(\"Y\", $timefirst));\n $nextmonth = mktime(0, 0, 0, date(\"m\", $timefirst) + 1, date(\"d\", $timefirst) + 10, date(\"Y\", $timefirst));\n assign_to_template(array(\n \"monthly\" => $monthly,\n \"currentweek\" => $currentweek,\n \"currentday\" => $currentday,\n \"now\" => $timefirst,\n \"prevmonth\" => $prevmonth,\n \"thismonth\" => $timefirst,\n \"nextmonth\" => $nextmonth,\n ));\n break; // end switch $viewtype minicalendar\n case \"byday\": //note aggregates events by groups of days\n // Remember this is the code for weekly view and monthly listview\n // Test your fixes on both views\n // \t\t$startperiod = 0;\n //\t\t\t$totaldays = 0;\n switch ($viewrange) {\n case \"day\":\n $startperiod = expDateTime::startOfDayTimestamp($time);\n $totaldays = 1;\n $next = expDateTime::endOfDayTimestamp($startperiod);\n if (!empty($this->config['starttype'])) $startperiod = $time;\n $this->params['time'] = $time;\n assign_to_template(array(\n \"prev_timestamp3\" => strtotime('-3 days', $startperiod),\n \"prev_timestamp2\" => strtotime('-2 days', $startperiod),\n \"prev_timestamp\" => strtotime('-1 days', $startperiod),\n \"next_timestamp\" => strtotime('+1 days', $startperiod),\n \"next_timestamp2\" => strtotime('+2 days', $startperiod),\n \"next_timestamp3\" => strtotime('+3 days', $startperiod),\n 'params' => $this->params\n ));\n break;\n case \"week\":\n $startperiod = expDateTime::startOfWeekTimestamp($time);\n $totaldays = 7;\n $next = strtotime('+7 days', $startperiod);\n// $next = expDateTime::endOfWeekTimestamp($startperiod);\n if (!empty($this->config['starttype'])) $startperiod = $time;\n $this->params['time'] = $time;\n assign_to_template(array(\n \"prev_timestamp3\" => strtotime('-21 days', $startperiod),\n \"prev_timestamp2\" => strtotime('-14 days', $startperiod),\n \"prev_timestamp\" => strtotime('-7 days', $startperiod),\n \"next_timestamp\" => $next,\n \"next_timestamp2\" => strtotime('+14 days', $startperiod),\n \"next_timestamp3\" => strtotime('+21 days', $startperiod),\n 'params' => $this->params\n ));\n break;\n case \"twoweek\":\n $startperiod = expDateTime::startOfWeekTimestamp($time);\n $totaldays = 14;\n $next = strtotime('+14 days', $startperiod);\n if (!empty($this->config['starttype'])) $startperiod = $time;\n assign_to_template(array(\n \"prev_timestamp3\" => strtotime('-42 days', $startperiod),\n \"prev_timestamp2\" => strtotime('-28 days', $startperiod),\n \"prev_timestamp\" => strtotime('-14 days', $startperiod),\n \"next_timestamp\" => $next,\n \"next_timestamp2\" => strtotime('+28 days', $startperiod),\n \"next_timestamp3\" => strtotime('+42 days', $startperiod),\n ));\n break;\n case \"month\":\n default: // range = month\n $startperiod = expDateTime::startOfMonthTimestamp($time);\n $totaldays = date('t', $time);\n $next = strtotime('+1 months', $startperiod);\n// $next = expDateTime::endOfMonthTimestamp($startperiod);\n $this->params['time'] = $time;\n assign_to_template(array(\n \"prev_timestamp3\" => strtotime('-3 months', $startperiod),\n \"prev_timestamp2\" => strtotime('-2 months', $startperiod),\n \"prev_timestamp\" => strtotime('-1 months', $startperiod),\n \"next_timestamp\" => $next,\n \"next_timestamp2\" => strtotime('+2 months', $startperiod),\n \"next_timestamp3\" => strtotime('+3 months', $startperiod),\n 'params' => $this->params\n ));\n break;\n } // end switch $viewrange",
" // $days = array();\n // added per Ignacio\n //\t\t\t$endofmonth = date('t', $time);\n $extitems = $this->getExternalEvents($startperiod, $next);\n if (!empty($this->config['aggregate_registrations']))\n $regitems = eventregistrationController::getRegEventsForDates($startperiod, $next, $regcolor);\n for ($i = 1; $i <= $totaldays; $i++) {\n // $info = getdate($time);\n // switch ($viewrange) {\n // case \"week\":\n // $start = mktime(0,0,0,$info['mon'],$i,$info['year']); //FIXME this can't be right?\n // break;\n // case \"twoweek\":\n //// $start = mktime(0,0,0,$info['mon'],$info['mday']+($i-1),$info['year']); //FIXME this can't be right?\n // \t\t $start = $startperiod + ($i*86400);\n // break;\n // default: // range = month\n // $start = mktime(0,0,0,$info['mon'],$i,$info['year']);\n // }\n $start = expDateTime::startOfDayTimestamp($startperiod + ($i * 86400) - 86400);\n $edates = $ed->find(\"all\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($start) . \" AND date <= \" . expDateTime::endOfDayTimestamp($start));\n// $days[$start] = $this->getEventsForDates($edates, true, isset($this->config['only_featured']) ? true : false);\n $days[$start] = $this->event->getEventsForDates($edates, true, isset($this->config['only_featured']) ? true : false);\n // for ($j = 0; $j < count($days[$start]); $j++) {\n // $thisloc = expCore::makeLocation($this->loc->mod,$this->loc->src,$days[$start][$j]->id);\n // $days[$start][$j]->permissions = array(\n // \"manage\"=>(expPermissions::check(\"manage\",$thisloc) || expPermissions::check(\"manage\",$this->loc)),\n // \"edit\"=>(expPermissions::check(\"edit\",$thisloc) || expPermissions::check(\"edit\",$this->loc)),\n // \"delete\"=>(expPermissions::check(\"delete\",$thisloc) || expPermissions::check(\"delete\",$this->loc))\n // );\n // }\n if (!empty($extitems[$start]))\n $days[$start] = array_merge($extitems[$start], $days[$start]);\n if (!empty($regitems[$start]))\n $days[$start] = array_merge($regitems[$start], $days[$start]);\n $days[$start] = expSorter::sort(array('array' => $days[$start], 'sortby' => 'eventstart', 'order' => 'ASC'));\n }\n assign_to_template(array(\n \"time\" => $startperiod,\n 'days' => $days,\n \"now\" => $startperiod,\n ));\n break; // end switch $viewtype byday\n case \"monthly\": //note this is a simply array of events for the requested month\n // build a month array of weeks with an array of days\n // $monthly = array();\n // $counts = array();\n $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;\n $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = (int)date('W',$timefirst);\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);\n $extitems = $this->getExternalEvents($timefirst, expDateTime::endOfMonthTimestamp($timefirst));\n if (!empty($this->config['aggregate_registrations']))\n $regitems = eventregistrationController::getRegEventsForDates($timefirst, expDateTime::endOfMonthTimestamp($timefirst), $regcolor);\n for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;\n $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfDayTimestamp($start) . \" AND date <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n// $monthly[$week][$i] = $this->getEventsForDates($dates, true, isset($this->config['only_featured']) ? true : false);\n $monthly[$week][$i] = $this->event->getEventsForDates($dates, true, isset($this->config['only_featured']) ? true : false);\n if (!empty($extitems[$start]))\n $monthly[$week][$i] = array_merge($extitems[$start], $monthly[$week][$i]);\n if (!empty($regitems[$start]))\n $monthly[$week][$i] = array_merge($regitems[$start], $monthly[$week][$i]);\n $monthly[$week][$i] = expSorter::sort(array('array' => $monthly[$week][$i], 'sortby' => 'eventstart', 'order' => 'ASC'));\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }\n $this->params['time'] = $time;\n assign_to_template(array(\n \"currentweek\" => $currentweek,\n \"monthly\" => $monthly,\n \"counts\" => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n \"now\" => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params\n ));\n break; // end switch $viewtype monthly\n case \"administration\": //note a simple list of all upcoming events, except no external nor registration events\n // Check perms and return if cant view\n if (!$user) return;\n $continue = (expPermissions::check(\"manage\", $this->loc) ||\n expPermissions::check(\"create\", $this->loc) ||\n expPermissions::check(\"edit\", $this->loc) ||\n expPermissions::check(\"delete\", $this->loc)\n ) ? 1 : 0;\n $dates = $ed->find(\"all\", $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp(time()));\n// $items = $this->getEventsForDates($dates);\n $items = $this->event->getEventsForDates($dates);\n // if (!$continue) {\n // foreach ($items as $i) {\n // $iloc = expCore::makeLocation($this->loc->mod,$this->loc->src,$i->id);\n // if (expPermissions::check(\"edit\",$iloc) ||\n // expPermissions::check(\"delete\",$iloc) ||\n // expPermissions::check(\"manage\",$iloc)\n // ) {\n // $continue = true;\n // }\n // }\n // }\n if (!$continue) return;\n // for ($i = 0; $i < count($items); $i++) {\n // $thisloc = expCore::makeLocation($this->loc->mod,$this->loc->src,$items[$i]->id);\n // //\t\t\t\tif ($user && $items[$i]->poster == $user->id) $canviewapproval = 1;\n // $items[$i]->permissions = array(\n // \"manage\"=>(expPermissions::check(\"manage\",$thisloc) || expPermissions::check(\"manage\",$this->loc)),\n // \"edit\"=>(expPermissions::check(\"edit\",$thisloc) || expPermissions::check(\"edit\",$this->loc)),\n // \"delete\"=>(expPermissions::check(\"delete\",$thisloc) || expPermissions::check(\"delete\",$this->loc))\n // );\n // }\n $items = expSorter::sort(array('array' => $items, 'sortby' => 'eventstart', 'order' => 'ASC'));\n assign_to_template(array(\n 'items' => $items,\n ));\n break; // end switch $viewtype administration\n case \"default\": //note a simple list of events based on $viewrange\n default;\n // $items = null;\n // $dates = null;\n $day = expDateTime::startOfDayTimestamp(time());\n $sort_asc = true; // For the getEventsForDates call\n // $moreevents = false;\n switch ($viewrange) {\n case \"upcoming\": // events in the future\n if (!empty($this->config['enable_ical']) && !empty($this->config['rss_limit']) && $this->config['rss_limit'] > 0) {\n $eventlimit = \" AND date <= \" . ($day + ($this->config['rss_limit'] * 86400));\n } else {\n $eventlimit = \"\";\n }\n $dates = $ed->find(\"all\", $locsql . \" AND date >= \" . $day . $eventlimit . \" ORDER BY date ASC \");\n $begin = $day;\n $end = null;\n //\t\t\t\t\t$moreevents = count($dates) < $db->countObjects(\"eventdate\",$locsql.\" AND date >= $day\");\n break;\n case \"past\": // events in the past\n $dates = $ed->find(\"all\", $locsql . \" AND date < $day ORDER BY date DESC \");\n //\t\t\t\t\t$moreevents = count($dates) < $db->countObjects(\"eventdate\",$locsql.\" AND date < $day\");\n $sort_asc = false;\n $begin = null;\n $end = $day;\n break;\n case \"today\": // events occuring today\n $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfDayTimestamp($day) . \" AND date <= \" . expDateTime::endOfDayTimestamp($day) . \")\");\n $begin = $day;\n $end = expDateTime::endOfDayTimestamp($day);\n break;\n case \"day\": // events for a specific day (same as byday day?)\n $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfDayTimestamp($time) . \" AND date <= \" . expDateTime::endOfDayTimestamp($time) . \")\");\n $begin = expDateTime::startOfDayTimestamp($time);\n $end = expDateTime::endOfDayTimestamp($time);\n break;\n case \"next\": // future events\n $dates = array($ed->find(\"all\", $locsql . \" AND date >= $time\"));\n $begin = expDateTime::startOfDayTimestamp($time);\n $end = null;\n break;\n case \"month\": // events for a specific month (same as monthly?)\n// $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfMonthTimestamp(time()) . \" AND date <= \" . expDateTime::endOfMonthTimestamp(time()) . \")\");\n $dates = $ed->find(\"all\", $locsql . \" AND (date >= \" . expDateTime::startOfMonthTimestamp($time) . \" AND date <= \" . expDateTime::endOfMonthTimestamp($time) . \")\");\n $begin = expDateTime::startOfMonthTimestamp($time);\n $end = expDateTime::endOfMonthTimestamp($time);\n break;\n case \"all\": // all events\n default;\n $dates = $ed->find(\"all\", $locsql);\n $begin = null;\n $end = null;\n }\n// $items = $this->getEventsForDates($dates, $sort_asc, isset($this->config['only_featured']) ? true : false, true);\n $items = $this->event->getEventsForDates($dates, $sort_asc, isset($this->config['only_featured']) ? true : false, true);\n if ($viewrange != 'past') {\n $extitems = $this->getExternalEvents($begin, $end);\n // we need to flatten these down to simple array of events\n $extitem = array();\n foreach ($extitems as $days) {\n foreach ($days as $event) {\n if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time()))\n break;\n if (empty($event->eventstart))\n $event->eventstart = $event->eventdate->date;\n $extitem[] = $event;\n }\n }\n $items = array_merge($items, $extitem);",
" if (!empty($this->config['aggregate_registrations']))\n $regitems = eventregistrationController::getRegEventsForDates($begin, $end, $regcolor);\n // we need to flatten these down to simple array of events\n $regitem = array();\n if (!empty($regitems)) foreach ($regitems as $days) {\n foreach ($days as $value) {\n $regitem[] = $value;\n }\n }\n $items = array_merge($items, $regitem);",
" // remove today's events that have already ended\n if ($viewtype == 'default' && $viewrange == 'upcoming') {\n foreach ($items as $key=>$item) {\n if (!$item->is_allday && $item->eventend < time()) {\n //fixme we've left events ending earlier in the day, but already cancelled out tomorrow's event\n unset($items[$key]);\n } else {\n break; // they are chronological so we can end\n }\n }\n }\n }\n $items = expSorter::sort(array('array' => $items, 'sortby' => 'eventstart', 'order' => 'ASC'));\n // Upcoming events can be configured to show a specific number of events.\n // The previous call gets all events in the future from today\n // If configured, cut the array to the configured number of events\n //\t\t\tif ($template->viewconfig['num_events']) {\n //\t\t\t\tswitch ($viewrange) {\n //\t\t\t\t\tcase \"upcoming\":\n //\t\t\t\t\tcase \"past\":\n //\t\t\t\t\t\t$moreevents = $template->viewconfig['num_events'] < count($items);\n //\t\t\t\t\t\tbreak;\n //\t\t\t\t}\n //\t\t\t\t$items = array_slice($items, 0, $template->viewconfig['num_events']);\n //\t\t\t}\n // for ($i = 0; $i < count($items); $i++) {\n // $thisloc = expCore::makeLocation($this->loc->mod,$this->loc->src,$items[$i]->id);\n // $items[$i]->permissions = array(\n // 'manage'=>(expPermissions::check('manage',$thisloc) || expPermissions::check('manage',$this->loc)),\n // 'edit'=>(expPermissions::check('edit',$thisloc) || expPermissions::check('edit',$this->loc)),\n // 'delete'=>(expPermissions::check('delete',$thisloc) || expPermissions::check('delete',$this->loc))\n // );\n // }\n assign_to_template(array(\n 'items' => $items,\n \"now\" => $day,\n ));\n }\n }",
" /**\n * default view for individual item\n */\n function show() {\n expHistory::set('viewable', $this->params);\n if (!empty($this->params['date_id'])) { // specific event instance\n $eventdate = new eventdate($this->params['date_id']);\n $eventdate->event = new event($eventdate->event_id);\n } else { // we'll default to the first event of this series\n $event = new event($this->params['id']);\n $eventdate = new eventdate($event->eventdate[0]->id);\n }\n if (empty($eventdate->id))\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>'event'));",
" if (!empty($eventdate->event->feedback_form) && $eventdate->event->feedback_form != 'Disallow Feedback') {\n assign_to_template(array(\n 'feedback_form' => $eventdate->event->feedback_form,\n ));\n }",
" assign_to_template(array(\n 'event' => $eventdate,\n ));\n }",
" function edit() {\n global $template;",
" parent::edit();\n $allforms = array();\n $allforms[\"\"] = gt('Disallow Feedback');\n // calculate which event date is the one being edited\n $event_key = 0;\n foreach ($template->tpl->tpl_vars['record']->value->eventdate as $key=>$d) {\n \t if ($d->id == $this->params['date_id']) $event_key = $key;\n \t}",
" assign_to_template(array(\n 'allforms' => array_merge($allforms, expTemplate::buildNameList(\"forms\", \"event/email\", \"tpl\", \"[!_]*\")),\n 'checked_date' => !empty($this->params['date_id']) ? $this->params['date_id'] : null,\n 'event_key' => $event_key,\n ));\n }",
" /**\n * Delete a recurring event by asking for which event dates to delete\n *\n */\n function delete_recurring() {\n $item = $this->event->find('first', 'id=' . $this->params['id']);\n if ($item->is_recurring == 1) { // need to give user options\n expHistory::set('editable', $this->params);\n assign_to_template(array(\n 'checked_date' => $this->params['date_id'],\n 'event' => $item,\n ));\n } else { // Process a regular delete\n $item->delete();\n }\n }",
" /**\n * Delete selected event dates for a recurring event and event if all event dates deleted\n *\n */\n function delete_selected() {\n $item = $this->event->find('first', 'id=' . $this->params['id']);\n if ($item && $item->is_recurring == 1) {\n $event_remaining = false;\n $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id);\n foreach ($eventdates as $ed) {\n if (array_key_exists($ed->id, $this->params['dates'])) {\n $ed->delete();\n } else {\n $event_remaining = true;\n }\n }\n if (!$event_remaining) {\n $item->delete(); // model will also ensure we delete all event dates\n }\n expHistory::back();\n } else {\n notfoundController::handle_not_found();\n }\n }",
" function delete_all_past() {\n $locsql = $this->aggregateWhereClause();\n $ed = new eventdate();\n $dates = $ed->find(\"all\", $locsql . \" AND date < \" . strtotime('-1 months', time()));\n foreach ($dates as $date) {\n $date->delete(); // event automatically deleted if all assoc eventdates are deleted\n }\n expHistory::back();\n }",
" /**\n \t * get the metainfo for this module\n \t * @return array\n \t */\n \tfunction metainfo() {\n global $router;",
" $action = $router->params['action'];\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n // look for event date_id which expController::metainfo won't detect\n// if (!empty($router->params['action']) && $router->params['action'] == 'show' && !isset($router->params['id']) && isset($router->params['date_id'])) {\n switch ($action) {\n case 'show':\n if (!isset($router->params['id']) && isset($router->params['date_id'])) {\n // look up the record.\n $object = new eventdate((int)$router->params['date_id']);\n // set the meta info\n if (!empty($object)) {\n if (!empty($object->event->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->event->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n if (!empty($object->expTag)) {\n $keyw = '';\n foreach ($object->expTag as $tag) {\n if (!empty($keyw)) $keyw .= ', ';\n $keyw .= $tag->title;\n }\n } else {\n $keyw = SITE_KEYWORDS;\n }\n $metainfo['title'] = empty($object->event->meta_title) ? $object->event->title : $object->event->meta_title;\n $metainfo['keywords'] = empty($object->event->meta_keywords) ? $keyw : $object->event->meta_keywords;\n $metainfo['description'] = empty($object->event->meta_description) ? $desc : $object->event->meta_description;\n $metainfo['canonical'] = empty($object->event->canonical) ? $router->plainPath() : $object->event->canonical;\n $metainfo['noindex'] = empty($object->event->meta_noindex) ? false : $object->event->meta_noindex;\n $metainfo['nofollow'] = empty($object->event->meta_nofollow) ? false : $object->event->meta_nofollow;\n return $metainfo;\n break;\n }\n }\n default:\n return parent::metainfo();\n }\n }",
" /**\n * function to build a string to pull in all events within requested date range\n */\n function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) {\n if (empty($endtimestamp)) {\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($timestamp) . \")\";\n } else {\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($endtimestamp) . \")\";\n }\n if ($multiday)\n $date_sql .= \" OR (\" . expDateTime::startOfDayTimestamp($timestamp) . \" BETWEEN \".$field.\" AND dateFinished)\";\n $date_sql .= \")\";\n return $date_sql;\n }",
" function send_feedback() {\n $success = false;\n if (isset($this->params['id'])) {\n $ed = new eventdate($this->params['id']);\n// $email_addrs = array();\n if ($ed->event->feedback_email != '') {\n $msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . expString::escape($this->params['formname']), $this->loc);\n $msgtemplate->assign('params', $this->params);\n $msgtemplate->assign('event', $ed);\n $email_addrs = explode(',', $ed->event->feedback_email);\n //This is an easy way to remove duplicates\n $email_addrs = array_flip(array_flip($email_addrs));\n $email_addrs = array_map('trim', $email_addrs);\n $mail = new expMail();\n $success += $mail->quickSend(array(\n \"text_message\" => $msgtemplate->render(),\n 'to' => $email_addrs,\n 'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS),\n 'subject' => $this->params['subject'],\n ));\n }\n }",
" if ($success) {\n flashAndFlow('message', gt('Your feedback was successfully sent.'));\n } else {\n flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.'));\n }\n }",
" function ical() {\n if (isset($this->params['date_id']) || isset($this->params['title']) || isset($this->params['src'])) {\n $cfg = new expConfig();\n $configs = $cfg->find('all', \"location_data LIKE '%event%'\"); // get all event module configs\n foreach ($configs as $config) {\n $loc = expUnserialize($config->location_data);\n if (!empty($this->params['title'])) {\n if ($this->params['title'] == $config->config['feed_sef_url']) {\n $this->config = $config->config;\n break;\n }\n } elseif (!empty($this->params['src'])) {\n if ($this->params['src'] == $loc->src) {\n $this->config = $config->config;\n break;\n }\n }\n }\n $this->loc = $loc;",
" if ($this->config['enable_ical']) {\n $ed = new eventdate();\n if (isset($this->params['date_id'])) { // get single specific event only\n// $dates = array($db->selectObject(\"eventdate\",\"id=\".$this->params['date_id']));\n $dates = $ed->find('first', \"id=\" . $this->params['date_id']);\n $Filename = \"Event-\" . $this->params['date_id'];\n } else {\n $locsql = $this->aggregateWhereClause();",
" $day = expDateTime::startOfDayTimestamp(time());\n if (!empty($this->config['enable_ical']) && isset($this->config['rss_limit']) && ($this->config['rss_limit'] > 0)) {\n $rsslimit = \" AND date <= \" . ($day + ($this->config['rss_limit'] * 86400));\n } else {\n $rsslimit = \"\";\n }",
" if (isset($this->params['time'])) {\n $time = intval($this->params['time']); // get current month's events\n// $dates = $db->selectObjects(\"eventdate\",$locsql.\" AND (date >= \".expDateTime::startOfMonthTimestamp($time).\" AND date <= \".expDateTime::endOfMonthTimestamp($time).\")\");\n $dates = $ed->find('all', $locsql . \" AND (date >= \" . expDateTime::startOfMonthTimestamp($time) . \" AND date <= \" . expDateTime::endOfMonthTimestamp($time) . \")\");\n } else {\n $time = date('U', strtotime(\"midnight -1 month\", time())); // previous month also\n// $dates = $db->selectObjects(\"eventdate\",$locsql.\" AND date >= \".expDateTime::startOfDayTimestamp($time).$rsslimit);\n $dates = $ed->find('all', $locsql . \" AND date >= \" . expDateTime::startOfDayTimestamp($time) . $rsslimit);\n }\n //\t\t\t$title = $db->selectValue('container', 'title', \"internal='\".serialize($loc).\"'\");\n $title = $this->config['feed_title'];\n $Filename = preg_replace('/\\s+/', '', $title); // without whitespace\n }",
" if (!function_exists(\"quoted_printable_encode\")) { // function added in php v5.3.0\n function quoted_printable_encode($input, $line_max = 75) {\n $hex = array('0', '1', '2', '3', '4', '5', '6', '7',\n '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');\n $lines = preg_split(\"/(?:\\r\\n|\\r|\\n)/\", $input);\n $linebreak = \"=0D=0A=\\r\\n\";\n /* the linebreak also counts as characters in the mime_qp_long_line\n * rule of spam-assassin */\n $line_max = $line_max - strlen($linebreak);\n $escape = \"=\";\n $output = \"\";\n $cur_conv_line = \"\";\n $length = 0;\n $whitespace_pos = 0;\n $addtl_chars = 0;",
" // iterate lines\n for ($j = 0, $jMax = count($lines); $j < $jMax; $j++) {\n $line = $lines[$j];\n $linlen = strlen($line);",
" // iterate chars\n for ($i = 0; $i < $linlen; $i++) {\n $c = substr($line, $i, 1);\n $dec = ord($c);",
" $length++;",
" if ($dec == 32) {\n // space occurring at end of line, need to encode\n if (($i == ($linlen - 1))) {\n $c = \"=20\";\n $length += 2;\n }",
" $addtl_chars = 0;\n $whitespace_pos = $i;\n } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) {\n $h2 = floor($dec / 16);\n $h1 = floor($dec % 16);\n $c = $escape . $hex[\"$h2\"] . $hex[\"$h1\"];\n $length += 2;\n $addtl_chars += 2;\n }",
" // length for wordwrap exceeded, get a newline into the text\n if ($length >= $line_max) {\n $cur_conv_line .= $c;",
" // read only up to the whitespace for the current line\n $whitesp_diff = $i - $whitespace_pos + $addtl_chars;",
" /* the text after the whitespace will have to be read\n * again ( + any additional characters that came into\n * existence as a result of the encoding process after the whitespace)\n *\n * Also, do not start at 0, if there was *no* whitespace in\n * the whole line */\n if (($i + $addtl_chars) > $whitesp_diff) {\n $output .= substr($cur_conv_line, 0, (strlen($cur_conv_line) -\n $whitesp_diff)) . $linebreak;\n $i = $i - $whitesp_diff + $addtl_chars;\n } else {\n $output .= $cur_conv_line . $linebreak;\n }",
" $cur_conv_line = \"\";\n $length = 0;\n $whitespace_pos = 0;\n } else {\n // length for wordwrap not reached, continue reading\n $cur_conv_line .= $c;\n }\n } // end of for",
" $length = 0;\n $whitespace_pos = 0;\n $output .= $cur_conv_line;\n $cur_conv_line = \"\";",
" if ($j <= count($lines) - 1) {\n $output .= $linebreak;\n }\n } // end for",
" return trim($output);\n } // end quoted_printable_encode\n }",
" $tz = DISPLAY_DEFAULT_TIMEZONE;\n $msg = \"BEGIN:VCALENDAR\\n\";\n $msg .= \"VERSION:2.0\\n\"; // version for iCalendar files vs vCalendar files\n $msg .= \"CALSCALE:GREGORIAN\\n\";\n $msg .= \"METHOD: PUBLISH\\n\";\n $msg .= \"PRODID:<-//ExponentCMS//EN>\\n\";\n if (isset($this->config['rss_cachetime']) && ($this->config['rss_cachetime'] > 0)) {\n $msg .= \"X-PUBLISHED-TTL:PT\" . $this->config['rss_cachetime'] . \"M\\n\";\n }\n $msg .= \"X-WR-CALNAME:$Filename\\n\";",
"// $items = $this->getEventsForDates($dates);\n $items = $this->event->getEventsForDates($dates);",
" for ($i = 0, $iMax = count($items); $i < $iMax; $i++) {",
" // Convert events stored in local time to GMT\n $eventstart = new DateTime(date('r', $items[$i]->eventstart), new DateTimeZone($tz));\n $eventstart->setTimezone(new DateTimeZone('GMT'));\n $eventend = new DateTime(date('r', $items[$i]->eventend), new DateTimeZone($tz));\n $eventend->setTimezone(new DateTimeZone('GMT'));\n if ($items[$i]->is_allday) {\n $dtstart = \"DTSTART;VALUE=DATE:\" . date(\"Ymd\", $items[$i]->eventstart) . \"\\n\";\n $dtend = \"DTEND;VALUE=DATE:\" . date(\"Ymd\", strtotime(\"midnight +1 day\", $items[$i]->eventstart)) . \"\\n\";\n } else {\n $dtstart = \"DTSTART;VALUE=DATE-TIME:\" . $eventstart->format(\"Ymd\\THi00\") . \"Z\\n\";\n if ($items[$i]->eventend) {\n $dtend = \"DTEND;VALUE=DATE-TIME:\" . $eventend->format(\"Ymd\\THi00\") . \"Z\\n\";\n } else {\n $dtend = \"DTEND;VALUE=DATE-TIME:\" . $eventstart->format(\"Ymd\\THi00\") . \"Z\\n\";\n }\n }",
" $body = trim(strip_tags(str_replace(array(\"<br />\", \"<br>\", \"br/>\", \"</p>\"), \"\\n\", $items[$i]->body)));\n if ($items[$i]->is_cancelled) $body = gt('This Event Has Been Cancelled') . ' - ' . $body;\n $body = str_replace(array(\"\\r\"), \"\", $body);\n $body = str_replace(array(\" \"), \" \", $body);\n $body = expString::convertSmartQuotes($body);\n if (!isset($this->params['style'])) {\n // it's going to Outlook so remove all formatting from body text\n $body = quoted_printable_encode($body);\n } elseif ($this->params['style'] == \"g\") {\n // It's going to Google (doesn't like quoted-printable, but likes html breaks)\n $body = str_replace(array(\"\\n\"), \"<br />\", $body);\n } else {\n // It's going elsewhere (doesn't like quoted-printable)\n $body = str_replace(array(\"\\n\"), \" -- \", $body);\n }\n $title = $items[$i]->title;",
" $msg .= \"BEGIN:VEVENT\\n\";\n $msg .= $dtstart . $dtend;\n $msg .= \"UID:\" . $items[$i]->date_id . \"\\n\";\n $msg .= \"DTSTAMP:\" . date(\"Ymd\\THis\", time()) . \"Z\\n\";\n if ($title) {\n $msg .= \"SUMMARY:$title\\n\";\n }\n if ($body) {\n $msg .= \"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:\" . $body . \"\\n\";\n }\n //\tif($link_url) { $msg .= \"URL: $link_url\\n\";}\n if (!empty($this->config['usecategories'])) {\n if (!empty($items[$i]->expCat[0]->title)) {\n $msg .= \"CATEGORIES:\".$items[$i]->expCat[0]->title.\"\\n\";\n } else {\n $msg .= \"CATEGORIES:\".$this->config['uncat'].\"\\n\";\n }\n }\n $msg .= \"END:VEVENT\\n\";\n }\n $msg .= \"END:VCALENDAR\";",
" // Kick it out as a file download\n ob_end_clean();",
" //\t$mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : \"text/x-vCalendar\";\n //\t$mime_type = \"text/x-vCalendar\";\n $mime_type = 'text/Calendar';\n header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Content-length: ' . strlen($msg));\n header('Content-Transfer-Encoding: binary');\n header('Content-Encoding:');\n //\theader(\"Content-Disposition: inline; filename=\".$Filename.\".ics\");\n header('Content-Disposition: attachment; filename=\"' . $Filename . '.ics\"');\n // IE need specific headers\n //\tif (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: no-cache, must-revalidate');\n header('Pragma: public');\n header('Vary: User-Agent');\n //\t} else {\n header('Pragma: no-cache');\n //\t}\n echo $msg;\n exit();\n } else {\n notfoundController::handle_not_found();\n }\n } else {\n notfoundController::handle_not_found();\n }\n }",
" function send_reminders() {\n if (isset($this->params['title']) || isset($this->params['src'])) {\n $cfg = new expConfig();\n $configs = $cfg->find('all', \"location_data LIKE '%event%'\"); // get all event module configs\n foreach ($configs as $config) {\n $loc = expUnserialize($config->location_data);\n if (!empty($this->params['title'])) {\n if ($this->params['title'] == $config->config['feed_sef_url']) {\n $this->config = $config->config;\n break;\n }\n } elseif (!empty($this->params['src'])) {\n if ($this->params['src'] == $loc->src) {\n $this->config = $config->config;\n break;\n }\n }\n }",
" if (empty($this->config['reminder_active'])) {\n notfoundController::handle_not_found();\n return;\n }\n if (!empty($this->config['reminder_code']) && (empty($this->params['code']) || ($this->params['code'] != $this->config['reminder_code']))) {\n notfoundController::handle_not_authorized();\n return;\n }",
" $this->loc = $loc;\n $locsql = $this->aggregateWhereClause();",
" $view = (isset($this->params['view']) ? $this->params['view'] : '');\n if ($view == \"\") {\n $view = \"send_reminders\"; // default reminder view\n }",
"// $template = expTemplate::get_template_for_action($this, $view, $this->loc);\n global $template;",
" $title = $this->config['feed_title'];\n $template->assign('moduletitle', $title);",
" $time = (isset($this->params['time']) ? intval($this->params['time']) : time());\n $time = (int)$time;",
" $template->assign(\"time\", $time);",
" $startperiod = expDateTime::startOfDayTimestamp($time);\n if (!empty($this->params['days'])) {\n $totaldays = $this->params['days'];\n } else {\n $totaldays = 7; // default 7 days of events\n }",
" $count = 0;\n $info = getdate($startperiod);\n for ($i = 0; $i < $totaldays; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $info['mday'] + $i, $info['year']);\n $ed = new eventdate();\n $edates = $ed->find('all', $locsql . \" AND (date >= \" . expDateTime::startOfDayTimestamp($start) . \" AND date <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $days[$start] = array();\n// $days[$start] = $this->getEventsForDates($edates);\n $days[$start] = $this->event->getEventsForDates($edates);\n for ($j = 0, $jMax = count($days[$start]); $j < $jMax; $j++) {\n $thisloc = expCore::makeLocation($loc->mod, $loc->src, $days[$start][$j]->id);\n $days[$start][$j]->permissions = array(\n \"manage\" => (expPermissions::check(\"manage\", $thisloc) || expPermissions::check(\"manage\", $loc)),\n \"edit\" => (expPermissions::check(\"edit\", $thisloc) || expPermissions::check(\"edit\", $loc)),\n \"delete\" => (expPermissions::check(\"delete\", $thisloc) || expPermissions::check(\"delete\", $loc))\n );\n }\n $counts[$start] = count($days[$start]);\n $count += count($days[$start]);\n $days[$start] = expSorter::sort(array('array' => $days[$start], 'sortby' => 'eventstart', 'order' => 'ASC'));\n }\n $template->assign(\"days\", $days);\n $template->assign(\"counts\", $counts);\n $template->assign(\"start\", $startperiod);\n $template->assign(\"totaldays\", $totaldays);",
" if ($count == 0) {\n flash('error',gt('No Events to Send!'));\n echo show_msg_queue('error');\n return;\n }",
" if (bs3())\n $css = file_get_contents(BASE . \"external/bootstrap3/css/bootstrap.css\");\n elseif (bs2())\n $css = file_get_contents(BASE . \"external/bootstrap/css/bootstrap.css\");\n else\n $css = file_get_contents(BASE . \"framework/modules/events/assets/css/calendar.css\");\n $template->assign(\"css\", $css);\n $template->assign(\"config\", $this->config);\n $template->assign(\"src\", $loc->src);",
" // format and send email\n $subject = $this->config['email_title_reminder'] . \" - $title\";\n $from_addr = $this->config['email_address_reminder'];\n $headers = array(\n \"From\" => $from = $this->config['email_from_reminder'],\n \"Reply-to\" => $reply = $this->config['email_reply_reminder']\n );",
" // set up the html message\n $template->assign(\"showdetail\", !empty($this->config['email_showdetail']));\n $htmlmsg = $template->render();",
" // now the same thing for the text message\n $msg = preg_replace('/(<script[^>]*>.+?<\\/script>|<style[^>]*>.+?<\\/style>)/s', '', $htmlmsg); // remove any script or style blocks\n $msg = trim(strip_tags(str_replace(array(\"<br />\", \"<br>\", \"br/>\"), \"\\n\", $msg)));",
" // Saved. do notifs\n $emails = array();\n if (!empty($this->config['user_list'])) foreach ($this->config['user_list'] as $c) {\n $u = user::getUserById($c);\n $emails[$u->email] = trim(user::getUserAttribution($u->id));\n }\n if (!empty($this->config['group_list'])) foreach ($this->config['group_list'] as $c) {\n $grpusers = group::getUsersInGroup($c);\n foreach ($grpusers as $u) {\n $emails[$u->email] = trim(user::getUserAttribution($u->id));\n }\n }\n if (!empty($this->config['address_list'])) foreach ($this->config['address_list'] as $c) {\n $emails[] = $c;\n }\n if (empty($emails)) {\n flash('error',gt('No One to Send Reminders to!'));\n echo show_msg_queue('error');\n return;\n }",
" $emails = array_flip(array_flip($emails));\n $emails = array_map('trim', $emails);\n// $headers = array(\n// \"MIME-Version\" => \"1.0\",\n// \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n// );\n $mail = new expMail();\n $mail->quickSend(array(\n// 'headers' => $headers,\n 'html_message' => $htmlmsg,\n \"text_message\" => $msg,\n 'to' => $emails,\n 'from' => array(trim($this->config['email_address_reminder']) => $this->config['email_from_reminder']),\n 'subject' => $subject,\n ));",
" flash('message',gt('The following reminder was sent via email'));\n echo show_msg_queue();\n// echo($htmlmsg);\n } else {\n flash('error',gt('No Calendar Selected!'));\n echo show_msg_queue('error');\n }\n }",
" /** @deprecated moved to event model\n * @param $edates\n * @param bool $sort_asc\n * @param bool $featuredonly\n * @param bool $condense\n * @return array\n */\n function getEventsForDates($edates, $sort_asc = true, $featuredonly = false, $condense = false) {\n global $eventid;",
" $events = array();\n $featuresql = \"\";\n if ($featuredonly) $featuresql = \" AND is_featured=1\";\n foreach ($edates as $edate) {\n $evs = $this->event->find('all', \"id=\" . $edate->event_id . $featuresql);\n foreach ($evs as $key=>$event) {\n if ($condense) {\n $eventid = $event->id;\n $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;'));\n if (!empty($multiday_event)) {\n unset($evs[$key]);\n continue;\n }\n }\n $evs[$key]->eventstart += $edate->date;\n $evs[$key]->eventend += $edate->date;\n $evs[$key]->date_id = $edate->id;\n if (!empty($event->expCat)) {\n $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color);\n// if (substr($catcolor,0,1)=='#') $catcolor = '\" style=\"color:'.$catcolor.';';\n $evs[$key]->color = $catcolor;\n }\n }\n if (count($events) < 500) { // magic number to not crash loop?\n $events = array_merge($events, $evs);\n } else {\n// $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!');\n// $events = array_merge($events, $evs);\n flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'));\n break; // keep from breaking system by too much data\n }\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }",
" function getExternalEvents($startdate, $enddate, $multiday = false) {\n global $db;",
" $extevents = array();\n $dy = 0; // index of events array\n if (!empty($this->config['pull_gcal'])) foreach ($this->config['pull_gcal'] as $key=>$extgcalurl) {\n// $dy = count($extevents); // index of events array\n $cache_hit = false;\n $gcal_cname = str_replace(array(\"/\",\":\",\"&\",\"?\"),\"_\",$extgcalurl);\n $cache_fname = BASE.'tmp/cache/'.$gcal_cname.\".cache\";\n if (file_exists($cache_fname)) {\n $cache = unserialize(file_get_contents($cache_fname));\n if ($startdate >= $cache['start_date'] || $startdate >= $cache['first_date']) {\n $events = $db->selectObjects('event_cache','feed=\"'.$extgcalurl.'\" AND ' . self::build_daterange_sql($startdate,$enddate,'eventdate',true));\n foreach ($events as $event) {\n if ($multiday) {\n $extevents[$event->eventdate][$dy] = $event;\n $extevents[$event->eventdate][$dy]->feedkey = $key;\n $extevents[$event->eventdate][$dy]->location_data = 'gcalevent' . $key;\n $extevents[$event->eventdate][$dy]->color = !empty($this->config['pull_gcal_color'][$key]) ? $this->config['pull_gcal_color'][$key] : null;\n if ($event->is_allday) {\n $extevents[$event->eventdate][$dy]->eventstart = $event->eventdate;\n }\n $dy++;\n } else {\n $endit = !empty($event->dateFinished) ? $event->dateFinished : $event->eventdate;\n// for ($i = $startdate; $i < $enddate; $i += 86400) {\n for ($i = $event->eventdate; $i <= $endit; $i += 86400) {\n if ((!empty($event->dateFinished) && $i > $event->dateFinished) || (empty($event->dateFinished) && $i > $event->eventdate)) {\n break;\n } else {\n $extevents[$i][$dy] = clone($event);\n $extevents[$i][$dy]->eventdate = (int)$i;\n $extevents[$i][$dy]->eventstart = ($event->eventstart - $event->eventdate);\n $extevents[$i][$dy]->eventend = ($event->eventend - (!empty($event->dateFinished)?$event->dateFinished:$event->eventdate));\n $extevents[$i][$dy]->eventstart = ($extevents[$i][$dy]->eventstart) + $i;\n $extevents[$i][$dy]->eventend = ($extevents[$i][$dy]->eventend) + $i;\n $extevents[$i][$dy]->feedkey = $key;\n $extevents[$i][$dy]->location_data = 'gcalevent' . $key;\n $extevents[$i][$dy]->color = !empty($this->config['pull_gcal_color'][$key]) ? $this->config['pull_gcal_color'][$key] : null;\n $dy++;\n }\n }\n }\n }\n $cache_hit = true;\n }\n }\n if (!$cache_hit) { // pull in the external events\n foreach ($this->get_gcal_events($extgcalurl, $startdate, $enddate, $dy, $key, $multiday) as $date=>$events) {\n foreach ($events as $event) {\n $extevents[$date][] = $event;\n }\n }\n }\n }\n if (!empty($this->config['pull_ical'])) foreach ($this->config['pull_ical'] as $key=>$exticalurl) {\n// $dy = count($extevents); // index of events array\n $cache_hit = false;\n $ical_cname = str_replace(array(\"/\",\":\",\"&\",\"?\"),\"_\",$exticalurl);\n $cache_fname = BASE.'tmp/cache/'.$ical_cname.\".cache\";\n if (file_exists($cache_fname)) {\n $cache = unserialize(file_get_contents($cache_fname));\n if ($startdate >= $cache['start_date'] || $startdate >= $cache['first_date']) {\n $events = $db->selectObjects('event_cache','feed=\"'.$exticalurl.'\" AND ' . self::build_daterange_sql($startdate,$enddate,'eventdate',true));\n foreach ($events as $event) {\n $extevents[$event->eventdate][$dy] = $event;\n $extevents[$event->eventdate][$dy]->location_data = 'icalevent' . $key;\n $extevents[$event->eventdate][$dy]->color = !empty($this->config['pull_ical_color'][$key]) ? $this->config['pull_ical_color'][$key] : null;\n $dy++;\n }\n $cache_hit = true;\n }\n }\n if (!$cache_hit) { // pull in the external events\n foreach ($this->get_ical_events($exticalurl, $startdate, $enddate, $dy, $key, $multiday) as $date=>$events) {\n foreach ($events as $event) {\n $extevents[$date][] = $event;\n }\n }\n }\n }\n return $extevents;\n }",
" public function get_gcal_events($extgcalurl, $startdate, $enddate=null, &$dy=0, $key=0, $multiday=false) {\n $extevents = array();\n if (!empty($startdate)) $begin = date(\"Y-m-d\\Th:i:sP\", expDateTime::startOfDayTimestamp($startdate));\n if (!empty($enddate)) $end = date(\"Y-m-d\\Th:i:sP\", expDateTime::endOfDayTimestamp($enddate));\n else $end = date(\"Y-m-d\\Th:i:sP\", (expDateTime::endOfDayTimestamp($startdate + ((3600*24)*30))));",
" if (substr($extgcalurl, -5) == 'basic') {\n $extgcalurl = substr($extgcalurl, 0, - 5) . 'full';\n }\n $feed = $extgcalurl . \"?orderby=starttime&singleevents=true\";\n if (!empty($startdate)) $feed .= \"&start-min=\" . $begin;\n if (!empty($enddate)) $feed .= \"&start-max=\" . $end;",
" // XML method\n// $s = simplexml_load_file($feed);\n// foreach ($s->entry as $item) {\n// $gd = $item->children('http://schemas.google.com/g/2005');\n// if (!empty($gd->when)) {\n// $dtstart = $gd->when->attributes()->startTime;\n// } elseif (!empty($gd->recurrence)){\n// $dtstart = $gd->recurrence->when->attributes()->startTime;\n// } else {\n// $dtstart = $item->attributes()->When;\n// }\n// //FIXME must convert $dtstart timezone\n// $eventdate = expDateTime::startOfDayTimestamp(strtotime($dtstart));\n// $ourtzoffsets = (int)(date('O',$eventdate)) * 36;\n// $theirtzoffset = -((int)(substr($dtstart,-5,2)) * 3600);\n// $tzoffset = $ourtzoffsets - $theirtzoffset;\n// $extevents[$eventdate][$dy] = new stdClass();\n// $extevents[$eventdate][$dy]->eventdate = $eventdate;\n// $extevents[$eventdate][$dy]->eventstart += strtotime($dtstart) + $tzoffset;\n// if (!empty($gd->when)) {\n// $dtend = $gd->when->attributes()->endTime;\n// } elseif (!empty($gd->recurrence)) {\n// $dtend = $gd->recurrence->when->attributes()->endTime;\n// }\n// //FIXME must convert $dtend timezone\n// if (!empty($dtend)) $extevents[$eventdate][$dy]->eventend += strtotime($dtend) + $tzoffset;\n// // dtstart required, one occurrence, (orig. start date)\n// $extevents[$eventdate][$dy]->title = $item->title;\n// $extevents[$eventdate][$dy]->body = $item->content;\n // End XML method",
" // DOM method\n $doc = new DOMDocument();\n $doc->load($feed);\n $entries = $doc->getElementsByTagName(\"entry\");\n foreach ($entries as $item) {\n $times = $item->getElementsByTagName(\"when\");\n $dtstart = $times->item(0)->getAttributeNode(\"startTime\")->value;\n $eventdate = expDateTime::startOfDayTimestamp(strtotime($dtstart));\n $extevents[$eventdate][$dy] = new stdClass();\n $extevents[$eventdate][$dy]->eventdate = $eventdate;\n $dtend = @$times->item(0)->getAttributeNode(\"endTime\")->value;\n $ourtzoffsets = (int)date('O',$eventdate) * 36;\n $theirtzoffset = -((int)substr($dtstart,-5,2) * 3600);\n $tzoffset = $ourtzoffsets - $theirtzoffset;\n if (strlen($dtstart) > 10) {\n $extevents[$eventdate][$dy]->eventstart = ((int)substr($dtstart, 11, 2) * 3600) + ((int)substr($dtstart, 14, 2) * 60) + $tzoffset;\n// if (date(\"I\", $eventdate)) $extevents[$eventdate][$dy]->eventstart += 3600;\n $extevents[$eventdate][$dy]->eventend = ((int)substr($dtend, 11, 2) * 3600) + ((int)substr($dtend, 14, 2) * 60) + $tzoffset;\n// if (date(\"I\", $eventdate)) $extevents[$eventdate][$dy]->eventend += 3600;\n } else {\n $extevents[$eventdate][$dy]->eventstart = null;\n $extevents[$eventdate][$dy]->is_allday = 1;\n }\n $extevents[$eventdate][$dy]->eventstart += $eventdate;\n $extevents[$eventdate][$dy]->eventend += $eventdate;\n if (empty($dtend)) $extevents[$eventdate][$dy]->eventend = $extevents[$eventdate][$dy]->eventstart;",
" $titles = $item->getElementsByTagName(\"title\");\n $extevents[$eventdate][$dy]->title = $titles->item(0)->nodeValue;\n $contents = $item->getElementsByTagName(\"content\");\n $extevents[$eventdate][$dy]->body = $contents->item(0)->nodeValue;\n // End DOM method",
"// $extevents[$eventdate][$dy]->location_data = serialize(expCore::makeLocation('extevent',$extcal->id));\n $extevents[$eventdate][$dy]->location_data = 'gcalevent' . $key;\n $extevents[$eventdate][$dy]->color = !empty($this->config['pull_gcal_color'][$key]) ? $this->config['pull_gcal_color'][$key] : null;\n $dy++;\n }\n return $extevents;\n }",
" public function get_ical_events($exticalurl, $startdate=null, $enddate=null, &$dy=0, $key=0, $multiday=false) {\n $extevents = array();\n// require_once BASE . 'external/iCalcreator.class.php';\n require_once BASE . 'external/iCalcreator-2.22/iCalcreator.php';\n $v = new vcalendar(); // initiate new CALENDAR\n if (stripos($exticalurl, 'http') === 0) {\n $v->setConfig('url', $exticalurl);\n } else {\n $v->setConfig('directory', dirname($exticalurl));\n $v->setConfig('filename', basename($exticalurl));\n }\n $v->parse();\n if ($startdate === null) {\n $startYear = false;\n $startMonth = false;\n $startDay = false;\n } else {\n $startYear = date('Y', $startdate);\n $startMonth = date('n', $startdate);\n $startDay = date('j', $startdate);\n }\n if ($enddate === null) {\n $endYear = $startYear+1;\n $endMonth = $startMonth;\n $endDay = $startDay;\n } else {\n $endYear = date('Y', $enddate);\n $endMonth = date('n', $enddate);\n $endDay = date('j', $enddate);\n }\n // get all events within period split out recurring events as single events per each day\n $eventArray = $v->selectComponents($startYear, $startMonth, $startDay, $endYear, $endMonth, $endDay, 'vevent');\n // Set the timezone to GMT\n @date_default_timezone_set('GMT');\n $tzarray = getTimezonesAsDateArrays($v);\n // Set the default timezone\n @date_default_timezone_set(DISPLAY_DEFAULT_TIMEZONE);\n if (!empty($eventArray)) foreach ($eventArray as $year => $yearArray) {\n if (!empty($yearArray)) foreach ($yearArray as $month => $monthArray) {\n if (!empty($monthArray)) foreach ($monthArray as $day => $dailyEventsArray) {\n if (!empty($dailyEventsArray)) foreach ($dailyEventsArray as $vevent) {\n // process each event\n $yesterday = false;\n $currdate = $vevent->getProperty('x-current-dtstart');\n $thisday = explode('-', $currdate[1]);\n $thisday2 = substr($thisday[2], 0, 2);\n // if member of a recurrence set,\n // returns array( 'x-current-dtstart', <DATE>)\n // <DATE> = (string) date(\"Y-m-d [H:i:s][timezone/UTC offset]\")\n $dtstart = $vevent->getProperty('dtstart', false, true);\n $dtend = $vevent->getProperty('dtend', false, true);\n if (empty($dtend))\n $dtend = $dtstart;",
" // calculate the cumulative timezone offset in seconds to convert to local/system time\n $tzoffsets = array();\n $date_tzoffset = 0;\n if (!empty($tzarray)) {\n// $ourtzoffsets = -(iCalUtilityFunctions::_tz2offset(date('O',time())));\n $ourtzoffsets = -(iCalUtilityFunctions::_tz2offset(date('O',self::_date2timestamp($dtstart['value']))));\n // Set the timezone to GMT\n @date_default_timezone_set('GMT');\n if (!empty($dtstart['params']['TZID'])) $tzoffsets = getTzOffsetForDate($tzarray, $dtstart['params']['TZID'], $dtstart['value']);\n // Set the default timezone\n @date_default_timezone_set(DISPLAY_DEFAULT_TIMEZONE);\n if (isset($tzoffsets['offsetSec'])) $date_tzoffset = $ourtzoffsets + $tzoffsets['offsetSec'];\n }\n if (empty($tzoffsets)) {\n $date_tzoffset = -(iCalUtilityFunctions::_tz2offset(date('O',self::_date2timestamp($dtstart['value']))));\n }\n //FIXME we must have the real timezone offset for the date by this point",
" //FIXME this is for the google ical feed which is bad!\n if ($dtstart['value']['day'] != (int)$thisday2 && (isset($dtstart['value']['day']) && isset($dtend['value']['hour']))&&\n !((int)$dtstart['value']['hour'] == 0 && (int)$dtstart['value']['min'] == 0 && (int)$dtstart['value']['sec'] == 0\n && (int)$dtend['value']['hour'] == 0 && (int)$dtend['value']['min'] == 0 && (int)$dtend['value']['sec'] == 0\n && ((((int)$dtstart['value']['day'] - (int)$dtend['value']['day']) == -1) || (((int)$dtstart['value']['month'] - (int)$dtend['value']['month']) == -1) || (((int)$dtstart['value']['month'] - (int)$dtend['value']['month']) == -11)))) {\n $dtst = strtotime($currdate[1]);\n $dtst1 = iCalUtilityFunctions::_timestamp2date($dtst);\n $dtstart['value']['year'] = $dtst1['year'];\n $dtstart['value']['month'] = $dtst1['month'];\n $dtstart['value']['day'] = $dtst1['day'];\n $currenddate = $vevent->getProperty('x-current-dtend');\n $dtet = strtotime($currenddate[1]);\n $dtet1 = iCalUtilityFunctions::_timestamp2date($dtet);\n $dtend['value']['year'] = $dtet1['year'];\n $dtend['value']['month'] = $dtet1['month'];\n $dtend['value']['day'] = $dtet1['day'];\n// $date_tzoffset = 0;\n }",
" if (!empty($dtstart['value']['hour']) && !((int)$dtstart['value']['hour'] == 0 && (int)$dtstart['value']['min'] == 0 && (int)$dtstart['value']['sec'] == 0\n && (int)$dtend['value']['hour'] == 0 && (int)$dtend['value']['min'] == 0 && (int)$dtend['value']['sec'] == 0\n && ((((int)$dtstart['value']['day'] - (int)$dtend['value']['day']) == -1) || (((int)$dtstart['value']['month'] - (int)$dtend['value']['month']) == -1) || (((int)$dtstart['value']['month'] - (int)$dtend['value']['month']) == -11)))) {\n $eventdate = expDateTime::startOfDayTimestamp(self::_date2timestamp($dtstart['value']) - $date_tzoffset);\n// $eventend = expDateTime::startOfDayTimestamp(self::_date2timestamp($dtend['value']) - $date_tzoffset);\n $extevents[$eventdate][$dy] = new stdClass();\n $extevents[$eventdate][$dy]->eventdate = new stdClass();\n $extevents[$eventdate][$dy]->eventdate->date = $eventdate;\n// if ((int)($dtstart['value']['hour']) == 0 && (int)($dtstart['value']['min']) == 0 && (int)($dtstart['value']['sec']) == 0\n// && (int)($dtend['value']['hour']) == 0 && (int)($dtend['value']['min']) == 0 && (int)($dtend['value']['sec']) == 0\n// && ((((int)($dtstart['value']['day']) - (int)($dtend['value']['day'])) == -1) || (((int)($dtstart['value']['month']) - (int)($dtend['value']['month'])) == -1) || (((int)($dtstart['value']['month']) - (int)($dtend['value']['month'])) == -11))) {\n//// if ($dtstart['value']['day'] != (int)($thisday2)) {\n// if (date('d',$eventdate) != $thisday2) {\n//// if (date('d',$eventdate) != date('d',$eventend)) {\n// $yesterday = true;\n// } else {\n// $extevents[$eventdate][$dy]->eventstart = null;\n// $extevents[$eventdate][$dy]->is_allday = 1;\n// }\n// } else {\n if (date('d',$eventdate) != $thisday2) {\n// if (date('d',$eventdate) != date('d',$eventend)) {\n $yesterday = true;\n } else {\n $extevents[$eventdate][$dy]->eventstart = ($dtstart['value']['hour'] * 3600) + ($dtstart['value']['min'] * 60) - $date_tzoffset;\n// if (date(\"I\", $eventdate)) $extevents[$eventdate][$dy]->eventstart += 3600; // adjust for daylight savings time\n }\n// }\n } else {\n // this is an all day event\n $eventdate = expDateTime::startOfDayTimestamp(self::_date2timestamp($dtstart['value']));\n// $eventend = expDateTime::startOfDayTimestamp(self::_date2timestamp($dtend['value']));\n $extevents[$eventdate][$dy] = new stdClass();\n $extevents[$eventdate][$dy]->eventdate = new stdClass();\n $extevents[$eventdate][$dy]->eventdate->date = $eventdate;\n// if ($dtstart['value']['day'] != (int)($thisday2)) {\n if (date('d',$eventdate) != $thisday2) {\n// if (date('d',$eventdate) != date('d',$eventend)) {\n $yesterday = true;\n } else {\n $extevents[$eventdate][$dy]->eventstart = null;\n $extevents[$eventdate][$dy]->is_allday = 1;\n }\n }",
" // set the end time if needed\n if (!$yesterday && isset($dtend['value']['hour']) && empty($extevents[$eventdate][$dy]->is_allday)) {\n// if ($dtend['value']['day'] != (int)($thisday2)) {\n// if ((date('d',$eventend) != $thisday2)) {\n// $yesterday = true;\n// } else {\n $extevents[$eventdate][$dy]->eventend = ($dtend['value']['hour'] * 3600) + ($dtend['value']['min'] * 60) - $date_tzoffset;\n// if (date(\"I\", $eventdate)) $extevents[$eventdate][$dy]->eventend += 3600; // adjust for daylight savings time\n// }\n }",
" // convert the start and end times to a full date\n if (isset($extevents[$eventdate][$dy]->eventstart) && $extevents[$eventdate][$dy]->eventstart != null)\n $extevents[$eventdate][$dy]->eventstart += $eventdate;\n if (isset($extevents[$eventdate][$dy]->eventend))\n $extevents[$eventdate][$dy]->eventend += $eventdate;",
" // dtstart required, one occurrence, (orig. start date)\n $extevents[$eventdate][$dy]->title = $vevent->getProperty('summary');\n $body = $vevent->getProperty('description');\n // convert end of lines\n $body = nl2br(str_replace(\"\\\\n\",\" <br>\\n\",$body));\n $body = str_replace(\"\\n\",\" <br>\\n\",$body);\n $body = str_replace(array('==0A','=0A','=C2=A0'),\" <br>\\n\",$body);\n $extevents[$eventdate][$dy]->body = $body;\n $extevents[$eventdate][$dy]->location_data = 'icalevent' . $key;\n $extevents[$eventdate][$dy]->color = !empty($this->config['pull_ical_color'][$key]) ? $this->config['pull_ical_color'][$key] : null;\n if (!$yesterday && $eventdate >= $startdate) {\n $dy++;\n } else {\n unset($extevents[$eventdate][$dy]);\n }\n }\n }\n }\n }\n return $extevents;\n }",
" public static function _date2timestamp( $datetime, $wtz=null ) {\n if( !isset( $datetime['hour'] )) $datetime['hour'] = 0;\n if( !isset( $datetime['min'] )) $datetime['min'] = 0;\n if( !isset( $datetime['sec'] )) $datetime['sec'] = 0;\n if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || empty( $datetime['tz'] )))\n return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );\n $output = $offset = 0;\n if( empty( $wtz )) {\n if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) {\n $offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1;\n $wtz = 'UTC';\n }\n else\n $wtz = $datetime['tz'];\n }\n if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz )))\n $wtz = 'UTC';\n try {\n $strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] );\n $d = new DateTime( $strdate, new DateTimeZone( $wtz ));\n if( 0 != $offset ) // adjust for offset\n $d->modify( $offset.' seconds' );\n $output = $d->format( 'U' );\n unset( $d );\n }\n catch( Exception $e ) {\n $output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );\n }\n return $output;\n }",
" /**\n * build/update the external event cache\n *\n */\n public function build_cache() {\n global $db;",
" // get our requested config\n $cfg = new expConfig();\n $configs = $cfg->find('all', \"location_data LIKE '%event%'\"); // get all event module configs\n foreach ($configs as $config) {\n $loc = expUnserialize($config->location_data);\n if (!empty($this->params['title'])) {\n if ($this->params['title'] == $config->config['feed_sef_url']) {\n $this->config = $config->config;\n break;\n }\n } elseif (!empty($this->params['src'])) {\n if ($this->params['src'] == $loc->src) {\n $this->config = $config->config;\n break;\n }\n }\n }",
" // next loop through our config pull urls",
" // google xml pull\n if (!empty($this->config['pull_gcal'])) foreach ($this->config['pull_gcal'] as $key=>$extgcalurl) {\n $start = expDateTime::startOfMonthTimestamp(time());\n $gcal_cname = str_replace(array(\"/\",\":\",\"&\",\"?\"),\"_\",$extgcalurl);\n $cache_fname = BASE.'tmp/cache/'.$gcal_cname.\".cache\";\n $db->delete('event_cache', \"feed='\" . $extgcalurl . \"' AND eventdate > \" . $start); // replace future events\n // loop through 12 months, 1 month at a time\n for ($i=1; $i < 13; $i++) {\n $end = expDateTime::endOfMonthTimestamp($start);\n $tmp = 0;\n $extevents = $this->get_gcal_events($extgcalurl, $start, $end, $tmp, 0, true);\n// $extevents = $this->get_gcal_events($extgcalurl, null, null, 0, 0, 0, true);\n foreach ($extevents as $day) {\n foreach ($day as $extevent) {\n $event_cache = new stdClass();\n $event_cache->feed = $extgcalurl;\n $event_cache->event_id = $extevent->event_id;\n $event_cache->title = $extevent->title;\n $event_cache->body = $extevent->body;\n $event_cache->eventdate = $extevent->eventdate->date;\n if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)\n $event_cache->dateFinished = $extevent->dateFinished;\n if (isset($extevent->eventstart))\n $event_cache->eventstart = $extevent->eventstart;\n if (isset($extevent->eventend))\n $event_cache->eventend = $extevent->eventend;\n if (isset($extevent->is_allday))\n $event_cache->is_allday = $extevent->is_allday;\n $found = false;\n if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries\n $found = $db->selectObject('event_cache','feed=\"'.$extgcalurl.'\" AND event_id=\"'.$event_cache->event_id.'\" AND eventdate='.$event_cache->eventdate);\n if (!$found)\n $db->insertObject($event_cache,'event_cache');\n }\n }\n $start = expDateTime::startOfMonthTimestamp($end + 1024);\n }\n $cache_contents = serialize(array('start_date'=>$start,'first_date'=>(int)$db->selectValue('event_cache','eventdate','feed=\"'.$extgcalurl.'\" ORDER BY eventdate'),'refresh_date'=>time()));\n file_put_contents($cache_fname, $cache_contents);\n }",
" // ical pull\n $start = expDateTime::startOfMonthTimestamp(time());\n if (!empty($this->config['pull_ical'])) foreach ($this->config['pull_ical'] as $key=>$exticalurl) {\n $ical_cname = str_replace(array(\"/\",\":\",\"&\",\"?\"),\"_\",$exticalurl);\n $cache_fname = BASE.'tmp/cache/'.$ical_cname.\".cache\";\n $db->delete('event_cache', \"feed='\" . $exticalurl . \"' AND eventdate > \" . $start);\n // get 1 years worth of events\n $extevents = $this->get_ical_events($exticalurl, $start);\n foreach ($extevents as $day) {\n foreach ($day as $extevent) {\n $event_cache = new stdClass();\n $event_cache->feed = $exticalurl;\n $event_cache->title = $extevent->title;\n $event_cache->body = $extevent->body;\n $event_cache->eventdate = $extevent->eventdate->date;\n if (isset($extevent->dateFinished))\n $event_cache->dateFinished = $extevent->dateFinished;\n $event_cache->eventstart = $extevent->eventstart;\n if (isset($extevent->eventend))\n $event_cache->eventend = $extevent->eventend;\n if (isset($extevent->is_allday))\n $event_cache->is_allday = $extevent->is_allday;\n $db->insertObject($event_cache, 'event_cache');\n }\n }\n $cache_contents = serialize(array('start_date'=>$start,'first_date'=>(int)$db->selectValue('event_cache','eventdate','feed=\"'.$exticalurl.'\" ORDER BY eventdate'),'refresh_date'=>time()));\n file_put_contents($cache_fname, $cache_contents);\n }\n flash('message', gt('External Calendar Event cache updated'));\n echo show_msg_queue();\n }",
" function import() {\n $pullable_modules = expModules::listInstalledControllers($this->baseclassname);\n $modules = new expPaginator(array(\n 'records' => $pullable_modules,\n 'controller' => $this->loc->mod,\n 'action' => $this->params['action'],\n 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns' => array(\n gt('Title') => 'title',\n gt('Page') => 'section'\n ),\n ));",
" assign_to_template(array(\n 'modules' => $modules,\n ));\n }",
" function import_select()\n {\n if (empty($this->params['import_aggregate'])) {\n expValidator::setErrorField('import_aggregate[]');\n expValidator::failAndReturnToForm(gt('You must select a module.'), $this->params);\n }\n $extevents = array();\n unset(\n $this->params['begin'],\n $this->params['end']\n ); // always use date value\n $begin = yuidatetimecontrol::parseData('begin', $this->params);\n $end = yuidatetimecontrol::parseData('end', $this->params);\n if ($this->params['file_type'] == 'file') {\n //Get the temp directory to put the uploaded file\n $directory = \"tmp\";",
" //Get the file save it to the temp directory\n if (!empty($_FILES[\"import_file\"]) && $_FILES[\"import_file\"][\"error\"] == UPLOAD_ERR_OK) {\n $file = expFile::fileUpload(\n \"import_file\",\n false,\n false,\n time() . \"_\" . $_FILES['import_file']['name'],\n $directory . '/'\n );\n if ($file === null) {\n switch ($_FILES[\"import_file\"][\"error\"]) {\n case UPLOAD_ERR_INI_SIZE:\n case UPLOAD_ERR_FORM_SIZE:\n $this->params['_formError'] = gt(\n 'The file you attempted to upload is too large. Contact your system administrator if this is a problem.'\n );\n break;\n case UPLOAD_ERR_PARTIAL:\n $this->params['_formError'] = gt('The file was only partially uploaded.');\n break;\n case UPLOAD_ERR_NO_FILE:\n $this->params['_formError'] = gt('No file was uploaded.');\n break;\n default:\n $this->params['_formError'] = gt(\n 'A strange internal error has occurred. Please contact the Exponent Developers.'\n );\n break;\n }\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n } else {\n $extevents = $this->get_ical_events($directory . \"/\" . $file->filename, $begin, $end);\n }\n } else {\n expValidator::setErrorField('import_file');\n expValidator::failAndReturnToForm(gt('File failed to upload.'), $this->params); // file upload error\n }\n } else {\n if (empty($this->params['ext_feed'])) {\n expValidator::setErrorField('ext_feed');\n expValidator::failAndReturnToForm(gt('You must enter a feed url.'), $this->params);\n }\n $extevents = $this->get_ical_events($this->params['ext_feed'], $begin, $end);\n }",
" $src = $this->params['import_aggregate'][0];\n $count = 0;\n foreach ($extevents as $day) {\n foreach ($day as $extevent) {\n $event = array();\n $event['title'] = $extevent->title;\n $event['body'] = $extevent->body;\n $event['eventdate'] = $extevent->eventdate->date;\n $event['eventstart'] = $extevent->eventstart;\n $event['eventstart'] -= $event['eventdate'];\n if (isset($extevent->eventend))\n $event['eventend'] = $extevent->eventend;\n else\n $event['eventend'] = $extevent->eventstart;\n $event['eventend'] -= $event['eventdate'];\n if (isset($extevent->is_allday))\n $event['is_allday'] = $extevent->is_allday;\n $event['module'] = 'event';\n $event['src'] = $src;\n $item = new event(); // create new populated record to auto-set things\n $item->update($event);\n $count++;\n }\n }",
" unlink($directory . \"/\" . $file->filename);",
" // update search index\n $this->addContentToSearch();",
" flashAndFlow('message', $count . ' ' . gt('events were imported.'));\n }",
" /** @deprecated\n * function to build a control requested via ajax\n * we the html just like the control smarty function\n * @deprecated\n */\n public function buildControl() {\n $control = new colorcontrol();\n if (!empty($this->params['value'])) $control->value = $this->params['value'];\n if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value'];\n $control->default = $this->params['value'];\n if (!empty($this->params['hide'])) $control->hide = $this->params['hide'];\n if (isset($this->params['flip'])) $control->flip = $this->params['flip'];\n $this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : '';\n $control->name = $this->params['name'];\n $this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : '';\n $control->id = isset($this->params['id']) && $this->params['id'] != \"\" ? $this->params['id'] : \"\";\n //echo $control->id;\n if (empty($control->id)) $control->id = $this->params['name'];\n if (empty($control->name)) $control->name = $this->params['id'];",
" // attempt to translate the label\n if (!empty($this->params['label'])) {\n $this->params['label'] = gt($this->params['label']);\n } else {\n $this->params['label'] = null;\n }\n echo $control->toHTML($this->params['label'], $this->params['name']);\n// $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code)));\n// $ar->send();\n }",
"}\n",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Models\n * @package Modules\n */",
"class event extends expRecord {\n public $has_many = array('eventdate');\n protected $attachable_item_types = array(\n 'content_expCats'=>'expCat',\n 'content_expFiles'=>'expFile',\n 'content_expTags'=>'expTag'\n );",
" /**\n * Events have special circumstances since they are based on dates\n * 'upcoming', 'month', 'week', 'day', etc...\n *\n * @param string $range\n * @param null $where\n * @param null $order\n * @param null $limit\n * @param int $limitstart\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @return array\n */\n public function find($range = 'all', $where = null, $order = null, $limit = null, $limitstart = 0, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false)\n {\n if (is_numeric($range) || in_array($range, array('all', 'first', 'bytitle', 'count', 'in', 'bytag', 'bycat'))) {\n return parent::find($range, $where, $order, $limit, $limitstart, $get_assoc, $get_attached, $except, $cascade_except);\n } else { // 'upcoming', 'month', 'week', 'day', etc...\n //note $order is boolean for 'featured'\n //note $limit is number of days, NOT number of records\n //note $limitstart is a unixtimestamp in this instance",
"",
" $ed = new eventdate();\n $day = expDateTime::startOfDayTimestamp(time());\n $sort_asc = true; // For the getEventsForDates call\n if (strcasecmp($range, 'upcoming') == 0) {\n if (!empty($limit)) {\n $eventlimit = \" AND date <= \" . ($day + ($limit * 86400));\n } else {\n $eventlimit = \"\";\n }\n $dates = $ed->find(\"all\", $where . \" AND date >= \" . $day . $eventlimit . \" ORDER BY date ASC \");\n// $begin = $day;\n// $end = null;\n $items = $this->getEventsForDates($dates, $sort_asc, $order ? true : false, true);",
" ",
" // external events\n// $extitems = $this->getExternalEvents($begin, $end);\n // we need to crunch these down\n// $extitem = array();\n// foreach ($extitems as $days) {\n// foreach ($days as $event) {\n// if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break;\n// if (empty($event->eventstart)) $event->eventstart = $event->eventdate->date;\n// $extitem[] = $event;\n// }\n// }\n// $items = array_merge($items, $extitem);",
" ",
" // event registration events\n// if (!empty($this->config['aggregate_registrations'])) $regitems = eventregistrationController::getRegEventsForDates($begin, $end, $regcolor);\n // we need to crunch these down\n// $regitem = array();\n// if (!empty($regitems)) foreach ($regitems as $days) {\n// foreach ($days as $value) {\n// $regitem[] = $value;\n// }\n// }\n// $items = array_merge($items, $regitem);",
" ",
" $items = expSorter::sort(array('array' => $items, 'sortby' => 'eventstart', 'order' => 'ASC'));\n return $items;\n }\n }\n }",
" function getEventsForDates($edates, $sort_asc = true, $featuredonly = false, $condense = false) {\n global $eventid;",
" $events = array();\n $featuresql = \"\";\n if ($featuredonly)\n $featuresql = \" AND is_featured=1\";\n foreach ($edates as $edate) {\n $evs = $this->find('all', \"id=\" . $edate->event_id . $featuresql);\n foreach ($evs as $key=>$event) {\n if ($condense) {\n //fixme we're leaving events which ended earlier in the day which won't be displayed, which therefore cancels out tomorrow's event\n $eventid = $event->id;\n $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;'));\n if (!empty($multiday_event)) {\n unset($evs[$key]);\n continue;\n }\n }\n $evs[$key]->eventstart += $edate->date;\n $evs[$key]->eventend += $edate->date;\n $evs[$key]->date_id = $edate->id;\n if (!empty($event->expCat)) {\n $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color);\n// if (substr($catcolor,0,1)=='#') $catcolor = '\" style=\"color:'.$catcolor.';';\n $evs[$key]->color = $catcolor;\n }\n }\n if (count($events) < 500) { // magic number to not crash loop?\n $events = array_merge($events, $evs);\n } else {\n// $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!');\n// $events = array_merge($events, $evs);\n flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'));\n break; // keep from breaking system by too much data\n }\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }",
" public function update($params = array()) {\n $params['eventstart'] = datetimecontrol::parseData('eventstart',$params);\n $params['eventend'] = datetimecontrol::parseData('eventend',$params);\n $this->checkForAttachableItems($params);\n $this->build($params);\n// $id = !empty($params['id']) ? $params['id'] : null;\n// $calevent = new event($id);\n// $calevent->update($params); // prime the record with the parameters",
" if (!empty($params['id'])) { // update existing event\n $calevent = new eventdate();\n \t\tif (!empty($params['is_recurring'])) {\n \t\t\t// For recurring events, check some stuff.\n \t\t\t// Were all dates selected?\n $eventdates = $calevent->find('all',\"event_id=\".$this->id);\n \t\t\tif (count($params['dates']) != count($eventdates)) { // only part of list changed\n \t\t\t\t// yes. just update the original\n// $calevent->update();\n \t\t\t\t// If the date has changed, modify the current date_id\n// \t\t\t} else { // we've split out dates from original\n \t\t\t\t// No, create new and relink affected dates\n \t\t\t\tunset($this->id);\n// $calevent = new event($params); // create a new event based on parameters\n \t\t\t\tif (count($params['dates']) == 1) $this->is_recurring = 0; // Back to a single event.",
" $this->save(true); // save new event to get an event id",
" unset($params['id']);\n \t\t\t\tforeach (array_keys($params['dates']) as $date_id) { // update all the date occurrences being changed\n $eventdate = $calevent->find('first',\"id=\".$date_id);\n $eventdate->event_id = $this->id;\n if (count($params['dates']) == 1) $eventdate->date = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"eventdate\",$params));\n $eventdate->update($params);\n \t\t\t\t}\n \t\t\t} else { // all existing event occurrences have changed\n// \t\t\t $eventdate = $db->selectObject('eventdate','id='.intval($params['date_id']));\n $eventdate = $calevent->find('first','id='.intval($params['date_id']));\n $eventdate->date = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"eventdate\",$params));\n $eventdate->update();\n }\n \t\t} else { // not recurring\n// $calevent->update();\n \t\t\t// There should be only one eventdate\n// $eventdate = $calevent->eventdate[0]->find('first','event_id = '.$calevent->id);\n $eventdate = $calevent->find('first','event_id = '.$this->id);\n \t\t\t$eventdate->date = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"eventdate\",$params));\n $eventdate->update();\n \t\t}\n \t} else { // new event\n \t\t$start_recur = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"eventdate\",$params));\n \t\t$stop_recur = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"untildate\",$params));",
" \t\tif (!empty($params['recur']) && $params['recur'] != \"recur_none\") { // recurring event\n \t\t\t// Do recurrence\n $freq = $params['recur_freq_'.$params['recur']];",
" \t\t\tswitch ($params['recur']) {\n \t\t\t\tcase \"recur_daily\":\n \t\t\t\t\t$dates = expDateTime::recurringDailyDates($start_recur,$stop_recur,$freq);\n \t\t\t\t\tbreak;\n \t\t\t\tcase \"recur_weekly\":\n $dateinfo = getdate($start_recur); //FIXME hack in case the day of week wasn't checked off\n \t\t\t\t\t$dates = expDateTime::recurringWeeklyDates($start_recur,$stop_recur,$freq,(!empty($params['day']) ? array_keys($params['day']) : array($dateinfo['wday'])));\n \t\t\t\t\tbreak;\n \t\t\t\tcase \"recur_monthly\":\n \t\t\t\t\t$dates = expDateTime::recurringMonthlyDates($start_recur,$stop_recur,$freq,(!empty($params['month_type'])?$params['month_type']:true));\n \t\t\t\t\tbreak;\n \t\t\t\tcase \"recur_yearly\":\n \t\t\t\t\t$dates = expDateTime::recurringYearlyDates($start_recur,$stop_recur,$freq);\n \t\t\t\t\tbreak;\n \t\t\t\tdefault:\n \t\t\t\t\techo \"Bad type: \" . $params['recur'] . \"<br />\";\n \t\t\t\t\treturn;\n \t\t\t\t\tbreak;\n \t\t\t}",
" $this->is_recurring = 1; // Set the recurrence flag.\n \t\t} else { // not recurring\n \t\t\t$dates = array($start_recur);\n \t\t}\n// $calevent->update($params); // prime the record with the parameters\n $this->save(true);\n \t\tforeach ($dates as $d) {\n $edate = new eventdate(array('event_id'=>$this->id,'location_data'=>$this->location_data,'date'=>$d));\n $edate->update();\n }\n \t}\n// $calevent->update($params);\n // call expController->update() to save the image, is it necessary?\n $this->save(true);\n }",
" public function afterDelete() {\n $ed = new eventdate();\n $dates = $ed->find('all','event_id='.$this->id);\n foreach ($dates as $date) {\n $date->delete();\n }\n }",
" public static function dayNames() {\n $days = array();\n for ($i=0; $i < 7; $i++) {\n $days['short'][$i] = substr(strftime(\"%a\", mktime(0, 0, 0, 6, $i+2, 2013)), 0, 1);\n $days['med'][$i] = strftime(\"%a\", mktime(0, 0, 0, 6, $i+2, 2013));\n $days['long'][$i] = strftime('%A ', mktime(0, 0, 0, 6, $i+2, 2013));\n }\n return $days;\n }",
" ",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Models\n * @package Modules\n */",
"class event extends expRecord {\n public $has_many = array('eventdate');\n protected $attachable_item_types = array(\n 'content_expCats'=>'expCat',\n 'content_expFiles'=>'expFile',\n 'content_expTags'=>'expTag'\n );",
" /**\n * Events have special circumstances since they are based on dates\n * 'upcoming', 'month', 'week', 'day', etc...\n *\n * @param string $range\n * @param null $where\n * @param null $order\n * @param null $limit\n * @param int $limitstart\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @return array\n */\n public function find($range = 'all', $where = null, $order = null, $limit = null, $limitstart = 0, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false)\n {\n if (is_numeric($range) || in_array($range, array('all', 'first', 'bytitle', 'count', 'in', 'bytag', 'bycat'))) {\n return parent::find($range, $where, $order, $limit, $limitstart, $get_assoc, $get_attached, $except, $cascade_except);\n } else { // 'upcoming', 'month', 'week', 'day', etc...\n //note $order is boolean for 'featured'\n //note $limit is number of days, NOT number of records\n //note $limitstart is a unixtimestamp in this instance",
" $order = expString::escape($order);\n if ($limit !== null)\n $limit = intval($limit);\n if ($limitstart !== null)\n $limitstart = intval($limitstart);",
" $ed = new eventdate();\n $day = expDateTime::startOfDayTimestamp(time());\n $sort_asc = true; // For the getEventsForDates call\n if (strcasecmp($range, 'upcoming') == 0) {\n if (!empty($limit)) {\n $eventlimit = \" AND date <= \" . ($day + ($limit * 86400));\n } else {\n $eventlimit = \"\";\n }\n $dates = $ed->find(\"all\", $where . \" AND date >= \" . $day . $eventlimit . \" ORDER BY date ASC \");\n// $begin = $day;\n// $end = null;\n $items = $this->getEventsForDates($dates, $sort_asc, $order ? true : false, true);",
"",
" // external events\n// $extitems = $this->getExternalEvents($begin, $end);\n // we need to crunch these down\n// $extitem = array();\n// foreach ($extitems as $days) {\n// foreach ($days as $event) {\n// if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break;\n// if (empty($event->eventstart)) $event->eventstart = $event->eventdate->date;\n// $extitem[] = $event;\n// }\n// }\n// $items = array_merge($items, $extitem);",
"",
" // event registration events\n// if (!empty($this->config['aggregate_registrations'])) $regitems = eventregistrationController::getRegEventsForDates($begin, $end, $regcolor);\n // we need to crunch these down\n// $regitem = array();\n// if (!empty($regitems)) foreach ($regitems as $days) {\n// foreach ($days as $value) {\n// $regitem[] = $value;\n// }\n// }\n// $items = array_merge($items, $regitem);",
"",
" $items = expSorter::sort(array('array' => $items, 'sortby' => 'eventstart', 'order' => 'ASC'));\n return $items;\n }\n }\n }",
" function getEventsForDates($edates, $sort_asc = true, $featuredonly = false, $condense = false) {\n global $eventid;",
" $events = array();\n $featuresql = \"\";\n if ($featuredonly)\n $featuresql = \" AND is_featured=1\";\n foreach ($edates as $edate) {\n $evs = $this->find('all', \"id=\" . $edate->event_id . $featuresql);\n foreach ($evs as $key=>$event) {\n if ($condense) {\n //fixme we're leaving events which ended earlier in the day which won't be displayed, which therefore cancels out tomorrow's event\n $eventid = $event->id;\n $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;'));\n if (!empty($multiday_event)) {\n unset($evs[$key]);\n continue;\n }\n }\n $evs[$key]->eventstart += $edate->date;\n $evs[$key]->eventend += $edate->date;\n $evs[$key]->date_id = $edate->id;\n if (!empty($event->expCat)) {\n $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color);\n// if (substr($catcolor,0,1)=='#') $catcolor = '\" style=\"color:'.$catcolor.';';\n $evs[$key]->color = $catcolor;\n }\n }\n if (count($events) < 500) { // magic number to not crash loop?\n $events = array_merge($events, $evs);\n } else {\n// $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!');\n// $events = array_merge($events, $evs);\n flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'));\n break; // keep from breaking system by too much data\n }\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }",
" public function update($params = array()) {\n $params['eventstart'] = datetimecontrol::parseData('eventstart',$params);\n $params['eventend'] = datetimecontrol::parseData('eventend',$params);\n $this->checkForAttachableItems($params);\n $this->build($params);\n// $id = !empty($params['id']) ? $params['id'] : null;\n// $calevent = new event($id);\n// $calevent->update($params); // prime the record with the parameters",
" if (!empty($params['id'])) { // update existing event\n $calevent = new eventdate();\n \t\tif (!empty($params['is_recurring'])) {\n \t\t\t// For recurring events, check some stuff.\n \t\t\t// Were all dates selected?\n $eventdates = $calevent->find('all',\"event_id=\".$this->id);\n \t\t\tif (count($params['dates']) != count($eventdates)) { // only part of list changed\n \t\t\t\t// yes. just update the original\n// $calevent->update();\n \t\t\t\t// If the date has changed, modify the current date_id\n// \t\t\t} else { // we've split out dates from original\n \t\t\t\t// No, create new and relink affected dates\n \t\t\t\tunset($this->id);\n// $calevent = new event($params); // create a new event based on parameters\n \t\t\t\tif (count($params['dates']) == 1) $this->is_recurring = 0; // Back to a single event.",
" $this->save(true); // save new event to get an event id",
" unset($params['id']);\n \t\t\t\tforeach (array_keys($params['dates']) as $date_id) { // update all the date occurrences being changed\n $eventdate = $calevent->find('first',\"id=\".$date_id);\n $eventdate->event_id = $this->id;\n if (count($params['dates']) == 1) $eventdate->date = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"eventdate\",$params));\n $eventdate->update($params);\n \t\t\t\t}\n \t\t\t} else { // all existing event occurrences have changed\n// \t\t\t $eventdate = $db->selectObject('eventdate','id='.intval($params['date_id']));\n $eventdate = $calevent->find('first','id='.intval($params['date_id']));\n $eventdate->date = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"eventdate\",$params));\n $eventdate->update();\n }\n \t\t} else { // not recurring\n// $calevent->update();\n \t\t\t// There should be only one eventdate\n// $eventdate = $calevent->eventdate[0]->find('first','event_id = '.$calevent->id);\n $eventdate = $calevent->find('first','event_id = '.$this->id);\n \t\t\t$eventdate->date = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"eventdate\",$params));\n $eventdate->update();\n \t\t}\n \t} else { // new event\n \t\t$start_recur = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"eventdate\",$params));\n \t\t$stop_recur = expDateTime::startOfDayTimestamp(yuicalendarcontrol::parseData(\"untildate\",$params));",
" \t\tif (!empty($params['recur']) && $params['recur'] != \"recur_none\") { // recurring event\n \t\t\t// Do recurrence\n $freq = $params['recur_freq_'.$params['recur']];",
" \t\t\tswitch ($params['recur']) {\n \t\t\t\tcase \"recur_daily\":\n \t\t\t\t\t$dates = expDateTime::recurringDailyDates($start_recur,$stop_recur,$freq);\n \t\t\t\t\tbreak;\n \t\t\t\tcase \"recur_weekly\":\n $dateinfo = getdate($start_recur); //FIXME hack in case the day of week wasn't checked off\n \t\t\t\t\t$dates = expDateTime::recurringWeeklyDates($start_recur,$stop_recur,$freq,(!empty($params['day']) ? array_keys($params['day']) : array($dateinfo['wday'])));\n \t\t\t\t\tbreak;\n \t\t\t\tcase \"recur_monthly\":\n \t\t\t\t\t$dates = expDateTime::recurringMonthlyDates($start_recur,$stop_recur,$freq,(!empty($params['month_type'])?$params['month_type']:true));\n \t\t\t\t\tbreak;\n \t\t\t\tcase \"recur_yearly\":\n \t\t\t\t\t$dates = expDateTime::recurringYearlyDates($start_recur,$stop_recur,$freq);\n \t\t\t\t\tbreak;\n \t\t\t\tdefault:\n \t\t\t\t\techo \"Bad type: \" . $params['recur'] . \"<br />\";\n \t\t\t\t\treturn;\n \t\t\t\t\tbreak;\n \t\t\t}",
" $this->is_recurring = 1; // Set the recurrence flag.\n \t\t} else { // not recurring\n \t\t\t$dates = array($start_recur);\n \t\t}\n// $calevent->update($params); // prime the record with the parameters\n $this->save(true);\n \t\tforeach ($dates as $d) {\n $edate = new eventdate(array('event_id'=>$this->id,'location_data'=>$this->location_data,'date'=>$d));\n $edate->update();\n }\n \t}\n// $calevent->update($params);\n // call expController->update() to save the image, is it necessary?\n $this->save(true);\n }",
" public function afterDelete() {\n $ed = new eventdate();\n $dates = $ed->find('all','event_id='.$this->id);\n foreach ($dates as $date) {\n $date->delete();\n }\n }",
" public static function dayNames() {\n $days = array();\n for ($i=0; $i < 7; $i++) {\n $days['short'][$i] = substr(strftime(\"%a\", mktime(0, 0, 0, 6, $i+2, 2013)), 0, 1);\n $days['med'][$i] = strftime(\"%a\", mktime(0, 0, 0, 6, $i+2, 2013));\n $days['long'][$i] = strftime('%A ', mktime(0, 0, 0, 6, $i+2, 2013));\n }\n return $days;\n }",
"",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class fileController extends expController {\n public $basemodel_name = \"expFile\";",
" protected $add_permissions = array(\n// 'picker'=>'Manage Files',\n 'import'=>'Import',\n 'export'=>'Export',\n );",
" protected $remove_permissions = array(\n 'delete'\n );",
"",
" public $requires_login = array(",
" 'picker'=>'must be logged in',\n 'editAlt'=>'must be logged in',\n 'editCat'=>'must be logged in',\n 'editShare'=>'must be logged in',\n 'editTitle'=>'must be logged in',",
" );",
" static function displayname() { return gt(\"File Manager\"); }\n static function description() { return gt(\"Add and manage Exponent Files\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }",
" public function manage_fixPaths() {\n // fixes file directory issues when the old file class was used to save record\n // where the trailing forward slash was not added. This simply checks to see\n // if the trailing / is there, if not, it adds it.",
" ",
" $file = new expFile();\n $files = $file->find('all');",
" ",
" foreach ($files as $key=>$file) {\n if (substr($files[$key]->directory,-1,1)!=\"/\") {\n $files[$key]->directory = $files[$key]->directory.'/';\n }\n $files[$key]->save();\n }",
" ",
"// eDebug($files,true);\n }",
" ",
" public function picker() {\n// global $user;",
" $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $jscatarray = array();\n $catarray = array();\n $catarray[] = 'Root Folder';\n foreach ($cats as $key=>$cat) {\n $jscatarray[$key]['label'] = $cat->title;\n $jscatarray[$key]['value'] = $cat->id;\n $catarray[$cat->id] = $cat->title;\n }\n $jsuncat['label'] = 'Root';\n $jsuncat['value'] = null;\n array_unshift($jscatarray,$jsuncat);\n $catarray['-1'] = 'All Folders';\n if (strstr($this->params['update'],'?')) {\n $update = explode('?',$this->params['update']);\n if (!empty($update[0])) $this->params['update'] = $update[0];\n }\n assign_to_template(array(\n 'update'=>$this->params['update'],\n 'filter'=>!empty($this->params['filter'])?$this->params['filter']:null,\n 'cats'=>$catarray,\n 'jscats'=>json_encode($jscatarray)\n ));\n }",
" ",
" public function uploader() {\n global $user;\n //expHistory::set('manageable', $this->params);\n flash('message',gt('Upload size limit').': '.ini_get('upload_max_filesize'));\n if(intval(ini_get('upload_max_filesize'))!=intval(ini_get('post_max_size')) && $user->isAdmin()){\n flash('error',gt('In order for the uploader to work correctly, \\'\"post_max_size\\' and \\'upload_max_filesize\\' within your php.ini file must match one another'));\n }",
" $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $catarray = array();\n $catarray[] = 'Root Folder';\n foreach ($cats as $cat) {\n $catarray[$cat->id] = $cat->title;\n }\n assign_to_template(array(\n 'update'=>$this->params['update'],\n \"upload_size\"=>ini_get('upload_max_filesize'),\n \"post_size\"=>ini_get('post_max_size'),\n \"bmax\"=>intval(ini_get('upload_max_filesize')/1024*1000000000),\n 'cats'=>$catarray,\n ));\n }",
" ",
" /**\n * Returns attached file view template configuration settings template\n *\n */\n public function get_view_config() {\n global $template;",
" ",
" // set paths we will search in for the view\n $paths = array(\n BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure',\n BASE.'framework/modules/common/views/file/configure',\n );",
" foreach ($paths as $path) {\n $view = $path.'/'.$this->params['view'].'.tpl';\n if (is_readable($view)) {\n if (bs(true)) {\n $bstrapview = $path.'/'.$this->params['view'].'.bootstrap.tpl';\n if (file_exists($bstrapview)) {\n $view = $bstrapview;\n }\n }\n if (bs3(true)) {\n $bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.tpl';\n if (file_exists($bstrapview)) {\n $view = $bstrapview;\n }\n }\n $template = new controllertemplate($this, $view);\n $ar = new expAjaxReply(200, 'ok');\n\t\t $ar->send();\n }\n }\n }",
" ",
" /**\n * Returns view template configuration settings view template\n *\n */\n public function get_module_view_config() {\n global $template;",
"// $controller = new $this->params['mod'];\n $controller = expModules::getController($this->params['mod']);\n // set paths we will search in for the view\n $paths = array(\n// BASE.'themes/'.DISPLAY_THEME.'/modules/'.$this->params['mod'].'/views/'.$this->params['mod'].'/configure',\n// BASE.'framework/modules/'.$this->params['mod'].'/views/'.$this->params['mod'].'/configure',\n $controller->viewpath.'/configure',\n \t BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath.'/configure'\n );",
" $config_found = false;\n foreach ($paths as $path) {\n $view = $path.'/'.$this->params['view'].'.config';\n if (is_readable($view)) {\n if (bs(true)) {\n $bstrapview = $path.'/'.$this->params['view'].'.bootstrap.config';\n if (file_exists($bstrapview)) {\n $view = $bstrapview;\n }\n }\n if (bs3(true)) {\n $bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.config';\n if (file_exists($bstrapview)) {\n $view = $bstrapview;\n }\n }\n $template = new controllertemplate($this, $view);\n $config_found = true;\n }\n }\n $parts = explode('_', $this->params['view']);\n if (!$config_found && ($this->params['view'] != $parts[0])) {\n foreach ($paths as $path) {\n $actview = $path.'/'.$parts[0].'.config';\n if (is_readable($actview)) {\n if (bs(true)) {\n $bstrapview = $path . '/' . $actview . '.bootstrap.config';\n if (file_exists($bstrapview)) {\n $actview = $bstrapview;\n }\n }\n if (bs3(true)) {\n $bstrapview = $path . '/' . $actview . '.bootstrap3.config';\n if (file_exists($bstrapview)) {\n $actview = $bstrapview;\n }\n }\n $template = new controllertemplate($this, $actview);\n $config_found = true;\n }\n }\n }\n if (!$config_found) {\n echo \"<p>\".gt('There Are No View Specific Settings').\"</p>\";\n $template = expTemplate::get_common_template('blank', null);\n }",
"// expTemplate::get_config_template($this);\n $ar = new expAjaxReply(200, 'ok');\n $ar->send();\n }",
" /**\n * Get a file record by id or pathname and return it as JSON via Ajax\n */\n public function getFile() {\n if (is_numeric($this->params['id'])) {\n $file = new expFile($this->params['id']);\n } else {\n $efile = new expFile();\n $path = str_replace(BASE, '', $this->params['id']);\n $path = str_replace('\\\\', '/', $path);\n $file = $efile->find('first','directory=\"'.dirname($path).'/'.'\" AND filename=\"'.basename($path).'\"');\n }\n $ar = new expAjaxReply(200, 'ok', $file);\n $ar->send();\n }",
" public function getFilesByJSON() {\n global $user;",
" $modelname = $this->basemodel_name;\n $results = 25; // default get all\n $startIndex = 0; // default start at 0\n// $sort = null; // default don't sort\n// $dir = 'asc'; // default sort dir is asc\n// $sort_dir = SORT_ASC;",
" // How many records to get?\n if(strlen($this->params['results']) > 0) {\n $results = $this->params['results'];\n }",
" // Start at which record?\n if(strlen($this->params['startIndex']) > 0) {\n $startIndex = $this->params['startIndex'];\n }",
" // Sorted?\n if(strlen($this->params['sort']) > 0) {\n if ($this->params['sort'] == 'cat') {\n $sort = 'id';\n } else {\n $sort = $this->params['sort'];\n }\n// if ($sort = 'id') $sort = 'filename';\n }",
" // Sort dir?\n if (($this->params['dir'] == 'false') || ($this->params['dir'] == 'desc') || ($this->params['dir'] == 'yui-dt-desc')) {\n $dir = 'desc';\n $sort_dir = SORT_DESC;\n } else {\n $dir = 'asc';\n $sort_dir = SORT_ASC;\n }\n $totalrecords = 0;",
" if (!empty($this->params['query'])) {\n $filter = '';\n if (!$user->isAdmin()) {\n $filter = \"(poster=\".$user->id.\" OR shared=1) AND \";\n };\n// if ($this->params['update']=='ck' || $this->params['update']=='tiny') {\n if (!empty($this->params['filter']) && $this->params['filter'] == 'image') {\n $filter .= \"is_image=1 AND \";\n }",
"// $this->params['query'] = expString::sanitize($this->params['query']);\n// $totalrecords = $this->$modelname->find('count',\"filename LIKE '%\".$this->params['query'].\"%' OR title LIKE '%\".$this->params['query'].\"%' OR alt LIKE '%\".$this->params['query'].\"%'\");\n// $files = $this->$modelname->find('all',$filter.\"filename LIKE '%\".$this->params['query'].\"%' OR title LIKE '%\".$this->params['query'].\"%' OR alt LIKE '%\".$this->params['query'].\"%'\".$imagesOnly,$sort.' '.$dir, $results, $startIndex);\n $files = $this->$modelname->find('all',$filter.\"(filename LIKE '%\".$this->params['query'].\"%' OR title LIKE '%\".$this->params['query'].\"%' OR alt LIKE '%\".$this->params['query'].\"%')\",$sort.' '.$dir);",
" //FiXME we need to get all records then group by cat, then trim/paginate\n $querycat = !empty($this->params['cat']) ? $this->params['cat'] : '0';\n $groupedfiles = array();\n foreach ($files as $key=>$file) {\n $filecat = !empty($file->expCat[0]->id) ? $file->expCat[0]->id : 0;\n if (($querycat == $filecat || $querycat == -1)) {\n $totalrecords++;\n if (count($groupedfiles) < ($startIndex + $results)) {\n $groupedfiles[$key] = $files[$key];\n if (!empty($file->expCat[0]->title)) {\n $groupedfiles[$key]->cat = $file->expCat[0]->title;\n $groupedfiles[$key]->catid = $file->expCat[0]->id;\n }\n $tmpusr = new user($file->poster);\n $groupedfiles[$key]->user = new stdClass();\n $groupedfiles[$key]->user->firstname = $tmpusr->firstname;\n $groupedfiles[$key]->user->lastname = $tmpusr->lastname;\n $groupedfiles[$key]->user->username = $tmpusr->username;\n }\n }\n }\n $groupedfiles = array_values(array_filter($groupedfiles));\n $files = array_slice($groupedfiles,$startIndex,$results);",
" $returnValue = array(\n 'recordsReturned'=>count($files),\n 'totalRecords'=>$totalrecords,\n 'startIndex'=>$startIndex,\n 'sort'=>$sort,\n 'dir'=>$dir,\n 'pageSize'=>$results,\n 'records'=>$files\n );\n } else {\n if (!$user->isAdmin()) {\n $filter = \"(poster=\".$user->id.\" OR shared=1)\";\n };\n// if ($this->params['update']=='ck' || $this->params['update']=='tiny') {\n if (!empty($this->params['filter']) && $this->params['filter'] == 'image') {\n $filter .= !empty($filter) ? \" AND \" : \"\";\n $filter .= \"is_image=1\";\n }",
" ",
"// $totalrecords = $this->$modelname->find('count',$filter);\n// $files = $this->$modelname->find('all',$filter,$sort.' '.$dir, $results, $startIndex);\n $files = $this->$modelname->find('all', $filter, $sort.' '.$dir);",
" $groupedfiles = array();\n foreach ($files as $key=>$file) {\n if (empty($file->expCat[0]->title)) {\n $totalrecords++;\n if (count($groupedfiles) < ($startIndex + $results)) {\n $groupedfiles[$key] = $files[$key];\n // $files[$key]->cat = $file->expCat[0]->title;\n // $files[$key]->catid = $file->expCat[0]->id;\n $tmpusr = new user($file->poster);\n $groupedfiles[$key]->user = new stdClass();\n $groupedfiles[$key]->user->firstname = $tmpusr->firstname;\n $groupedfiles[$key]->user->lastname = $tmpusr->lastname;\n $groupedfiles[$key]->user->username = $tmpusr->username;\n }\n }\n }\n $groupedfiles = array_values(array_filter($groupedfiles));\n $files = array_slice($groupedfiles,$startIndex,$results);",
" $returnValue = array(\n 'recordsReturned'=>count($files),\n 'totalRecords'=>$totalrecords,\n 'startIndex'=>$startIndex,\n 'sort'=>$sort,\n 'dir'=>$dir,\n 'pageSize'=>$results,\n 'records'=>$files\n );",
" \n }\n ",
" echo json_encode($returnValue);\n }",
" /**\n * create a new virtual folder in response to an ajax request\n * return updated list of virtual folders in response to an ajax request\n */\n public function createFolder() {\n if (!empty($this->params['folder'])) {\n $expcat = new expCat($this->params['folder']);\n if (empty($expcat->id)) {\n $expcat->module = 'file';\n $expcat->title = $this->params['folder'];\n $expcat->update();\n }\n// $this->params['module'] = 'file';\n// $this->params['title'] = $this->params['folder'];\n// parent::update();\n $cats = $expcat->find('all','module=\"file\"','rank');\n $catarray = array();\n $catarray[] = 'Root Folder';\n foreach ($cats as $cat) {\n $catarray[$cat->id] = $cat->title;\n }\n echo json_encode($catarray);\n }\n }",
" public function delete() {\n// global $db,$user;\n global $user;",
" $file = new expFile($this->params['id']);\n if ($user->id==$file->poster || $user->isAdmin()) {\n $file->delete();\n if (unlink($file->directory.$file->filename)) {\n flash('message',$file->filename.' '.gt('was successfully deleted'));\n } else {\n flash('error',$file->filename.' '.gt('was deleted from the database, but could not be removed from the file system.'));\n }\n } else {\n flash('error',$file->filename.' '.gt('wasn\\'t deleted because you don\\'t own the file.'));\n }\n redirect_to(array(\"controller\"=>'file',\"action\"=>'picker',\"ajax_action\"=>1,\"update\"=>$this->params['update'],\"filter\"=>$this->params['filter']));",
" } \n ",
" public function deleter() {\n// global $db;",
" $notafile = array();\n// $files = $db->selectObjects('expFiles',1);\n foreach (expFile::selectAllFiles() as $file) {\n if (!is_file(BASE.$file->directory.$file->filename)) {\n $notafile[$file->id] = $file;\n }\n }\n assign_to_template(array(\n 'files'=>$notafile\n ));\n }",
" public function deleteit() {\n global $user;\n if (!empty($this->params['deleteit'])) {\n foreach ($this->params['deleteit'] as $file) {\n $delfile = new expFile($file);\n if ($user->id==$delfile->poster || $user->isAdmin()) {\n $delfile->delete();\n flash('error',$delfile->filename.' '.gt('was deleted from the database.'));\n }\n }\n }\n redirect_to(array(\"controller\"=>'file',\"action\"=>'picker',\"ajax_action\"=>1,\"update\"=>$this->params['update'],\"filter\"=>$this->params['filter']));\n }",
" public function batchDelete() {\n global $user;",
" $error = false;\n// if (get_magic_quotes_gpc()) $this->params['files'] = stripslashes($this->params['files']); // magic quotes fix\n $this->params['files'] = stripslashes($this->params['files']);\n $files = json_decode($this->params['files']);\n switch (json_last_error()) { //FIXME json error checking/reporting, may no longer be needed\n case JSON_ERROR_NONE:\n break;\n case JSON_ERROR_DEPTH:\n $error = 'JSON - Maximum stack depth exceeded';\n break;\n case JSON_ERROR_STATE_MISMATCH:\n $error = 'JSON - Underflow or the modes mismatch';\n break;\n case JSON_ERROR_CTRL_CHAR:\n $error = 'JSON - Unexpected control character found';\n break;\n case JSON_ERROR_SYNTAX:\n $error = 'JSON - Syntax error, malformed JSON';\n break;\n case JSON_ERROR_UTF8:\n $error = 'JSON - Malformed UTF-8 characters, possibly incorrectly encoded';\n break;\n default:\n $error = 'JSON - Unknown error';\n break;\n }",
" if (empty($error)) foreach ($files as $file) {\n $delfile = new expFile($file->id);\n if ($user->id==$delfile->poster || $user->isAdmin()) {\n $delfile->delete();\n unlink($delfile->directory.$delfile->filename);\n } else {\n $error = gt(\"you didn't have permission\");\n }\n }\n if (!empty($error)) {\n $ar = new expAjaxReply(300, gt(\"Some files were NOT deleted because\") . ' ' . $error);\n } else {\n $ar = new expAjaxReply(200, gt('Your files were deleted successfully'), $file);\n }\n $ar->send();\n }",
" public function adder() {\n global $db;",
" $notindb = array();\n $allfiles = expFile::listFlat(BASE.'files',true,null,array(),BASE);\n foreach ($allfiles as $path=>$file) {\n if ($file[0] != '.') {\n// $found = false;\n $npath = preg_replace('/'.$file.'/','',$path, 1);\n// $dbfiles = $db->selectObjects('expFiles',\"filename='\".$file.\"' AND directory='\".$npath.\"'\");\n $dbfile = $db->selectObject('expFiles',\"filename='\".$file.\"' AND directory='\".$npath.\"'\");\n// foreach ($dbfiles as $dbfile) {\n// if (!empty($dbfile)) $found = ($dbfile->directory == str_replace($file,'',$path));\n// }\n// if (!$found) {\n// $notindb[$path] = $file;\n// }\n if (empty($dbfile)) {\n $notindb[$path] = $file;\n }\n }\n }\n assign_to_template(array(\n 'files'=>$notindb\n ));\n }",
" public function addit() {\n foreach ($this->params['addit'] as $file) {\n $newfile = new expFile(array('directory'=>dirname($file).'/','filename'=>basename($file)));\n $newfile->posted = $newfile->last_accessed = filemtime($file);\n $newfile->save();\n flash('message',$newfile->filename.' '.gt('was added to the File Manager.'));\n }\n redirect_to(array(\"controller\"=>'file',\"action\"=>'picker',\"ajax_action\"=>1,\"update\"=>$this->params['update'],\"filter\"=>$this->params['filter']));\n }",
" public function upload() {",
" ",
" // upload the file, but don't save the record yet...\n if ($this->params['resize'] != 'false') {\n $maxwidth = $this->params['max_width'];\n } else {\n $maxwidth = null;\n }\n $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth);\n // since most likely this function will only get hit via flash in YUI Uploader\n // and since Flash can't pass cookies, we lose the knowledge of our $user\n // so we're passing the user's ID in as $_POST data. We then instantiate a new $user,\n // and then assign $user->id to $file->poster so we have an audit trail for the upload",
" if (is_object($file)) {\n $resized = !empty($file->resized) ? true : false;\n $user = new user($this->params['usrid']);\n $file->poster = $user->id;\n $file->posted = $file->last_accessed = time();\n $file->save();\n if (!empty($this->params['cat'])) {\n $expcat = new expCat($this->params['cat']);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n }",
" // a echo so YUI Uploader is notified of the function's completion\n if ($resized) {\n echo gt('File resized and then saved');\n } else {\n echo gt('File saved');\n }\n } else {\n echo gt('File was NOT uploaded!');\n// flash('error',gt('File was not uploaded!'));\n }",
" } ",
"\n public function quickUpload(){\n global $user;",
" if (!empty($this->params['folder']) || (defined('QUICK_UPLOAD_FOLDER') && QUICK_UPLOAD_FOLDER != '' && QUICK_UPLOAD_FOLDER != 0)) {\n // prevent attempt to place file somewhere other than /files folder\n if (!empty($this->params['folder']) && strpos($this->params['folder'], '..') !== false) {\n $ar = new expAjaxReply(300, gt(\"File was not uploaded!\"));\n $ar->send();\n }\n if (SITE_FILE_MANAGER == 'picker') {\n $quikFolder = !empty($this->params['folder']) ? $this->params['folder'] :QUICK_UPLOAD_FOLDER;\n $destDir = null;\n } elseif (SITE_FILE_MANAGER == 'elfinder') {\n $quikFolder = null;\n $destDir = UPLOAD_DIRECTORY_RELATIVE . (!empty($this->params['folder']) ? $this->params['folder'] :QUICK_UPLOAD_FOLDER) . '/';\n // create folder if non-existant\n expFile::makeDirectory($destDir);\n }\n } else {\n $quikFolder = null;\n $destDir = null;\n }",
" //extensive suitability check before doing anything with the file...\n if (isset($_SERVER['HTTP_X_FILE_NAME'])) { //HTML5 XHR upload\n $file = expFile::fileXHRUpload($_SERVER['HTTP_X_FILE_NAME'],false,false,null,$destDir,intval(QUICK_UPLOAD_WIDTH));\n $file->poster = $user->id;\n $file->posted = $file->last_accessed = time();\n $file->save();\n if (!empty($quikFolder)) {\n $expcat = new expCat($quikFolder);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n }\n $ar = new expAjaxReply(200, gt('Your File was uploaded successfully'), $file->id);\n $ar->send();\n } else { //$_POST upload\n if (($_FILES['uploadfile'] == \"none\") OR (empty($_FILES['uploadfile']['name'])) ) {\n $message = gt(\"No file uploaded.\");\n } else if ($_FILES['uploadfile'][\"size\"] == 0) {\n $message = gt(\"The file is zero length.\");\n // } else if (($_FILES['upload'][\"type\"] != \"image/pjpeg\") AND ($_FILES['upload'][\"type\"] != \"image/jpeg\") AND ($_FILES['upload'][\"type\"] != \"image/png\")) {\n // $message = gt(\"The image must be in either JPG or PNG format. Please upload a JPG or PNG instead.\");\n } else if (!is_uploaded_file($_FILES['uploadfile'][\"tmp_name\"])) {\n $message = gt(\"You may be attempting to hack our server.\");\n } else {\n // upload the file, but don't save the record yet...\n $file = expFile::fileUpload('uploadfile',false,false,null,$destDir,intval(QUICK_UPLOAD_WIDTH));\n // since most likely this function will only get hit via flash in YUI Uploader\n // and since Flash can't pass cookies, we lose the knowledge of our $user\n // so we're passing the user's ID in as $_POST data. We then instantiate a new $user,\n // and then assign $user->id to $file->poster so we have an audit trail for the upload\n if (is_object($file)) {\n $file->poster = $user->id;\n $file->posted = $file->last_accessed = time();\n $file->save();\n if (!empty($quikFolder)) {\n $expcat = new expCat($quikFolder);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n }\n $ar = new expAjaxReply(200, gt('Your File was uploaded successfully'), $file->id);\n } else {\n $ar = new expAjaxReply(300, gt(\"File was not uploaded!\").' - '.$file);\n }\n $ar->send();\n }\n }\n }",
" public function editCat() {\n global $user;\n $file = new expFile($this->params['id']);\n if ($user->id==$file->poster || $user->isAdmin()) {\n $expcat = new expCat($this->params['newValue']);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n $file->cat = $expcat->title;\n $file->catid = $expcat->id;\n $ar = new expAjaxReply(200, gt('Your Folder was updated successfully'), $file);\n } else {\n $ar = new expAjaxReply(300, gt(\"You didn't create this file, so you can't edit it.\"));\n }\n $ar->send();\n }",
" public function editTitle() {\n global $user;\n $file = new expFile($this->params['id']);\n if ($user->id==$file->poster || $user->isAdmin()) {\n $file->title = $this->params['newValue'];\n $file->save();\n $ar = new expAjaxReply(200, gt('Your title was updated successfully'), $file);\n } else {\n $ar = new expAjaxReply(300, gt(\"You didn't create this file, so you can't edit it.\"));\n }\n $ar->send();",
" } ",
"\n public function editAlt() {",
" global $user; ",
" $file = new expFile($this->params['id']);\n if ($user->id==$file->poster || $user->isAdmin()) {\n $file->alt = $this->params['newValue'];\n $file->save();\n $ar = new expAjaxReply(200, gt('Your alt was updated successfully'), $file);\n } else {\n $ar = new expAjaxReply(300, gt(\"You didn't create this file, so you can't edit it.\"));\n }\n $ar->send();\n echo json_encode($file); //FIXME we exit before hitting this",
" } ",
"\n public function editShare() {\n global $user;\n $file = new expFile($this->params['id']);\n\t\tif(!isset($this->params['newValue'])) {\n\t\t\t$this->params['newValue'] = 0;\n\t\t}\n if ($user->id==$file->poster || $user->isAdmin()) {\n $file->shared = $this->params['newValue'];\n $file->save();\n $ar = new expAjaxReply(200, gt('This file is now shared.'), $file);\n } else {\n $ar = new expAjaxReply(300, gt(\"You didn't create this file, so it's not yours to share.\"));\n }\n $ar->send();\n echo json_encode($file); //FIXME we exit before hitting this\n }",
" public function import_eql() {\n }",
" public function import_eql_process() {\n global $db;",
" if ($_FILES['file']['error'] != UPLOAD_ERR_OK) {\n \tswitch($_FILES['file']['error']) {\n \t\tcase UPLOAD_ERR_INI_SIZE:\n \t\tcase UPLOAD_ERR_FORM_SIZE:\n \t\t\techo gt('The file you uploaded exceeded the size limits for the server.').'<br />';\n \t\t\tbreak;\n \t\tcase UPLOAD_ERR_PARTIAL:\n \t\t\techo gt('The file you uploaded was only partially uploaded.').'<br />';\n \t\t\tbreak;\n \t\tcase UPLOAD_ERR_NO_FILE:\n \t\t\techo gt('No file was uploaded.').'<br />';\n \t\t\tbreak;\n \t}\n } else {\n $errors = array();\n expSession::clearAllUsersSessionCache();",
" // copy in deprecated definitions files to aid in import\n $src = BASE . \"install/old_definitions\";\n $dst = BASE . \"framework/core/definitions\";\n if (is_dir($src) && expUtil::isReallyWritable($dst)) {\n $dir = opendir($src);\n while (false !== ($file = readdir($dir))) {\n if (($file != '.') && ($file != '..')) {\n if (!file_exists($dst . '/' . $file)) {\n copy($src . '/' . $file, $dst . '/' . $file);\n }\n }\n }\n closedir($dir);\n }",
" expFile::restoreDatabase($_FILES['file']['tmp_name'], $errors);",
" // now remove deprecated definitions files\n $src = BASE . \"install/old_definitions\";\n $dst = BASE . \"framework/core/definitions\";\n if (is_dir($src) && expUtil::isReallyWritable($dst)) {\n $dir = opendir($src);\n while (false !== ($file = readdir($dir))) {\n if (($file != '.') && ($file != '..')) {\n if (file_exists($dst . '/' . $file)) {\n unlink($dst . '/' . $file);\n }\n // remove empty deprecated tables\n $table = substr($file, 0, -4);\n if ($db->tableIsEmpty($table)) {\n $db->dropTable($table);\n }\n }\n }\n closedir($dir);\n }",
" // update search index\n searchController::spider();",
" // check to see if we need to install or upgrade the restored database\n expVersion::checkVersion();",
" assign_to_template(\n array(\n 'success' => !count($errors),\n 'errors' => $errors,\n )\n );\n }\n }",
" public static function getTables() {\n global $db;",
" expDatabase::fix_table_names();\n $tables = $db->getTables();\n if (!function_exists('tmp_removePrefix')) {\n \tfunction tmp_removePrefix($tbl) {\n \t\t// we add 1, because DB_TABLE_PREFIX no longer has the trailing\n \t\t// '_' character - that is automatically added by the database class.\n \t\treturn substr($tbl,strlen(DB_TABLE_PREFIX)+1);\n \t}\n }\n $tables = array_map('tmp_removePrefix',$tables);\n usort($tables,'strnatcmp');\n return $tables;\n }",
" public function export_eql() {\n// global $db, $user;\n global $user;",
"// expDatabase::fix_table_names();\n// $tables = $db->getTables();\n// if (!function_exists('tmp_removePrefix')) {\n// \tfunction tmp_removePrefix($tbl) {\n// \t\t// we add 1, because DB_TABLE_PREFIX no longer has the trailing\n// \t\t// '_' character - that is automatically added by the database class.\n// \t\treturn substr($tbl,strlen(DB_TABLE_PREFIX)+1);\n// \t}\n// }\n// $tables = array_map('tmp_removePrefix',$tables);\n// usort($tables,'strnatcmp');",
" assign_to_template(array(\n 'user' => $user,\n 'tables' => self::getTables(),\n ));\n }",
" public function export_eql_process() {\n// global $db;",
" if (!isset($this->params['tables'])) { // No checkboxes clicked so we'll dump all tables\n $this->params['tables'] = self::getTables();\n $this->params['tables'] = array_flip($this->params['tables']);\n }\n// \techo gt('You must choose at least one table to export.');\n// } else { // All good\n \t$filename = str_replace(\n \t\tarray('__DOMAIN__','__DB__'),\n \t\tarray(str_replace('.','_',HOSTNAME),DB_NAME),\n $this->params['filename']);\n \t$filename = preg_replace('/[^A-Za-z0-9_.-]/','-',strftime($filename,time()).'.eql');",
" \tob_end_clean();\n \tob_start(\"ob_gzhandler\");",
" \tif (isset($this->params['save_sample'])) { // Save as a theme sample is checked off\n \t\t$path = BASE . \"themes/\".DISPLAY_THEME.\"/sample.eql\";\n \t\tif (!$eql = fopen ($path, \"w\")) {\n \t\t\tflash('error',gt(\"Error opening eql file for writing\").\" \".$path);\n \t\t} else {\n //TODO we need to write inside call passing $eql file pointer\n $eqlfile = expFile::dumpDatabase(array_keys($this->params['tables']));\n \t\t\tif (fwrite ($eql, $eqlfile) === FALSE) {\n \t\t\t\tflash('error',gt(\"Error writing to eql file\").\" \".$path);\n \t\t\t}\n \t\t\tfclose ($eql);\n \t\t\tflash('message',gt(\"Sample database (eql file) saved to\").\" '\".DISPLAY_THEME.\"' \".gt(\"theme\"));\n \t\t\texpHistory::back();\n \t\t}\n \t} else {\n \t\t// This code was lifted from phpMyAdmin, but this is Open Source, right?",
" \t\t// 'application/octet-stream' is the registered IANA type but\n \t\t// MSIE and Opera seems to prefer 'application/octetstream'\n \t\t$mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" \t\theader('Content-Type: ' . $mime_type);\n \t\theader('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n \t\t// IE need specific headers\n \t\tif (EXPONENT_USER_BROWSER == 'IE') {\n \t\t\theader('Content-Disposition: inline; filename=\"' . $filename . '\"');\n \t\t\theader('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n \t\t\theader('Pragma: public');\n \t\t} else {\n \t\t\theader('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n \t\t\theader('Pragma: no-cache');\n \t\t}\n echo expFile::dumpDatabase(array_keys($this->params['tables'])); //FIXME we need to echo inside call\n \t\texit; // Exit, since we are exporting\n \t}\n// }\n }",
" public function import_files() {\n }",
" public function import_files_process() {\n if ($_FILES['file']['error'] != UPLOAD_ERR_OK) {\n \tswitch($_FILES['file']['error']) {\n \t\tcase UPLOAD_ERR_INI_SIZE:\n \t\tcase UPLOAD_ERR_FORM_SIZE:\n \t\t\techo gt('The file you uploaded exceeded the size limits for the server.').'<br />';\n \t\t\tbreak;\n \t\tcase UPLOAD_ERR_PARTIAL:\n \t\t\techo gt('The file you uploaded was only partially uploaded.').'<br />';\n \t\t\tbreak;\n \t\tcase UPLOAD_ERR_NO_FILE:\n \t\t\techo gt('No file was uploaded.').'<br />';\n \t\t\tbreak;\n \t}\n } else {\n \t$basename = basename($_FILES['file']['name']);",
" \tinclude_once(BASE.'external/Tar.php');\n \t$tar = new Archive_Tar($_FILES['file']['tmp_name'],'gz');",
" \t$dest_dir = BASE.'tmp/extensionuploads/'.uniqid('');\n \t@mkdir($dest_dir,DIR_DEFAULT_MODE_STR);\n \tif (!file_exists($dest_dir)) {\n \t\techo gt('Unable to create temporary directory to extract files archive.');\n \t} else {\n \t\t$return = $tar->extract($dest_dir);\n \t\tif (!$return) {\n \t\t\techo '<br />'.gt('Error extracting TAR archive').'<br />';\n \t\t} else if (!file_exists($dest_dir.'/files') || !is_dir($dest_dir.'/files')) {\n \t\t\techo '<br />'.gt('Invalid archive format, no \\'/files\\' folder').'<br />';\n \t\t} else {\n \t\t\t// Show the form for specifying which mod types to 'extract'",
" \t\t\t$mods = array(); // Stores the mod classname, the files list, and the module's real name",
" \t\t\t$dh = opendir($dest_dir.'/files');\n \t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\tif ($file{0} != '.' && is_dir($dest_dir.'/files/'.$file)) {\n \t\t\t\t\t$mods[$file] = array(\n \t\t\t\t\t\t'',\n \t\t\t\t\t\tarray_keys(expFile::listFlat($dest_dir.'/files/'.$file,1,null,array(),$dest_dir.'/files/'))\n \t\t\t\t\t);\n //\t\t\t\t\tif (class_exists($file)) {\n //\t\t\t\t\t\t$mods[$file][0] = call_user_func(array($file,'name')); // $file is the class name of the module\n //\t\t\t\t\t}\n \t\t\t\t} elseif ($file != '.' && $file != '..') {\n \t\t\t\t\t$mods[$file] = array(\n \t\t\t\t\t\t'',\n \t\t\t\t\t\t$file\n \t\t\t\t\t);\n \t\t\t\t}\n \t\t\t}",
" assign_to_template(array(\n 'dest_dir' => $dest_dir,\n 'file_data' => $mods,\n ));\n \t\t}\n \t}\n }\n }",
" public function import_files_extract() {\n $dest_dir = $this->params['dest_dir'];\n $files = array();\n foreach (array_keys($this->params['mods']) as $file) {\n \t$files[$file] = expFile::canCreate(BASE.'files/'.$file);\n //\tif (class_exists($mod)) {\n //\t\t$files[$mod][0] = call_user_func(array($mod,'name'));\n //\t}\n //\tforeach (array_keys(expFile::listFlat($dest_dir.'/files',1,null,array(),$dest_dir.'/files/')) as $file) {\n //\t\t$files[$mod][1][$file] = expFile::canCreate(BASE.'files/'.$file);\n //\t}\n }",
" expSession::set('dest_dir',$dest_dir);\n expSession::set('files_data',$files);",
" assign_to_template(array(\n 'files_data' => $files,\n ));\n }",
" public function import_files_finish() {\n $dest_dir = expSession::get('dest_dir');\n $files = expSession::get('files_data');\n if (!file_exists(BASE.'files')) {\n \tmkdir(BASE.'files',DIR_DEFAULT_MODE_STR);\n }",
" $filecount = 0;\n foreach (array_keys($files) as $file) {\n expFile::copyDirectoryStructure($dest_dir.'/files/'.$file,BASE.'files/'.$file);\n \tcopy($dest_dir.'/files/'.$file,BASE.'files/'.$file);\n \t$filecount++;\n }",
" expSession::un_set('dest_dir');\n expSession::un_set('files_data');",
" expFile::removeDirectory($dest_dir);",
" assign_to_template(array(\n 'file_count' => $filecount,\n ));\n }",
" public function export_files() {\n global $user;",
" $loc = expCore::makeLocation($this->params['controller'],isset($this->params['src'])?$this->params['src']:null,isset($this->params['int'])?$this->params['int']:null);\n //$mods = array();\n //$dh = opendir(BASE.'files');\n //while (($file = readdir($dh)) !== false) {\n //\tif (is_dir(BASE.'files/'.$file) && $file{0} != '.' && class_exists($file)) {\n //\t\t$mods[$file] = call_user_func(array($file,'name'));\n //\t}\n //}\n //uasort($mods,'strnatcmp');",
" assign_to_template(array(\n 'user' => $user,\n ));\n }",
" public function export_files_process() {\n// global $db;",
" //if (!isset($this->params['mods'])) {\n //\techo gt('You must select at least one module to export files for.');\n //\treturn;\n //}",
" include_once(BASE.'external/Tar.php');",
" $files = array();\n //foreach (array_keys($this->params['mods']) as $mod) {\n //\tforeach ($db->selectObjects('file',\"directory LIKE 'files/\".$mod.\"%'\") as $file) {\n// foreach ($db->selectObjects('expFiles',1) as $file) {\n foreach (expFile::selectAllFiles() as $file) {\n $files[] = BASE.$file->directory.$file->filename;\n }\n //}",
" $fname = tempnam(BASE.'/tmp','exporter_files_');\n $tar = new Archive_Tar($fname,'gz');\n $tar->createModify($files,'',BASE);",
" $filename = str_replace(\n array('__DOMAIN__','__DB__'),\n array(str_replace('.','_',HOSTNAME),DB_NAME),\n $this->params['filename']);\n $filename = preg_replace('/[^A-Za-z0-9_.-]/','-',strftime($filename,time()).'.tar.gz');",
" if (isset($this->params['save_sample'])) { // Save as a theme sample is checked off\n copy($fname,BASE . \"themes/\".DISPLAY_THEME_REAL.\"/sample.tar.gz\");\n unlink($fname);\n flash('message',gt(\"Sample uploaded files archive saved to\").\" '\".DISPLAY_THEME_REAL.\"' \".gt(\"theme\"));\n expHistory::back();\n } else {\n ob_end_clean();\n // This code was lifted from phpMyAdmin, but this is Open Source, right?",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }",
" $fh = fopen($fname,'rb');\n while (!feof($fh)) {\n echo fread($fh,8192);\n }\n fclose($fh);\n unlink($fname);\n }",
" exit(''); // Exit, since we are exporting.\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class fileController extends expController {\n public $basemodel_name = \"expFile\";",
"",
" protected $remove_permissions = array(\n 'delete'\n );",
"// protected $manage_permissions = array(\n// 'picker'=>'Manage Files',\n// 'import'=>'Import',\n// 'export'=>'Export',\n// );",
" public $requires_login = array(",
" 'picker'=>'You must be logged in to perform this action',\n 'adder'=>'You must be logged in to perform this action',\n 'addit'=>'You must be logged in to perform this action',\n 'batchDelete'=>'You must be logged in to perform this action',\n 'createFolder'=>'You must be logged in to perform this action',\n 'deleter'=>'You must be logged in to perform this action',\n 'deleteit'=>'You must be logged in to perform this action',\n 'edit'=>'You must be logged in to perform this action',\n 'quickUpload'=>'You must be logged in to perform this action',\n 'upload'=>'You must be logged in to perform this action',\n 'uploader'=>'You must be logged in to perform this action',",
" );",
" static function displayname() { return gt(\"File Manager\"); }\n static function description() { return gt(\"Add and manage Exponent Files\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }",
" public function manage_fixPaths() {\n // fixes file directory issues when the old file class was used to save record\n // where the trailing forward slash was not added. This simply checks to see\n // if the trailing / is there, if not, it adds it.",
"",
" $file = new expFile();\n $files = $file->find('all');",
"",
" foreach ($files as $key=>$file) {\n if (substr($files[$key]->directory,-1,1)!=\"/\") {\n $files[$key]->directory = $files[$key]->directory.'/';\n }\n $files[$key]->save();\n }",
"",
"// eDebug($files,true);\n }",
"",
" public function picker() {\n// global $user;",
" $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $jscatarray = array();\n $catarray = array();\n $catarray[] = 'Root Folder';\n foreach ($cats as $key=>$cat) {\n $jscatarray[$key]['label'] = $cat->title;\n $jscatarray[$key]['value'] = $cat->id;\n $catarray[$cat->id] = $cat->title;\n }\n $jsuncat['label'] = 'Root';\n $jsuncat['value'] = null;\n array_unshift($jscatarray,$jsuncat);\n $catarray['-1'] = 'All Folders';\n if (strstr($this->params['update'],'?')) {\n $update = explode('?',$this->params['update']);\n if (!empty($update[0])) $this->params['update'] = $update[0];\n }\n assign_to_template(array(\n 'update'=>$this->params['update'],\n 'filter'=>!empty($this->params['filter'])?$this->params['filter']:null,\n 'cats'=>$catarray,\n 'jscats'=>json_encode($jscatarray)\n ));\n }",
"",
" public function uploader() {\n global $user;\n //expHistory::set('manageable', $this->params);\n flash('message',gt('Upload size limit').': '.ini_get('upload_max_filesize'));\n if(intval(ini_get('upload_max_filesize'))!=intval(ini_get('post_max_size')) && $user->isAdmin()){\n flash('error',gt('In order for the uploader to work correctly, \\'\"post_max_size\\' and \\'upload_max_filesize\\' within your php.ini file must match one another'));\n }",
" $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $catarray = array();\n $catarray[] = 'Root Folder';\n foreach ($cats as $cat) {\n $catarray[$cat->id] = $cat->title;\n }\n assign_to_template(array(\n 'update'=>$this->params['update'],\n \"upload_size\"=>ini_get('upload_max_filesize'),\n \"post_size\"=>ini_get('post_max_size'),\n \"bmax\"=>intval(ini_get('upload_max_filesize')/1024*1000000000),\n 'cats'=>$catarray,\n ));\n }",
"",
" /**\n * Returns attached file view template configuration settings template\n *\n */\n public function get_view_config() {\n global $template;",
"",
" // set paths we will search in for the view\n $paths = array(\n BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure',\n BASE.'framework/modules/common/views/file/configure',\n );",
" foreach ($paths as $path) {\n $view = $path.'/'.$this->params['view'].'.tpl';\n if (is_readable($view)) {\n if (bs(true)) {\n $bstrapview = $path.'/'.$this->params['view'].'.bootstrap.tpl';\n if (file_exists($bstrapview)) {\n $view = $bstrapview;\n }\n }\n if (bs3(true)) {\n $bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.tpl';\n if (file_exists($bstrapview)) {\n $view = $bstrapview;\n }\n }\n $template = new controllertemplate($this, $view);\n $ar = new expAjaxReply(200, 'ok');\n\t\t $ar->send();\n }\n }\n }",
"",
" /**\n * Returns view template configuration settings view template\n *\n */\n public function get_module_view_config() {\n global $template;",
"// $controller = new $this->params['mod'];\n $controller = expModules::getController($this->params['mod']);\n // set paths we will search in for the view\n $paths = array(\n// BASE.'themes/'.DISPLAY_THEME.'/modules/'.$this->params['mod'].'/views/'.$this->params['mod'].'/configure',\n// BASE.'framework/modules/'.$this->params['mod'].'/views/'.$this->params['mod'].'/configure',\n $controller->viewpath.'/configure',\n \t BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath.'/configure'\n );",
" $config_found = false;\n foreach ($paths as $path) {\n $view = $path.'/'.$this->params['view'].'.config';\n if (is_readable($view)) {\n if (bs(true)) {\n $bstrapview = $path.'/'.$this->params['view'].'.bootstrap.config';\n if (file_exists($bstrapview)) {\n $view = $bstrapview;\n }\n }\n if (bs3(true)) {\n $bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.config';\n if (file_exists($bstrapview)) {\n $view = $bstrapview;\n }\n }\n $template = new controllertemplate($this, $view);\n $config_found = true;\n }\n }\n $parts = explode('_', $this->params['view']);\n if (!$config_found && ($this->params['view'] != $parts[0])) {\n foreach ($paths as $path) {\n $actview = $path.'/'.$parts[0].'.config';\n if (is_readable($actview)) {\n if (bs(true)) {\n $bstrapview = $path . '/' . $actview . '.bootstrap.config';\n if (file_exists($bstrapview)) {\n $actview = $bstrapview;\n }\n }\n if (bs3(true)) {\n $bstrapview = $path . '/' . $actview . '.bootstrap3.config';\n if (file_exists($bstrapview)) {\n $actview = $bstrapview;\n }\n }\n $template = new controllertemplate($this, $actview);\n $config_found = true;\n }\n }\n }\n if (!$config_found) {\n echo \"<p>\".gt('There Are No View Specific Settings').\"</p>\";\n $template = expTemplate::get_common_template('blank', null);\n }",
"// expTemplate::get_config_template($this);\n $ar = new expAjaxReply(200, 'ok');\n $ar->send();\n }",
" /**\n * Get a file record by id or pathname and return it as JSON via Ajax\n */\n public function getFile() {\n if (is_numeric($this->params['id'])) {\n $file = new expFile($this->params['id']);\n } else {\n $efile = new expFile();\n $path = str_replace(BASE, '', $this->params['id']);\n $path = str_replace('\\\\', '/', $path);\n $file = $efile->find('first','directory=\"'.dirname($path).'/'.'\" AND filename=\"'.basename($path).'\"');\n }\n $ar = new expAjaxReply(200, 'ok', $file);\n $ar->send();\n }",
" public function getFilesByJSON() {\n global $user;",
" $modelname = $this->basemodel_name;\n $results = 25; // default get all\n $startIndex = 0; // default start at 0\n// $sort = null; // default don't sort\n// $dir = 'asc'; // default sort dir is asc\n// $sort_dir = SORT_ASC;",
" // How many records to get?\n if(strlen($this->params['results']) > 0) {\n $results = $this->params['results'];\n }",
" // Start at which record?\n if(strlen($this->params['startIndex']) > 0) {\n $startIndex = $this->params['startIndex'];\n }",
" // Sorted?\n if(strlen($this->params['sort']) > 0) {\n if ($this->params['sort'] == 'cat') {\n $sort = 'id';\n } else {\n $sort = $this->params['sort'];\n }\n// if ($sort = 'id') $sort = 'filename';\n }",
" // Sort dir?\n if (($this->params['dir'] == 'false') || ($this->params['dir'] == 'desc') || ($this->params['dir'] == 'yui-dt-desc')) {\n $dir = 'desc';\n $sort_dir = SORT_DESC;\n } else {\n $dir = 'asc';\n $sort_dir = SORT_ASC;\n }\n $totalrecords = 0;",
" if (!empty($this->params['query'])) {\n $filter = '';\n if (!$user->isAdmin()) {\n $filter = \"(poster=\".$user->id.\" OR shared=1) AND \";\n };\n// if ($this->params['update']=='ck' || $this->params['update']=='tiny') {\n if (!empty($this->params['filter']) && $this->params['filter'] == 'image') {\n $filter .= \"is_image=1 AND \";\n }",
"// $this->params['query'] = expString::sanitize($this->params['query']);\n// $totalrecords = $this->$modelname->find('count',\"filename LIKE '%\".$this->params['query'].\"%' OR title LIKE '%\".$this->params['query'].\"%' OR alt LIKE '%\".$this->params['query'].\"%'\");\n// $files = $this->$modelname->find('all',$filter.\"filename LIKE '%\".$this->params['query'].\"%' OR title LIKE '%\".$this->params['query'].\"%' OR alt LIKE '%\".$this->params['query'].\"%'\".$imagesOnly,$sort.' '.$dir, $results, $startIndex);\n $files = $this->$modelname->find('all',$filter.\"(filename LIKE '%\".$this->params['query'].\"%' OR title LIKE '%\".$this->params['query'].\"%' OR alt LIKE '%\".$this->params['query'].\"%')\",$sort.' '.$dir);",
" //FiXME we need to get all records then group by cat, then trim/paginate\n $querycat = !empty($this->params['cat']) ? $this->params['cat'] : '0';\n $groupedfiles = array();\n foreach ($files as $key=>$file) {\n $filecat = !empty($file->expCat[0]->id) ? $file->expCat[0]->id : 0;\n if (($querycat == $filecat || $querycat == -1)) {\n $totalrecords++;\n if (count($groupedfiles) < ($startIndex + $results)) {\n $groupedfiles[$key] = $files[$key];\n if (!empty($file->expCat[0]->title)) {\n $groupedfiles[$key]->cat = $file->expCat[0]->title;\n $groupedfiles[$key]->catid = $file->expCat[0]->id;\n }\n $tmpusr = new user($file->poster);\n $groupedfiles[$key]->user = new stdClass();\n $groupedfiles[$key]->user->firstname = $tmpusr->firstname;\n $groupedfiles[$key]->user->lastname = $tmpusr->lastname;\n $groupedfiles[$key]->user->username = $tmpusr->username;\n }\n }\n }\n $groupedfiles = array_values(array_filter($groupedfiles));\n $files = array_slice($groupedfiles,$startIndex,$results);",
" $returnValue = array(\n 'recordsReturned'=>count($files),\n 'totalRecords'=>$totalrecords,\n 'startIndex'=>$startIndex,\n 'sort'=>$sort,\n 'dir'=>$dir,\n 'pageSize'=>$results,\n 'records'=>$files\n );\n } else {\n if (!$user->isAdmin()) {\n $filter = \"(poster=\".$user->id.\" OR shared=1)\";\n };\n// if ($this->params['update']=='ck' || $this->params['update']=='tiny') {\n if (!empty($this->params['filter']) && $this->params['filter'] == 'image') {\n $filter .= !empty($filter) ? \" AND \" : \"\";\n $filter .= \"is_image=1\";\n }",
"",
"// $totalrecords = $this->$modelname->find('count',$filter);\n// $files = $this->$modelname->find('all',$filter,$sort.' '.$dir, $results, $startIndex);\n $files = $this->$modelname->find('all', $filter, $sort.' '.$dir);",
" $groupedfiles = array();\n foreach ($files as $key=>$file) {\n if (empty($file->expCat[0]->title)) {\n $totalrecords++;\n if (count($groupedfiles) < ($startIndex + $results)) {\n $groupedfiles[$key] = $files[$key];\n // $files[$key]->cat = $file->expCat[0]->title;\n // $files[$key]->catid = $file->expCat[0]->id;\n $tmpusr = new user($file->poster);\n $groupedfiles[$key]->user = new stdClass();\n $groupedfiles[$key]->user->firstname = $tmpusr->firstname;\n $groupedfiles[$key]->user->lastname = $tmpusr->lastname;\n $groupedfiles[$key]->user->username = $tmpusr->username;\n }\n }\n }\n $groupedfiles = array_values(array_filter($groupedfiles));\n $files = array_slice($groupedfiles,$startIndex,$results);",
" $returnValue = array(\n 'recordsReturned'=>count($files),\n 'totalRecords'=>$totalrecords,\n 'startIndex'=>$startIndex,\n 'sort'=>$sort,\n 'dir'=>$dir,\n 'pageSize'=>$results,\n 'records'=>$files\n );",
"\n }\n",
" echo json_encode($returnValue);\n }",
" /**\n * create a new virtual folder in response to an ajax request\n * return updated list of virtual folders in response to an ajax request\n */\n public function createFolder() {\n if (!empty($this->params['folder'])) {\n $expcat = new expCat($this->params['folder']);\n if (empty($expcat->id)) {\n $expcat->module = 'file';\n $expcat->title = $this->params['folder'];\n $expcat->update();\n }\n// $this->params['module'] = 'file';\n// $this->params['title'] = $this->params['folder'];\n// parent::update();\n $cats = $expcat->find('all','module=\"file\"','rank');\n $catarray = array();\n $catarray[] = 'Root Folder';\n foreach ($cats as $cat) {\n $catarray[$cat->id] = $cat->title;\n }\n echo json_encode($catarray);\n }\n }",
" public function delete() {\n// global $db,$user;\n global $user;",
" $file = new expFile($this->params['id']);\n if ($user->id==$file->poster || $user->isAdmin()) {\n $file->delete();\n if (unlink($file->directory.$file->filename)) {\n flash('message',$file->filename.' '.gt('was successfully deleted'));\n } else {\n flash('error',$file->filename.' '.gt('was deleted from the database, but could not be removed from the file system.'));\n }\n } else {\n flash('error',$file->filename.' '.gt('wasn\\'t deleted because you don\\'t own the file.'));\n }\n redirect_to(array(\"controller\"=>'file',\"action\"=>'picker',\"ajax_action\"=>1,\"update\"=>$this->params['update'],\"filter\"=>$this->params['filter']));",
" }\n",
" public function deleter() {\n// global $db;",
" $notafile = array();\n// $files = $db->selectObjects('expFiles',1);\n foreach (expFile::selectAllFiles() as $file) {\n if (!is_file(BASE.$file->directory.$file->filename)) {\n $notafile[$file->id] = $file;\n }\n }\n assign_to_template(array(\n 'files'=>$notafile\n ));\n }",
" public function deleteit() {\n global $user;\n if (!empty($this->params['deleteit'])) {\n foreach ($this->params['deleteit'] as $file) {\n $delfile = new expFile($file);\n if ($user->id==$delfile->poster || $user->isAdmin()) {\n $delfile->delete();\n flash('error',$delfile->filename.' '.gt('was deleted from the database.'));\n }\n }\n }\n redirect_to(array(\"controller\"=>'file',\"action\"=>'picker',\"ajax_action\"=>1,\"update\"=>$this->params['update'],\"filter\"=>$this->params['filter']));\n }",
" public function batchDelete() {\n global $user;",
" $error = false;\n// if (get_magic_quotes_gpc()) $this->params['files'] = stripslashes($this->params['files']); // magic quotes fix\n $this->params['files'] = stripslashes($this->params['files']);\n $files = json_decode($this->params['files']);\n switch (json_last_error()) { //FIXME json error checking/reporting, may no longer be needed\n case JSON_ERROR_NONE:\n break;\n case JSON_ERROR_DEPTH:\n $error = 'JSON - Maximum stack depth exceeded';\n break;\n case JSON_ERROR_STATE_MISMATCH:\n $error = 'JSON - Underflow or the modes mismatch';\n break;\n case JSON_ERROR_CTRL_CHAR:\n $error = 'JSON - Unexpected control character found';\n break;\n case JSON_ERROR_SYNTAX:\n $error = 'JSON - Syntax error, malformed JSON';\n break;\n case JSON_ERROR_UTF8:\n $error = 'JSON - Malformed UTF-8 characters, possibly incorrectly encoded';\n break;\n default:\n $error = 'JSON - Unknown error';\n break;\n }",
" if (empty($error)) foreach ($files as $file) {\n $delfile = new expFile($file->id);\n if ($user->id==$delfile->poster || $user->isAdmin()) {\n $delfile->delete();\n unlink($delfile->directory.$delfile->filename);\n } else {\n $error = gt(\"you didn't have permission\");\n }\n }\n if (!empty($error)) {\n $ar = new expAjaxReply(300, gt(\"Some files were NOT deleted because\") . ' ' . $error);\n } else {\n $ar = new expAjaxReply(200, gt('Your files were deleted successfully'), $file);\n }\n $ar->send();\n }",
" public function adder() {\n global $db;",
" $notindb = array();\n $allfiles = expFile::listFlat(BASE.'files',true,null,array(),BASE);\n foreach ($allfiles as $path=>$file) {\n if ($file[0] != '.') {\n// $found = false;\n $npath = preg_replace('/'.$file.'/','',$path, 1);\n// $dbfiles = $db->selectObjects('expFiles',\"filename='\".$file.\"' AND directory='\".$npath.\"'\");\n $dbfile = $db->selectObject('expFiles',\"filename='\".$file.\"' AND directory='\".$npath.\"'\");\n// foreach ($dbfiles as $dbfile) {\n// if (!empty($dbfile)) $found = ($dbfile->directory == str_replace($file,'',$path));\n// }\n// if (!$found) {\n// $notindb[$path] = $file;\n// }\n if (empty($dbfile)) {\n $notindb[$path] = $file;\n }\n }\n }\n assign_to_template(array(\n 'files'=>$notindb\n ));\n }",
" public function addit() {\n foreach ($this->params['addit'] as $file) {\n $newfile = new expFile(array('directory'=>dirname($file).'/','filename'=>basename($file)));\n $newfile->posted = $newfile->last_accessed = filemtime($file);\n $newfile->save();\n flash('message',$newfile->filename.' '.gt('was added to the File Manager.'));\n }\n redirect_to(array(\"controller\"=>'file',\"action\"=>'picker',\"ajax_action\"=>1,\"update\"=>$this->params['update'],\"filter\"=>$this->params['filter']));\n }",
" public function upload() {",
"",
" // upload the file, but don't save the record yet...\n if ($this->params['resize'] != 'false') {\n $maxwidth = $this->params['max_width'];\n } else {\n $maxwidth = null;\n }\n $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth);\n // since most likely this function will only get hit via flash in YUI Uploader\n // and since Flash can't pass cookies, we lose the knowledge of our $user\n // so we're passing the user's ID in as $_POST data. We then instantiate a new $user,\n // and then assign $user->id to $file->poster so we have an audit trail for the upload",
" if (is_object($file)) {\n $resized = !empty($file->resized) ? true : false;\n $user = new user($this->params['usrid']);\n $file->poster = $user->id;\n $file->posted = $file->last_accessed = time();\n $file->save();\n if (!empty($this->params['cat'])) {\n $expcat = new expCat($this->params['cat']);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n }",
" // a echo so YUI Uploader is notified of the function's completion\n if ($resized) {\n echo gt('File resized and then saved');\n } else {\n echo gt('File saved');\n }\n } else {\n echo gt('File was NOT uploaded!');\n// flash('error',gt('File was not uploaded!'));\n }",
" }",
"\n public function quickUpload(){\n global $user;",
" if (!empty($this->params['folder']) || (defined('QUICK_UPLOAD_FOLDER') && QUICK_UPLOAD_FOLDER != '' && QUICK_UPLOAD_FOLDER != 0)) {\n // prevent attempt to place file somewhere other than /files folder\n if (!empty($this->params['folder']) && strpos($this->params['folder'], '..') !== false) {\n $ar = new expAjaxReply(300, gt(\"File was not uploaded!\"));\n $ar->send();\n }\n if (SITE_FILE_MANAGER == 'picker') {\n $quikFolder = !empty($this->params['folder']) ? $this->params['folder'] :QUICK_UPLOAD_FOLDER;\n $destDir = null;\n } elseif (SITE_FILE_MANAGER == 'elfinder') {\n $quikFolder = null;\n $destDir = UPLOAD_DIRECTORY_RELATIVE . (!empty($this->params['folder']) ? $this->params['folder'] :QUICK_UPLOAD_FOLDER) . '/';\n // create folder if non-existant\n expFile::makeDirectory($destDir);\n }\n } else {\n $quikFolder = null;\n $destDir = null;\n }",
" //extensive suitability check before doing anything with the file...\n if (isset($_SERVER['HTTP_X_FILE_NAME'])) { //HTML5 XHR upload\n $file = expFile::fileXHRUpload($_SERVER['HTTP_X_FILE_NAME'],false,false,null,$destDir,intval(QUICK_UPLOAD_WIDTH));\n $file->poster = $user->id;\n $file->posted = $file->last_accessed = time();\n $file->save();\n if (!empty($quikFolder)) {\n $expcat = new expCat($quikFolder);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n }\n $ar = new expAjaxReply(200, gt('Your File was uploaded successfully'), $file->id);\n $ar->send();\n } else { //$_POST upload\n if (($_FILES['uploadfile'] == \"none\") OR (empty($_FILES['uploadfile']['name'])) ) {\n $message = gt(\"No file uploaded.\");\n } else if ($_FILES['uploadfile'][\"size\"] == 0) {\n $message = gt(\"The file is zero length.\");\n // } else if (($_FILES['upload'][\"type\"] != \"image/pjpeg\") AND ($_FILES['upload'][\"type\"] != \"image/jpeg\") AND ($_FILES['upload'][\"type\"] != \"image/png\")) {\n // $message = gt(\"The image must be in either JPG or PNG format. Please upload a JPG or PNG instead.\");\n } else if (!is_uploaded_file($_FILES['uploadfile'][\"tmp_name\"])) {\n $message = gt(\"You may be attempting to hack our server.\");\n } else {\n // upload the file, but don't save the record yet...\n $file = expFile::fileUpload('uploadfile',false,false,null,$destDir,intval(QUICK_UPLOAD_WIDTH));\n // since most likely this function will only get hit via flash in YUI Uploader\n // and since Flash can't pass cookies, we lose the knowledge of our $user\n // so we're passing the user's ID in as $_POST data. We then instantiate a new $user,\n // and then assign $user->id to $file->poster so we have an audit trail for the upload\n if (is_object($file)) {\n $file->poster = $user->id;\n $file->posted = $file->last_accessed = time();\n $file->save();\n if (!empty($quikFolder)) {\n $expcat = new expCat($quikFolder);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n }\n $ar = new expAjaxReply(200, gt('Your File was uploaded successfully'), $file->id);\n } else {\n $ar = new expAjaxReply(300, gt(\"File was not uploaded!\").' - '.$file);\n }\n $ar->send();\n }\n }\n }",
" public function editCat() {\n global $user;\n $file = new expFile($this->params['id']);\n if ($user->id==$file->poster || $user->isAdmin()) {\n $expcat = new expCat($this->params['newValue']);\n $params['expCat'][0] = $expcat->id;\n $file->update($params);\n $file->cat = $expcat->title;\n $file->catid = $expcat->id;\n $ar = new expAjaxReply(200, gt('Your Folder was updated successfully'), $file);\n } else {\n $ar = new expAjaxReply(300, gt(\"You didn't create this file, so you can't edit it.\"));\n }\n $ar->send();\n }",
" public function editTitle() {\n global $user;\n $file = new expFile($this->params['id']);\n if ($user->id==$file->poster || $user->isAdmin()) {\n $file->title = $this->params['newValue'];\n $file->save();\n $ar = new expAjaxReply(200, gt('Your title was updated successfully'), $file);\n } else {\n $ar = new expAjaxReply(300, gt(\"You didn't create this file, so you can't edit it.\"));\n }\n $ar->send();",
" }",
"\n public function editAlt() {",
" global $user;",
" $file = new expFile($this->params['id']);\n if ($user->id==$file->poster || $user->isAdmin()) {\n $file->alt = $this->params['newValue'];\n $file->save();\n $ar = new expAjaxReply(200, gt('Your alt was updated successfully'), $file);\n } else {\n $ar = new expAjaxReply(300, gt(\"You didn't create this file, so you can't edit it.\"));\n }\n $ar->send();\n echo json_encode($file); //FIXME we exit before hitting this",
" }",
"\n public function editShare() {\n global $user;\n $file = new expFile($this->params['id']);\n\t\tif(!isset($this->params['newValue'])) {\n\t\t\t$this->params['newValue'] = 0;\n\t\t}\n if ($user->id==$file->poster || $user->isAdmin()) {\n $file->shared = $this->params['newValue'];\n $file->save();\n $ar = new expAjaxReply(200, gt('This file is now shared.'), $file);\n } else {\n $ar = new expAjaxReply(300, gt(\"You didn't create this file, so it's not yours to share.\"));\n }\n $ar->send();\n echo json_encode($file); //FIXME we exit before hitting this\n }",
" public function import_eql() {\n }",
" public function import_eql_process() {\n global $db;",
" if ($_FILES['file']['error'] != UPLOAD_ERR_OK) {\n \tswitch($_FILES['file']['error']) {\n \t\tcase UPLOAD_ERR_INI_SIZE:\n \t\tcase UPLOAD_ERR_FORM_SIZE:\n \t\t\techo gt('The file you uploaded exceeded the size limits for the server.').'<br />';\n \t\t\tbreak;\n \t\tcase UPLOAD_ERR_PARTIAL:\n \t\t\techo gt('The file you uploaded was only partially uploaded.').'<br />';\n \t\t\tbreak;\n \t\tcase UPLOAD_ERR_NO_FILE:\n \t\t\techo gt('No file was uploaded.').'<br />';\n \t\t\tbreak;\n \t}\n } else {\n $errors = array();\n expSession::clearAllUsersSessionCache();",
" // copy in deprecated definitions files to aid in import\n $src = BASE . \"install/old_definitions\";\n $dst = BASE . \"framework/core/definitions\";\n if (is_dir($src) && expUtil::isReallyWritable($dst)) {\n $dir = opendir($src);\n while (false !== ($file = readdir($dir))) {\n if (($file != '.') && ($file != '..')) {\n if (!file_exists($dst . '/' . $file)) {\n copy($src . '/' . $file, $dst . '/' . $file);\n }\n }\n }\n closedir($dir);\n }",
" expFile::restoreDatabase($_FILES['file']['tmp_name'], $errors);",
" // now remove deprecated definitions files\n $src = BASE . \"install/old_definitions\";\n $dst = BASE . \"framework/core/definitions\";\n if (is_dir($src) && expUtil::isReallyWritable($dst)) {\n $dir = opendir($src);\n while (false !== ($file = readdir($dir))) {\n if (($file != '.') && ($file != '..')) {\n if (file_exists($dst . '/' . $file)) {\n unlink($dst . '/' . $file);\n }\n // remove empty deprecated tables\n $table = substr($file, 0, -4);\n if ($db->tableIsEmpty($table)) {\n $db->dropTable($table);\n }\n }\n }\n closedir($dir);\n }",
" // update search index\n searchController::spider();",
" // check to see if we need to install or upgrade the restored database\n expVersion::checkVersion();",
" assign_to_template(\n array(\n 'success' => !count($errors),\n 'errors' => $errors,\n )\n );\n }\n }",
" public static function getTables() {\n global $db;",
" expDatabase::fix_table_names();\n $tables = $db->getTables();\n if (!function_exists('tmp_removePrefix')) {\n \tfunction tmp_removePrefix($tbl) {\n \t\t// we add 1, because DB_TABLE_PREFIX no longer has the trailing\n \t\t// '_' character - that is automatically added by the database class.\n \t\treturn substr($tbl,strlen(DB_TABLE_PREFIX)+1);\n \t}\n }\n $tables = array_map('tmp_removePrefix',$tables);\n usort($tables,'strnatcmp');\n return $tables;\n }",
" public function export_eql() {\n// global $db, $user;\n global $user;",
"// expDatabase::fix_table_names();\n// $tables = $db->getTables();\n// if (!function_exists('tmp_removePrefix')) {\n// \tfunction tmp_removePrefix($tbl) {\n// \t\t// we add 1, because DB_TABLE_PREFIX no longer has the trailing\n// \t\t// '_' character - that is automatically added by the database class.\n// \t\treturn substr($tbl,strlen(DB_TABLE_PREFIX)+1);\n// \t}\n// }\n// $tables = array_map('tmp_removePrefix',$tables);\n// usort($tables,'strnatcmp');",
" assign_to_template(array(\n 'user' => $user,\n 'tables' => self::getTables(),\n ));\n }",
" public function export_eql_process() {\n// global $db;",
" if (!isset($this->params['tables'])) { // No checkboxes clicked so we'll dump all tables\n $this->params['tables'] = self::getTables();\n $this->params['tables'] = array_flip($this->params['tables']);\n }\n// \techo gt('You must choose at least one table to export.');\n// } else { // All good\n \t$filename = str_replace(\n \t\tarray('__DOMAIN__','__DB__'),\n \t\tarray(str_replace('.','_',HOSTNAME),DB_NAME),\n $this->params['filename']);\n \t$filename = preg_replace('/[^A-Za-z0-9_.-]/','-',strftime($filename,time()).'.eql');",
" \tob_end_clean();\n \tob_start(\"ob_gzhandler\");",
" \tif (isset($this->params['save_sample'])) { // Save as a theme sample is checked off\n \t\t$path = BASE . \"themes/\".DISPLAY_THEME.\"/sample.eql\";\n \t\tif (!$eql = fopen ($path, \"w\")) {\n \t\t\tflash('error',gt(\"Error opening eql file for writing\").\" \".$path);\n \t\t} else {\n //TODO we need to write inside call passing $eql file pointer\n $eqlfile = expFile::dumpDatabase(array_keys($this->params['tables']));\n \t\t\tif (fwrite ($eql, $eqlfile) === FALSE) {\n \t\t\t\tflash('error',gt(\"Error writing to eql file\").\" \".$path);\n \t\t\t}\n \t\t\tfclose ($eql);\n \t\t\tflash('message',gt(\"Sample database (eql file) saved to\").\" '\".DISPLAY_THEME.\"' \".gt(\"theme\"));\n \t\t\texpHistory::back();\n \t\t}\n \t} else {\n \t\t// This code was lifted from phpMyAdmin, but this is Open Source, right?",
" \t\t// 'application/octet-stream' is the registered IANA type but\n \t\t// MSIE and Opera seems to prefer 'application/octetstream'\n \t\t$mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" \t\theader('Content-Type: ' . $mime_type);\n \t\theader('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n \t\t// IE need specific headers\n \t\tif (EXPONENT_USER_BROWSER == 'IE') {\n \t\t\theader('Content-Disposition: inline; filename=\"' . $filename . '\"');\n \t\t\theader('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n \t\t\theader('Pragma: public');\n \t\t} else {\n \t\t\theader('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n \t\t\theader('Pragma: no-cache');\n \t\t}\n echo expFile::dumpDatabase(array_keys($this->params['tables'])); //FIXME we need to echo inside call\n \t\texit; // Exit, since we are exporting\n \t}\n// }\n }",
" public function import_files() {\n }",
" public function import_files_process() {\n if ($_FILES['file']['error'] != UPLOAD_ERR_OK) {\n \tswitch($_FILES['file']['error']) {\n \t\tcase UPLOAD_ERR_INI_SIZE:\n \t\tcase UPLOAD_ERR_FORM_SIZE:\n \t\t\techo gt('The file you uploaded exceeded the size limits for the server.').'<br />';\n \t\t\tbreak;\n \t\tcase UPLOAD_ERR_PARTIAL:\n \t\t\techo gt('The file you uploaded was only partially uploaded.').'<br />';\n \t\t\tbreak;\n \t\tcase UPLOAD_ERR_NO_FILE:\n \t\t\techo gt('No file was uploaded.').'<br />';\n \t\t\tbreak;\n \t}\n } else {\n \t$basename = basename($_FILES['file']['name']);",
" \tinclude_once(BASE.'external/Tar.php');\n \t$tar = new Archive_Tar($_FILES['file']['tmp_name'],'gz');",
" \t$dest_dir = BASE.'tmp/extensionuploads/'.uniqid('');\n \t@mkdir($dest_dir,DIR_DEFAULT_MODE_STR);\n \tif (!file_exists($dest_dir)) {\n \t\techo gt('Unable to create temporary directory to extract files archive.');\n \t} else {\n \t\t$return = $tar->extract($dest_dir);\n \t\tif (!$return) {\n \t\t\techo '<br />'.gt('Error extracting TAR archive').'<br />';\n \t\t} else if (!file_exists($dest_dir.'/files') || !is_dir($dest_dir.'/files')) {\n \t\t\techo '<br />'.gt('Invalid archive format, no \\'/files\\' folder').'<br />';\n \t\t} else {\n \t\t\t// Show the form for specifying which mod types to 'extract'",
" \t\t\t$mods = array(); // Stores the mod classname, the files list, and the module's real name",
" \t\t\t$dh = opendir($dest_dir.'/files');\n \t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\tif ($file{0} != '.' && is_dir($dest_dir.'/files/'.$file)) {\n \t\t\t\t\t$mods[$file] = array(\n \t\t\t\t\t\t'',\n \t\t\t\t\t\tarray_keys(expFile::listFlat($dest_dir.'/files/'.$file,1,null,array(),$dest_dir.'/files/'))\n \t\t\t\t\t);\n //\t\t\t\t\tif (class_exists($file)) {\n //\t\t\t\t\t\t$mods[$file][0] = call_user_func(array($file,'name')); // $file is the class name of the module\n //\t\t\t\t\t}\n \t\t\t\t} elseif ($file != '.' && $file != '..') {\n \t\t\t\t\t$mods[$file] = array(\n \t\t\t\t\t\t'',\n \t\t\t\t\t\t$file\n \t\t\t\t\t);\n \t\t\t\t}\n \t\t\t}",
" assign_to_template(array(\n 'dest_dir' => $dest_dir,\n 'file_data' => $mods,\n ));\n \t\t}\n \t}\n }\n }",
" public function import_files_extract() {\n $dest_dir = $this->params['dest_dir'];\n $files = array();\n foreach (array_keys($this->params['mods']) as $file) {\n \t$files[$file] = expFile::canCreate(BASE.'files/'.$file);\n //\tif (class_exists($mod)) {\n //\t\t$files[$mod][0] = call_user_func(array($mod,'name'));\n //\t}\n //\tforeach (array_keys(expFile::listFlat($dest_dir.'/files',1,null,array(),$dest_dir.'/files/')) as $file) {\n //\t\t$files[$mod][1][$file] = expFile::canCreate(BASE.'files/'.$file);\n //\t}\n }",
" expSession::set('dest_dir',$dest_dir);\n expSession::set('files_data',$files);",
" assign_to_template(array(\n 'files_data' => $files,\n ));\n }",
" public function import_files_finish() {\n $dest_dir = expSession::get('dest_dir');\n $files = expSession::get('files_data');\n if (!file_exists(BASE.'files')) {\n \tmkdir(BASE.'files',DIR_DEFAULT_MODE_STR);\n }",
" $filecount = 0;\n foreach (array_keys($files) as $file) {\n expFile::copyDirectoryStructure($dest_dir.'/files/'.$file,BASE.'files/'.$file);\n \tcopy($dest_dir.'/files/'.$file,BASE.'files/'.$file);\n \t$filecount++;\n }",
" expSession::un_set('dest_dir');\n expSession::un_set('files_data');",
" expFile::removeDirectory($dest_dir);",
" assign_to_template(array(\n 'file_count' => $filecount,\n ));\n }",
" public function export_files() {\n global $user;",
" $loc = expCore::makeLocation($this->params['controller'],isset($this->params['src'])?$this->params['src']:null,isset($this->params['int'])?$this->params['int']:null);\n //$mods = array();\n //$dh = opendir(BASE.'files');\n //while (($file = readdir($dh)) !== false) {\n //\tif (is_dir(BASE.'files/'.$file) && $file{0} != '.' && class_exists($file)) {\n //\t\t$mods[$file] = call_user_func(array($file,'name'));\n //\t}\n //}\n //uasort($mods,'strnatcmp');",
" assign_to_template(array(\n 'user' => $user,\n ));\n }",
" public function export_files_process() {\n// global $db;",
" //if (!isset($this->params['mods'])) {\n //\techo gt('You must select at least one module to export files for.');\n //\treturn;\n //}",
" include_once(BASE.'external/Tar.php');",
" $files = array();\n //foreach (array_keys($this->params['mods']) as $mod) {\n //\tforeach ($db->selectObjects('file',\"directory LIKE 'files/\".$mod.\"%'\") as $file) {\n// foreach ($db->selectObjects('expFiles',1) as $file) {\n foreach (expFile::selectAllFiles() as $file) {\n $files[] = BASE.$file->directory.$file->filename;\n }\n //}",
" $fname = tempnam(BASE.'/tmp','exporter_files_');\n $tar = new Archive_Tar($fname,'gz');\n $tar->createModify($files,'',BASE);",
" $filename = str_replace(\n array('__DOMAIN__','__DB__'),\n array(str_replace('.','_',HOSTNAME),DB_NAME),\n $this->params['filename']);\n $filename = preg_replace('/[^A-Za-z0-9_.-]/','-',strftime($filename,time()).'.tar.gz');",
" if (isset($this->params['save_sample'])) { // Save as a theme sample is checked off\n copy($fname,BASE . \"themes/\".DISPLAY_THEME_REAL.\"/sample.tar.gz\");\n unlink($fname);\n flash('message',gt(\"Sample uploaded files archive saved to\").\" '\".DISPLAY_THEME_REAL.\"' \".gt(\"theme\"));\n expHistory::back();\n } else {\n ob_end_clean();\n // This code was lifted from phpMyAdmin, but this is Open Source, right?",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }",
" $fh = fopen($fname,'rb');\n while (!feof($fh)) {\n echo fread($fh,8192);\n }\n fclose($fh);\n unlink($fname);\n }",
" exit(''); // Exit, since we are exporting.\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * Class to handle files at the File System Level and updating\n * the record for each file.\n *\n * expFile is an extension of expRecord because File information is stored\n * in the database for future access and retrieval. This class also handles\n * and and all File System handling as well: copy, move, delete, upload,\n * and importing of data in preparation of data importation. Upload and\n * import via child classes.\n *\n * @subpackage Models\n * @package Modules\n *\n */\n/** @define \"BASE\" \"../../..\" */\nclass expFile extends expRecord {",
"// ==========================================================\n// Class Constants",
" /*\n * The definition of this constant lets other parts of the subsystem know\n * that the Image Subsystem has been included for use.\n */\n const SYS_IMAGE = 1;\n const IMAGE_ERR_NOGD = '';\n const IMAGE_ERR_NOTSUPPORTED = '_unknown';\n const IMAGE_ERR_FILENOTFOUND = '_notfound';\n const IMAGE_ERR_PERMISSIONDENIED = '_denied';",
"// ===========================================================\n// File Access Control Values",
" /**\n * Mode to use for reading from files\n *\n * @constant string FILE_MODE_READ\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_MODE_READ = 'rb';",
" /**\n * Mode to use for truncating files, then writing\n *\n * @constant string FILE_MODE_WRITE\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_MODE_WRITE = 'wb';",
" /**\n * Mode to use for appending to files\n *\n * @constant string FILE_MODE_APPEND\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_MODE_APPEND = 'ab';",
" /**\n * Use this when a shared (read) lock is required.\n * This is a \"relabel\" of the PHP 'LOCK_SH' constant\n *\n * @constant string FILE_LOCK_SHARED\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_LOCK_SHARED = LOCK_SH;",
" /**\n * Use this when an exclusive (write) lock is required\n * This is a \"relabel\" of the PHP 'LOCK_EX' constant\n *\n * @constant string FILE_LOCK_EXCLUSIVE\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_LOCK_EXCLUSIVE = LOCK_EX;",
" // ==========================================================\n // Class Properties and their default values",
" /**\n * Database Table Name to store File info\n *\n * @public\n * @property string $table Database Table Name\n *\n */\n public $table = 'expFiles';\n protected $attachable_table = 'content_expFiles';",
" protected $attachable_item_types = array(\n 'content_expCats' => 'expCat',\n// 'content_expComments'=>'expComment',\n// 'content_expDefinableFields' => 'expDefinableField',\n// 'content_expFiles' => 'expFile',\n// 'content_expRatings'=>'expRating',\n// 'content_expSimpleNote'=>'expSimpleNote',\n// 'content_expTags'=>'expTag',\n );",
" /**\n * Relative OS System File path to where $filename is [to be] located\n *\n * @protected\n * @property string $directory Relative OS System File path\n *\n */\n public $directory = null;",
" /**\n * File Name of File to process\n *\n * @public\n * @property string $filename Name of File to process\n *\n */\n public $filename = null;",
" /**\n * Size of File, in Bytes\n *\n * @protected\n * @property string $filesize Size of File, in Bytes.\n *\n */\n public $filesize = null;",
" /**\n * Mime Type of File.\n *\n * @public\n * @property string $mimetype File MIME Type\n *\n */\n public $mimetype = null;",
" /**\n * Image width in pixels.\n *\n * @public\n * @property string $image_width Image width in pixels\n *\n */\n public $image_width = null;",
" /**\n * Image height in pixels.\n *\n * @public\n * @property string $image_height Image height in pixels\n *\n */\n public $image_height = null;",
" /**\n * Is this file an image.\n # Defaults to FALSE\n *\n * @public\n * @property string $is_image Is this file an image\n *\n */\n public $is_image = false;",
" /**\n * Determines if this file can be overwritten.\n * Also if it can be \"moved\" or \"renamed\" over\n * Default set to FALSE, no it can't\n *\n * @protected boolean\n * @property boolean $fileOverWrite Determines if this file be overwritten\n *\n * @access protected\n * @since 1.1\n */\n protected $fileOverWrite = false;",
" /**\n * Web based Path for current File\n *\n * @public\n * @property string $url Web based Path\n *\n */\n public $url = null;",
" /**\n * Full File System Path for current File. Also used to in FILE Record\n *\n * @public\n * @property string $path Full File System Path\n *\n */\n public $path = null;",
" /**\n * Relative File System Path for current File\n *\n * @public\n * @property string $path_relative Relative File System Path\n *\n */\n public $path_relative = null;",
"// ==========================================================\n// Class Methods",
" /**\n * Class constructor to create a File Class either from a database\n * record or from the File System.\n *\n * Class will either: a) load an existing File Record\n * b) modify an existing File Record\n * c) create a new File Record\n *\n * This will also handle any File System handling that is needed: copy,\n * move, create, delete, read and write.\n *\n * @access public\n *\n * @uses expRecord::__construct\n *\n * @PHPUnit Not Defined\n *\n * @param mixed $params - If an INT is given, this assumes that it needs to\n * load an existing File Record.\n * - If an ARRAY is given, this assumes that the elements\n * of the array are values to the File table that need\n * to be modified or other processing.\n * - If NULL is given, an empty File Object is created\n *\n * @param bool $get_assoc\n * @param bool $get_attached\n *\n * @return \\expFile Object@throws void\n *\n */\n public function __construct($params = array(), $get_assoc = false, $get_attached = true) {\n // Set 'directory' as the default FILE location\n // This will be redefined if a FILE record is loaded\n // or a path is given to the Class\n //eDebug($params,true);\n if (empty($params['directory']))\n $this->directory = UPLOAD_DIRECTORY_RELATIVE;\n // This will pull properties for class properties based upon\n // expRecord table definition\n parent::__construct($params, $get_assoc, $get_attached);",
" // If the 'directory' is the same as the default path then a given,\n // or derived, filename can be added to pathing settings\n //if ( $this->directory == UPLOAD_DIRECTORY_RELATIVE ) {\n if (!stristr($this->directory, BASE)) {\n // Place system level web root\n $this->url = URL_FULL . $this->directory . $this->filename;",
" // Place system level OS root\n $this->path = BASE . $this->directory . $this->filename;",
" // Place system OS relative path\n $this->path_relative = PATH_RELATIVE . $this->directory . $this->filename;\n } else {\n // Otherwise, the URL is not set since we can't use it, nether is\n // RELATIVE, as 'directory' must be an absolute path in this instance\n // Place system level OS root\n $relpath = str_replace(BASE, '', $this->directory);\n $this->path = $this->directory . $this->filename;\n $this->url = URL_FULL . $relpath . $this->filename;\n $this->path_relative = $relpath . $this->filename;\n }",
" // If a file location was given, not derived from the database,\n // basic file information is needed\n if (empty($this->id) && !empty($this->filename)) {\n // File info\n $_fileInfo = self::getImageInfo($this->path);\n // Assign info back to class\n $this->is_image = !empty($_fileInfo['is_image']) ? $_fileInfo['is_image'] : false;\n $this->filesize = !empty($_fileInfo['fileSize']) ? $_fileInfo['fileSize'] : 0;\n if (!empty($_fileInfo['mime'])) $this->mimetype = $_fileInfo['mime'];\n if (!empty($_fileInfo['is_image'])) {\n $this->image_width = $_fileInfo[0];\n $this->image_height = $_fileInfo[1];\n }\n }\n }",
" public function exists() {\n return (!empty($this->id) && is_file(BASE . PATH_RELATIVE . $this->directory . $this->filename));\n }\n// =========================================================================\n// Static Methods",
" public static function selectAllFiles() {\n global $db;",
" return $db->selectObjects('expFiles',1);\n }",
" /**\n * File ($_POST) UPLOAD that also optionally inserts File info into database.\n *\n * File UPLOAD is a straight forward uploader and processor. It can accept\n * filename and destination directory overrides as well. It has an additional\n * pair of flags that allow for an upload NOT to be inserted into the database\n * (default to INSERT) and if it previous file, with the same name, should be\n * overwritten (default to NO overwrite)\n *\n * @static\n * @access public\n *\n * @uses class|method|global|variable description\n * @requires class_name\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param string $_postName The name of the _FILE upload array\n * @param bool|string $_force Force the uploaded to overwrite existing file of same name\n * @param bool|string $_save Save file info to database, defaults to TRUE\n * @param string $_destFile Override the uploaded file name\n * @param string $_destDir Override the default FILE UPLOAD location\n *\n * @param null $_max_width\n *\n * @return object $_objFile expFile Object\n * @return object $errMsg Error message if something failed@throws void\n *\n * @TODO Have file upload overwrite make sure not to duplicate its record in the DB\n */\n public static function fileUpload($_postName = null,\n $_force = false,\n $_save = true,\n $_destFile = null,\n $_destDir = null,\n $_max_width = null\n ) {",
" // Make sure something was sent first off...\n if ((!isset($_SERVER['CONTENT_TYPE'])) ||\n (strpos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== 0)\n ) {\n return 'bad upload form';\n }",
" //check for errors\n switch ($_FILES[$_postName]['error']) {\n case UPLOAD_ERR_OK:\n // Everything looks good. Continue with the update.\n break;\n case UPLOAD_ERR_INI_SIZE:\n//\t\t\tcase images:\n // This is a tricky one to catch. If the file is too large for\n // POST, then the script won't even run.\n // But if its between post_max_size and upload_max_filesize,\n // we will get here.\n return 'file_too_large';\n case UPLOAD_ERR_FORM_SIZE:\n return 'file_exceeds_form_MAX_FILE_SIZE';\n case UPLOAD_ERR_PARTIAL:\n return 'partial_file';\n case UPLOAD_ERR_NO_FILE:\n return 'no_file_uploaded';\n case UPLOAD_ERR_NO_TMP_DIR:\n return 'missing_tmp_folder';\n case UPLOAD_ERR_CANT_WRITE:\n return 'failed_write_to_disk';\n case UPLOAD_ERR_EXTENSION:\n return 'upload_stopped_by_extension';\n default:\n return 'unknown';\n break;\n }",
" // If $_destDir is not defined, use the default Files directory\n// $_destDir = ( $_destDir == null ) ? UPLOAD_DIRECTORY : $_destDir;\n $_destDir = ($_destDir == null) ? UPLOAD_DIRECTORY_RELATIVE : $_destDir;",
" // If $_destFile is defined, use that name as an override for the\n // uploaded file name\n $_destFile = ($_destFile == null) ? self::fixName($_FILES[$_postName]['name']) : $_destFile;",
" // Fix the filename, so that we don't have funky characters screwing\n // with our attempt to create the destination file.\n // $_destFile = self::fixFileName( $_FILES[$_postName]['name']);\n // eDebug($_destFile,1);",
" // Build destination fille path for future use\n $_destFullPath = BASE . $_destDir . $_destFile;",
" //if the file exists and we don't want to overwrite it, create a new one\n if (file_exists($_destFullPath) && $_force == false) {\n $_destFile = self::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }",
" //Check to see if the directory exists. If not, create the directory structure.\n // if (!file_exists(BASE . $_destDir)) {\n // self::makeDirectory(BASE . $_destDir);",
" // } ",
"\n // Move the temporary uploaded file into the destination directory,\n // and change the name.\n $resized = false;\n $maxwidth = intval($_max_width);\n if (!empty($maxwidth)) {\n $tempFile = tempnam(sys_get_temp_dir(), 'exp_upload_') . '_' . $_destFile;\n move_uploaded_file($_FILES[$_postName]['tmp_name'], $tempFile);\n require_once(BASE . 'framework/modules/pixidou/includes/class.upload/class.upload.php');\n $handle = new upload($tempFile);\n if ($handle->uploaded) {\n $handle->file_new_name_body = $_destFile;\n $handle->file_new_name_ext = '';\n $handle->image_resize = true;\n $handle->image_x = $maxwidth;\n $handle->image_y = $maxwidth;\n $handle->image_ratio_no_zoom_in = true;\n $handle->jpeg_quality = THUMB_QUALITY;\n $handle->process(BASE . $_destDir);\n if ($handle->processed) {\n if ($handle->image_src_x != $handle->image_dst_x) $resized = true;\n $handle->clean();\n }\n }\n } else {\n $tmp = move_uploaded_file($_FILES[$_postName]['tmp_name'], $_destFullPath);\n }",
" if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);\n // Checking\n if ($__oldumask != umask()) {\n flash('error', gt('An error occurred while setting file permissions') . ': ' . $_destFullPath);\n }\n } else {\n return 'could not move';\n }",
" // At this point, we are good to go.",
" // Create a new expFile Object for further processing\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);",
" // Insert new File Record\n if ($_save === true) {\n $_objFile->save();\n }\n if ($resized) $_objFile->resized = true;\n return $_objFile;\n }",
" /**\n * XHR (HTML5) File UPLOAD that also inserts File info into database.\n *\n * File UPLOAD is a straight forward uploader and processor. It can accept\n * filename and destination directory overrides as well. It has an additional\n * pair of flags that allow for an upload NOT to be inserted into the database\n * (default to INSERT) and if it previous file, with the same name, should be\n * overwritten (default to NO overwrite)\n *\n * @static\n * @access public\n *\n * @uses class|method|global|variable description\n * @requires class_name\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param null $fileName\n * @param bool|string $_force Force the uploaded to overwrite existing file of same name\n * @param bool|string $_save Save file info to database, defaults to TRUE\n * @param string $_destFile Override the uploaded file name\n * @param string $_destDir Override the default FILE UPLOAD location\n *\n * @param null $_max_width\n *\n * @return object $_objFile expFile Object\n * @return object $errMsg Error message if something failed@throws void\n *\n * @TODO Have file upload overwrite make sure not to duplicate its record in the DB\n */\n public static function fileXHRUpload($fileName = null,\n $_force = false,\n $_save = true,\n $_destFile = null,\n $_destDir = null,\n $_max_width = null\n ) {",
" // If $_destDir is not defined, use the default Files directory\n $_destDir = ($_destDir == null) ? UPLOAD_DIRECTORY_RELATIVE : $_destDir;",
" // If $_destFile is defined, use that name as an override for the\n // uploaded file name\n $_destFile = ($_destFile == null) ? self::fixName($fileName) : $_destFile;",
" // Fix the filename, so that we don't have funky characters screwing\n // with our attempt to create the destination file.\n // $_destFile = self::fixFileName( $_FILES[$_postName]['name']);\n // eDebug($_destFile,1);",
" // Build destination fille path for future use\n $_destFullPath = BASE . $_destDir . $_destFile;",
" //if the file exists and we don't want to overwrite it, create a new one\n if (file_exists($_destFullPath) && $_force == false) {\n $_destFile = self::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }",
" //Check to see if the directory exists. If not, create the directory structure.\n // if (!file_exists(BASE . $_destDir)) {\n // self::makeDirectory(BASE . $_destDir);\n // }",
" // Move the temporary uploaded file into the destination directory,\n // and change the name.\n $resized = false;\n $maxwidth = intval($_max_width);\n if (!empty($maxwidth)) {\n $tempFile = tempnam(sys_get_temp_dir(), 'exp_upload_') . '_' . $_destFile;\n// move_uploaded_file($_FILES[$fileName]['tmp_name'], $tempFile);\n file_put_contents($tempFile, file_get_contents('php://input'));\n require_once(BASE . 'framework/modules/pixidou/includes/class.upload/class.upload.php');\n $handle = new upload($tempFile);\n if ($handle->uploaded) {\n $handle->file_new_name_body = $_destFile;\n $handle->file_new_name_ext = '';\n $handle->image_resize = true;\n $handle->image_x = $maxwidth;\n $handle->image_y = $maxwidth;\n $handle->image_ratio_no_zoom_in = true;\n $handle->jpeg_quality = THUMB_QUALITY;\n $handle->process(BASE . $_destDir);\n if ($handle->processed) {\n if ($handle->image_src_x != $handle->image_dst_x) $resized = true;\n $handle->clean();\n }\n }\n } else {\n file_put_contents($_destFullPath, file_get_contents('php://input', 'r'));\n }",
" if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);\n // Checking\n if ($__oldumask != umask()) {\n flash('error', gt('An error occurred while setting file permissions') . ': ' . $_destFullPath);\n }\n } else {\n return 'could not move';\n }",
" // At this point, we are good to go.",
" // Create a new expFile Object for further processing\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);",
" // Insert new File Record\n if ($_save === true) {\n $_objFile->save();\n }\n if ($resized) $_objFile->resized = true;\n return $_objFile;\n }",
" /**\n * Performs a system level check on the file and retrieves its size\n *\n * @static\n * @access public\n *\n * @uses function filesize() Built-in PHP method\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param bool|string $_path Full path to file to pull info from\n *\n * @return int $_fileSize Size of file in bytes\n * @throws void\n *\n */\n public static function fileSize($_path = false) {\n if ($_path)\n $_fileSize = filesize($_path);\n else\n $_fileSize = 0;",
" return $_fileSize;\n }",
" /**\n * check for duplicate files and returns a file name that's not already in the system\n *\n * @static\n * @access public\n *\n * @uses function filesize() Built-in PHP method\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param string $filepath direct path of the file to check against\n *\n * @return int $newFileName Name of the file that isn't a duplicate\n * @throws void\n *\n */\n public static function resolveDuplicateFilename($filepath) {\n $extension = strrchr($filepath, \".\"); // grab the file extention by looking for the last dot in the string\n $filnameWoExt = str_replace($extension, \"\", str_replace(\"/\", \"\", strrchr($filepath, \"/\"))); // filename sans extention\n $pathToFile = str_replace($filnameWoExt . $extension, \"\", $filepath); // path sans filename",
" $i = \"\";\n $inc = \"\";\n while (file_exists($pathToFile . $filnameWoExt . $inc . $extension)) {\n $i++;\n $inc = \"-\" . $i;\n }",
" //we'll just return the new filename assuming we've\n //already got the path we want on the other side\n return $filnameWoExt . $inc . $extension;\n }",
" /**\n * prompts the user to download a file\n *\n * @static\n * @access public\n *\n * @uses function download() Built-in PHP method\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param string $file Full path to file to download\n *\n * @return void\n * @throws void\n *\n */\n public static function download($file) {\n // we are expecting an int val as a file ID or the whole file object.\n // If all we get is the ID then we'll instantiate a new file object.\n // If that object doesn't have it's id property set or the file doesn't\n // actually exist then we can assume its not a valid file object and\n // return false.\n if (!is_object($file)) $file = new expFile($file);\n //if (empty($file->id) || !file_exists($file->path)) return false;\n if (!file_exists($file->path)) {\n flash('error', gt('The file is unavailable for Download'));\n expHistory::back();\n return false;\n }",
" // NO buffering from here on out or things break unexpectedly. - RAM\n ob_end_clean();",
" // This code was lifted from phpMyAdmin, but this is Open Source, right?\n // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n // It seems that other headers I've added make IE prefer octet-stream again. - RAM",
" $mimetype = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : $file->mimetype;",
" header('Content-Type: ' . $mimetype);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Content-Transfer-Encoding: binary');\n//\t\theader('Content-Encoding:');\n header('Content-Disposition: attachment; filename=\"' . $file->filename . '\";');\n $filesize = filesize($file->path);\n if ($filesize) header(\"Content-length: \" . $filesize); // for some reason the webserver cant run stat on the files and this breaks.\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }",
" //Read the file out directly\n readfile($file->path);\n exit();\n }",
" /**\n * Replace anything but alphanumeric characters with an UNDERSCORE\n *\n * @static\n * @access public\n *\n * @uses function preg_replace built-in PHP Function\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param string $name File name to 'fix'\n *\n * @return string $name the correct filename\n * @throws void\n *\n */\n public static function fixName($name) {\n $name = preg_replace('/[^A-Za-z0-9\\.]/','_',$name);",
" if ($name[0] == '.')",
" $name[0] = '_';",
"",
" return $name;\n// return preg_replace('/[^A-Za-z0-9\\.]/', '-', $name);\n }",
" /**\n * Return the mimetype for the passed filename\n *\n * @param string $filename\n * @return string\n */\n public static function getMimeType($filename) {\n /* Store an array of commom mimetypes */\n $types = array(\n 'txt' => 'text/plain',\n 'htm' => 'text/html',\n 'html' => 'text/html',\n 'php' => 'text/html',\n 'css' => 'text/css',\n 'js' => 'application/javascript',\n 'json' => 'application/json',\n 'xml' => 'application/xml',",
" // images\n 'png' => 'image/png',\n 'jpe' => 'image/jpeg',\n 'jpeg' => 'image/jpeg',\n 'jpg' => 'image/jpeg',\n 'gif' => 'image/gif',\n 'bmp' => 'image/bmp',\n 'ico' => 'image/vnd.microsoft.icon',\n 'tiff' => 'image/tiff',\n 'tif' => 'image/tiff',\n 'svg' => 'image/svg+xml',\n 'svgz' => 'image/svg+xml',",
" // archives\n 'gz' => 'application/x-gzip',\n 'zip' => 'application/zip',\n 'rar' => 'application/x-rar-compressed',\n 'exe' => 'application/x-msdownload',\n 'msi' => 'application/x-msdownload',\n 'cab' => 'application/vnd.ms-cab-compressed',",
" // audio/video\n 'mp3' => 'audio/mpeg',\n 'ogg' => 'audio/ogg',\n 'qt' => 'video/quicktime',\n 'mov' => 'video/quicktime',\n 'f4v' => 'video/mp4',\n 'mp4' => 'video/mp4',\n 'm4v' => 'video/x-m4v',\n 'ogv' => 'video/ogg',\n '3gp' => 'video/3gpp',\n 'webm' => 'video/webm',\n 'flv' => 'video/x-flv',\n 'swf' => 'application/x-shockwave-flash',",
" // adobe\n 'pdf' => 'application/pdf',\n// 'psd' => 'image/vnd.adobe.photoshop',\n// 'ai' => 'application/postscript',\n// 'eps' => 'application/postscript',\n// 'ps' => 'application/postscript',",
" // ms office\n// 'doc' => 'application/msword',\n// 'rtf' => 'application/rtf',\n// 'xls' => 'application/vnd.ms-excel',\n// 'ppt' => 'application/vnd.ms-powerpoint',",
" // open office\n// 'odt' => 'application/vnd.oasis.opendocument.text',\n// 'ods' => 'application/vnd.oasis.opendocument.spreadsheet'\n );",
" /* Get the file extension,\n * FYI: this is *really* hax.\n */\n $fileparts = explode('.',$filename);\n $extension = strtolower(array_pop($fileparts));\n if(array_key_exists($extension, $types)) {\n /* If we can *guess* the mimetype based on the filename, do that for standardization */\n return $types[$extension];\n } elseif(function_exists('finfo_open')) {\n /* If we don't have to guess, do it the right way */\n $finfo = finfo_open(FILEINFO_MIME);\n $mimetype = finfo_file($finfo, $filename);\n finfo_close($finfo);\n return $mimetype;\n } else {\n /* Otherwise, let the browser guess */\n return 'application/octet-stream';\n }\n }",
"// ==========================================================\n// Class Image Processing Methods\n// @TODO This collection of methods need to be placed in their own Class",
" /**\n * Return size and mimetype information about an image file,\n * given its path/filename. This is a wrapper around the\n * built-in PHP 'getimagesize' function, to make all implementations\n * work identically.\n *\n * @static\n * @access public\n *\n * @uses function getimagesize() Built-in PHP function\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param bool|string $_path Full path to file to pull info from\n *\n * @return array $_sizeinfo An array of Image File info\n * @return array $error message Error message@throws void\n *\n */\n public static function getImageInfo($_path = false) {",
" $_path = __realpath($_path);",
" if (!file_exists($_path)) return self::IMAGE_ERR_FILENOTFOUND;\n if (!is_readable($_path)) return self::IMAGE_ERR_PERMISSIONDENIED;",
" if ($_sizeinfo = @getimagesize($_path)) {\n $_sizeinfo['is_image'] = true;\n// if (!isset($_sizeinfo['mime'])) {\n// // In case this implementation of getimagesize doesn't discover\n// // the mime type\n// $_types = array(\n// 'jpg' => 'image/jpeg',\n// 'jpeg' => 'image/jpeg',\n// 'gif' => 'image/gif',\n// 'png' => 'image/png'\n// );\n//\n// $_fileData = pathinfo($_path);\n// if (array_key_exists($_fileData['extension'], $_types)) $_sizeinfo['mime'] = $_types[$_fileData['extension']];\n// }\n } else {\n $_sizeinfo['is_image'] = false;\n// if (!isset($_sizeinfo['mime'])) {\n// // In case this implementation of getimagesize doesn't discover\n// // the mime type\n// $_types = array(\n// 'mp3' => 'audio/mpeg',\n// 'ogg' => 'audio/ogg',\n// 'flv' => 'video/x-flv',\n// 'f4v' => 'video/mp4',\n// 'mp4' => 'video/mp4',\n// 'ogv' => 'video/ogg',\n// '3gp' => 'video/3gpp',\n// 'webm' => 'video/webm',\n// 'pdf' => 'application/pdf',\n// );\n//\n// $_fileData = pathinfo($_path);\n// if (array_key_exists($_fileData['extension'], $_types)) $_sizeinfo['mime'] = $_types[$_fileData['extension']];\n// }\n }\n $_sizeinfo['mime'] = self::getMimeType($_path);\n $_sizeinfo['fileSize'] = self::fileSize($_path);",
" return $_sizeinfo;\n }",
" /** exdoc\n * Create an image resource handle (from GD) for a given filename.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * At this point, the user should have called self::getImageInfo on the filename\n * and verified that the file does indeed exist, and is readable. A safeguard check\n * is in place, however.\n *\n * @param string $filename The path/filename of the image.\n *\n * @return null|resource|string\n * @node Model:expFile\n */\n public static function openImageFile($filename) {\n if (!EXPONENT_HAS_GD) return null;",
" $sizeinfo = @getimagesize($filename);\n $info = gd_info();",
" if ($sizeinfo['mime'] == 'image/jpeg' && $info['JPG Support'] == true) {\n $img = imagecreatefromjpeg($filename);\n } else if ($sizeinfo['mime'] == 'image/png' && $info['PNG Support'] == true) {\n $img = imagecreatefrompng($filename);\n } else if ($sizeinfo['mime'] == 'image/gif' && $info['GIF Read Support'] == true) {\n $img = imagecreatefromgif($filename);\n } else {\n // Either we have an unknown image type, or an unsupported image type.\n return self::IMAGE_ERR_NOTSUPPORTED;\n }",
" if (function_exists('imagesavealpha')) {\n imagealphablending($img, false);\n imagesavealpha($img, true);\n }\n return $img;\n }",
" /** exdoc\n * Create a new blank image resource, with the specified width and height.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param integer $w Width of the image resource to create (in pixels)\n * @param integer $h Height of the image resource to create (in pixels)\n *\n * @return null|resource\n * @node Model:expFile\n */\n public static function imageCreate($w, $h) {\n if (!EXPONENT_HAS_GD) {\n return null;\n }\n $info = gd_info();\n if (strpos($info['GD Version'], '2.0') !== false) {\n $img = imagecreatetruecolor($w, $h);",
" if (function_exists('imagesavealpha')) {\n imagealphablending($img, false);\n imagesavealpha($img, true);\n }",
" return $img;\n } else {\n return imagecreate($w, $h);\n }\n }",
" function copyToDirectory($destination) {\n //eDebug($this,true);\n copy($this->path, $destination . $this->filename);\n }",
" public static function imageCopyresized($dest, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {\n if (!EXPONENT_HAS_GD) {\n return null;\n }\n $info = gd_info();\n if (strpos($info['GD Version'], '2.0') !== false) {\n return imagecopyresampled($dest, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\n } else {\n return imagecopyresized($dest, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\n }\n }",
" /** exdoc\n * Proportionally scale an image by a specific percentage\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param float $scale The scaling factor, as a decimal (i.e. 0.5 for 50%)\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleByPercent($filename, $scale) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($scale == 1) {\n return $original;\n }",
" $w = $scale * $sizeinfo[0];\n $h = $scale * $sizeinfo[1];",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $w, $h, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" /** exdoc\n * Proportionally scale an image to a given width. Height adjusts accordingly.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param integer $width The desired width of the scaled image, in pixels.\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleToWidth($filename, $width) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }\n $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $sizeinfo;\n }",
" if ($width == $sizeinfo[0]) {\n return $original;\n }",
" $w = $width;\n $h = ($width / $sizeinfo[0]) * $sizeinfo[1];",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $w, $h, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" /** exdoc\n * Proportionally scale an image to a given height. Width adjusts accordingly.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param integer $height The desired height of the scaled image, in pixels.\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleToHeight($filename, $height) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($height == $sizeinfo[1]) {\n return $original;\n }",
" $w = ($height / $sizeinfo[1]) * $sizeinfo[0];\n $h = $height;",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $w, $h, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" /** exdoc\n * Proportionally scale an image to fit within the given width / height.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param integer $width The maximum width of the scaled image, in pixels.\n * @param integer $height The maximum height of the scaled image, in pixels.\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleToConstraint($filename, $width, $height) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($width >= $sizeinfo[0] && $height >= $sizeinfo[1]) {\n return $original;\n }",
" $w = $width;\n $h = ($width / $sizeinfo[0]) * $sizeinfo[1];",
" if ($h > $height) { // height is outside\n $w = ($height / $sizeinfo[1]) * $sizeinfo[0];\n $h = $height;\n }",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $w, $h, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" /** exdoc\n * Scale an image to a square keeping the image aspect ratio.\n * If the image is smaller in either dimension than request square side original is returned.\n * Image is first cropped to a square of length smaller of width or height and then resized.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param $side\n *\n * @return array|null|resource|string\n * @internal param int $size The desired side length of the scaled image, in pixels.\n * @node Model:expFile\n */\n public static function imageScaleToSquare($filename, $side) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($side >= $sizeinfo[0] || $side >= $sizeinfo[1]) {\n return $original;\n }",
" /* The defaults will serve in case the image is a square */\n $src_x = 0;\n $src_y = 0;\n $width = $sizeinfo[0];\n $height = $sizeinfo[1];",
" /*if width greater than height, we crop the image left and right */\n if ($sizeinfo[0] > $sizeinfo[1]) {\n $width = $sizeinfo[1];\n $height = $sizeinfo[1];\n $src_x = round(($sizeinfo[0] - $width) / 2, 0);\n } else {\n /*if height greater than width, we crop the image top and bottom */\n $height = $sizeinfo[0];\n $width = $sizeinfo[0];\n $src_y = round(($sizeinfo[1] - $height) / 2, 0);\n }",
" $w = $side;\n $h = $side;",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, $src_x, $src_y, $w, $h, $width, $height);",
" return $thumb;\n }",
" /** exdoc\n * Scale an image to a given width and height, without regard to aspect ratio.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param integer $width The desired width of the scaled image, in pixels.\n * @param integer $height The desired height of the scaled image, in pixels.\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleManually($filename, $width, $height) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($width == $sizeinfo[0] && $height == $sizeinfo[1]) {\n return $original;\n }",
" $thumb = self::imageCreate($width, $height);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $width, $height, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" public static function imageRotate($filename, $degrees) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" $color = imagecolorclosesthwb($original, 255, 255, 255);",
" return imagerotate($original, $degrees, $color);\n }",
" public static function imageFlip($filename, $is_horizontal) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" // Horizontal - invert y coords\n // Vertical - invert x coords",
" $w = $sizeinfo[0];\n $h = $sizeinfo[1];\n $new = self::imageCreate($w, $h);",
" if ($is_horizontal) {\n // Copy column by column\n //$dest,$src,$dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {\n for ($i = 0; $i < $w; $i++) {\n imagecopy($new, $original, // DESTINATION, SOURCE\n $i, 0, // dst_X, dst_Y\n $w - $i - 1, 0, // src_X,src_Y\n 1, $h); //src_W, src_H\n }\n } else {\n // Copy row by row.\n //$dest,$src,$dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {\n for ($i = 0; $i < $h; $i++) {\n imagecopy($new, $original, // DESTINATION, SOURCE\n 0, $i, // dst_X, dst_Y\n 0, $h - $i - 1, // src_X,src_Y\n #$w,1,\t\t// dst_W, dst_H\n $w, 1); //src_W, src_H\n }\n }\n return $new;\n }",
" /** exdoc\n *\n * @state <b>UNDOCUMENTED</b>\n * @node Undocumented\n *\n * @param $img\n * @param $sizeinfo\n * @param null $filename\n * @param int $quality\n */\n public static function imageOutput($img, $sizeinfo, $filename = null, $quality = 75) {\n header('Content-type: ' . $sizeinfo['mime']);\n if ($sizeinfo['mime'] == 'image/jpeg') {\n ($filename != null) ? imagejpeg($img, $filename, $quality) : imagejpeg($img, null, $quality);\n } else if ($sizeinfo['mime'] == 'image/png') {\n ($filename != null) ? imagepng($img, $filename) : imagepng($img);\n } else if ($sizeinfo['mime'] == 'image/gif') {\n ($filename != null) ? imagepng($img, $filename) : imagepng($img);\n }\n }",
" /** exdoc\n *\n * @state <b>UNDOCUMENTED</b>\n * @node Undocumented\n *\n * @param $w\n * @param $h\n * @param $string\n *\n * @return null|resource\n */\n public static function imageCaptcha($w, $h, $string) {\n $img = self::imageCreate($w, $h);\n if ($img) {\n // We were able to create an image.\n $bg = imagecolorallocate($img, 250, 255, 225);\n imagefill($img, 0, 0, $bg);\n #echo $bg;\n $colors = array();\n for ($i = 0; $i < strlen($string) && $i < 10; $i++) {\n $colors[$i] = imagecolorallocate($img, mt_rand(50, 150), mt_rand(50, 150), mt_rand(50, 150));\n }\n $px_per_char = floor($w / (strlen($string) + 1));\n for ($i = 0, $iMax = strlen($string); $i < $iMax; $i++) {\n imagestring($img, mt_rand(4, 6), $px_per_char * ($i + 1) + mt_rand(-5, 5), mt_rand(0, $h / 2), $string{$i}, $colors[($i % 10)]);\n }",
" // Need this to be 'configurable'\n for ($i = 0; $i < strlen($string) / 2 && $i < 10; $i++) {\n $c = imagecolorallocate($img, mt_rand(150, 250), mt_rand(150, 250), mt_rand(150, 250));\n imageline($img, mt_rand(0, $w / 4), mt_rand(5, $h - 5), mt_rand(3 * $w / 4, $w), mt_rand(0, $h), $c);\n }",
" //imagestring($img,6,0,0,$string,$color);\n return $img;\n } else {\n return null;\n }\n }",
" static function recurse_copy($src, $dst) {\n $dir = opendir($src);\n @mkdir($dst,DIR_DEFAULT_MODE_STR);\n while (false !== ($file = readdir($dir))) {\n if (($file != '.') && ($file != '..')) {\n if (is_dir($src . '/' . $file)) {\n self::recurse_copy($src . '/' . $file, $dst . '/' . $file);\n } else {\n if (!copy($src . '/' . $file, $dst . '/' . $file)) {\n return false;\n }\n ;\n }\n }\n }\n closedir($dir);\n return true;\n }",
" /**\n * Recursively removes all files in a given directory, and all\n * the files and directories underneath it.\n * Optionally can skip dotfiles\n *\n * @param string $dir directory to work with\n * @param bool $dot_files should dotfiles be removed?\n *\n * @return array\n */\n public static function removeFilesInDirectory($dir, $dot_files = false) {\n $results['removed'] = array();\n $results['not_removed'] = array();",
" $files = scandir($dir);\n array_shift($files); // remove '.' from array\n array_shift($files); // remove '..' from array\n foreach ($files as $file) {\n if ($dot_files || substr($file, 0, 1) != '.') { // don't remove dot files\n $file = $dir . '/' . $file;\n if (is_dir($file)) {\n self::removeFilesInDirectory($file);\n rmdir($file);\n } else {\n if (is_writeable($file) && !is_dir($file)) {\n unlink($file);\n $results['removed'][] = $file;\n } else {\n $results['not_removed'][] = $file;\n }\n }\n }\n }",
" /*\told routine\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n $filepath = $dir.'/'.$file;\n if (substr($file,0,1) != '.') {\n if (is_writeable($filepath) && !is_dir($filepath)) {\n unlink($filepath);\n $results['removed'][] = $filepath;\n } else {\n $results['not_removed'][] = $filepath;\n }\n }\n }\n }*/",
" return $results;\n }",
" /** exdoc\n * This method creates a directory and all of its parent directories, if they do not exist,\n * emulating the behavior of the -p option to mkdir on UNIX systems. Returns\n * a SYS_FILES_* constant, indicating its status.\n *\n * @param string $dir The directory to create. This path must be relative to BASE\n * @param null $mode\n * @param bool $is_full\n *\n * @return int\n * @node Model:expFile\n */\n public static function makeDirectory($dir, $mode = null, $is_full = false) {\n $__oldumask = umask(0);\n $parentdir = ($is_full ? \"/\" : BASE); // we will add to parentdir with each directory\n foreach (explode(\"/\", $dir) as $part) {\n if ($part != \"\" && !is_dir($parentdir . $part)) {\n // No parent directory. Create it.\n if (is_file($parentdir . $part)) return SYS_FILES_FOUNDFILE;\n if (expUtil::isReallyWritable($parentdir)) {\n if ($mode == null) $mode = octdec(DIR_DEFAULT_MODE_STR + 0);\n mkdir($parentdir . $part, $mode);\n chmod($parentdir . $part, $mode);\n } else return SYS_FILES_NOTWRITABLE;\n }\n $parentdir .= $part . \"/\";\n }\n umask($__oldumask);\n return SYS_FILES_SUCCESS;\n }",
" /**\n * Recursively removes the given directory, and all\n * of the files and directories underneath it.\n *\n * @param string $dir The path of the directory to remove\n *\n * @node Model:expFile\n *\n * @param string $dir directory to work with\n *\n * @return int\n */\n public static function removeDirectory($dir) {\n if (strpos($dir, BASE) != 0) $dir = BASE . $dir;\n $dh = opendir($dir);\n if ($dh) {\n while (($file = readdir($dh)) !== false) {\n if ($file != \".\" && $file != \"..\" && is_dir(\"$dir/$file\")) {\n if (self::removeDirectory(\"$dir/$file\") == SYS_FILES_NOTDELETABLE) return SYS_FILES_NOTDELETABLE;\n } else if (is_file(\"$dir/$file\") || is_link(is_file(\"$dir/$file\"))) {\n unlink(\"$dir/$file\");\n if (file_exists(\"$dir/$file\")) {\n return SYS_FILES_NOTDELETABLE;\n }\n } else if ($file != \".\" && $file != \"..\") {\n echo \"BAD STUFF HAPPENED<br />\";\n echo \"--------Don't know what to do with $dir/$file<br />\";\n//\t\t\t\t\techo \"<xmp>\";\n echo \"<pre>\";\n print_r(stat(\"$dir/$file\"));\n echo filetype(\"$dir/$file\");\n//\t\t\t\t\techo \"</xmp>\";\n echo \"</pre>\";\n }\n }\n }\n closedir($dh);\n rmdir($dir);\n }",
" /** exdoc\n * Move an uploaded temporary file to a more permanent home inside of the Exponent files/ directory.\n * This function takes into account the default file modes specified in the site configuration.\n *\n * @param string $tmp_name The temporary path of the uploaded file.\n * @param string $dest The full path to the destination file (including the destination filename).\n *\n * @return null|string The destination file if it exists, otherwise null\n * @node Model:expFile\n */\n public static function moveUploadedFile($tmp_name, $dest) {\n move_uploaded_file($tmp_name, $dest);\n if (file_exists($dest)) {\n $__oldumask = umask(0);\n chmod($dest, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);\n return str_replace(BASE, '', $dest);\n } else return null;\n }",
" /** exdoc\n * Checks to see if the upload destination file exists. This is to prevent\n * accidentally uploading over the top of another file.\n * Returns true if the file already exists, and false if it does not.\n *\n * @param string $dir The directory to contain the existing directory.\n * @param string $name The name of the file control used to upload the\n * file. The files subsystem will look to the $_FILES array\n * to get the filename of the uploaded file.\n *\n * @return bool\n * @node Model:expFile\n */\n public static function uploadDestinationFileExists($dir, $name) {\n return (file_exists(BASE . $dir . \"/\" . self::fixName($_FILES[$name]['name'])));\n }",
" /** exdoc\n * Lists files and directories under a given parent directory. Returns an\n * associative, flat array of files and directories. The key is the full file\n * or directory name, and the value is the file or directory name.\n *\n * @param string $dir The path of the directory to look at.\n * @param boolean $recurse A boolean dictating whether to descend into subdirectories\n * recursively, and list files and subdirectories.\n * @param string $ext An optional file extension. If specified, only files ending with\n * that file extension will show up in the list. Directories are not affected.\n * @param array $exclude_dirs An array of directory names to exclude. These names are\n * path-independent. Specifying \"dir\" will ignore all directories and\n * sub-directories named \"dir\", regardless of their parent.\n * @param string $relative\n *\n * @return array\n * @node Model:expFile\n */\n public static function listFlat($dir, $recurse = false, $ext = null, $exclude_dirs = array(), $relative = \"\") {\n $files = array();\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_dir(\"$dir/$file\") && !in_array($file, $exclude_dirs) && $recurse && $file != \".\" && $file != \"..\" && $file != \"CVS\") {\n $files = array_merge($files, self::listFlat(\"$dir/$file\", $recurse, $ext, $exclude_dirs, $relative));\n }\n if (is_file(\"$dir/$file\") && ($ext == null || substr($file, -1 * strlen($ext), strlen($ext)) == $ext)) {\n $files[str_replace($relative, \"\", \"$dir/$file\")] = $file;\n }\n }\n closedir($dh);\n }\n return $files;\n }",
" /** exdoc\n * Looks at the filesystem structure surrounding the destination\n * and determines if the web server can create a new file there.\n * Returns one of the following:\n * <br>SYS_FILES_NOTWRITABLE - unable to create files in destination\n * <br>SYS_FILES_SUCCESS - A file or directory can be created in destination\n * <br>SYS_FILES_FOUNDFILE - Found destination to be a file, not a directory\n *\n * @param string $dest Path to the directory to check\n *\n * @return int\n * @node Model:expFile\n */\n public static function canCreate($dest) {\n if (substr($dest, 0, 1) == '/') $dest = str_replace(BASE, '', $dest);\n $parts = explode('/', $dest);\n $working = BASE;\n for ($i = 0, $iMax = count($parts); $i < $iMax; $i++) {\n if ($parts[$i] != '') {\n if (!file_exists($working . $parts[$i])) {\n return (expUtil::isReallyWritable($working) ? SYS_FILES_SUCCESS : SYS_FILES_NOTWRITABLE);\n }\n $working .= $parts[$i] . '/';\n }\n }\n // If we got this far, then the file we are asking about already exists.\n // Check to see if we can overwrite this file.\n // First however, we need to strip off the '/' that was added a few lines up as the last part of the for loop.\n $working = substr($working, 0, -1);",
" if (!expUtil::isReallyWritable($working)) {\n return SYS_FILES_NOTWRITABLE;\n } else {\n if (is_file($working)) {\n return SYS_FILES_FOUNDFILE;\n } else {\n return SYS_FILES_FOUNDDIR;\n }\n }\n }",
" /**\n * Test if file can be uploaded using tmp folder\n *\n * @param string $tmp\n * @param string $dest\n *\n * @return bool\n */\n public static function canUpload($tmp = 'tmp', $dest = 'files/uploads') {\n $result = expFile::canCreate(BASE . $tmp . '/TEST') != SYS_FILES_SUCCESS;\n $result |= expFile::canCreate(BASE . $dest . '/TEST') != SYS_FILES_SUCCESS;\n return $result;\n }",
" /** exdoc\n * Copies just the directory structure (including subdirectories) of a given directory.\n * Any files in the source directory are ignore, and duplicate copies are made (no symlinks).\n *\n * @param string $src The directory to copy structure from. This must be a full path.\n * @param string $dest The directory to create duplicate structure in. If this directory is not empty,\n * you may run into some problems, because of file/directory conflicts.\n * @param array $exclude_dirs An array of directory names to exclude. These names are\n * path-independent. Specifying \"dir\" will ignore all directories and\n * sub-directories named \"dir\", regardless of their parent.\n *\n * @node Model:expFile\n */\n public static function copyDirectoryStructure($src, $dest, $exclude_dirs = array()) {\n $__oldumask = umask(0);\n if (!is_dir($dest)) {\n $file_path = pathinfo($dest);\n $dest = $file_path['dirname'];\n }\n if (!is_dir($src)) {\n $file_path = pathinfo($src);\n $src = $file_path['dirname'];\n }\n if (!file_exists($dest)) mkdir($dest, fileperms($src));\n $dh = opendir($src);\n while (($file = readdir($dh)) !== false) {\n if (is_dir(\"$src/$file\") && !in_array($file, $exclude_dirs) && substr($file, 0, 1) != \".\" && $file != \"CVS\") {\n if (!file_exists($dest.\"/\".$file)) mkdir($dest.\"/\".$file, fileperms($src.\"/\".$file));\n if (is_dir($dest.\"/\".$file)) {\n self::copyDirectoryStructure($src.\"/\".$file, $dest.\"/\".$file);\n }\n }\n }\n closedir($dh);\n umask($__oldumask);\n }",
" /** exdoc\n * This function takes a database object and dumps\n * all of the records in all of the tables into a string.\n * The contents of the string are suitable for storage\n * in a file or other permanent mechanism, and is in\n * the EQL format naively handled by the current\n * implementation.\n *\n * @param null/array $tables\n * @param null/string $type The type of dump\n * @param null/string/array $opts Record descimiator\n *\n * @return string The content of export file\n * @node Model:expFile\n */\n public static function dumpDatabase($tables = null, $type = null, $opts = null) {\n global $db;",
" //FIXME we need to echo and/or write to file within this method to handle large database dumps\n $dump = EQL_HEADER . \"\\r\\n\";\n if ($type == null || $type == 'export') {\n $dump .= 'VERSION:' . EXPONENT . \"\\r\\n\\r\\n\";\n } else {\n $dump .= 'VERSION:' . EXPONENT . ':' . $type . \"\\r\\n\\r\\n\";\n }",
" if (is_string($tables)) $tables = array($tables);\n if (!is_array($tables)) { // dump all the tables\n $tables = $db->getTables();\n if (!function_exists('tmp_removePrefix')) {\n function tmp_removePrefix($tbl) {\n return substr($tbl, strlen(DB_TABLE_PREFIX) + 1);\n // we add 1, because DB_TABLE_PREFIX no longer has the trailing\n // '_' character - that is automatically added by the database class.\n }\n }\n $tables = array_map('tmp_removePrefix', $tables);\n }\n uasort($tables, 'strnatcmp');\n foreach ($tables as $key=>$table) {\n $where = '1';\n if ($type == 'Form') {\n if ($table == 'forms') {\n $where = 'id=' . $opts;\n } elseif ($table == 'forms_control') {\n $where = 'forms_id=' . $opts;\n }\n } elseif ($type == 'export') {\n if (is_string($opts))\n $where = $opts;\n elseif (is_array($opts) && !empty($opts[$key]))\n $where = $opts[$key];\n }\n $tmp = $db->countObjects($table,$where);\n if ($type != 'export' || $db->countObjects($table, $where)) {\n $tabledef = $db->getDataDefinition($table);\n $dump .= 'TABLE:' . $table . \"\\r\\n\";\n $dump .= 'TABLEDEF:' . str_replace(array(\"\\r\", \"\\n\"), array('\\r', '\\n'), serialize($tabledef)) . \"\\r\\n\";\n foreach ($db->selectObjects($table, $where) as $obj) {\n $dump .= 'RECORD:' . str_replace(array(\"\\r\", \"\\n\"), array('\\r', '\\n'), serialize($obj)) . \"\\r\\n\";\n }\n $dump .= \"\\r\\n\";\n }\n }\n //FIXME $dump may become too large and exhaust memory\n return $dump;\n }",
" /** exdoc\n * This function restores a database (overwriting all data in\n * any existing tables) from an EQL object dump. Returns true if\n * the restore was a success and false if something went horribly wrong\n * (unable to read file, etc.) Even if true is returned, there is a chance\n * that some errors were encountered. Check $errors to be sure everything\n * was fine.\n *\n * @param string $file The filename of the EQL file to restore from\n * @param array $errors A referenced array that stores errors. Whatever\n * variable is passed in this argument will contain all errors encountered\n * during the parse/restore.\n * @param null/string $type The type of eql file to restore\n *\n * @return bool\n * @node Model:expFile\n */\n public static function restoreDatabase($file, &$errors, $type = null) {\n global $db;",
"// $errors = array();",
" if (is_readable($file)) {\n $eql = @fopen($file, \"r\");\n if ($eql) {\n //NOTE changed to fgets($file)\n// $lines = @file($file);\n $line0 = fgets($eql);\n $line1 = fgets($eql);",
" // Sanity check\n// if (count($lines) < 2 || trim($lines[0]) != EQL_HEADER) {\n if ($line1 === false || trim($line0) != EQL_HEADER) {\n $errors[] = gt('Not a valid EQL file');\n return false;\n }",
"// $version = explode(':', trim($lines[1]));\n $version = explode(':', trim($line1));\n $eql_version = $version[1] + 0;\n $current_version = EXPONENT + 0;\n if ((array_key_exists(2, $version) && $type == null) || (array_key_exists(\n 2,\n $version\n ) && $version[2] != $type)\n ) {\n $eql_version = 0; // trying to import wrong eql type\n }",
"// $clear_function = '';\n $fprefix = '';\n // Check version and include necessary converters\n if ($eql_version != $current_version) {\n $errors[] = gt('EQL file was Not a valid EQL version');\n return false;\n //\t\t\t$fprefix = 'expFile::'.implode('',explode('.',$eql_version)).'_';\n //\t\t\tif (function_exists($fprefix.'clearedTable')) {\n //\t\t\t\t$clear_function = $fprefix.'clearedTable';\n //\t\t\t}\n }",
" // make sure the database tables are up to date\n expDatabase::install_dbtables();",
" $table = '';\n $oldformdata = array();\n $itsoldformdata = false;\n $newformdata = array();\n $itsnewformdata = false;\n// for ($i = 2; $i < count($lines); $i++) {\n $line_number = 2;\n while (($line = fgets($eql)) !== false) {\n $table_function = '';\n// $line_number = $i;\n $line_number++;\n// $line = trim($lines[$i]);\n $line = trim($line);\n if ($line != '') {\n $pair = explode(':', $line);\n $pair[1] = implode(':', array_slice($pair, 1));\n $pair = array_slice($pair, 0, 2);",
" if ($pair[0] == 'TABLE') {\n $itsoldformdata = false; // we are on a new table set\n $itsnewformdata = false;\n $table = $pair[1];\n if ($fprefix != '') {\n $table_function = $fprefix . $table;\n }\n if ($db->tableExists($table)) {\n if ($type == null) {\n $db->delete($table); // drop/empty table records\n }\n// if ($clear_function != '') {\n// $clear_function($db, $table);\n// }\n } else {\n if (substr($table, 0, 12) == 'formbuilder_') {\n $formbuildertypes = array(\n 'address',\n 'control',\n 'form',\n 'report'\n );\n $ttype = substr($table, 12);\n if (!in_array($ttype, $formbuildertypes)) {\n $itsoldformdata = true;\n }\n } elseif (substr($table, 0, 6) == 'forms_' && $table != 'forms_control') {\n $itsnewformdata = true;\n }\n //\t\t\t\t\t\tif (!file_exists(BASE.'framework/core/definitions/'.$table.'.php')) {\n $errors[] = sprintf(\n gt('Table \"%s\" not found in the database (line %d)'),\n $table,\n $line_number\n );\n //\t\t\t\t\t\t} else if (!is_readable(BASE.'framework/core/definitions/'.$table.'.php')) {\n //\t\t\t\t\t\t\t$errors[] = sprintf(gt('Data definition file for %s (%s) is not readable (line %d)'),$table,'framework/core/definitions/'.$table.'.php',$line_number);\n //\t\t\t\t\t\t} else {\n //\t\t\t\t\t\t\t$dd = include(BASE.'framework/core/definitions/'.$table.'.php');\n //\t\t\t\t\t\t\t$info = (is_readable(BASE.'framework/core/definitions/'.$table.'.info.php') ? include(BASE.'framework/core/definitions/'.$table.'.info.php') : array());\n //\t\t\t\t\t\t\t$db->createTable($table,$dd,$info);\n //\t\t\t\t\t\t}\n }\n } else {\n if ($pair[0] == 'TABLEDEF') { // new in v2.1.4, re-create a missing table\n $pair[1] = str_replace(array('\\r', '\\n'), array(\"\\r\", \"\\n\"), $pair[1]);\n//\t\t\t\t\t\t$tabledef = expUnserialize($pair[1]);\n $tabledef = @unserialize($pair[1]);\n if (!$db->tableExists($table)) {\n $db->createTable($table, $tabledef, array());\n $errors[] = sprintf(\n gt('* However...we successfully recreated the \"%s\" Table from the EQL file'),\n $table\n );\n } else {\n $db->alterTable($table, $tabledef, array(), true);\n }\n $itsoldformdata = false; // we've recreated the table using the tabledef\n $itsnewformdata = false;\n } else {\n if ($pair[0] == 'RECORD') {\n if ($db->tableExists($table)) {\n // Here we need to check the conversion scripts.\n $pair[1] = str_replace(array('\\r', '\\n'), array(\"\\r\", \"\\n\"), $pair[1]);\n //\t\t\t\t\t\t$object = expUnserialize($pair[1]);\n $object = @unserialize($pair[1]);\n if ($type == 'Form') {\n if ($table == 'forms') {\n $forms_id = $object->id = $db->max(\n $table,\n 'id'\n ) + 1; // create a new record\n $spare = new expRecord();\n $spare->title = $object->title;\n $spare->makeSefUrl();\n $object->sef_url = $spare->sef_url;\n } elseif ($table == 'forms_control') {\n $object->id = null; // create a new record\n $object->forms_id = $forms_id; // assign to new form record\n } elseif (substr($table, 6) == 'forms_') {\n $object->id = null; // create a new record\n }\n }\n if (!$object) {\n $object = unserialize(stripslashes($pair[1]));\n }\n if (function_exists($table_function)) {\n $table_function($db, $object);\n } else {\n if (is_object($object)) {\n $db->insertObject($object, $table);\n } else {\n $errors[] = sprintf(\n gt('Unable to decipher \"%s\" record (line %d)'),\n $pair[0],\n $line_number\n );\n }\n }\n } elseif ($itsoldformdata) {\n $oldformdata[$table][] = $pair[1]; // store for later\n } elseif ($itsnewformdata) {\n $newformdata[$table][] = $pair[1]; // store for later\n }\n } else {\n $errors[] = sprintf(\n gt('Invalid specifier type \"%s\" (line %d)'),\n $pair[0],\n $line_number\n );\n }\n }\n }\n }\n }",
" // check for and process to rebuild old formbuilder module data table\n if (!empty($oldformdata)) {\n foreach ($oldformdata as $tablename => $tabledata) {\n $oldform = $db->selectObject('formbuilder_form', 'table_name=\"' . substr($tablename, 12) . '\"');\n if (!empty($oldform)) {\n // create the old table\n $table = self::updateFormbuilderTable($oldform);",
" // populate the table\n foreach ($tabledata as $record) {\n $record = str_replace('\\r\\n', \"\\r\\n\", $record);\n $object = @unserialize($record);\n if (!$object) {\n $object = unserialize(stripslashes($record));\n }\n if (is_object($object)) {\n $db->insertObject($object, 'formbuilder_' . $table);\n }\n }\n $errors[] = sprintf(\n gt(\n '* However...we successfully recreated the \"formbuilder_%s\" Table from the EQL file'\n ),\n $table\n );\n }\n }\n }",
" // check for and process to rebuild new forms module data table\n if (!empty($newformdata)) {\n foreach ($newformdata as $tablename => $tabledata) {\n $newform = $db->selectObject('forms', 'table_name=\"' . substr($tablename, 6) . '\"');\n if (!empty($newform)) {\n // create the new table\n $form = new forms($newform->id);\n $table = $form->updateTable();",
" // populate the table\n foreach ($tabledata as $record) {\n $record = str_replace('\\r\\n', \"\\r\\n\", $record);\n $object = @unserialize($record);\n if (!$object) {\n $object = unserialize(stripslashes($record));\n }\n if (is_object($object)) {\n// $db->insertObject($object, 'forms_' . $table);\n $form->insertRecord($object);\n }\n }\n $errors[] = sprintf(\n gt('* However...we successfully recreated the \"forms_%s\" Table from the EQL file'),\n $table\n );\n }\n }\n }",
" // ensure the form data table exists and is current\n// foreach ($db->selectObjects('forms') as $f) {\n// if ($f->is_saved) $f->updateTable();\n// }\n $formmodel = new forms();\n $forms = $formmodel->find('all');\n foreach ($forms as $f) {\n if ($f->is_saved) {\n $f->updateTable();\n }\n }",
" // rename mixed case tables if necessary\n expDatabase::fix_table_names();\n// if ($eql_version != $current_version) {\n// $errors[] = gt('EQL file was Not a valid EQL version');\n// return false;\n// }\n return true;\n } else {\n $errors[] = gt('Unable to read EQL file');\n return false;\n }\n } else {\n $errors[] = gt('Unable to find EQL file');\n return false;\n }\n }",
" /** exdoc\n * This function reads a database EQL object dump file and returns an array of the\n * database tables and records, or false if something went horribly wrong\n * (unable to read file, etc.) Even if an array is returned, there is a chance\n * that some errors were encountered. Check $errors to be sure everything\n * was fine.\n *\n * @param string $file The filename of the EQL file to parse\n * @param array $errors A referenced array that stores errors. Whatever\n * variable is passed in this argument will contain all errors encountered\n * during the parse/restore.\n * @param null/string/array $type The list of tables to return, empty = entire file\n * @return array/bool\n * @node Model:expFile\n */\n public static function parseDatabase($file, &$errors, $type = null) {\n// $errors = array();\n $data = array();",
" if (is_readable($file)) {\n $lines = @file($file); //FIXME we may have to change this for handling large files via fgets()...see dumpDatabase() above",
" // Sanity check\n if (count($lines) < 2 || trim($lines[0]) != EQL_HEADER) {\n $errors[] = gt('Not a valid EQL file');\n return false;\n }",
" $version = explode(':', trim($lines[1]));\n $eql_version = $version[1] + 0;\n $current_version = EXPONENT + 0;\n if ((array_key_exists(2, $version) && $type == null) || (array_key_exists(2, $version) && $version[2] != $type)) {\n $eql_version = 0; // trying to import wrong eql type\n }",
" // Check version and include necessary converters\n if ($eql_version != $current_version) {\n $errors[] = gt('EQL file was Not a valid EQL version');\n return false;\n }",
" $table = '';\n for ($i = 2, $iMax = count($lines); $i < $iMax; $i++) {\n $line_number = $i;\n $line = trim($lines[$i]);\n if ($line != '') {\n $pair = explode(':', $line);\n $pair[1] = implode(':', array_slice($pair, 1));\n $pair = array_slice($pair, 0, 2);",
" if ($pair[0] == 'TABLE') {\n $table = $pair[1];\n $data[$table] = new stdClass();\n $data[$table]->name = $table;\n $data[$table]->records = array();\n } else if ($pair[0] == 'TABLEDEF') { // new in v2.1.4, re-create a missing table\n $pair[1] = str_replace('\\r\\n', \"\\r\\n\", $pair[1]);\n $tabledef = @unserialize($pair[1]);\n $data[$table]->tabledef = $tabledef;\n } else if ($pair[0] == 'RECORD') {\n // Here we need to check the conversion scripts.\n $pair[1] = str_replace('\\r\\n', \"\\r\\n\", $pair[1]);\n//\t\t\t\t\t\t$object = expUnserialize($pair[1]);\n $object = @unserialize($pair[1]);\n if (!$object) $object = unserialize(stripslashes($pair[1]));\n if (is_object($object)) {\n $data[$table]->records[] = object2Array($object); //FIXME should we convert this? object2array?\n } else {\n $errors[] = sprintf(gt('Unable to decipher \"%s\" record (line %d)'), $pair[0], $line_number);\n }\n } else {\n $errors[] = sprintf(gt('Invalid specifier type \"%s\" (line %d)'), $pair[0], $line_number);\n }\n }\n }",
" if (!empty($type)) {\n if (!is_array($type)) $type = array($type);\n foreach ($data as $key=>$tbl) {\n if (!in_array($key, $type)) {\n unset($data[$key]);\n }\n }\n }\n return $data;\n } else {\n $errors[] = gt('Unable to read EQL file');\n return false;\n }\n }",
" public function afterDelete() {\n global $db;",
"\t // get and delete all attachments to this file\n\t $db->delete('content_expFiles','expfiles_id='.$this->id);\n }",
" /**\n * recreates a deprecated formbuilder data table\n * needed to import form data from eql file exported prior to v2.1.4\n * this is just the old formbuilder_form::updateTable method\n *\n * @static\n * @param $object\n * @return mixed\n */\n static function updateFormbuilderTable($object) {\n\t\tglobal $db;",
"\t\tif (!empty($object->is_saved)) {\n\t\t\t$datadef = array(\n\t\t\t\t'id'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_ID,\n\t\t\t\t\tDB_PRIMARY=>true,\n\t\t\t\t\tDB_INCREMENT=>true),\n\t\t\t\t'ip'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_STRING,\n\t\t\t\t\tDB_FIELD_LEN=>25),\n\t\t\t\t'referrer'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_STRING,\n\t\t\t\t\tDB_FIELD_LEN=>1000),\n\t\t\t\t'timestamp'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_TIMESTAMP),\n\t\t\t\t'user_id'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_ID)\n\t\t\t);",
"\t\t\tif (!isset($object->id)) {\n\t\t\t\t$object->table_name = preg_replace('/[^A-Za-z0-9]/','_',$object->name);\n\t\t\t\t$tablename = 'formbuilder_'.$object->table_name;\n\t\t\t\t$index = '';\n\t\t\t\twhile ($db->tableExists($tablename . $index)) {\n\t\t\t\t\t$index++;\n\t\t\t\t}\n\t\t\t\t$tablename = $tablename.$index;\n\t\t\t\t$db->createTable($tablename,$datadef,array());\n\t\t\t\t$object->table_name .= $index;\n\t\t\t} else {\n\t\t\t\tif ($object->table_name == '') {\n\t\t\t\t\t$tablename = preg_replace('/[^A-Za-z0-9]/','_',$object->name);\n\t\t\t\t\t$index = '';\n\t\t\t\t\twhile ($db->tableExists('formbuilder_' . $tablename . $index)) {\n\t\t\t\t\t\t$index++;\n\t\t\t\t\t}\n\t\t\t\t\t$object->table_name = $tablename . $index;\n\t\t\t\t}",
"\t\t\t\t$tablename = 'formbuilder_'.$object->table_name;",
"\t\t\t\t//If table is missing, create a new one.\n\t\t\t\tif (!$db->tableExists($tablename)) {\n\t\t\t\t\t$db->createTable($tablename,$datadef,array());\n\t\t\t\t}",
"\t\t\t\t$ctl = null;\n\t\t\t\t$control_type = '';\n\t\t\t\t$tempdef = array();\n\t\t\t\tforeach ($db->selectObjects('formbuilder_control','form_id='.$object->id) as $control) {\n\t\t\t\t\tif ($control->is_readonly == 0) {\n\t\t\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t\t\t$ctl->identifier = $control->name;\n\t\t\t\t\t\t$ctl->caption = $control->caption;\n\t\t\t\t\t\t$ctl->id = $control->id;\n\t\t\t\t\t\t$control_type = get_class($ctl);\n\t\t\t\t\t\t$def = call_user_func(array($control_type,'getFieldDefinition'));\n\t\t\t\t\t\tif ($def != null) {\n\t\t\t\t\t\t\t$tempdef[$ctl->identifier] = $def;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$datadef = array_merge($datadef,$tempdef);\n\t\t\t\t$db->alterTable($tablename,$datadef,array(),true);\n\t\t\t}\n\t\t}\n\t\treturn $object->table_name;\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * Class to handle files at the File System Level and updating\n * the record for each file.\n *\n * expFile is an extension of expRecord because File information is stored\n * in the database for future access and retrieval. This class also handles\n * and and all File System handling as well: copy, move, delete, upload,\n * and importing of data in preparation of data importation. Upload and\n * import via child classes.\n *\n * @subpackage Models\n * @package Modules\n *\n */\n/** @define \"BASE\" \"../../..\" */\nclass expFile extends expRecord {",
"// ==========================================================\n// Class Constants",
" /*\n * The definition of this constant lets other parts of the subsystem know\n * that the Image Subsystem has been included for use.\n */\n const SYS_IMAGE = 1;\n const IMAGE_ERR_NOGD = '';\n const IMAGE_ERR_NOTSUPPORTED = '_unknown';\n const IMAGE_ERR_FILENOTFOUND = '_notfound';\n const IMAGE_ERR_PERMISSIONDENIED = '_denied';",
"// ===========================================================\n// File Access Control Values",
" /**\n * Mode to use for reading from files\n *\n * @constant string FILE_MODE_READ\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_MODE_READ = 'rb';",
" /**\n * Mode to use for truncating files, then writing\n *\n * @constant string FILE_MODE_WRITE\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_MODE_WRITE = 'wb';",
" /**\n * Mode to use for appending to files\n *\n * @constant string FILE_MODE_APPEND\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_MODE_APPEND = 'ab';",
" /**\n * Use this when a shared (read) lock is required.\n * This is a \"relabel\" of the PHP 'LOCK_SH' constant\n *\n * @constant string FILE_LOCK_SHARED\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_LOCK_SHARED = LOCK_SH;",
" /**\n * Use this when an exclusive (write) lock is required\n * This is a \"relabel\" of the PHP 'LOCK_EX' constant\n *\n * @constant string FILE_LOCK_EXCLUSIVE\n *\n * @access private\n * @PHPUnit Not Defined\n *\n */\n const FILE_LOCK_EXCLUSIVE = LOCK_EX;",
" // ==========================================================\n // Class Properties and their default values",
" /**\n * Database Table Name to store File info\n *\n * @public\n * @property string $table Database Table Name\n *\n */\n public $table = 'expFiles';\n protected $attachable_table = 'content_expFiles';",
" protected $attachable_item_types = array(\n 'content_expCats' => 'expCat',\n// 'content_expComments'=>'expComment',\n// 'content_expDefinableFields' => 'expDefinableField',\n// 'content_expFiles' => 'expFile',\n// 'content_expRatings'=>'expRating',\n// 'content_expSimpleNote'=>'expSimpleNote',\n// 'content_expTags'=>'expTag',\n );",
" /**\n * Relative OS System File path to where $filename is [to be] located\n *\n * @protected\n * @property string $directory Relative OS System File path\n *\n */\n public $directory = null;",
" /**\n * File Name of File to process\n *\n * @public\n * @property string $filename Name of File to process\n *\n */\n public $filename = null;",
" /**\n * Size of File, in Bytes\n *\n * @protected\n * @property string $filesize Size of File, in Bytes.\n *\n */\n public $filesize = null;",
" /**\n * Mime Type of File.\n *\n * @public\n * @property string $mimetype File MIME Type\n *\n */\n public $mimetype = null;",
" /**\n * Image width in pixels.\n *\n * @public\n * @property string $image_width Image width in pixels\n *\n */\n public $image_width = null;",
" /**\n * Image height in pixels.\n *\n * @public\n * @property string $image_height Image height in pixels\n *\n */\n public $image_height = null;",
" /**\n * Is this file an image.\n # Defaults to FALSE\n *\n * @public\n * @property string $is_image Is this file an image\n *\n */\n public $is_image = false;",
" /**\n * Determines if this file can be overwritten.\n * Also if it can be \"moved\" or \"renamed\" over\n * Default set to FALSE, no it can't\n *\n * @protected boolean\n * @property boolean $fileOverWrite Determines if this file be overwritten\n *\n * @access protected\n * @since 1.1\n */\n protected $fileOverWrite = false;",
" /**\n * Web based Path for current File\n *\n * @public\n * @property string $url Web based Path\n *\n */\n public $url = null;",
" /**\n * Full File System Path for current File. Also used to in FILE Record\n *\n * @public\n * @property string $path Full File System Path\n *\n */\n public $path = null;",
" /**\n * Relative File System Path for current File\n *\n * @public\n * @property string $path_relative Relative File System Path\n *\n */\n public $path_relative = null;",
"// ==========================================================\n// Class Methods",
" /**\n * Class constructor to create a File Class either from a database\n * record or from the File System.\n *\n * Class will either: a) load an existing File Record\n * b) modify an existing File Record\n * c) create a new File Record\n *\n * This will also handle any File System handling that is needed: copy,\n * move, create, delete, read and write.\n *\n * @access public\n *\n * @uses expRecord::__construct\n *\n * @PHPUnit Not Defined\n *\n * @param mixed $params - If an INT is given, this assumes that it needs to\n * load an existing File Record.\n * - If an ARRAY is given, this assumes that the elements\n * of the array are values to the File table that need\n * to be modified or other processing.\n * - If NULL is given, an empty File Object is created\n *\n * @param bool $get_assoc\n * @param bool $get_attached\n *\n * @return \\expFile Object@throws void\n *\n */\n public function __construct($params = array(), $get_assoc = false, $get_attached = true) {\n // Set 'directory' as the default FILE location\n // This will be redefined if a FILE record is loaded\n // or a path is given to the Class\n //eDebug($params,true);\n if (empty($params['directory']))\n $this->directory = UPLOAD_DIRECTORY_RELATIVE;\n // This will pull properties for class properties based upon\n // expRecord table definition\n parent::__construct($params, $get_assoc, $get_attached);",
" // If the 'directory' is the same as the default path then a given,\n // or derived, filename can be added to pathing settings\n //if ( $this->directory == UPLOAD_DIRECTORY_RELATIVE ) {\n if (!stristr($this->directory, BASE)) {\n // Place system level web root\n $this->url = URL_FULL . $this->directory . $this->filename;",
" // Place system level OS root\n $this->path = BASE . $this->directory . $this->filename;",
" // Place system OS relative path\n $this->path_relative = PATH_RELATIVE . $this->directory . $this->filename;\n } else {\n // Otherwise, the URL is not set since we can't use it, nether is\n // RELATIVE, as 'directory' must be an absolute path in this instance\n // Place system level OS root\n $relpath = str_replace(BASE, '', $this->directory);\n $this->path = $this->directory . $this->filename;\n $this->url = URL_FULL . $relpath . $this->filename;\n $this->path_relative = $relpath . $this->filename;\n }",
" // If a file location was given, not derived from the database,\n // basic file information is needed\n if (empty($this->id) && !empty($this->filename)) {\n // File info\n $_fileInfo = self::getImageInfo($this->path);\n // Assign info back to class\n $this->is_image = !empty($_fileInfo['is_image']) ? $_fileInfo['is_image'] : false;\n $this->filesize = !empty($_fileInfo['fileSize']) ? $_fileInfo['fileSize'] : 0;\n if (!empty($_fileInfo['mime'])) $this->mimetype = $_fileInfo['mime'];\n if (!empty($_fileInfo['is_image'])) {\n $this->image_width = $_fileInfo[0];\n $this->image_height = $_fileInfo[1];\n }\n }\n }",
" public function exists() {\n return (!empty($this->id) && is_file(BASE . PATH_RELATIVE . $this->directory . $this->filename));\n }\n// =========================================================================\n// Static Methods",
" public static function selectAllFiles() {\n global $db;",
" return $db->selectObjects('expFiles',1);\n }",
" /**\n * File ($_POST) UPLOAD that also optionally inserts File info into database.\n *\n * File UPLOAD is a straight forward uploader and processor. It can accept\n * filename and destination directory overrides as well. It has an additional\n * pair of flags that allow for an upload NOT to be inserted into the database\n * (default to INSERT) and if it previous file, with the same name, should be\n * overwritten (default to NO overwrite)\n *\n * @static\n * @access public\n *\n * @uses class|method|global|variable description\n * @requires class_name\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param string $_postName The name of the _FILE upload array\n * @param bool|string $_force Force the uploaded to overwrite existing file of same name\n * @param bool|string $_save Save file info to database, defaults to TRUE\n * @param string $_destFile Override the uploaded file name\n * @param string $_destDir Override the default FILE UPLOAD location\n *\n * @param null $_max_width\n *\n * @return object $_objFile expFile Object\n * @return object $errMsg Error message if something failed@throws void\n *\n * @TODO Have file upload overwrite make sure not to duplicate its record in the DB\n */\n public static function fileUpload($_postName = null,\n $_force = false,\n $_save = true,\n $_destFile = null,\n $_destDir = null,\n $_max_width = null\n ) {",
" // Make sure something was sent first off...\n if ((!isset($_SERVER['CONTENT_TYPE'])) ||\n (strpos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== 0)\n ) {\n return 'bad upload form';\n }",
" //check for errors\n switch ($_FILES[$_postName]['error']) {\n case UPLOAD_ERR_OK:\n // Everything looks good. Continue with the update.\n break;\n case UPLOAD_ERR_INI_SIZE:\n//\t\t\tcase images:\n // This is a tricky one to catch. If the file is too large for\n // POST, then the script won't even run.\n // But if its between post_max_size and upload_max_filesize,\n // we will get here.\n return 'file_too_large';\n case UPLOAD_ERR_FORM_SIZE:\n return 'file_exceeds_form_MAX_FILE_SIZE';\n case UPLOAD_ERR_PARTIAL:\n return 'partial_file';\n case UPLOAD_ERR_NO_FILE:\n return 'no_file_uploaded';\n case UPLOAD_ERR_NO_TMP_DIR:\n return 'missing_tmp_folder';\n case UPLOAD_ERR_CANT_WRITE:\n return 'failed_write_to_disk';\n case UPLOAD_ERR_EXTENSION:\n return 'upload_stopped_by_extension';\n default:\n return 'unknown';\n break;\n }",
" // If $_destDir is not defined, use the default Files directory\n// $_destDir = ( $_destDir == null ) ? UPLOAD_DIRECTORY : $_destDir;\n $_destDir = ($_destDir == null) ? UPLOAD_DIRECTORY_RELATIVE : $_destDir;",
" // If $_destFile is defined, use that name as an override for the\n // uploaded file name\n $_destFile = ($_destFile == null) ? self::fixName($_FILES[$_postName]['name']) : $_destFile;",
" // Fix the filename, so that we don't have funky characters screwing\n // with our attempt to create the destination file.\n // $_destFile = self::fixFileName( $_FILES[$_postName]['name']);\n // eDebug($_destFile,1);",
" // Build destination fille path for future use\n $_destFullPath = BASE . $_destDir . $_destFile;",
" //if the file exists and we don't want to overwrite it, create a new one\n if (file_exists($_destFullPath) && $_force == false) {\n $_destFile = self::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }",
" //Check to see if the directory exists. If not, create the directory structure.\n // if (!file_exists(BASE . $_destDir)) {\n // self::makeDirectory(BASE . $_destDir);",
" // }",
"\n // Move the temporary uploaded file into the destination directory,\n // and change the name.\n $resized = false;\n $maxwidth = intval($_max_width);\n if (!empty($maxwidth)) {\n $tempFile = tempnam(sys_get_temp_dir(), 'exp_upload_') . '_' . $_destFile;\n move_uploaded_file($_FILES[$_postName]['tmp_name'], $tempFile);\n require_once(BASE . 'framework/modules/pixidou/includes/class.upload/class.upload.php');\n $handle = new upload($tempFile);\n if ($handle->uploaded) {\n $handle->file_new_name_body = $_destFile;\n $handle->file_new_name_ext = '';\n $handle->image_resize = true;\n $handle->image_x = $maxwidth;\n $handle->image_y = $maxwidth;\n $handle->image_ratio_no_zoom_in = true;\n $handle->jpeg_quality = THUMB_QUALITY;\n $handle->process(BASE . $_destDir);\n if ($handle->processed) {\n if ($handle->image_src_x != $handle->image_dst_x) $resized = true;\n $handle->clean();\n }\n }\n } else {\n $tmp = move_uploaded_file($_FILES[$_postName]['tmp_name'], $_destFullPath);\n }",
" if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);\n // Checking\n if ($__oldumask != umask()) {\n flash('error', gt('An error occurred while setting file permissions') . ': ' . $_destFullPath);\n }\n } else {\n return 'could not move';\n }",
" // At this point, we are good to go.",
" // Create a new expFile Object for further processing\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);",
" // Insert new File Record\n if ($_save === true) {\n $_objFile->save();\n }\n if ($resized) $_objFile->resized = true;\n return $_objFile;\n }",
" /**\n * XHR (HTML5) File UPLOAD that also inserts File info into database.\n *\n * File UPLOAD is a straight forward uploader and processor. It can accept\n * filename and destination directory overrides as well. It has an additional\n * pair of flags that allow for an upload NOT to be inserted into the database\n * (default to INSERT) and if it previous file, with the same name, should be\n * overwritten (default to NO overwrite)\n *\n * @static\n * @access public\n *\n * @uses class|method|global|variable description\n * @requires class_name\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param null $fileName\n * @param bool|string $_force Force the uploaded to overwrite existing file of same name\n * @param bool|string $_save Save file info to database, defaults to TRUE\n * @param string $_destFile Override the uploaded file name\n * @param string $_destDir Override the default FILE UPLOAD location\n *\n * @param null $_max_width\n *\n * @return object $_objFile expFile Object\n * @return object $errMsg Error message if something failed@throws void\n *\n * @TODO Have file upload overwrite make sure not to duplicate its record in the DB\n */\n public static function fileXHRUpload($fileName = null,\n $_force = false,\n $_save = true,\n $_destFile = null,\n $_destDir = null,\n $_max_width = null\n ) {",
" // If $_destDir is not defined, use the default Files directory\n $_destDir = ($_destDir == null) ? UPLOAD_DIRECTORY_RELATIVE : $_destDir;",
" // If $_destFile is defined, use that name as an override for the\n // uploaded file name\n $_destFile = ($_destFile == null) ? self::fixName($fileName) : $_destFile;",
" // Fix the filename, so that we don't have funky characters screwing\n // with our attempt to create the destination file.\n // $_destFile = self::fixFileName( $_FILES[$_postName]['name']);\n // eDebug($_destFile,1);",
" // Build destination fille path for future use\n $_destFullPath = BASE . $_destDir . $_destFile;",
" //if the file exists and we don't want to overwrite it, create a new one\n if (file_exists($_destFullPath) && $_force == false) {\n $_destFile = self::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }",
" //Check to see if the directory exists. If not, create the directory structure.\n // if (!file_exists(BASE . $_destDir)) {\n // self::makeDirectory(BASE . $_destDir);\n // }",
" // Move the temporary uploaded file into the destination directory,\n // and change the name.\n $resized = false;\n $maxwidth = intval($_max_width);\n if (!empty($maxwidth)) {\n $tempFile = tempnam(sys_get_temp_dir(), 'exp_upload_') . '_' . $_destFile;\n// move_uploaded_file($_FILES[$fileName]['tmp_name'], $tempFile);\n file_put_contents($tempFile, file_get_contents('php://input'));\n require_once(BASE . 'framework/modules/pixidou/includes/class.upload/class.upload.php');\n $handle = new upload($tempFile);\n if ($handle->uploaded) {\n $handle->file_new_name_body = $_destFile;\n $handle->file_new_name_ext = '';\n $handle->image_resize = true;\n $handle->image_x = $maxwidth;\n $handle->image_y = $maxwidth;\n $handle->image_ratio_no_zoom_in = true;\n $handle->jpeg_quality = THUMB_QUALITY;\n $handle->process(BASE . $_destDir);\n if ($handle->processed) {\n if ($handle->image_src_x != $handle->image_dst_x) $resized = true;\n $handle->clean();\n }\n }\n } else {\n file_put_contents($_destFullPath, file_get_contents('php://input', 'r'));\n }",
" if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);\n // Checking\n if ($__oldumask != umask()) {\n flash('error', gt('An error occurred while setting file permissions') . ': ' . $_destFullPath);\n }\n } else {\n return 'could not move';\n }",
" // At this point, we are good to go.",
" // Create a new expFile Object for further processing\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);",
" // Insert new File Record\n if ($_save === true) {\n $_objFile->save();\n }\n if ($resized) $_objFile->resized = true;\n return $_objFile;\n }",
" /**\n * Performs a system level check on the file and retrieves its size\n *\n * @static\n * @access public\n *\n * @uses function filesize() Built-in PHP method\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param bool|string $_path Full path to file to pull info from\n *\n * @return int $_fileSize Size of file in bytes\n * @throws void\n *\n */\n public static function fileSize($_path = false) {\n if ($_path)\n $_fileSize = filesize($_path);\n else\n $_fileSize = 0;",
" return $_fileSize;\n }",
" /**\n * check for duplicate files and returns a file name that's not already in the system\n *\n * @static\n * @access public\n *\n * @uses function filesize() Built-in PHP method\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param string $filepath direct path of the file to check against\n *\n * @return int $newFileName Name of the file that isn't a duplicate\n * @throws void\n *\n */\n public static function resolveDuplicateFilename($filepath) {\n $extension = strrchr($filepath, \".\"); // grab the file extention by looking for the last dot in the string\n $filnameWoExt = str_replace($extension, \"\", str_replace(\"/\", \"\", strrchr($filepath, \"/\"))); // filename sans extention\n $pathToFile = str_replace($filnameWoExt . $extension, \"\", $filepath); // path sans filename",
" $i = \"\";\n $inc = \"\";\n while (file_exists($pathToFile . $filnameWoExt . $inc . $extension)) {\n $i++;\n $inc = \"-\" . $i;\n }",
" //we'll just return the new filename assuming we've\n //already got the path we want on the other side\n return $filnameWoExt . $inc . $extension;\n }",
" /**\n * prompts the user to download a file\n *\n * @static\n * @access public\n *\n * @uses function download() Built-in PHP method\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param string $file Full path to file to download\n *\n * @return void\n * @throws void\n *\n */\n public static function download($file) {\n // we are expecting an int val as a file ID or the whole file object.\n // If all we get is the ID then we'll instantiate a new file object.\n // If that object doesn't have it's id property set or the file doesn't\n // actually exist then we can assume its not a valid file object and\n // return false.\n if (!is_object($file)) $file = new expFile($file);\n //if (empty($file->id) || !file_exists($file->path)) return false;\n if (!file_exists($file->path)) {\n flash('error', gt('The file is unavailable for Download'));\n expHistory::back();\n return false;\n }",
" // NO buffering from here on out or things break unexpectedly. - RAM\n ob_end_clean();",
" // This code was lifted from phpMyAdmin, but this is Open Source, right?\n // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n // It seems that other headers I've added make IE prefer octet-stream again. - RAM",
" $mimetype = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : $file->mimetype;",
" header('Content-Type: ' . $mimetype);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Content-Transfer-Encoding: binary');\n//\t\theader('Content-Encoding:');\n header('Content-Disposition: attachment; filename=\"' . $file->filename . '\";');\n $filesize = filesize($file->path);\n if ($filesize) header(\"Content-length: \" . $filesize); // for some reason the webserver cant run stat on the files and this breaks.\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }",
" //Read the file out directly\n readfile($file->path);\n exit();\n }",
" /**\n * Replace anything but alphanumeric characters with an UNDERSCORE\n *\n * @static\n * @access public\n *\n * @uses function preg_replace built-in PHP Function\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param string $name File name to 'fix'\n *\n * @return string $name the correct filename\n * @throws void\n *\n */\n public static function fixName($name) {\n $name = preg_replace('/[^A-Za-z0-9\\.]/','_',$name);",
" if ($name[0] == '.') // attempt to upload a dot file",
" $name[0] = '_';",
" $name = str_replace('_', '..', $name); // attempt to upload with redirection to new folder",
" return $name;\n// return preg_replace('/[^A-Za-z0-9\\.]/', '-', $name);\n }",
" /**\n * Return the mimetype for the passed filename\n *\n * @param string $filename\n * @return string\n */\n public static function getMimeType($filename) {\n /* Store an array of commom mimetypes */\n $types = array(\n 'txt' => 'text/plain',\n 'htm' => 'text/html',\n 'html' => 'text/html',\n 'php' => 'text/html',\n 'css' => 'text/css',\n 'js' => 'application/javascript',\n 'json' => 'application/json',\n 'xml' => 'application/xml',",
" // images\n 'png' => 'image/png',\n 'jpe' => 'image/jpeg',\n 'jpeg' => 'image/jpeg',\n 'jpg' => 'image/jpeg',\n 'gif' => 'image/gif',\n 'bmp' => 'image/bmp',\n 'ico' => 'image/vnd.microsoft.icon',\n 'tiff' => 'image/tiff',\n 'tif' => 'image/tiff',\n 'svg' => 'image/svg+xml',\n 'svgz' => 'image/svg+xml',",
" // archives\n 'gz' => 'application/x-gzip',\n 'zip' => 'application/zip',\n 'rar' => 'application/x-rar-compressed',\n 'exe' => 'application/x-msdownload',\n 'msi' => 'application/x-msdownload',\n 'cab' => 'application/vnd.ms-cab-compressed',",
" // audio/video\n 'mp3' => 'audio/mpeg',\n 'ogg' => 'audio/ogg',\n 'qt' => 'video/quicktime',\n 'mov' => 'video/quicktime',\n 'f4v' => 'video/mp4',\n 'mp4' => 'video/mp4',\n 'm4v' => 'video/x-m4v',\n 'ogv' => 'video/ogg',\n '3gp' => 'video/3gpp',\n 'webm' => 'video/webm',\n 'flv' => 'video/x-flv',\n 'swf' => 'application/x-shockwave-flash',",
" // adobe\n 'pdf' => 'application/pdf',\n// 'psd' => 'image/vnd.adobe.photoshop',\n// 'ai' => 'application/postscript',\n// 'eps' => 'application/postscript',\n// 'ps' => 'application/postscript',",
" // ms office\n// 'doc' => 'application/msword',\n// 'rtf' => 'application/rtf',\n// 'xls' => 'application/vnd.ms-excel',\n// 'ppt' => 'application/vnd.ms-powerpoint',",
" // open office\n// 'odt' => 'application/vnd.oasis.opendocument.text',\n// 'ods' => 'application/vnd.oasis.opendocument.spreadsheet'\n );",
" /* Get the file extension,\n * FYI: this is *really* hax.\n */\n $fileparts = explode('.',$filename);\n $extension = strtolower(array_pop($fileparts));\n if(array_key_exists($extension, $types)) {\n /* If we can *guess* the mimetype based on the filename, do that for standardization */\n return $types[$extension];\n } elseif(function_exists('finfo_open')) {\n /* If we don't have to guess, do it the right way */\n $finfo = finfo_open(FILEINFO_MIME);\n $mimetype = finfo_file($finfo, $filename);\n finfo_close($finfo);\n return $mimetype;\n } else {\n /* Otherwise, let the browser guess */\n return 'application/octet-stream';\n }\n }",
"// ==========================================================\n// Class Image Processing Methods\n// @TODO This collection of methods need to be placed in their own Class",
" /**\n * Return size and mimetype information about an image file,\n * given its path/filename. This is a wrapper around the\n * built-in PHP 'getimagesize' function, to make all implementations\n * work identically.\n *\n * @static\n * @access public\n *\n * @uses function getimagesize() Built-in PHP function\n *\n * @PHPUnit Not Defined|Implement|Completed\n *\n * @param bool|string $_path Full path to file to pull info from\n *\n * @return array $_sizeinfo An array of Image File info\n * @return array $error message Error message@throws void\n *\n */\n public static function getImageInfo($_path = false) {",
" $_path = __realpath($_path);",
" if (!file_exists($_path)) return self::IMAGE_ERR_FILENOTFOUND;\n if (!is_readable($_path)) return self::IMAGE_ERR_PERMISSIONDENIED;",
" if ($_sizeinfo = @getimagesize($_path)) {\n $_sizeinfo['is_image'] = true;\n// if (!isset($_sizeinfo['mime'])) {\n// // In case this implementation of getimagesize doesn't discover\n// // the mime type\n// $_types = array(\n// 'jpg' => 'image/jpeg',\n// 'jpeg' => 'image/jpeg',\n// 'gif' => 'image/gif',\n// 'png' => 'image/png'\n// );\n//\n// $_fileData = pathinfo($_path);\n// if (array_key_exists($_fileData['extension'], $_types)) $_sizeinfo['mime'] = $_types[$_fileData['extension']];\n// }\n } else {\n $_sizeinfo['is_image'] = false;\n// if (!isset($_sizeinfo['mime'])) {\n// // In case this implementation of getimagesize doesn't discover\n// // the mime type\n// $_types = array(\n// 'mp3' => 'audio/mpeg',\n// 'ogg' => 'audio/ogg',\n// 'flv' => 'video/x-flv',\n// 'f4v' => 'video/mp4',\n// 'mp4' => 'video/mp4',\n// 'ogv' => 'video/ogg',\n// '3gp' => 'video/3gpp',\n// 'webm' => 'video/webm',\n// 'pdf' => 'application/pdf',\n// );\n//\n// $_fileData = pathinfo($_path);\n// if (array_key_exists($_fileData['extension'], $_types)) $_sizeinfo['mime'] = $_types[$_fileData['extension']];\n// }\n }\n $_sizeinfo['mime'] = self::getMimeType($_path);\n $_sizeinfo['fileSize'] = self::fileSize($_path);",
" return $_sizeinfo;\n }",
" /** exdoc\n * Create an image resource handle (from GD) for a given filename.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * At this point, the user should have called self::getImageInfo on the filename\n * and verified that the file does indeed exist, and is readable. A safeguard check\n * is in place, however.\n *\n * @param string $filename The path/filename of the image.\n *\n * @return null|resource|string\n * @node Model:expFile\n */\n public static function openImageFile($filename) {\n if (!EXPONENT_HAS_GD) return null;",
" $sizeinfo = @getimagesize($filename);\n $info = gd_info();",
" if ($sizeinfo['mime'] == 'image/jpeg' && $info['JPG Support'] == true) {\n $img = imagecreatefromjpeg($filename);\n } else if ($sizeinfo['mime'] == 'image/png' && $info['PNG Support'] == true) {\n $img = imagecreatefrompng($filename);\n } else if ($sizeinfo['mime'] == 'image/gif' && $info['GIF Read Support'] == true) {\n $img = imagecreatefromgif($filename);\n } else {\n // Either we have an unknown image type, or an unsupported image type.\n return self::IMAGE_ERR_NOTSUPPORTED;\n }",
" if (function_exists('imagesavealpha')) {\n imagealphablending($img, false);\n imagesavealpha($img, true);\n }\n return $img;\n }",
" /** exdoc\n * Create a new blank image resource, with the specified width and height.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param integer $w Width of the image resource to create (in pixels)\n * @param integer $h Height of the image resource to create (in pixels)\n *\n * @return null|resource\n * @node Model:expFile\n */\n public static function imageCreate($w, $h) {\n if (!EXPONENT_HAS_GD) {\n return null;\n }\n $info = gd_info();\n if (strpos($info['GD Version'], '2.0') !== false) {\n $img = imagecreatetruecolor($w, $h);",
" if (function_exists('imagesavealpha')) {\n imagealphablending($img, false);\n imagesavealpha($img, true);\n }",
" return $img;\n } else {\n return imagecreate($w, $h);\n }\n }",
" function copyToDirectory($destination) {\n //eDebug($this,true);\n copy($this->path, $destination . $this->filename);\n }",
" public static function imageCopyresized($dest, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {\n if (!EXPONENT_HAS_GD) {\n return null;\n }\n $info = gd_info();\n if (strpos($info['GD Version'], '2.0') !== false) {\n return imagecopyresampled($dest, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\n } else {\n return imagecopyresized($dest, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\n }\n }",
" /** exdoc\n * Proportionally scale an image by a specific percentage\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param float $scale The scaling factor, as a decimal (i.e. 0.5 for 50%)\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleByPercent($filename, $scale) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($scale == 1) {\n return $original;\n }",
" $w = $scale * $sizeinfo[0];\n $h = $scale * $sizeinfo[1];",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $w, $h, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" /** exdoc\n * Proportionally scale an image to a given width. Height adjusts accordingly.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param integer $width The desired width of the scaled image, in pixels.\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleToWidth($filename, $width) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }\n $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $sizeinfo;\n }",
" if ($width == $sizeinfo[0]) {\n return $original;\n }",
" $w = $width;\n $h = ($width / $sizeinfo[0]) * $sizeinfo[1];",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $w, $h, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" /** exdoc\n * Proportionally scale an image to a given height. Width adjusts accordingly.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param integer $height The desired height of the scaled image, in pixels.\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleToHeight($filename, $height) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($height == $sizeinfo[1]) {\n return $original;\n }",
" $w = ($height / $sizeinfo[1]) * $sizeinfo[0];\n $h = $height;",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $w, $h, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" /** exdoc\n * Proportionally scale an image to fit within the given width / height.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param integer $width The maximum width of the scaled image, in pixels.\n * @param integer $height The maximum height of the scaled image, in pixels.\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleToConstraint($filename, $width, $height) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($width >= $sizeinfo[0] && $height >= $sizeinfo[1]) {\n return $original;\n }",
" $w = $width;\n $h = ($width / $sizeinfo[0]) * $sizeinfo[1];",
" if ($h > $height) { // height is outside\n $w = ($height / $sizeinfo[1]) * $sizeinfo[0];\n $h = $height;\n }",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $w, $h, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" /** exdoc\n * Scale an image to a square keeping the image aspect ratio.\n * If the image is smaller in either dimension than request square side original is returned.\n * Image is first cropped to a square of length smaller of width or height and then resized.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param $side\n *\n * @return array|null|resource|string\n * @internal param int $size The desired side length of the scaled image, in pixels.\n * @node Model:expFile\n */\n public static function imageScaleToSquare($filename, $side) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($side >= $sizeinfo[0] || $side >= $sizeinfo[1]) {\n return $original;\n }",
" /* The defaults will serve in case the image is a square */\n $src_x = 0;\n $src_y = 0;\n $width = $sizeinfo[0];\n $height = $sizeinfo[1];",
" /*if width greater than height, we crop the image left and right */\n if ($sizeinfo[0] > $sizeinfo[1]) {\n $width = $sizeinfo[1];\n $height = $sizeinfo[1];\n $src_x = round(($sizeinfo[0] - $width) / 2, 0);\n } else {\n /*if height greater than width, we crop the image top and bottom */\n $height = $sizeinfo[0];\n $width = $sizeinfo[0];\n $src_y = round(($sizeinfo[1] - $height) / 2, 0);\n }",
" $w = $side;\n $h = $side;",
" $thumb = self::imageCreate($w, $h);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, $src_x, $src_y, $w, $h, $width, $height);",
" return $thumb;\n }",
" /** exdoc\n * Scale an image to a given width and height, without regard to aspect ratio.\n * This is a wrapper around various GD functions, to provide Exponent\n * programmers a single point of entry. It also handles situations where\n * there is no GD support compiled into the server. (In this case, null is returned).\n *\n * @param string $filename The path/filename of the image to scale.\n * @param integer $width The desired width of the scaled image, in pixels.\n * @param integer $height The desired height of the scaled image, in pixels.\n *\n * @return array|null|resource|string\n * @node Model:expFile\n */\n public static function imageScaleManually($filename, $width, $height) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" if ($width == $sizeinfo[0] && $height == $sizeinfo[1]) {\n return $original;\n }",
" $thumb = self::imageCreate($width, $height);\n if (!$thumb) return null;\n self::imageCopyresized($thumb, $original, 0, 0, 0, 0, $width, $height, $sizeinfo[0], $sizeinfo[1]);",
" return $thumb;\n }",
" public static function imageRotate($filename, $degrees) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" $color = imagecolorclosesthwb($original, 255, 255, 255);",
" return imagerotate($original, $degrees, $color);\n }",
" public static function imageFlip($filename, $is_horizontal) {\n $sizeinfo = self::getImageInfo($filename);\n if (!is_array($sizeinfo)) {\n return $sizeinfo;\n }",
" $original = self::openImageFile($filename, $sizeinfo);\n if (!is_resource($original)) {\n return $original;\n }",
" // Horizontal - invert y coords\n // Vertical - invert x coords",
" $w = $sizeinfo[0];\n $h = $sizeinfo[1];\n $new = self::imageCreate($w, $h);",
" if ($is_horizontal) {\n // Copy column by column\n //$dest,$src,$dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {\n for ($i = 0; $i < $w; $i++) {\n imagecopy($new, $original, // DESTINATION, SOURCE\n $i, 0, // dst_X, dst_Y\n $w - $i - 1, 0, // src_X,src_Y\n 1, $h); //src_W, src_H\n }\n } else {\n // Copy row by row.\n //$dest,$src,$dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {\n for ($i = 0; $i < $h; $i++) {\n imagecopy($new, $original, // DESTINATION, SOURCE\n 0, $i, // dst_X, dst_Y\n 0, $h - $i - 1, // src_X,src_Y\n #$w,1,\t\t// dst_W, dst_H\n $w, 1); //src_W, src_H\n }\n }\n return $new;\n }",
" /** exdoc\n *\n * @state <b>UNDOCUMENTED</b>\n * @node Undocumented\n *\n * @param $img\n * @param $sizeinfo\n * @param null $filename\n * @param int $quality\n */\n public static function imageOutput($img, $sizeinfo, $filename = null, $quality = 75) {\n header('Content-type: ' . $sizeinfo['mime']);\n if ($sizeinfo['mime'] == 'image/jpeg') {\n ($filename != null) ? imagejpeg($img, $filename, $quality) : imagejpeg($img, null, $quality);\n } else if ($sizeinfo['mime'] == 'image/png') {\n ($filename != null) ? imagepng($img, $filename) : imagepng($img);\n } else if ($sizeinfo['mime'] == 'image/gif') {\n ($filename != null) ? imagepng($img, $filename) : imagepng($img);\n }\n }",
" /** exdoc\n *\n * @state <b>UNDOCUMENTED</b>\n * @node Undocumented\n *\n * @param $w\n * @param $h\n * @param $string\n *\n * @return null|resource\n */\n public static function imageCaptcha($w, $h, $string) {\n $img = self::imageCreate($w, $h);\n if ($img) {\n // We were able to create an image.\n $bg = imagecolorallocate($img, 250, 255, 225);\n imagefill($img, 0, 0, $bg);\n #echo $bg;\n $colors = array();\n for ($i = 0; $i < strlen($string) && $i < 10; $i++) {\n $colors[$i] = imagecolorallocate($img, mt_rand(50, 150), mt_rand(50, 150), mt_rand(50, 150));\n }\n $px_per_char = floor($w / (strlen($string) + 1));\n for ($i = 0, $iMax = strlen($string); $i < $iMax; $i++) {\n imagestring($img, mt_rand(4, 6), $px_per_char * ($i + 1) + mt_rand(-5, 5), mt_rand(0, $h / 2), $string{$i}, $colors[($i % 10)]);\n }",
" // Need this to be 'configurable'\n for ($i = 0; $i < strlen($string) / 2 && $i < 10; $i++) {\n $c = imagecolorallocate($img, mt_rand(150, 250), mt_rand(150, 250), mt_rand(150, 250));\n imageline($img, mt_rand(0, $w / 4), mt_rand(5, $h - 5), mt_rand(3 * $w / 4, $w), mt_rand(0, $h), $c);\n }",
" //imagestring($img,6,0,0,$string,$color);\n return $img;\n } else {\n return null;\n }\n }",
" static function recurse_copy($src, $dst) {\n $dir = opendir($src);\n @mkdir($dst,DIR_DEFAULT_MODE_STR);\n while (false !== ($file = readdir($dir))) {\n if (($file != '.') && ($file != '..')) {\n if (is_dir($src . '/' . $file)) {\n self::recurse_copy($src . '/' . $file, $dst . '/' . $file);\n } else {\n if (!copy($src . '/' . $file, $dst . '/' . $file)) {\n return false;\n }\n ;\n }\n }\n }\n closedir($dir);\n return true;\n }",
" /**\n * Recursively removes all files in a given directory, and all\n * the files and directories underneath it.\n * Optionally can skip dotfiles\n *\n * @param string $dir directory to work with\n * @param bool $dot_files should dotfiles be removed?\n *\n * @return array\n */\n public static function removeFilesInDirectory($dir, $dot_files = false) {\n $results['removed'] = array();\n $results['not_removed'] = array();",
" $files = scandir($dir);\n array_shift($files); // remove '.' from array\n array_shift($files); // remove '..' from array\n foreach ($files as $file) {\n if ($dot_files || substr($file, 0, 1) != '.') { // don't remove dot files\n $file = $dir . '/' . $file;\n if (is_dir($file)) {\n self::removeFilesInDirectory($file);\n rmdir($file);\n } else {\n if (is_writeable($file) && !is_dir($file)) {\n unlink($file);\n $results['removed'][] = $file;\n } else {\n $results['not_removed'][] = $file;\n }\n }\n }\n }",
" /*\told routine\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n $filepath = $dir.'/'.$file;\n if (substr($file,0,1) != '.') {\n if (is_writeable($filepath) && !is_dir($filepath)) {\n unlink($filepath);\n $results['removed'][] = $filepath;\n } else {\n $results['not_removed'][] = $filepath;\n }\n }\n }\n }*/",
" return $results;\n }",
" /** exdoc\n * This method creates a directory and all of its parent directories, if they do not exist,\n * emulating the behavior of the -p option to mkdir on UNIX systems. Returns\n * a SYS_FILES_* constant, indicating its status.\n *\n * @param string $dir The directory to create. This path must be relative to BASE\n * @param null $mode\n * @param bool $is_full\n *\n * @return int\n * @node Model:expFile\n */\n public static function makeDirectory($dir, $mode = null, $is_full = false) {\n $__oldumask = umask(0);\n $parentdir = ($is_full ? \"/\" : BASE); // we will add to parentdir with each directory\n foreach (explode(\"/\", $dir) as $part) {\n if ($part != \"\" && !is_dir($parentdir . $part)) {\n // No parent directory. Create it.\n if (is_file($parentdir . $part)) return SYS_FILES_FOUNDFILE;\n if (expUtil::isReallyWritable($parentdir)) {\n if ($mode == null) $mode = octdec(DIR_DEFAULT_MODE_STR + 0);\n mkdir($parentdir . $part, $mode);\n chmod($parentdir . $part, $mode);\n } else return SYS_FILES_NOTWRITABLE;\n }\n $parentdir .= $part . \"/\";\n }\n umask($__oldumask);\n return SYS_FILES_SUCCESS;\n }",
" /**\n * Recursively removes the given directory, and all\n * of the files and directories underneath it.\n *\n * @param string $dir The path of the directory to remove\n *\n * @node Model:expFile\n *\n * @param string $dir directory to work with\n *\n * @return int\n */\n public static function removeDirectory($dir) {\n if (strpos($dir, BASE) != 0) $dir = BASE . $dir;\n $dh = opendir($dir);\n if ($dh) {\n while (($file = readdir($dh)) !== false) {\n if ($file != \".\" && $file != \"..\" && is_dir(\"$dir/$file\")) {\n if (self::removeDirectory(\"$dir/$file\") == SYS_FILES_NOTDELETABLE) return SYS_FILES_NOTDELETABLE;\n } else if (is_file(\"$dir/$file\") || is_link(is_file(\"$dir/$file\"))) {\n unlink(\"$dir/$file\");\n if (file_exists(\"$dir/$file\")) {\n return SYS_FILES_NOTDELETABLE;\n }\n } else if ($file != \".\" && $file != \"..\") {\n echo \"BAD STUFF HAPPENED<br />\";\n echo \"--------Don't know what to do with $dir/$file<br />\";\n//\t\t\t\t\techo \"<xmp>\";\n echo \"<pre>\";\n print_r(stat(\"$dir/$file\"));\n echo filetype(\"$dir/$file\");\n//\t\t\t\t\techo \"</xmp>\";\n echo \"</pre>\";\n }\n }\n }\n closedir($dh);\n rmdir($dir);\n }",
" /** exdoc\n * Move an uploaded temporary file to a more permanent home inside of the Exponent files/ directory.\n * This function takes into account the default file modes specified in the site configuration.\n *\n * @param string $tmp_name The temporary path of the uploaded file.\n * @param string $dest The full path to the destination file (including the destination filename).\n *\n * @return null|string The destination file if it exists, otherwise null\n * @node Model:expFile\n */\n public static function moveUploadedFile($tmp_name, $dest) {\n move_uploaded_file($tmp_name, $dest);\n if (file_exists($dest)) {\n $__oldumask = umask(0);\n chmod($dest, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);\n return str_replace(BASE, '', $dest);\n } else return null;\n }",
" /** exdoc\n * Checks to see if the upload destination file exists. This is to prevent\n * accidentally uploading over the top of another file.\n * Returns true if the file already exists, and false if it does not.\n *\n * @param string $dir The directory to contain the existing directory.\n * @param string $name The name of the file control used to upload the\n * file. The files subsystem will look to the $_FILES array\n * to get the filename of the uploaded file.\n *\n * @return bool\n * @node Model:expFile\n */\n public static function uploadDestinationFileExists($dir, $name) {\n return (file_exists(BASE . $dir . \"/\" . self::fixName($_FILES[$name]['name'])));\n }",
" /** exdoc\n * Lists files and directories under a given parent directory. Returns an\n * associative, flat array of files and directories. The key is the full file\n * or directory name, and the value is the file or directory name.\n *\n * @param string $dir The path of the directory to look at.\n * @param boolean $recurse A boolean dictating whether to descend into subdirectories\n * recursively, and list files and subdirectories.\n * @param string $ext An optional file extension. If specified, only files ending with\n * that file extension will show up in the list. Directories are not affected.\n * @param array $exclude_dirs An array of directory names to exclude. These names are\n * path-independent. Specifying \"dir\" will ignore all directories and\n * sub-directories named \"dir\", regardless of their parent.\n * @param string $relative\n *\n * @return array\n * @node Model:expFile\n */\n public static function listFlat($dir, $recurse = false, $ext = null, $exclude_dirs = array(), $relative = \"\") {\n $files = array();\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_dir(\"$dir/$file\") && !in_array($file, $exclude_dirs) && $recurse && $file != \".\" && $file != \"..\" && $file != \"CVS\") {\n $files = array_merge($files, self::listFlat(\"$dir/$file\", $recurse, $ext, $exclude_dirs, $relative));\n }\n if (is_file(\"$dir/$file\") && ($ext == null || substr($file, -1 * strlen($ext), strlen($ext)) == $ext)) {\n $files[str_replace($relative, \"\", \"$dir/$file\")] = $file;\n }\n }\n closedir($dh);\n }\n return $files;\n }",
" /** exdoc\n * Looks at the filesystem structure surrounding the destination\n * and determines if the web server can create a new file there.\n * Returns one of the following:\n * <br>SYS_FILES_NOTWRITABLE - unable to create files in destination\n * <br>SYS_FILES_SUCCESS - A file or directory can be created in destination\n * <br>SYS_FILES_FOUNDFILE - Found destination to be a file, not a directory\n *\n * @param string $dest Path to the directory to check\n *\n * @return int\n * @node Model:expFile\n */\n public static function canCreate($dest) {\n if (substr($dest, 0, 1) == '/') $dest = str_replace(BASE, '', $dest);\n $parts = explode('/', $dest);\n $working = BASE;\n for ($i = 0, $iMax = count($parts); $i < $iMax; $i++) {\n if ($parts[$i] != '') {\n if (!file_exists($working . $parts[$i])) {\n return (expUtil::isReallyWritable($working) ? SYS_FILES_SUCCESS : SYS_FILES_NOTWRITABLE);\n }\n $working .= $parts[$i] . '/';\n }\n }\n // If we got this far, then the file we are asking about already exists.\n // Check to see if we can overwrite this file.\n // First however, we need to strip off the '/' that was added a few lines up as the last part of the for loop.\n $working = substr($working, 0, -1);",
" if (!expUtil::isReallyWritable($working)) {\n return SYS_FILES_NOTWRITABLE;\n } else {\n if (is_file($working)) {\n return SYS_FILES_FOUNDFILE;\n } else {\n return SYS_FILES_FOUNDDIR;\n }\n }\n }",
" /**\n * Test if file can be uploaded using tmp folder\n *\n * @param string $tmp\n * @param string $dest\n *\n * @return bool\n */\n public static function canUpload($tmp = 'tmp', $dest = 'files/uploads') {\n $result = expFile::canCreate(BASE . $tmp . '/TEST') != SYS_FILES_SUCCESS;\n $result |= expFile::canCreate(BASE . $dest . '/TEST') != SYS_FILES_SUCCESS;\n return $result;\n }",
" /** exdoc\n * Copies just the directory structure (including subdirectories) of a given directory.\n * Any files in the source directory are ignore, and duplicate copies are made (no symlinks).\n *\n * @param string $src The directory to copy structure from. This must be a full path.\n * @param string $dest The directory to create duplicate structure in. If this directory is not empty,\n * you may run into some problems, because of file/directory conflicts.\n * @param array $exclude_dirs An array of directory names to exclude. These names are\n * path-independent. Specifying \"dir\" will ignore all directories and\n * sub-directories named \"dir\", regardless of their parent.\n *\n * @node Model:expFile\n */\n public static function copyDirectoryStructure($src, $dest, $exclude_dirs = array()) {\n $__oldumask = umask(0);\n if (!is_dir($dest)) {\n $file_path = pathinfo($dest);\n $dest = $file_path['dirname'];\n }\n if (!is_dir($src)) {\n $file_path = pathinfo($src);\n $src = $file_path['dirname'];\n }\n if (!file_exists($dest)) mkdir($dest, fileperms($src));\n $dh = opendir($src);\n while (($file = readdir($dh)) !== false) {\n if (is_dir(\"$src/$file\") && !in_array($file, $exclude_dirs) && substr($file, 0, 1) != \".\" && $file != \"CVS\") {\n if (!file_exists($dest.\"/\".$file)) mkdir($dest.\"/\".$file, fileperms($src.\"/\".$file));\n if (is_dir($dest.\"/\".$file)) {\n self::copyDirectoryStructure($src.\"/\".$file, $dest.\"/\".$file);\n }\n }\n }\n closedir($dh);\n umask($__oldumask);\n }",
" /** exdoc\n * This function takes a database object and dumps\n * all of the records in all of the tables into a string.\n * The contents of the string are suitable for storage\n * in a file or other permanent mechanism, and is in\n * the EQL format naively handled by the current\n * implementation.\n *\n * @param null/array $tables\n * @param null/string $type The type of dump\n * @param null/string/array $opts Record descimiator\n *\n * @return string The content of export file\n * @node Model:expFile\n */\n public static function dumpDatabase($tables = null, $type = null, $opts = null) {\n global $db;",
" //FIXME we need to echo and/or write to file within this method to handle large database dumps\n $dump = EQL_HEADER . \"\\r\\n\";\n if ($type == null || $type == 'export') {\n $dump .= 'VERSION:' . EXPONENT . \"\\r\\n\\r\\n\";\n } else {\n $dump .= 'VERSION:' . EXPONENT . ':' . $type . \"\\r\\n\\r\\n\";\n }",
" if (is_string($tables)) $tables = array($tables);\n if (!is_array($tables)) { // dump all the tables\n $tables = $db->getTables();\n if (!function_exists('tmp_removePrefix')) {\n function tmp_removePrefix($tbl) {\n return substr($tbl, strlen(DB_TABLE_PREFIX) + 1);\n // we add 1, because DB_TABLE_PREFIX no longer has the trailing\n // '_' character - that is automatically added by the database class.\n }\n }\n $tables = array_map('tmp_removePrefix', $tables);\n }\n uasort($tables, 'strnatcmp');\n foreach ($tables as $key=>$table) {\n $where = '1';\n if ($type == 'Form') {\n if ($table == 'forms') {\n $where = 'id=' . $opts;\n } elseif ($table == 'forms_control') {\n $where = 'forms_id=' . $opts;\n }\n } elseif ($type == 'export') {\n if (is_string($opts))\n $where = $opts;\n elseif (is_array($opts) && !empty($opts[$key]))\n $where = $opts[$key];\n }\n $tmp = $db->countObjects($table,$where);\n if ($type != 'export' || $db->countObjects($table, $where)) {\n $tabledef = $db->getDataDefinition($table);\n $dump .= 'TABLE:' . $table . \"\\r\\n\";\n $dump .= 'TABLEDEF:' . str_replace(array(\"\\r\", \"\\n\"), array('\\r', '\\n'), serialize($tabledef)) . \"\\r\\n\";\n foreach ($db->selectObjects($table, $where) as $obj) {\n $dump .= 'RECORD:' . str_replace(array(\"\\r\", \"\\n\"), array('\\r', '\\n'), serialize($obj)) . \"\\r\\n\";\n }\n $dump .= \"\\r\\n\";\n }\n }\n //FIXME $dump may become too large and exhaust memory\n return $dump;\n }",
" /** exdoc\n * This function restores a database (overwriting all data in\n * any existing tables) from an EQL object dump. Returns true if\n * the restore was a success and false if something went horribly wrong\n * (unable to read file, etc.) Even if true is returned, there is a chance\n * that some errors were encountered. Check $errors to be sure everything\n * was fine.\n *\n * @param string $file The filename of the EQL file to restore from\n * @param array $errors A referenced array that stores errors. Whatever\n * variable is passed in this argument will contain all errors encountered\n * during the parse/restore.\n * @param null/string $type The type of eql file to restore\n *\n * @return bool\n * @node Model:expFile\n */\n public static function restoreDatabase($file, &$errors, $type = null) {\n global $db;",
"// $errors = array();",
" if (is_readable($file)) {\n $eql = @fopen($file, \"r\");\n if ($eql) {\n //NOTE changed to fgets($file)\n// $lines = @file($file);\n $line0 = fgets($eql);\n $line1 = fgets($eql);",
" // Sanity check\n// if (count($lines) < 2 || trim($lines[0]) != EQL_HEADER) {\n if ($line1 === false || trim($line0) != EQL_HEADER) {\n $errors[] = gt('Not a valid EQL file');\n return false;\n }",
"// $version = explode(':', trim($lines[1]));\n $version = explode(':', trim($line1));\n $eql_version = $version[1] + 0;\n $current_version = EXPONENT + 0;\n if ((array_key_exists(2, $version) && $type == null) || (array_key_exists(\n 2,\n $version\n ) && $version[2] != $type)\n ) {\n $eql_version = 0; // trying to import wrong eql type\n }",
"// $clear_function = '';\n $fprefix = '';\n // Check version and include necessary converters\n if ($eql_version != $current_version) {\n $errors[] = gt('EQL file was Not a valid EQL version');\n return false;\n //\t\t\t$fprefix = 'expFile::'.implode('',explode('.',$eql_version)).'_';\n //\t\t\tif (function_exists($fprefix.'clearedTable')) {\n //\t\t\t\t$clear_function = $fprefix.'clearedTable';\n //\t\t\t}\n }",
" // make sure the database tables are up to date\n expDatabase::install_dbtables();",
" $table = '';\n $oldformdata = array();\n $itsoldformdata = false;\n $newformdata = array();\n $itsnewformdata = false;\n// for ($i = 2; $i < count($lines); $i++) {\n $line_number = 2;\n while (($line = fgets($eql)) !== false) {\n $table_function = '';\n// $line_number = $i;\n $line_number++;\n// $line = trim($lines[$i]);\n $line = trim($line);\n if ($line != '') {\n $pair = explode(':', $line);\n $pair[1] = implode(':', array_slice($pair, 1));\n $pair = array_slice($pair, 0, 2);",
" if ($pair[0] == 'TABLE') {\n $itsoldformdata = false; // we are on a new table set\n $itsnewformdata = false;\n $table = $pair[1];\n if ($fprefix != '') {\n $table_function = $fprefix . $table;\n }\n if ($db->tableExists($table)) {\n if ($type == null) {\n $db->delete($table); // drop/empty table records\n }\n// if ($clear_function != '') {\n// $clear_function($db, $table);\n// }\n } else {\n if (substr($table, 0, 12) == 'formbuilder_') {\n $formbuildertypes = array(\n 'address',\n 'control',\n 'form',\n 'report'\n );\n $ttype = substr($table, 12);\n if (!in_array($ttype, $formbuildertypes)) {\n $itsoldformdata = true;\n }\n } elseif (substr($table, 0, 6) == 'forms_' && $table != 'forms_control') {\n $itsnewformdata = true;\n }\n //\t\t\t\t\t\tif (!file_exists(BASE.'framework/core/definitions/'.$table.'.php')) {\n $errors[] = sprintf(\n gt('Table \"%s\" not found in the database (line %d)'),\n $table,\n $line_number\n );\n //\t\t\t\t\t\t} else if (!is_readable(BASE.'framework/core/definitions/'.$table.'.php')) {\n //\t\t\t\t\t\t\t$errors[] = sprintf(gt('Data definition file for %s (%s) is not readable (line %d)'),$table,'framework/core/definitions/'.$table.'.php',$line_number);\n //\t\t\t\t\t\t} else {\n //\t\t\t\t\t\t\t$dd = include(BASE.'framework/core/definitions/'.$table.'.php');\n //\t\t\t\t\t\t\t$info = (is_readable(BASE.'framework/core/definitions/'.$table.'.info.php') ? include(BASE.'framework/core/definitions/'.$table.'.info.php') : array());\n //\t\t\t\t\t\t\t$db->createTable($table,$dd,$info);\n //\t\t\t\t\t\t}\n }\n } else {\n if ($pair[0] == 'TABLEDEF') { // new in v2.1.4, re-create a missing table\n $pair[1] = str_replace(array('\\r', '\\n'), array(\"\\r\", \"\\n\"), $pair[1]);\n//\t\t\t\t\t\t$tabledef = expUnserialize($pair[1]);\n $tabledef = @unserialize($pair[1]);\n if (!$db->tableExists($table)) {\n $db->createTable($table, $tabledef, array());\n $errors[] = sprintf(\n gt('* However...we successfully recreated the \"%s\" Table from the EQL file'),\n $table\n );\n } else {\n $db->alterTable($table, $tabledef, array(), true);\n }\n $itsoldformdata = false; // we've recreated the table using the tabledef\n $itsnewformdata = false;\n } else {\n if ($pair[0] == 'RECORD') {\n if ($db->tableExists($table)) {\n // Here we need to check the conversion scripts.\n $pair[1] = str_replace(array('\\r', '\\n'), array(\"\\r\", \"\\n\"), $pair[1]);\n //\t\t\t\t\t\t$object = expUnserialize($pair[1]);\n $object = @unserialize($pair[1]);\n if ($type == 'Form') {\n if ($table == 'forms') {\n $forms_id = $object->id = $db->max(\n $table,\n 'id'\n ) + 1; // create a new record\n $spare = new expRecord();\n $spare->title = $object->title;\n $spare->makeSefUrl();\n $object->sef_url = $spare->sef_url;\n } elseif ($table == 'forms_control') {\n $object->id = null; // create a new record\n $object->forms_id = $forms_id; // assign to new form record\n } elseif (substr($table, 6) == 'forms_') {\n $object->id = null; // create a new record\n }\n }\n if (!$object) {\n $object = unserialize(stripslashes($pair[1]));\n }\n if (function_exists($table_function)) {\n $table_function($db, $object);\n } else {\n if (is_object($object)) {\n $db->insertObject($object, $table);\n } else {\n $errors[] = sprintf(\n gt('Unable to decipher \"%s\" record (line %d)'),\n $pair[0],\n $line_number\n );\n }\n }\n } elseif ($itsoldformdata) {\n $oldformdata[$table][] = $pair[1]; // store for later\n } elseif ($itsnewformdata) {\n $newformdata[$table][] = $pair[1]; // store for later\n }\n } else {\n $errors[] = sprintf(\n gt('Invalid specifier type \"%s\" (line %d)'),\n $pair[0],\n $line_number\n );\n }\n }\n }\n }\n }",
" // check for and process to rebuild old formbuilder module data table\n if (!empty($oldformdata)) {\n foreach ($oldformdata as $tablename => $tabledata) {\n $oldform = $db->selectObject('formbuilder_form', 'table_name=\"' . substr($tablename, 12) . '\"');\n if (!empty($oldform)) {\n // create the old table\n $table = self::updateFormbuilderTable($oldform);",
" // populate the table\n foreach ($tabledata as $record) {\n $record = str_replace('\\r\\n', \"\\r\\n\", $record);\n $object = @unserialize($record);\n if (!$object) {\n $object = unserialize(stripslashes($record));\n }\n if (is_object($object)) {\n $db->insertObject($object, 'formbuilder_' . $table);\n }\n }\n $errors[] = sprintf(\n gt(\n '* However...we successfully recreated the \"formbuilder_%s\" Table from the EQL file'\n ),\n $table\n );\n }\n }\n }",
" // check for and process to rebuild new forms module data table\n if (!empty($newformdata)) {\n foreach ($newformdata as $tablename => $tabledata) {\n $newform = $db->selectObject('forms', 'table_name=\"' . substr($tablename, 6) . '\"');\n if (!empty($newform)) {\n // create the new table\n $form = new forms($newform->id);\n $table = $form->updateTable();",
" // populate the table\n foreach ($tabledata as $record) {\n $record = str_replace('\\r\\n', \"\\r\\n\", $record);\n $object = @unserialize($record);\n if (!$object) {\n $object = unserialize(stripslashes($record));\n }\n if (is_object($object)) {\n// $db->insertObject($object, 'forms_' . $table);\n $form->insertRecord($object);\n }\n }\n $errors[] = sprintf(\n gt('* However...we successfully recreated the \"forms_%s\" Table from the EQL file'),\n $table\n );\n }\n }\n }",
" // ensure the form data table exists and is current\n// foreach ($db->selectObjects('forms') as $f) {\n// if ($f->is_saved) $f->updateTable();\n// }\n $formmodel = new forms();\n $forms = $formmodel->find('all');\n foreach ($forms as $f) {\n if ($f->is_saved) {\n $f->updateTable();\n }\n }",
" // rename mixed case tables if necessary\n expDatabase::fix_table_names();\n// if ($eql_version != $current_version) {\n// $errors[] = gt('EQL file was Not a valid EQL version');\n// return false;\n// }\n return true;\n } else {\n $errors[] = gt('Unable to read EQL file');\n return false;\n }\n } else {\n $errors[] = gt('Unable to find EQL file');\n return false;\n }\n }",
" /** exdoc\n * This function reads a database EQL object dump file and returns an array of the\n * database tables and records, or false if something went horribly wrong\n * (unable to read file, etc.) Even if an array is returned, there is a chance\n * that some errors were encountered. Check $errors to be sure everything\n * was fine.\n *\n * @param string $file The filename of the EQL file to parse\n * @param array $errors A referenced array that stores errors. Whatever\n * variable is passed in this argument will contain all errors encountered\n * during the parse/restore.\n * @param null/string/array $type The list of tables to return, empty = entire file\n * @return array/bool\n * @node Model:expFile\n */\n public static function parseDatabase($file, &$errors, $type = null) {\n// $errors = array();\n $data = array();",
" if (is_readable($file)) {\n $lines = @file($file); //FIXME we may have to change this for handling large files via fgets()...see dumpDatabase() above",
" // Sanity check\n if (count($lines) < 2 || trim($lines[0]) != EQL_HEADER) {\n $errors[] = gt('Not a valid EQL file');\n return false;\n }",
" $version = explode(':', trim($lines[1]));\n $eql_version = $version[1] + 0;\n $current_version = EXPONENT + 0;\n if ((array_key_exists(2, $version) && $type == null) || (array_key_exists(2, $version) && $version[2] != $type)) {\n $eql_version = 0; // trying to import wrong eql type\n }",
" // Check version and include necessary converters\n if ($eql_version != $current_version) {\n $errors[] = gt('EQL file was Not a valid EQL version');\n return false;\n }",
" $table = '';\n for ($i = 2, $iMax = count($lines); $i < $iMax; $i++) {\n $line_number = $i;\n $line = trim($lines[$i]);\n if ($line != '') {\n $pair = explode(':', $line);\n $pair[1] = implode(':', array_slice($pair, 1));\n $pair = array_slice($pair, 0, 2);",
" if ($pair[0] == 'TABLE') {\n $table = $pair[1];\n $data[$table] = new stdClass();\n $data[$table]->name = $table;\n $data[$table]->records = array();\n } else if ($pair[0] == 'TABLEDEF') { // new in v2.1.4, re-create a missing table\n $pair[1] = str_replace('\\r\\n', \"\\r\\n\", $pair[1]);\n $tabledef = @unserialize($pair[1]);\n $data[$table]->tabledef = $tabledef;\n } else if ($pair[0] == 'RECORD') {\n // Here we need to check the conversion scripts.\n $pair[1] = str_replace('\\r\\n', \"\\r\\n\", $pair[1]);\n//\t\t\t\t\t\t$object = expUnserialize($pair[1]);\n $object = @unserialize($pair[1]);\n if (!$object) $object = unserialize(stripslashes($pair[1]));\n if (is_object($object)) {\n $data[$table]->records[] = object2Array($object); //FIXME should we convert this? object2array?\n } else {\n $errors[] = sprintf(gt('Unable to decipher \"%s\" record (line %d)'), $pair[0], $line_number);\n }\n } else {\n $errors[] = sprintf(gt('Invalid specifier type \"%s\" (line %d)'), $pair[0], $line_number);\n }\n }\n }",
" if (!empty($type)) {\n if (!is_array($type)) $type = array($type);\n foreach ($data as $key=>$tbl) {\n if (!in_array($key, $type)) {\n unset($data[$key]);\n }\n }\n }\n return $data;\n } else {\n $errors[] = gt('Unable to read EQL file');\n return false;\n }\n }",
" public function afterDelete() {\n global $db;",
"\t // get and delete all attachments to this file\n\t $db->delete('content_expFiles','expfiles_id='.$this->id);\n }",
" /**\n * recreates a deprecated formbuilder data table\n * needed to import form data from eql file exported prior to v2.1.4\n * this is just the old formbuilder_form::updateTable method\n *\n * @static\n * @param $object\n * @return mixed\n */\n static function updateFormbuilderTable($object) {\n\t\tglobal $db;",
"\t\tif (!empty($object->is_saved)) {\n\t\t\t$datadef = array(\n\t\t\t\t'id'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_ID,\n\t\t\t\t\tDB_PRIMARY=>true,\n\t\t\t\t\tDB_INCREMENT=>true),\n\t\t\t\t'ip'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_STRING,\n\t\t\t\t\tDB_FIELD_LEN=>25),\n\t\t\t\t'referrer'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_STRING,\n\t\t\t\t\tDB_FIELD_LEN=>1000),\n\t\t\t\t'timestamp'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_TIMESTAMP),\n\t\t\t\t'user_id'=>array(\n\t\t\t\t\tDB_FIELD_TYPE=>DB_DEF_ID)\n\t\t\t);",
"\t\t\tif (!isset($object->id)) {\n\t\t\t\t$object->table_name = preg_replace('/[^A-Za-z0-9]/','_',$object->name);\n\t\t\t\t$tablename = 'formbuilder_'.$object->table_name;\n\t\t\t\t$index = '';\n\t\t\t\twhile ($db->tableExists($tablename . $index)) {\n\t\t\t\t\t$index++;\n\t\t\t\t}\n\t\t\t\t$tablename = $tablename.$index;\n\t\t\t\t$db->createTable($tablename,$datadef,array());\n\t\t\t\t$object->table_name .= $index;\n\t\t\t} else {\n\t\t\t\tif ($object->table_name == '') {\n\t\t\t\t\t$tablename = preg_replace('/[^A-Za-z0-9]/','_',$object->name);\n\t\t\t\t\t$index = '';\n\t\t\t\t\twhile ($db->tableExists('formbuilder_' . $tablename . $index)) {\n\t\t\t\t\t\t$index++;\n\t\t\t\t\t}\n\t\t\t\t\t$object->table_name = $tablename . $index;\n\t\t\t\t}",
"\t\t\t\t$tablename = 'formbuilder_'.$object->table_name;",
"\t\t\t\t//If table is missing, create a new one.\n\t\t\t\tif (!$db->tableExists($tablename)) {\n\t\t\t\t\t$db->createTable($tablename,$datadef,array());\n\t\t\t\t}",
"\t\t\t\t$ctl = null;\n\t\t\t\t$control_type = '';\n\t\t\t\t$tempdef = array();\n\t\t\t\tforeach ($db->selectObjects('formbuilder_control','form_id='.$object->id) as $control) {\n\t\t\t\t\tif ($control->is_readonly == 0) {\n\t\t\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t\t\t$ctl->identifier = $control->name;\n\t\t\t\t\t\t$ctl->caption = $control->caption;\n\t\t\t\t\t\t$ctl->id = $control->id;\n\t\t\t\t\t\t$control_type = get_class($ctl);\n\t\t\t\t\t\t$def = call_user_func(array($control_type,'getFieldDefinition'));\n\t\t\t\t\t\tif ($def != null) {\n\t\t\t\t\t\t\t$tempdef[$ctl->identifier] = $def;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$datadef = array_merge($datadef,$tempdef);\n\t\t\t\t$db->alterTable($tablename,$datadef,array(),true);\n\t\t\t}\n\t\t}\n\t\treturn $object->table_name;\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class filedownloadController extends expController {\n\tpublic $useractions = array(\n 'showall'=>'Show all',\n 'tags'=>\"Tags\",\n );\n\tpublic $remove_configs = array(\n// 'comments',\n// 'ealerts',\n 'files',\n 'rss', // because we do this as a custom tab within the module\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" public $rss_is_podcast = true;",
" static function displayname() { return gt(\"File Downloads\"); }\n static function description() { return gt(\"Place files on your website for users to download or use as a podcast.\"); }\n static function isSearchable() { return true; }",
"\t",
" function showall() {\n expHistory::set('viewable', $this->params);\n $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;\n if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {\n $limit = '0';\n }\n $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n $page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>$limit,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'dontsortwithincat'=>!empty($this->config['dontsort']) ? $this->config['dontsort'] : false,\n 'groups'=>!isset($this->params['group']) ? array() : array($this->params['group']),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n gt('Description')=>'body'\n ),\n ));",
" include_once(BASE.'external/mp3file.php');\n foreach ($page->records as $file) {\n if (!empty($file->expFile['downloadable'][0]) && ($file->expFile['downloadable'][0]->mimetype == \"audio/mpeg\") && (file_exists(BASE.$file->expFile['downloadable'][0]->directory.$file->expFile['downloadable'][0]->filename))) {\n $mp3 = new mp3file(BASE.$file->expFile['downloadable'][0]->directory.$file->expFile['downloadable'][0]->filename);\n $id3 = $mp3->get_metadata();\n if (($id3['Encoding']=='VBR') || ($id3['Encoding']=='CBR')) {\n $file->expFile['downloadable'][0]->duration = $id3['Length mm:ss'];\n }\n }\n }",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'items'=>$page->records,\n 'rank'=>($order==='rank')?1:0,\n 'params'=>$this->params,\n ));\n }",
" public function downloadfile() {\n if (empty($this->params['fileid'])) {\n flash('error', gt('There was an error while trying to download your file. No File Specified.'));\n expHistory::back();\n }",
" \n $fd = new filedownload($this->params['fileid']); ",
" if (empty($this->params['filenum'])) $this->params['filenum'] = 0;",
" if (empty($fd->expFile['downloadable'][$this->params['filenum']]->id)) {\n flash('error', gt('There was an error while trying to download your file. The file you were looking for could not be found.'));\n expHistory::back();",
" } \n ",
" $fd->downloads++;\n $fd->save();",
" ",
" // this will set the id to the id of the actual file..makes the download go right.\n $this->params['id'] = $fd->expFile['downloadable'][$this->params['filenum']]->id;",
" parent::downloadfile(); ",
" }",
" /**\n * Returns rich snippet PageMap meta data\n *\n * @param $request\n * @param $object\n *\n * @return string\n */\n function meta_rich($request, $object) {\n if (!empty($object->expFile[0]) && file_exists(BASE.$object->expFile[0]->directory.$object->expFile[0]->filename)) {\n $rich_meta = '<!--\n <PageMap>\n <DataObject type=\"action\">\n <Attribute name=\"label\" value=\"' . gt('Download') . '\"/>\n <Attribute name=\"url\" value=\"' . $object->download_link() . '\"/>\n <Attribute name=\"class\" value=\"download\"/>\n </DataObject>\n </PageMap>\n -->';\n return $rich_meta;\n }\n }",
" /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_fb($request, $object, $canonical)\n {\n $metainfo = array();\n $metainfo['type'] = 'article';\n if (!empty($object->body)) {\n $desc = str_replace('\"', \"'\", expString::summarize($object->body, 'html', 'para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $metainfo['title'] = substr(empty($object->meta_fb['title']) ? $object->title : $object->meta_fb['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_fb['description']) ? $desc : $object->meta_fb['description'], 0, 199);\n $metainfo['url'] = empty($object->meta_fb['url']) ? $canonical : $object->meta_fb['url'];\n $metainfo['image'] = empty($object->meta_fb['fbimage'][0]) ? '' : $object->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['downloadable'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['downloadable'][0]->url;\n } else {\n $config = expConfig::getConfig($object->location_data);\n if (!empty($config['expFile']['fbimage'][0])) {\n $file = new expFile($config['expFile']['fbimage'][0]);\n }\n if (!empty($file->id)) {\n $metainfo['image'] = $file->url;\n }\n if (empty($metainfo['image'])) {\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n }\n $mt = explode('/', $object->expFile['downloadable'][0]->mimetype);\n if ($mt[0] == 'audio' || $mt[0] == 'video') // add an audio/video attachment\n $metainfo[$mt[0]] = $object->expFile['downloadable'][0]->url;",
" return $metainfo;\n }",
" /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_tw($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['card'] = 'summary';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $config = expConfig::getConfig($object->location_data);\n if (!empty($object->meta_tw['twsite'])) {\n $metainfo['site'] = $object->meta_tw['twsite'];\n } elseif (!empty($config['twsite'])) {\n $metainfo['site'] = $config['twsite'];\n }\n $metainfo['title'] = substr(empty($object->meta_tw['title']) ? $object->title : $object->meta_tw['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_tw['description']) ? $desc : $object->meta_tw['description'], 0, 199);\n $metainfo['image'] = empty($object->meta_tw['twimage'][0]) ? '' : $object->meta_tw['twimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n if (!empty($config['expFile']['twimage'][0]))\n $file = new expFile($config['expFile']['twimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
" function getRSSContent($limit = 0) {\n include_once(BASE.'external/mp3file.php');",
" $fd = new filedownload();\n $items = $fd->find('all',$this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'created_at DESC', $limit);",
" ",
" //Convert the items to rss items\n $rssitems = array();",
" foreach ($items as $key => $item) { ",
" $rss_item = new FeedItem();",
" // Add the basic data\n $rss_item->title = expString::convertSmartQuotes($item->title);\n $rss_item->link = $rss_item->guid = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url));\n $rss_item->description = expString::convertSmartQuotes($item->body);\n $rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n $rss_item->authorEmail = user::getEmailById($item->poster);\n// $rss_item->date = isset($item->publish_date) ? date(DATE_RSS,$item->publish_date) : date(DATE_RSS, $item->created_at);\n $rss_item->date = isset($item->publish_date) ? $item->publish_date : $item->created_at;\n if (!empty($item->expCat[0]->title))\n $rss_item->category = array($item->expCat[0]->title);",
" // Add the attachment/enclosure info\n $rss_item->enclosure = new Enclosure();\n $rss_item->enclosure->url = !empty($item->expFile['downloadable'][0]->url) ? $item->expFile['downloadable'][0]->url : '';\n $rss_item->enclosure->length = !empty($item->expFile['downloadable'][0]->filesize) ? $item->expFile['downloadable'][0]->filesize : '';\n $rss_item->enclosure->type = !empty($item->expFile['downloadable'][0]->mimetype) ? $item->expFile['downloadable'][0]->mimetype : '';\n if ($rss_item->enclosure->type == 'audio/mpeg')\n $rss_item->enclosure->type = 'audio/mpg';",
" // Add iTunes info\n $rss_item->itunes = new iTunes();\n $rss_item->itunes->subtitle = expString::convertSmartQuotes($item->title);\n $rss_item->itunes->summary = expString::convertSmartQuotes($item->body);\n $rss_item->itunes->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n $tags = '';\n foreach ($item->expTag as $tag) {\n $tags .= $tag->title.\", \";\n }\n if (!empty($tags)) {\n $rss_item->itunes->keywords = $tags;\n }\n if (($rss_item->enclosure->type == \"audio/mpg\") && (file_exists(BASE.$item->expFile['downloadable'][0]->directory.$item->expFile['downloadable'][0]->filename))) {\n $mp3 = new mp3file(BASE.$item->expFile['downloadable'][0]->directory.$item->expFile['downloadable'][0]->filename);\n $id3 = $mp3->get_metadata();\n if (($id3['Encoding']=='VBR') || ($id3['Encoding']=='CBR')) {\n $rss_item->itunes->duration = $id3['Length mm:ss'];\n }\n if (!empty($id3['artist'])) {\n $rss_item->author = $id3['artist'];\n $rss_item->itunes->author = $id3['artist'];\n }\n if (!empty($id3['comment'])) {\n $rss_item->itunes->subtitle = $id3['comment'];\n }\n } else {\n $rss_item->itunes->duration = 'Unknown';\n }",
" // Add the item to the array.\n $rssitems[$key] = $rss_item;",
" if ($limit && count($rssitems) >= $limit)\n break;\n }\n return $rssitems;\n }",
"\t",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class filedownloadController extends expController {\n\tpublic $useractions = array(\n 'showall'=>'Show all',\n 'tags'=>\"Tags\",\n );\n\tpublic $remove_configs = array(\n// 'comments',\n// 'ealerts',\n 'files',\n 'rss', // because we do this as a custom tab within the module\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" public $rss_is_podcast = true;",
" static function displayname() { return gt(\"File Downloads\"); }\n static function description() { return gt(\"Place files on your website for users to download or use as a podcast.\"); }\n static function isSearchable() { return true; }",
"",
" function showall() {\n expHistory::set('viewable', $this->params);\n $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;\n if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {\n $limit = '0';\n }\n $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n $page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>$limit,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'dontsortwithincat'=>!empty($this->config['dontsort']) ? $this->config['dontsort'] : false,\n 'groups'=>!isset($this->params['group']) ? array() : array($this->params['group']),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n gt('Description')=>'body'\n ),\n ));",
" include_once(BASE.'external/mp3file.php');\n foreach ($page->records as $file) {\n if (!empty($file->expFile['downloadable'][0]) && ($file->expFile['downloadable'][0]->mimetype == \"audio/mpeg\") && (file_exists(BASE.$file->expFile['downloadable'][0]->directory.$file->expFile['downloadable'][0]->filename))) {\n $mp3 = new mp3file(BASE.$file->expFile['downloadable'][0]->directory.$file->expFile['downloadable'][0]->filename);\n $id3 = $mp3->get_metadata();\n if (($id3['Encoding']=='VBR') || ($id3['Encoding']=='CBR')) {\n $file->expFile['downloadable'][0]->duration = $id3['Length mm:ss'];\n }\n }\n }",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'items'=>$page->records,\n 'rank'=>($order==='rank')?1:0,\n 'params'=>$this->params,\n ));\n }",
" public function downloadfile() {\n if (empty($this->params['fileid'])) {\n flash('error', gt('There was an error while trying to download your file. No File Specified.'));\n expHistory::back();\n }",
"\n $fd = new filedownload(intval($this->params['fileid']));",
" if (empty($this->params['filenum'])) $this->params['filenum'] = 0;",
" if (empty($fd->expFile['downloadable'][$this->params['filenum']]->id)) {\n flash('error', gt('There was an error while trying to download your file. The file you were looking for could not be found.'));\n expHistory::back();",
" }\n",
" $fd->downloads++;\n $fd->save();",
"",
" // this will set the id to the id of the actual file..makes the download go right.\n $this->params['id'] = $fd->expFile['downloadable'][$this->params['filenum']]->id;",
" parent::downloadfile();",
" }",
" /**\n * Returns rich snippet PageMap meta data\n *\n * @param $request\n * @param $object\n *\n * @return string\n */\n function meta_rich($request, $object) {\n if (!empty($object->expFile[0]) && file_exists(BASE.$object->expFile[0]->directory.$object->expFile[0]->filename)) {\n $rich_meta = '<!--\n <PageMap>\n <DataObject type=\"action\">\n <Attribute name=\"label\" value=\"' . gt('Download') . '\"/>\n <Attribute name=\"url\" value=\"' . $object->download_link() . '\"/>\n <Attribute name=\"class\" value=\"download\"/>\n </DataObject>\n </PageMap>\n -->';\n return $rich_meta;\n }\n }",
" /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_fb($request, $object, $canonical)\n {\n $metainfo = array();\n $metainfo['type'] = 'article';\n if (!empty($object->body)) {\n $desc = str_replace('\"', \"'\", expString::summarize($object->body, 'html', 'para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $metainfo['title'] = substr(empty($object->meta_fb['title']) ? $object->title : $object->meta_fb['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_fb['description']) ? $desc : $object->meta_fb['description'], 0, 199);\n $metainfo['url'] = empty($object->meta_fb['url']) ? $canonical : $object->meta_fb['url'];\n $metainfo['image'] = empty($object->meta_fb['fbimage'][0]) ? '' : $object->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['downloadable'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['downloadable'][0]->url;\n } else {\n $config = expConfig::getConfig($object->location_data);\n if (!empty($config['expFile']['fbimage'][0])) {\n $file = new expFile($config['expFile']['fbimage'][0]);\n }\n if (!empty($file->id)) {\n $metainfo['image'] = $file->url;\n }\n if (empty($metainfo['image'])) {\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n }\n $mt = explode('/', $object->expFile['downloadable'][0]->mimetype);\n if ($mt[0] == 'audio' || $mt[0] == 'video') // add an audio/video attachment\n $metainfo[$mt[0]] = $object->expFile['downloadable'][0]->url;",
" return $metainfo;\n }",
" /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_tw($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['card'] = 'summary';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $config = expConfig::getConfig($object->location_data);\n if (!empty($object->meta_tw['twsite'])) {\n $metainfo['site'] = $object->meta_tw['twsite'];\n } elseif (!empty($config['twsite'])) {\n $metainfo['site'] = $config['twsite'];\n }\n $metainfo['title'] = substr(empty($object->meta_tw['title']) ? $object->title : $object->meta_tw['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_tw['description']) ? $desc : $object->meta_tw['description'], 0, 199);\n $metainfo['image'] = empty($object->meta_tw['twimage'][0]) ? '' : $object->meta_tw['twimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n if (!empty($config['expFile']['twimage'][0]))\n $file = new expFile($config['expFile']['twimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
" function getRSSContent($limit = 0) {\n include_once(BASE.'external/mp3file.php');",
" $fd = new filedownload();\n $items = $fd->find('all',$this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'created_at DESC', $limit);",
"",
" //Convert the items to rss items\n $rssitems = array();",
" foreach ($items as $key => $item) {",
" $rss_item = new FeedItem();",
" // Add the basic data\n $rss_item->title = expString::convertSmartQuotes($item->title);\n $rss_item->link = $rss_item->guid = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url));\n $rss_item->description = expString::convertSmartQuotes($item->body);\n $rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n $rss_item->authorEmail = user::getEmailById($item->poster);\n// $rss_item->date = isset($item->publish_date) ? date(DATE_RSS,$item->publish_date) : date(DATE_RSS, $item->created_at);\n $rss_item->date = isset($item->publish_date) ? $item->publish_date : $item->created_at;\n if (!empty($item->expCat[0]->title))\n $rss_item->category = array($item->expCat[0]->title);",
" // Add the attachment/enclosure info\n $rss_item->enclosure = new Enclosure();\n $rss_item->enclosure->url = !empty($item->expFile['downloadable'][0]->url) ? $item->expFile['downloadable'][0]->url : '';\n $rss_item->enclosure->length = !empty($item->expFile['downloadable'][0]->filesize) ? $item->expFile['downloadable'][0]->filesize : '';\n $rss_item->enclosure->type = !empty($item->expFile['downloadable'][0]->mimetype) ? $item->expFile['downloadable'][0]->mimetype : '';\n if ($rss_item->enclosure->type == 'audio/mpeg')\n $rss_item->enclosure->type = 'audio/mpg';",
" // Add iTunes info\n $rss_item->itunes = new iTunes();\n $rss_item->itunes->subtitle = expString::convertSmartQuotes($item->title);\n $rss_item->itunes->summary = expString::convertSmartQuotes($item->body);\n $rss_item->itunes->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n $tags = '';\n foreach ($item->expTag as $tag) {\n $tags .= $tag->title.\", \";\n }\n if (!empty($tags)) {\n $rss_item->itunes->keywords = $tags;\n }\n if (($rss_item->enclosure->type == \"audio/mpg\") && (file_exists(BASE.$item->expFile['downloadable'][0]->directory.$item->expFile['downloadable'][0]->filename))) {\n $mp3 = new mp3file(BASE.$item->expFile['downloadable'][0]->directory.$item->expFile['downloadable'][0]->filename);\n $id3 = $mp3->get_metadata();\n if (($id3['Encoding']=='VBR') || ($id3['Encoding']=='CBR')) {\n $rss_item->itunes->duration = $id3['Length mm:ss'];\n }\n if (!empty($id3['artist'])) {\n $rss_item->author = $id3['artist'];\n $rss_item->itunes->author = $id3['artist'];\n }\n if (!empty($id3['comment'])) {\n $rss_item->itunes->subtitle = $id3['comment'];\n }\n } else {\n $rss_item->itunes->duration = 'Unknown';\n }",
" // Add the item to the array.\n $rssitems[$key] = $rss_item;",
" if ($limit && count($rssitems) >= $limit)\n break;\n }\n return $rssitems;\n }",
"",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class formsController extends expController {\n public $useractions = array(\n 'enterdata' => 'Input Records',\n 'showall' => 'Show All Records',\n 'show' => 'Show a Single Record',\n );",
"",
" public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n// 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" protected $add_permissions = array(\n 'viewdata' => \"View Data\",\n 'enter_data' => \"Enter Data\" // slight naming variation to not fully restrict enterdata method\n );",
"// public $codequality = 'beta';",
" static function displayname() {\n return gt(\"Forms\");\n }",
" static function description() {\n return gt(\"Allows the creation of forms that can be emailed, or even viewed if they are optionally stored in the database\");\n }",
" static function author() {\n return \"Dave Leffler\";\n }",
" static function isSearchable() {\n return false;\n }",
" function searchName() {\n return gt(\"Forms\");\n }",
" function searchCategory() {\n return gt('Form Data');\n }",
" static function requiresConfiguration()\n {\n return true;\n }",
" public function showall() {\n if ((!empty($this->config['unrestrict_view']) || expPermissions::check('viewdata', $this->loc))) {\n expHistory::set('viewable', $this->params);\n $f = null;\n if (!empty($this->config)) {\n $f = $this->forms->find('first', 'id=' . $this->config['forms_id']);\n } elseif (!empty($this->params['title'])) {",
" $f = $this->forms->find('first', 'sef_url=\"' . $this->params['title'] . '\"');",
" $this->get_defaults($f);\n } elseif (!empty($this->params['id'])) {\n $f = $this->forms->find('first', 'id=' . $this->params['id']);\n $this->get_defaults($f);\n }",
" if (!empty($f)) {\n if (empty($this->config['report_filter']) && empty($this->params['filter'])) { // allow for param of 'filter' also\n $where = '1';\n } elseif (!empty($this->params['filter'])) {",
" $where = $this->params['filter'];",
" } else {\n $where = $this->config['report_filter'];\n }\n $fc = new forms_control();\n if (empty($this->config['column_names_list'])) {\n //define some default columns...\n $controls = $fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly=0 AND is_static = 0', 'rank');\n foreach (array_slice($controls, 0, 5) as $control) { // default to only first 5 columns\n $this->config['column_names_list'][] = $control->name;\n }\n }",
" // pre-process records\n $items = $f->selectRecordsArray($where);\n $columns = array();\n foreach ($this->config['column_names_list'] as $column_name) {\n if ($column_name == \"ip\") {\n// $columns[gt('IP Address')] = 'ip';\n $columns['ip'] = gt('IP Address');\n } elseif ($column_name == \"referrer\") {\n// $columns[gt('Referrer')] = 'referrer';\n $columns['referrer'] = gt('Referrer');\n } elseif ($column_name == \"location_data\") {\n// $columns[gt('Entry Point')] = 'location_data';\n $columns['location_data'] = gt('Entry Point');\n } elseif ($column_name == \"user_id\") {\n foreach ($items as $key => $item) {\n if ($item[$column_name] != 0) {\n $locUser = user::getUserById($item[$column_name]);\n $item[$column_name] = $locUser->username;\n } else {\n $item[$column_name] = '';\n }\n $items[$key] = $item;\n }\n// $columns[gt('Posted by')] = 'user_id';\n $columns['user_id'] = gt('Posted by');\n } elseif ($column_name == \"timestamp\") {\n foreach ($items as $key => $item) {\n $item[$column_name] = strftime(DISPLAY_DATETIME_FORMAT, $item[$column_name]);\n $items[$key] = $item;\n }\n// $columns[gt('Timestamp')] = 'timestamp';\n $columns['timestamp'] = gt('Timestamp');\n } else {\n $control = $fc->find('first', \"name='\" . $column_name . \"' AND forms_id=\" . $f->id, 'rank');\n if ($control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n foreach ($items as $key => $item) {\n //We have to add special sorting for date time columns!!!\n $item[$column_name] = @call_user_func(\n array($control_type, 'templateFormat'),\n $item[$column_name],\n $ctl\n );\n $items[$key] = $item;\n }\n// $columns[$control->caption] = $column_name;\n $columns[$column_name] = $control->caption;\n }\n }\n }",
" $page = new expPaginator(\n array(\n 'records' => $items,\n 'where' => 1,\n// 'limit' => (isset($this->params['limit']) && $this->params['limit'] != '') ? $this->params['limit'] : 10,\n 'order' => (isset($this->params['order']) && $this->params['order'] != '') ? $this->params['order'] : (!empty($this->config['order']) ? $this->config['order'] : 'id'),\n 'dir' => (isset($this->params['dir']) && $this->params['dir'] != '') ? $this->params['dir'] : 'ASC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'src' => $this->loc->src,\n 'columns' => $columns\n )\n );",
" assign_to_template(\n array(\n// \"backlink\" => expHistory::getLastNotEditable(),\n \"backlink\" => expHistory::getLast('viewable'),\n \"f\" => $f,\n \"page\" => $page,\n \"title\" => !empty($this->config['report_name']) ? $this->config['report_name'] : '',\n \"description\" => !empty($this->config['report_desc']) ? $this->config['report_desc'] : null,\n \"filtered\" => !empty($this->config['report_filter']) ? $this->config['report_filter'] : ''\n )\n );\n }\n } else {\n assign_to_template(array(\n \"error\" => 1,\n ));\n }\n }",
" public function show() {\n if (!empty($this->config['unrestrict_view']) || expPermissions::check('viewdata', $this->loc)) {\n expHistory::set('viewable', $this->params);\n $f = null;\n if (!empty($this->config)) {\n $f = $this->forms->find('first', 'id=' . $this->config['forms_id']);\n } elseif (!empty($this->params['forms_id'])) {\n $f = $this->forms->find('first', 'id=' . $this->params['forms_id']);\n } elseif (!empty($this->params['title'])) {",
" $f = $this->forms->find('first', 'sef_url=\"' . $this->params['title'] . '\"');",
" redirect_to(array('controller' => 'forms', 'action' => 'enterdata', 'forms_id' => $f->id));\n }",
" if (!empty($f)) {\n $fc = new forms_control();\n $controls = $fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly=0 AND is_static = 0', 'rank');\n $id = !empty($this->params['id']) ? $this->params['id'] : null;\n $data = $f->getRecord($id);",
" $fields = array();\n $captions = array();\n if ($controls && $data) {\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $control_type = get_class($ctl);\n $name = $c->name;\n $fields[$name] = call_user_func(array($control_type, 'templateFormat'), $data->$name, $ctl);\n $captions[$name] = $c->caption;\n }",
" // system added fields\n $captions['ip'] = gt('IP Address');\n $captions['timestamp'] = gt('Timestamp');\n $captions['user_id'] = gt('Posted by');\n $fields['ip'] = $data->ip;\n $fields['timestamp'] = strftime(DISPLAY_DATETIME_FORMAT, $data->timestamp);\n $locUser = user::getUserById($data->user_id);\n $fields['user_id'] = !empty($locUser->username) ? $locUser->username : '';",
" // add a browse other records (next/prev) feature here\n $field = !empty($this->config['order']) ? $this->config['order'] : 'id';\n $data->next = $f->getRecord($field . ' > ' . $data->$field . ' ORDER BY ' . $field);\n if (!empty($data->next) && $data->next != $data->id) {\n assign_to_template(\n array(\n \"next\" => $data->next,\n )\n );\n }\n $data->prev = $f->getRecord($field . ' < ' . $data->$field . ' ORDER BY ' . $field . ' DESC');\n if (!empty($data->prev) && $data->prev != $data->id) {\n assign_to_template(\n array(\n \"prev\" => $data->prev,\n )\n );\n }\n }",
" $count = $f->countRecords();\n assign_to_template(\n array(\n // \"backlink\"=>expHistory::getLastNotEditable(),\n // 'backlink' => expHistory::getLast('editable'),\n 'backlink' => makeLink(expHistory::getBack(1)),\n \"f\" => $f,\n // \"record_id\" => $this->params['id'],\n \"record_id\" => !empty($data->id) ? $data->id : null,\n \"title\" => !empty($this->config['report_name']) ? $this->config['report_name'] : gt(\n 'Viewing Record'\n ),\n \"description\" => !empty($this->config['report_desc']) ? $this->config['report_desc'] : null,\n 'fields' => $fields,\n 'captions' => $captions,\n \"count\" => $count,\n 'is_email' => 0,\n \"css\" => file_get_contents(BASE . \"framework/core/assets/css/tables.css\"),\n )\n );\n }\n } else {\n assign_to_template(array(\n \"error\" => 1,\n ));\n }\n }",
" public function enter_data() {\n $this->enterdata();\n }",
" public function enterdata() {\n if (empty($this->config['restrict_enter']) || expPermissions::check('enterdata', $this->loc)) {",
" global $user;",
" expHistory::set('viewable', $this->params);\n $f = null;\n if (!empty($this->config)) {\n $f = $this->forms->find('first', 'id=' . $this->config['forms_id']);\n } elseif (!empty($this->params['forms_id'])) {\n $f = $this->forms->find('first', 'id=' . $this->params['forms_id']);\n $this->get_defaults($f);\n }",
" if (!empty($f)) {\n $form = new form();\n $form->id = $f->sef_url;\n $form->horizontal = !empty($this->config['style']);\n if (!empty($this->params['id'])) {\n $fc = new forms_control();\n $controls = $fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly = 0 AND is_static = 0','rank');\n $data = $f->getRecord($this->params['id']);\n } else {\n if (!empty($f->forms_control)) {\n $controls = $f->forms_control;\n } else {\n $controls = array();\n }\n $data = expSession::get('forms_data_' . $f->id);\n }\n // display list of email addresses\n if (!empty($this->config['select_email'])) {\n //Building Email List...\n $emaillist = array();\n if (!empty($this->config['user_list'])) foreach ($this->config['user_list'] as $c) {\n $u = user::getUserById($c);\n if (!empty($u->email)) {\n if (!empty($u->firstname) || !empty($u->lastname)) {\n $title = $u->firstname . ' ' . $u->lastname . ' ('. $u->email . ')';\n } else {\n $title = $u->username . ' ('. $u->email . ')';\n }\n $emaillist[$u->email] = $title;\n }\n }\n if (!empty($this->config['group_list'])) foreach ($this->config['group_list'] as $c) {\n// $grpusers = group::getUsersInGroup($c);\n// foreach ($grpusers as $u) {\n// $emaillist[] = $u->email;\n// }\n $g = group::getGroupById($c);\n $emaillist[$c] = $g->name;\n }\n if (!empty($this->config['address_list'])) foreach ($this->config['address_list'] as $c) {\n $emaillist[$c] = $c;\n }\n //This is an easy way to remove duplicates\n $emaillist = array_flip(array_flip($emaillist));\n $emaillist = array_map('trim', $emaillist);\n $emaillist = array_reverse($emaillist, true);\n if (empty($this->config['select_exclude_all']))\n $emaillist[0] = gt('All Addresses');\n $emaillist = array_reverse($emaillist, true);\n if (!empty($this->config['select_dropdown']))\n $form->register('email_dest', gt('Send Response to'), new dropdowncontrol('', $emaillist));\n else\n $form->register('email_dest', gt('Send Response to'), new radiogroupcontrol('', $emaillist));\n }\n// $paged = false;\n foreach ($controls as $key=>$c) {\n $ctl = expUnserialize($c->data);\n $ctl->_id = $c->id;\n $ctl->_readonly = $c->is_readonly;\n $ctl->_ishidden = !empty($ctl->is_hidden) && empty($this->params['id']); // hide it if entering new data\n if (!empty($this->params['id'])) {\n if ($c->is_readonly == 0) {\n $name = $c->name;\n if ($c->is_static == 0) {\n $ctl->default = $data->$name;\n }\n }\n } else {\n if (!empty($data[$c->name])) $ctl->default = $data[$c->name];\n }\n if ($key == 0) $ctl->focus = true; // first control gets the focus\n $form->register($c->name, $c->caption, $ctl);\n// if (get_class($ctl) == 'pagecontrol') $paged = true;\n }",
" // if we are editing an existing record we'll need to do recaptcha here since we won't call confirm_data\n if (!empty($this->params['id'])) {\n $antispam = '';\n if (SITE_USE_ANTI_SPAM && ANTI_SPAM_CONTROL == 'recaptcha') {\n // make sure we have the proper config.\n if (!defined('RECAPTCHA_PUB_KEY')) {\n $antispam .= '<h2 style=\"color:red\">' . gt('reCaptcha configuration is missing the public key.') . '</h2>';\n }\n if ($user->isLoggedIn() && ANTI_SPAM_USERS_SKIP == 1) {\n // skip it for logged on users based on config\n } else {\n // include the library and show the form control\n require_once(BASE . 'external/ReCaptcha/autoload.php'); //FIXME not sure we need this here\n $re_theme = (RECAPTCHA_THEME == 'dark') ? 'dark' : 'light';\n $antispam .= '<input type=\"hidden\" class=\"hiddenRecaptcha required\" name=\"hiddenRecaptcha\" id=\"hiddenRecaptcha\">';\n $antispam .= '<div class=\"g-recaptcha\" data-sitekey=\"' . RECAPTCHA_PUB_KEY . '\" data-theme=\"' . $re_theme . '\"></div>';\n $antispam .= '<script type=\"text/javascript\" src=\"https://www.google.com/recaptcha/api.js?hl=' . LOCALE . '\" async defer></script>';\n $antispam .= '<p>' . gt('Fill out the above security question to submit your form.') . '</p>';\n }\n }\n $form->register(uniqid(''), '', new htmlcontrol($antispam));\n }",
" if (empty($this->config['submitbtn'])) $this->config['submitbtn'] = gt('Submit');\n if (!empty($this->params['id'])) {\n $cancel = gt('Cancel');\n $form->meta('action', 'submit_data');\n $form->meta('isedit', 1);\n $form->meta('data_id', $data->id);\n $form->location($this->loc);\n assign_to_template(array(\n 'edit_mode' => 1,\n ));\n } else {\n $cancel = '';\n $form->meta(\"action\", \"confirm_data\");\n }\n if (empty($this->config['submitbtn'])) $this->config['submitbtn'] = gt('Submit');\n if (empty($this->config['resetbtn'])) $this->config['resetbtn'] = '';\n $form->register(\"submit\", \"\", new buttongroupcontrol($this->config['submitbtn'], $this->config['resetbtn'], $cancel, 'finish'));",
" $form->meta(\"m\", $this->loc->mod);\n $form->meta(\"s\", $this->loc->src);\n $form->meta(\"i\", $this->loc->int);\n $form->meta(\"id\", $f->id);\n $formmsg = '';\n $form->location(expCore::makeLocation(\"forms\", $this->loc->src, $this->loc->int));\n if (count($controls) == 0) {\n $form->controls['submit']->disabled = true;\n $formmsg .= gt('This form is blank. Select \"Design Form\" to add input fields.') . '<br>';\n } elseif (empty($f->is_saved) && empty($this->config['is_email'])) {\n $form->controls['submit']->disabled = true;\n $formmsg .= gt('There are no actions assigned to this form. Select \"Configure Settings\" then either select \"Email Form Data\" and/or \"Save Submissions to Database\".');\n }\n $count = $f->countRecords();\n if ($formmsg) {\n flash('notice', $formmsg);\n }\n if (empty($this->config['description'])) $this->config['description'] = '';\n assign_to_template(array(\n \"description\" => $this->config['description'],\n \"form_html\" => $form->toHTML(),\n \"form\" => $f,\n \"count\" => $count,\n// 'paged' => $paged,\n ));\n }\n } else {\n assign_to_template(array(\n \"error\" => 1,\n ));\n }\n }",
" public function confirm_data() {\n $f = new forms($this->params['id']);\n $cols = $f->forms_control;\n $counts = array();\n $responses = array();\n $captions = array();",
" foreach ($cols as $col) {\n $newupload = false;\n $coldef = expUnserialize($col->data);\n $coldata = new ReflectionClass($coldef);\n if (empty($coldef->is_hidden)) {\n $coltype = $coldata->getName();\n if ($coltype == 'uploadcontrol' && !empty($_FILES)) {\n $newupload = true;\n $value = call_user_func(array($coltype, 'parseData'), $col->name, $_FILES, true);\n } else {\n $value = call_user_func(array($coltype, 'parseData'), $col->name, $this->params, true);\n }\n $value = call_user_func(array($coltype, 'templateFormat'), $value, $coldef); // convert parsed value to user readable\n //eDebug($value);\n// $counts[$col->caption] = isset($counts[$col->caption]) ? $counts[$col->caption] + 1 : 1;\n// $num = $counts[$col->caption] > 1 ? $counts[$col->caption] : '';",
" if (!empty($this->params[$col->name])) {\n// if ($coltype == 'checkboxcontrol') {\n// $responses[$col->caption . $num] = gt('Yes');\n// } else {\n// $responses[$col->caption . $num] = $value;\n $responses[$col->name] = $value;\n $captions[$col->name] = $col->caption;\n// }\n } else {\n if ($coltype == 'checkboxcontrol') {\n// $responses[$col->caption . $num] = gt('No');\n $responses[$col->name] = gt('No');\n $captions[$col->name] = $col->caption;\n } elseif ($coltype == 'datetimecontrol' || $coltype == 'calendarcontrol') {\n// $responses[$col->name] = $value;\n $responses[$col->name] = $value;\n $captions[$col->name] = $col->caption;\n } elseif ($coltype == 'uploadcontrol') {\n if ($newupload) {\n $this->params[$col->name] = PATH_RELATIVE . call_user_func(\n array($coltype, 'moveFile'),\n $col->name,\n $_FILES,\n true\n );\n }\n // $value = call_user_func(array($coltype,'buildDownloadLink'),$this->params[$col->name],$_FILES[$col->name]['name'],true);\n //eDebug($value);\n// $responses[$col->caption . $num] = $_FILES[$col->name]['name'];\n// $responses[$col->name] = $_FILES[$col->name]['name'];\n// $responses[$col->name] = $this->params[$col->name];\n $responses[$col->name] = call_user_func(array($coltype, 'templateFormat'), $this->params[$col->name], null); // convert parsed value to user readable\n $captions[$col->name] = $col->caption;\n } elseif ($coltype != 'htmlcontrol' && $coltype != 'pagecontrol') {\n// $responses[$col->caption . $num] = '';\n $responses[$col->name] = '';\n $captions[$col->name] = $col->caption;\n }\n }\n }\n }",
" // remove some post data we don't want to pass thru to the form\n unset(\n $this->params['controller'],\n $this->params['action'],\n $this->params['view']\n );\n foreach ($this->params as $k => $v) {\n // $this->params[$k]=htmlentities(htmlspecialchars($v,ENT_COMPAT,LANG_CHARSET));\n $this->params[$k] = htmlspecialchars($v, ENT_COMPAT, LANG_CHARSET);\n }\n expSession::set('forms_data_' . $this->params['id'], $this->params);",
" assign_to_template(array(\n 'responses' => $responses,\n 'captions' => $captions,\n 'postdata' => $this->params,\n ));\n }",
" public function submit_data() {\n // Check for form errors\n $this->params['manual_redirect'] = true;\n if (!expValidator::check_antispam($this->params)) {\n flash('error', gt('Security Validation Failed'));\n expHistory::back();\n }",
" global $db, $user;\n $f = new forms($this->params['id']);\n $fc = new forms_control();\n $controls = $fc->find('all', \"forms_id=\" . $f->id . \" AND is_readonly=0\",'rank');\n $this->get_defaults($f);",
" $db_data = new stdClass();\n $emailFields = array();\n $captions = array();\n $attachments = array();\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, \"getFieldDefinition\"));\n if ($def != null) {\n $emailValue = htmlspecialchars_decode(call_user_func(array($control_type, 'parseData'), $c->name, $this->params, true));\n $value = stripslashes(expString::escape($emailValue));",
" //eDebug($value);\n $varname = $c->name;\n $db_data->$varname = $value;\n // $fields[$c->name] = call_user_func(array($control_type,'templateFormat'),$value,$ctl);\n if (!$ctl->is_hidden) {\n $emailFields[$c->name] = call_user_func(array($control_type, 'templateFormat'), $value, $ctl);\n $captions[$c->name] = $c->caption;\n if (strtolower($c->name) == \"email\" && expValidator::isValidEmail($value)) {\n $from = $value;\n }\n if (strtolower($c->name) == \"name\") {\n $from_name = $value;\n }\n if (get_class($ctl) == 'uploadcontrol') {\n $attachments[] = htmlspecialchars_decode($this->params[$c->name]);\n }\n }\n }\n }",
" if (!isset($this->params['data_id']) || (isset($this->params['data_id']) && expPermissions::check(\"editdata\", $f->loc))) {\n if (!empty($f->is_saved)) {\n if (isset($this->params['data_id'])) {\n //if this is an edit we remove the record and insert a new one.\n $olddata = $f->getRecord($this->params['data_id']);\n $db_data->ip = $olddata->ip;\n $db_data->user_id = $olddata->user_id;\n $db_data->timestamp = $olddata->timestamp;\n $db_data->referrer = $olddata->referrer;\n $db_data->location_data = $olddata->location_data;\n $f->deleteRecord($this->params['data_id']);\n } else {\n $db_data->ip = $_SERVER['REMOTE_ADDR'];\n if (expSession::loggedIn()) {\n $db_data->user_id = $user->id;\n $from = $user->email;\n $from_name = $user->firstname . \" \" . $user->lastname . \" (\" . $user->username . \")\";\n } else {\n $db_data->user_id = 0;\n }\n $db_data->timestamp = time();\n $referrer = $db->selectValue(\"sessionticket\", \"referrer\", \"ticket = '\" . expSession::getTicketString() . \"'\");\n $db_data->referrer = $referrer;\n $location_data = null;\n if (!empty($this->params['src'])) {\n $mod = !empty($this->params['module']) ? $this->params['module'] : $this->params['controller'];\n expCore::makeLocation($mod,$this->params['src'],$this->params['int']);\n }\n $db_data->location_data = $location_data;\n }\n $f->insertRecord($db_data);\n } else {\n $referrer = $db->selectValue(\"sessionticket\", \"referrer\", \"ticket = '\" . expSession::getTicketString() . \"'\");\n }",
" //Email stuff here...\n //Don't send email if this is an edit.\n if (!empty($this->config['is_email']) && !isset($this->params['data_id'])) {\n //Building Email List...\n $emaillist = array();\n if (!empty($this->config['select_email']) && !empty($this->params['email_dest'])) {\n if (strval(intval($this->params['email_dest'])) == strval($this->params['email_dest'])) {\n foreach (group::getUsersInGroup($this->params['email_dest']) as $locUser) {\n if ($locUser->email != '') $emaillist[$locUser->email] = trim(user::getUserAttribution($locUser->id));\n }\n } else {\n $emaillist[] = $this->params['email_dest'];\n }\n } else { // send to all form addressee's\n $emaillist = array();\n if (!empty($this->config['user_list'])) foreach ($this->config['user_list'] as $c) {\n $u = user::getUserById($c);\n $emaillist[$u->email] = trim(user::getUserAttribution($u->id));\n }\n if (!empty($this->config['group_list'])) foreach ($this->config['group_list'] as $c) {\n $grpusers = group::getUsersInGroup($c);\n foreach ($grpusers as $u) {\n $emaillist[$u->email] = trim(user::getUserAttribution($u->id));\n }\n }\n if (!empty($this->config['address_list'])) foreach ($this->config['address_list'] as $c) {\n $emaillist[] = $c;\n }\n }\n //This is an easy way to remove duplicates\n $emaillist = array_flip(array_flip($emaillist));\n $emaillist = array_map('trim', $emaillist);",
" if (empty($this->config['report_def'])) {\n $msgtemplate = expTemplate::get_template_for_action($this, 'email/default_report', $this->loc);",
" } else {\n $msgtemplate = expTemplate::get_template_for_action($this, 'email/custom_report', $this->loc);\n $msgtemplate->assign('template', $this->config['report_def']);\n }\n $msgtemplate->assign(\"fields\", $emailFields);\n $msgtemplate->assign(\"captions\", $captions);\n $msgtemplate->assign('title', $this->config['report_name']);\n $msgtemplate->assign(\"is_email\", 1);\n if (!empty($referrer)) $msgtemplate->assign(\"referrer\", $referrer);\n $emailText = $msgtemplate->render();\n $emailText = trim(strip_tags(str_replace(array(\"<br />\", \"<br>\", \"br/>\"), \"\\n\", $emailText)));\n $msgtemplate->assign(\"css\", file_get_contents(BASE . \"framework/core/assets/css/tables.css\"));\n $emailHtml = $msgtemplate->render();",
" if (empty($from)) {\n $from = trim(SMTP_FROMADDRESS);\n }\n if (empty($from_name)) {\n $from_name = trim(ORGANIZATION_NAME);\n }\n // $headers = array(\n // \"MIME-Version\"=>\"1.0\",\n // \"Content-type\"=>\"text/html; charset=\".LANG_CHARSET\n // );\n if (count($emaillist)) {\n $mail = new expMail();\n if (!empty($attachments)) {\n foreach ($attachments as $attachment) {\n if (strlen(PATH_RELATIVE) != 1)\n $attachment = str_replace(PATH_RELATIVE, '', $attachment); // strip relative path for links coming from templates\n if (file_exists(BASE . $attachment)) {\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $ftype = finfo_file($finfo, $relpath . $attachment);\n// finfo_close($finfo);\n $mail->attach_file_on_disk(BASE . $attachment, expFile::getMimeType($attachment));\n }\n }\n }\n $mail->quickSend(array(\n //\t'headers'=>$headers,\n 'html_message' => $emailHtml,\n \"text_message\" => $emailText,\n 'to' => $emaillist,\n 'from' => array(trim($from) => $from_name),\n 'subject' => $this->config['subject'],\n ));\n }\n }",
" if (!empty($this->config['is_auto_respond']) && !isset($this->params['data_id']) && !empty($db_data->email)) {\n if (empty($from)) {\n $from = trim(SMTP_FROMADDRESS);\n }\n if (empty($from_name)) {\n $from_name = trim(ORGANIZATION_NAME);\n }\n// $headers = array(\n// \"MIME-Version\" => \"1.0\",\n// \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n// );",
" $tmsg = trim(strip_tags(str_replace(array(\"<br />\", \"<br>\", \"br/>\"), \"\\n\", $this->config['auto_respond_body'])));",
" if ($this->config['auto_respond_form']) ",
" $tmsg .= \"\\n\" . $emailText;\n $hmsg = $this->config['auto_respond_body'];",
" if ($this->config['auto_respond_form']) ",
" $hmsg .= \"\\n\" . $emailHtml;\n $mail = new expMail();\n $mail->quickSend(array(\n// 'headers' => $headers,\n \"text_message\" => $tmsg,\n 'html_message' => $hmsg,\n 'to' => $db_data->email,\n 'from' => array(trim($from) => $from_name),\n 'subject' => $this->config['auto_respond_subject'],\n ));\n }",
" // clear the users post data from the session.\n expSession::un_set('forms_data_' . $f->id);",
" //If is a new post show response, otherwise redirect to the flow.\n if (!isset($this->params['data_id'])) {\n if (empty($this->config['response'])) $this->config['response'] = gt('Thanks for your submission');\n assign_to_template(array(\n \"backlink\"=>expHistory::getLastNotEditable(),\n \"response_html\"=>$this->config['response'],\n ));\n } else {\n flash('message', gt('Record was updated!'));\n // expHistory::back();\n expHistory::returnTo('editable');\n }\n }\n }",
" /**\n * delete item in saved data\n *\n */\n function delete() {\n if (empty($this->params['id']) || empty($this->params['forms_id'])) {\n flash('error', gt('Missing id for the') . ' ' . gt('item') . ' ' . gt('you would like to delete'));\n expHistory::back();\n }",
" $f = new forms($this->params['forms_id']);\n $f->deleteRecord($this->params['id']);",
" expHistory::back();\n }",
" /**\n * delete all items in saved data\n *\n */\n function delete_records() {\n if (empty($this->params['forms_id'])) {\n flash('error', gt('Missing id for the') . ' ' . gt('form records') . ' ' . gt('you would like to delete'));\n expHistory::back();\n }",
" $f = new forms($this->params['forms_id']);\n $recs = $f->getRecords();\n foreach ($recs as $rec) {\n $f->deleteRecord($rec->id);\n }",
" flash('message', gt('All form records were deleted!'));\n expHistory::back();\n }",
" /**\n * Manage site forms\n *\n */\n public function manage() {\n expHistory::set('manageable', $this->params);\n $forms = $this->forms->find('all', 1);\n foreach($forms as $key=>$f) {\n if (!empty($f->table_name) && $f->tableExists() ) {\n $forms[$key]->count = $f->countRecords();\n }\n $forms[$key]->control_count = count($f->forms_control);\n }",
" assign_to_template(array(\n 'select' => !empty($this->params['select']),\n 'forms' => $forms\n ));\n }",
" /**\n * Assign selected form to current module\n *\n */\n public function activate() {\n // assign new form assigned\n $this->config['forms_id'] = $this->params['id'];\n // set default settings for this form\n $f = new forms($this->params['id']);\n if (!empty($f->description)) $this->config['description'] = $f->description;\n if (!empty($f->response)) $this->config['response'] = $f->response;\n if (!empty($f->report_name)) $this->config['report_name'] = $f->report_name;\n if (!empty($f->report_desc)) $this->config['report_desc'] = $f->report_desc;\n if (!empty($f->column_names_list)) $this->config['column_names_list'] = $f->column_names_list;\n if (!empty($f->report_def)) $this->config['report_def'] = $f->report_def;",
" // setup and save the config\n $config = new expConfig($this->loc);\n $config->update(array('config' => $this->config));",
" expHistory::back();\n }",
" public function edit_form() {\n expHistory::set('editable', $this->params);\n if (!empty($this->params['id'])) {\n $f = $this->forms->find('first', 'id=' . $this->params['id']);\n } else {\n $f = new forms();\n }\n $fields = array();\n $column_names = array();\n $cols = array();",
" if (!empty($f->column_names_list)) {\n $cols = explode('|!|', $f->column_names_list);\n }\n $fc = new forms_control();\n foreach ($fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly=0','rank') as $control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, 'getFieldDefinition'));\n if ($def != null) {\n $fields[$control->name] = $control->caption;\n if (in_array($control->name, $cols)) {\n $column_names[$control->name] = $control->caption;\n }\n }\n }\n $fields['ip'] = gt('IP Address');\n if (in_array('ip', $cols)) $column_names['ip'] = gt('IP Address');\n $fields['user_id'] = gt('Posted by');\n if (in_array('user_id', $cols)) $column_names['user_id'] = gt('Posted by');\n $fields['timestamp'] = gt('Timestamp');\n if (in_array('timestamp', $cols)) $column_names['timestamp'] = gt('Timestamp');\n// if (in_array('location_data', $cols)) $column_names['location_data'] = gt('Entry Point');",
" if (!empty($this->params['copy'])) {\n $f->old_id = $f->id;\n $f->id = null;\n $f->sef_url = null;\n $f->is_saved = false;\n $f->table_name = null;\n }\n $fieldlist = '[';\n if (isset($f->id)) {\n $fc = new forms_control();\n foreach ($fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly=0','rank') as $control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, 'getFieldDefinition'));\n if ($def != null) {\n $fields[$control->name] = $control->caption;\n if (in_array($control->name, $cols)) {\n $column_names[$control->name] = $control->caption;\n }\n }\n if ($control_type != 'pagecontrol' && $control_type != 'htmlcontrol') {\n $fieldlist .= '[\"{\\$fields[\\'' . $control->name . '\\']}\",\"' . $control->caption . '\",\"' . gt('Insert') . ' ' . $control->caption . ' ' . gt('Field') . '\"],';\n }\n }\n $fields['ip'] = gt('IP Address');\n if (in_array('ip', $cols)) $column_names['ip'] = gt('IP Address');\n $fields['user_id'] = gt('Posted by');\n if (in_array('user_id', $cols)) $column_names['user_id'] = gt('Posted by');\n $fields['timestamp'] = gt('Timestamp');\n if (in_array('timestamp', $cols)) $column_names['timestamp'] = gt('Timestamp');\n// if (in_array('location_data', $cols)) $column_names['location_data'] = gt('Entry Point');\n }\n $fieldlist .= ']';",
" assign_to_template(array(\n 'column_names' => $column_names,\n 'fields' => $fields,\n 'form' => $f,\n 'fieldlist' => $fieldlist,\n ));\n }",
" /**\n * Updates the form\n */\n public function update_form() {\n $this->forms->update($this->params);\n if (!empty($this->params['old_id'])) {\n // copy all the controls to the new form\n $fc = new forms_control();\n $controls = $fc->find('all','forms_id='.$this->params['old_id'],'rank');\n foreach ($controls as $control) {\n $control->id = null;\n $control->forms_id = $this->forms->id;\n $control->update();\n }\n }\n// if (!empty($this->params['is_saved']) && empty($this->params['table_name'])) {\n if (!empty($this->params['is_saved'])) {\n // we are now saving data to the database and need to create it first\n// $form = new forms($this->params['id']);\n $this->params['table_name'] = $this->forms->updateTable();\n// $this->params['_validate'] = false; // we don't want a check for unique sef_name\n// parent::update(); // now with a form tablename\n }\n expHistory::back();\n }",
" public function delete_form() {\n expHistory::set('editable', $this->params);\n $modelname = $this->basemodel_name;\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the') . ' ' . $modelname . ' ' . gt('you would like to delete'));\n expHistory::back();\n }\n $form = new $modelname($this->params['id']);",
" $form->delete();\n expHistory::returnTo('manageable');\n }",
" public function design_form() {\n if (!empty($this->params['id'])) {\n expHistory::set('editable', $this->params);\n $f = new forms($this->params['id']);\n $controls = $f->forms_control;",
" $form = new fakeform();\n $form->horizontal = !empty($this->config['style']) ? $this->config['style'] : false;\n if (isset($this->params['style']))\n $form->horizontal = $this->params['style'];\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $ctl->_id = $c->id;\n $ctl->_readonly = $c->is_readonly;\n $ctl->_controltype = get_class($ctl);\n $form->register($c->name, $c->caption, $ctl);\n }",
" $types = expTemplate::listControlTypes();\n $types[\".break\"] = gt('Static - Spacer');\n $types[\".line\"] = gt('Static - Horizontal Line');\n uasort($types, \"strnatcmp\");\n if (!bs3())\n array_unshift($types, '[' . gt('Please Select' . ']'));",
" $forms_list = array();\n $forms = $f->find('all', 1);\n if (!empty($forms)) foreach ($forms as $frm) {\n if ($frm->id != $f->id)\n $forms_list[$frm->id] = $frm->title;\n }",
" assign_to_template(array(\n 'form' => $f,\n 'forms_list' => $forms_list,\n 'form_html' => $form->toHTML($f->id),\n 'backlink' => expHistory::getLastNotEditable(),\n 'types' => $types,\n 'style' => $form->horizontal\n ));\n }\n }",
" public function edit_control() {\n $f = new forms($this->params['forms_id']);\n if ($f) {\n if (bs2()) {\n expCSS::pushToHead(array(\n \"corecss\"=>\"forms-bootstrap\"\n ));\n } elseif (bs3()) {\n expCSS::pushToHead(array(\n \"corecss\"=>\"forms-bootstrap3\"\n ));\n } else {\n expCSS::pushToHead(array(\n \"corecss\" => \"forms\",\n ));\n }",
" if (isset($this->params['control_type']) && $this->params['control_type']{0} == \".\") {\n // there is nothing to edit for these type controls, so add it then return\n $htmlctl = new htmlcontrol();\n $htmlctl->identifier = uniqid(\"\");\n $htmlctl->caption = \"\";\n if (!empty($this->params['rank']))\n $htmlctl->rank = $this->params['rank'];\n switch ($this->params['control_type']) {\n case \".break\":\n $htmlctl->html = \"<br />\";\n break;\n case \".line\":\n $htmlctl->html = \"<hr size='1' />\";\n break;\n }\n $ctl = new forms_control();\n $ctl->name = uniqid(\"\");\n $ctl->caption = \"\";\n $ctl->data = serialize($htmlctl);\n $ctl->forms_id = $f->id;\n $ctl->is_readonly = 1;\n if (!empty($this->params['rank']))\n $ctl->rank = $this->params['rank'];\n $ctl->update();\n if (!expJavascript::inAjaxAction())\n expHistory::returnTo('editable');\n else { // we need a graceful exit for inAjaxAction\n assign_to_template(array(\n 'form_html' => ucfirst(substr($this->params['control_type'],1)) . ' ' . gt('control was added to form') . '<input type=\"hidden\" name=\"staticcontrol\" id=\"'.$ctl->id.'\" />',\n 'type' => 'static',\n ));\n }\n } else {\n $control_type = \"\";\n $ctl = null;\n if (isset($this->params['id'])) {\n $control = new forms_control($this->params['id']);\n if ($control) {\n $ctl = expUnserialize($control->data);\n $ctl->identifier = $control->name;\n $ctl->caption = $control->caption;\n $ctl->id = $control->id;\n $control_type = get_class($ctl);\n $f->id = $control->forms_id;\n }\n }\n if ($control_type == \"\") $control_type = $this->params['control_type'];\n $form = call_user_func(array($control_type, \"form\"), $ctl);\n $form->location($this->loc);\n if ($ctl) {\n if (isset($form->controls['identifier']->disabled)) $form->controls['identifier']->disabled = true;\n $form->meta(\"id\", $ctl->id);\n $form->meta(\"identifier\", $ctl->identifier);\n }\n $form->meta(\"action\", \"save_control\");\n// $form->meta('control_type', $control_type);\n $form->meta('forms_id', $f->id);\n $types = expTemplate::listControlTypes();\n $othertypes = expTemplate::listSimilarControlTypes($control_type);\n if (count($othertypes) > 1) {\n $otherlist = new dropdowncontrol($control_type,$othertypes);\n $form->registerBefore('identifier','control_type',gt('Control Type'),$otherlist);\n } else {\n $form->registerBefore('identifier','control_type',gt('Control Type'),new genericcontrol('hidden',$control_type));\n }\n assign_to_template(array(\n 'form_html' => $form->toHTML(),\n 'type' => $types[$control_type],\n 'is_edit' => ($ctl == null ? 0 : 1),\n ));\n }\n }\n }",
" public function save_control() {\n $f = new forms($this->params['forms_id']);\n if ($f) {\n $ctl = null;\n $control = null;\n // get previous data from existing control\n if (isset($this->params['id'])) {\n $control = new forms_control($this->params['id']);\n if ($control) {\n $ctl = expUnserialize($control->data);\n $ctl->identifier = $control->name;\n $ctl->caption = $control->caption;\n }\n } else {\n $control = new forms_control();\n }",
" // update control with data from form\n// $ctl1 = new $this->params['control_type']();\n// $ctl1 = expCore::cast($ctl1,$ctl);\n if (!empty($ctl)) {\n $ctl1 = expCore::cast($ctl,$this->params['control_type']);\n } else {\n $ctl1 = $ctl;\n }\n if (call_user_func(array($this->params['control_type'], 'useGeneric')) == true) {\n $ctl1 = call_user_func(array('genericcontrol', 'update'), $this->params, $ctl1);\n } else {\n $ctl1 = call_user_func(array($this->params['control_type'], 'update'), $this->params, $ctl1);\n }\n if (!empty($this->params['rank']))\n $ctl1->rank = $this->params['rank'];",
" //lets make sure the name submitted by the user is not a duplicate. if so we will fail back to the form\n if (!empty($control->id)) {\n //FIXME change this to an expValidator call\n $check = $control->getControl('name=\"' . $ctl1->identifier . '\" AND forms_id=' . $f->id . ' AND id != ' . $control->id);\n if (!empty($check) && empty($this->params['id'])) {\n //expValidator::failAndReturnToForm(gt('A field with the same name already exists for this form'), $_$this->params\n flash('error', gt('A field by the name\").\" \"' . $ctl1->identifier . '\" \".gt(\"already exists on this form'));\n expHistory::returnTo('editable');\n }\n }",
" if ($ctl1 != null) {\n $name = substr(preg_replace('/[^A-Za-z0-9]/', '_', $ctl1->identifier), 0, 20);\n if (!isset($this->params['id']) && $control->countControls(\"name='\" . $name . \"' AND forms_id=\" . $this->params['forms_id']) > 0) {\n $this->params['_formError'] = gt('Identifier must be unique.');\n expSession::set('last_POST', $this->params);\n } elseif ($name == 'id' || $name == 'ip' || $name == 'user_id' || $name == 'timestamp' || $name == 'location_data') {\n $this->params['_formError'] = sprintf(gt('Identifier cannot be \"%s\".'), $name);\n expSession::set('last_POST', $this->params);\n } else {\n if (!isset($this->params['id'])) {\n $control->name = $name;\n }\n $control->caption = $ctl1->caption;\n $control->forms_id = $this->params['forms_id'];\n $control->is_static = (!empty($ctl1->is_static) ? $ctl1->is_static : 0);\n if (!empty($ctl1->pattern)) $ctl1->pattern = addslashes($ctl1->pattern);\n $control->data = serialize($ctl1);",
" if (!empty($this->params['rank']))\n $control->rank = $this->params['rank'];\n if (!empty($control->id)) {\n $control->update();\n } else {\n $control->update();\n // reset summary report to all columns\n if (!$control->is_static) {\n $f->column_names_list = null;\n $f->update();\n //FIXME we also need to update any config column_names_list settings?\n }\n }\n $f->updateTable();\n }\n }\n }\n if (!expJavascript::inAjaxAction())\n expHistory::returnTo('editable');\n else {\n echo $control->id;\n }\n }",
" public function delete_control() {\n $ctl = null;\n if (isset($this->params['id'])) {\n $ctl = new forms_control($this->params['id']);\n }",
" if ($ctl) {\n $f = new forms($ctl->forms_id);\n $ctl->delete();\n $f->updateTable();\n if (!expJavascript::inAjaxAction())\n expHistory::returnTo('editable');\n }\n }",
" public function rerank_control() {\n if (!empty($this->params['id'])) {\n $fc = new forms_control($this->params['id']);\n $fc->rerank_control($this->params['rank']);\n // if we reranked a pagecontrol, we need to check/auto-correct the rank if needed\n $fc->update(array('rank'=>$this->params['rank'])); // force auto-validation of ranks\n }\n }",
" /**\n * Output a single control to an ajax request\n */\n public function build_control() {\n if (!empty($this->params['id'])) {\n $control = new forms_control($this->params['id']);\n $form = new fakeform();\n $form->horizontal = !empty($this->config['style']) ? $this->config['style'] : false;\n $ctl = expUnserialize($control->data);\n $ctl->_id = $control->id;\n $ctl->_readonly = $control->is_readonly;\n $ctl->_controltype = get_class($ctl);\n if (isset($this->params['style']))\n $form->horizontal = $this->params['style'];\n $form->register($control->name, $control->caption, $ctl);\n $form->style_form();\n echo $form->controlToHTML($control->name);\n }\n }",
" function configure() {\n $fields = array();\n $column_names = array();\n $cols = array();\n// $forms_list = array();\n// $forms = $this->forms->find('all', 1);\n// if (!empty($forms)) foreach ($forms as $form) {\n// $forms_list[$form->id] = $form->title;\n// } else {\n// $forms_list[0] = gt('You must select a form1');\n// }\n if (!empty($this->config['column_names_list'])) {\n $cols = $this->config['column_names_list'];\n }\n $fieldlist = '[';\n if (isset($this->config['forms_id'])) {\n $fc = new forms_control();\n foreach ($fc->find('all', 'forms_id=' . $this->config['forms_id'] . ' AND is_readonly=0','rank') as $control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, 'getFieldDefinition'));\n if ($def != null) {\n $fields[$control->name] = $control->caption;\n if (in_array($control->name, $cols)) {\n $column_names[$control->name] = $control->caption;\n }\n }\n if ($control_type != 'pagecontrol' && $control_type != 'htmlcontrol') {\n $fieldlist .= '[\"{\\$fields[\\'' . $control->name . '\\']}\",\"' . $control->caption . '\",\"' . gt('Insert') . ' ' . $control->caption . ' ' . gt('Field') . '\"],';\n }\n }\n $fields['ip'] = gt('IP Address');\n if (in_array('ip', $cols)) $column_names['ip'] = gt('IP Address');\n $fields['user_id'] = gt('Posted by');\n if (in_array('user_id', $cols)) $column_names['user_id'] = gt('Posted by');\n $fields['timestamp'] = gt('Timestamp');\n if (in_array('timestamp', $cols)) $column_names['timestamp'] = gt('Timestamp');\n// if (in_array('location_data', $cols)) $column_names['location_data'] = gt('Entry Point');\n }\n $fieldlist .= ']';\n $title = gt('No Form Assigned Yet!');\n if (!empty($this->config['forms_id'])) {\n $form = $this->forms->find('first', 'id=' . $this->config['forms_id']);\n $this->config['is_saved'] = $form->is_saved;\n $this->config['table_name'] = $form->table_name;\n $title = $form->title;\n }\n assign_to_template(array(\n// 'forms_list' => $forms_list,\n 'form_title' => $title,\n 'column_names' => $column_names,\n 'fields' => $fields,\n 'fieldlist' => $fieldlist,\n ));",
" parent::configure();\n }",
" /**\n * create a new default config array using the form defaults\n */\n private function get_defaults($form) {\n if (empty($this->config)) { // NEVER overwrite an existing config\n $this->config = array();\n $config = get_object_vars($form);\n if (!empty($config['column_names_list'])) {\n $config['column_names_list'] = explode('|!|', $config['column_names_list']); //fixme $form->column_names_list is a serialized array?\n }\n unset ($config['forms_control']);\n $this->config = $config;\n }\n }",
" /**\n * get the metainfo for this module\n *\n * @return array\n */\n function metainfo() {\n global $router;",
" if (empty($router->params['action'])) return false;\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);",
" // figure out what metadata to pass back based on the action we are in.\n switch ($router->params['action']) {\n case 'showall':\n $metainfo['title'] = gt(\"Showing Form Records\") . ' - ' . SITE_TITLE;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n break;\n case 'show':\n $metainfo['title'] = gt(\"Showing Form Record\") . ' - ' . SITE_TITLE;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n break;\n default:\n $metainfo = parent::metainfo();\n }\n return $metainfo;\n }",
" public function export_csv() {\n if (!empty($this->params['id'])) {\n $f = new forms($this->params['id']);\n $this->get_defaults($f); // fills $this->config with form defaults if needed\n $items = $f->getRecords();",
" $fc = new forms_control();\n //FIXME should we default to only 5 columns or all columns? and should we pick up modules columns ($this->config) or just form defaults ($f->)\n //$f->column_names_list is a serialized array\n //$this->config['column_names_list'] is an array\n if ($this->config['column_names_list'] == '') {\n //define some default columns...\n $controls = $fc->find('all', \"forms_id=\" . $f->id . \" AND is_readonly = 0 AND is_static = 0\", \"rank\");\n// foreach (array_slice($controls, 0, 5) as $control) {\n foreach ($controls as $control) {\n// if ($this->config['column_names_list'] != '')\n// $this->config['column_names_list'] .= '|!|';\n// $this->config['column_names_list'] .= $control->name;\n $this->config['column_names_list'][$control->name] = $control->name;\n }\n }",
"// $rpt_columns2 = explode(\"|!|\", $this->config['column_names_list']);",
" $rpt_columns = array();\n // popuplate field captions/labels\n foreach ($this->config['column_names_list'] as $column) {\n $control = $fc->find('first', \"forms_id=\" . $f->id . \" AND name = '\" . $column . \"' AND is_readonly = 0 AND is_static = 0\", \"rank\");\n if (!empty($control)) {\n $rpt_columns[$control->name] = $control->caption;\n } else {\n switch ($column) {\n case 'ip':\n $rpt_columns[$column] = gt('IP Address');\n break;\n case 'referrer':\n $rpt_columns[$column] = gt('Event ID');\n break;\n case 'user_id':\n $rpt_columns[$column] = gt('Posted by');\n break;\n case 'timestamp':\n $rpt_columns[$column] = gt('Timestamp');\n break;\n }\n }\n }",
" // populate field data\n foreach ($rpt_columns as $column_name=>$column_caption) {\n if ($column_name == \"ip\" || $column_name == \"referrer\" || $column_name == \"location_data\") {\n } elseif ($column_name == \"user_id\") {\n foreach ($items as $key => $item) {\n if ($item->$column_name != 0) {\n $locUser = user::getUserById($item->$column_name);\n $item->$column_name = $locUser->username;\n } else {\n $item->$column_name = '';\n }\n $items[$key] = $item;\n }\n } elseif ($column_name == \"timestamp\") {\n// $srt = $column_name . \"_srt\";\n foreach ($items as $key => $item) {\n// $item->$srt = $item->$column_name;\n $item->$column_name = strftime(\"%m/%d/%y %T\", $item->$column_name); // needs to be in a machine readable format\n $items[$key] = $item;\n }\n } else {\n $control = $fc->find('first', \"name='\" . $column_name . \"' AND forms_id=\" . $this->params['id'],'rank');\n if ($control) {\n// $ctl = unserialize($control->data);\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n// $srt = $column_name . \"_srt\";\n// $datadef = call_user_func(array($control_type, 'getFieldDefinition'));\n foreach ($items as $key => $item) {\n //We have to add special sorting for date time columns!!!\n// if (isset($datadef[DB_FIELD_TYPE]) && $datadef[DB_FIELD_TYPE] == DB_DEF_TIMESTAMP) {\n// $item->$srt = $item->$column_name;\n// }\n $item->$column_name = call_user_func(array($control_type, 'templateFormat'), $item->$column_name, $ctl);\n $items[$key] = $item;\n }\n }\n }\n }",
" if (LANG_CHARSET == 'UTF-8') {\n $file = chr(0xEF) . chr(0xBB) . chr(0xBF); // add utf-8 signature to file to open appropriately in Excel, etc...\n } else {\n $file = \"\";\n }",
" $file .= self::sql2csv($items, $rpt_columns);",
" // CREATE A TEMP FILE\n $tmpfname = tempnam(getcwd(), \"rep\"); // Rig",
" $handle = fopen($tmpfname, \"w\");\n fwrite($handle, $file);\n fclose($handle);",
" if (file_exists($tmpfname)) {",
" ob_end_clean();",
" // This code was lifted from phpMyAdmin, but this is Open Source, right?\n // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n // It seems that other headers I've added make IE prefer octet-stream again. - RAM",
" $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : 'text/comma-separated-values;';\n header('Content-Type: ' . $mime_type . ' charset=' . LANG_CHARSET . \"'\");\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n $filesize = filesize($tmpfname);\n header('Content-length: ' . $filesize);\n header('Content-Transfer-Encoding: binary');\n// header('Content-Encoding:');\n header('Content-Disposition: attachment; filename=\"report.csv\"');\n if ($filesize) header('Content-length: ' . $filesize); // for some reason the webserver cant run stat on the files and this breaks.\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }\n //Read the file out directly\n readfile($tmpfname);",
"// if (DEVELOPMENT == 0) exit();\n unlink($tmpfname);\n exit();\n } else {\n error_log(\"error file doesn't exist\", 0);\n }\n }\n// expHistory::back();\n }",
" /**\n * This converts the sql statement into a nice CSV.\n * We grab the items array which is stored funkily in the DB in an associative array when we pull it.\n * So basically our aray looks like this:\n *\n * ITEMS\n * {[id]=>myID, [Name]=>name, [Address]=>myaddr}\n * {[id]=>myID1, [Name]=>name1, [Address]=>myaddr1}\n * {[id]=>myID2, [Name]=>name2, [Address]=>myaddr2}\n * {[id]=>myID3, [Name]=>name3, [Address]=>myaddr3}\n * {[id]=>myID4, [Name]=>name4, [Address]=>myaddr4}\n * {[id]=>myID5, [Name]=>name5, [Address]=>myaddr5}\n *\n * So by nature of the array, the keys are repetated in each line (id, name, etc)\n * So if we want to make a header row, we just run through once at the beginning and\n * use the array_keys function to strip out a functional header\n *\n * @param $items\n *\n * @param null $rptcols\n *\n * @return string\n */\n public static function sql2csv($items, $rptcols = null) {\n $str = \"\";\n foreach ($rptcols as $individual_Header) {\n if (!is_array($rptcols) || in_array($individual_Header, $rptcols)) $str .= $individual_Header . \",\"; //FIXME $individual_Header is ALWAYS in $rptcols?\n }\n $str .= \"\\r\\n\";\n foreach ($items as $item) {\n foreach ($rptcols as $key => $rowitem) {\n if (!is_array($rptcols) || property_exists($item, $key)) {\n $rowitem = str_replace(\",\", \" \", $item->$key);\n $str .= $rowitem . \",\";\n }\n } //foreach rowitem\n $str = substr($str, 0, strlen($str) - 1);\n $str .= \"\\r\\n\";\n } //end of foreach loop\n return $str;\n }",
" /**\n * Export form, controls and optionally the data table\n *\n */\n public function export_eql() {\n assign_to_template(array(\n \"id\" => $this->params['id'],\n ));\n }",
" /**\n * Export form, controls and optionally the data table\n *\n */\n public function export_eql_process() {\n if (!empty($this->params['id'])) {\n $f = new forms($this->params['id']);",
" $filename = preg_replace('/[^A-Za-z0-9_.-]/','-',$f->sef_url.'.eql');",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // This code was lifted from phpMyAdmin, but this is Open Source, right?",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n $tables = array(\n 'forms',\n 'forms_control'\n );\n if (!empty($this->params['include_data'])) {\n $tables[] = 'forms_'.$f->table_name;\n }\n echo expFile::dumpDatabase($tables, 'Form', $this->params['id']); //FIXME we need to echo inside call\n exit; // Exit, since we are exporting\n }\n// expHistory::back();\n }",
" /**\n * Import form, controls and optionally the data table\n *\n */\n public function import_eql() {\n }",
" /**\n * Import form, controls and optionally the data table\n *\n */\n public function import_eql_process() {\n $errors = array();",
" //FIXME check for duplicate form data table name before import?\n expFile::restoreDatabase($_FILES['file']['tmp_name'], $errors, 'Form');",
" if (empty($errors)) {\n flash('message',gt('Form was successfully imported'));\n } else {\n $message = gt('Form import encountered the following errors') . ':<br>';\n foreach ($errors as $error) {\n $message .= '* ' . $error . '<br>';\n }\n flash('error', $message);\n }\n expHistory::back();\n }",
" public function import_csv() {\n if (expFile::canCreate(BASE . \"tmp/test\") != SYS_FILES_SUCCESS) {\n assign_to_template(array(\n \"error\" => \"The /tmp directory is not writable. Please contact your administrator.\",\n ));\n } else {\n //Setup the arrays with the name/value pairs for the dropdown menus\n $delimiterArray = Array(\n ',' => gt('Comma'),\n ';' => gt('Semicolon'),\n ':' => gt('Colon'),\n ' ' => gt('Space'));",
" $forms = $this->forms->find('all', 1);\n $formslist = array();\n $formslist[0] = gt('--Create a New Form--');\n foreach ($forms as $aform) {\n if (!empty($aform->is_saved)) {\n $formslist[$aform->id] = $aform->title;\n if (empty($formslist[$aform->id])) $formslist[$aform->id] = gt('Untitled');\n }\n }",
"// //Setup the meta data (hidden values)\n// $form = new form();\n// $form->meta(\"controller\", \"forms\");\n// $form->meta(\"action\", \"import_csv_mapper\");\n//\n// //Register the dropdown menus\n// $form->register(\"delimiter\", gt('Delimiter Character'), new dropdowncontrol(\",\", $delimiterArray));\n// $form->register(\"upload\", gt('CSV File to Upload'), new uploadcontrol());\n// $form->register(\"use_header\", gt('First Row is a Header'), new checkboxcontrol(0, 0));\n// $form->register(\"rowstart\", gt('Forms Data begins in Row'), new textcontrol(\"1\", 1, 0, 6));\n// $form->register(\"forms_id\", gt('Target Form'), new dropdowncontrol(\"0\", $formslist));\n// $form->register(\"submit\", \"\", new buttongroupcontrol(gt('Next'), \"\", gt('Cancel')));",
" assign_to_template(array(\n// \"form_html\" => $form->tohtml(),\n 'delimiters' => $delimiterArray,\n 'forms_list' => $formslist,\n ));\n }\n }",
" public function import_csv_mapper() {\n //Check to make sure the user filled out the required input.\n if (!is_numeric($this->params[\"rowstart\"])) {\n unset($this->params[\"rowstart\"]);\n $this->params['_formError'] = gt('The starting row must be a number.');\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit('Redirecting...');\n }",
" if (!empty($this->params['forms_id'])) {\n // if we are importing to an existing form, jump to that step\n $this->import_csv_data_mapper();\n } else {\n //Get the temp directory to put the uploaded file\n $directory = \"tmp\";",
" //Get the file save it to the temp directory\n if ($_FILES[\"upload\"][\"error\"] == UPLOAD_ERR_OK) {\n //\t$file = file::update(\"upload\",$directory,null,time().\"_\".$_FILES['upload']['name']);\n $file = expFile::fileUpload(\"upload\", false, false, time() . \"_\" . $_FILES['upload']['name'], $directory.'/'); //FIXME quick hack to remove file model\n if ($file == null) {\n switch ($_FILES[\"upload\"][\"error\"]) {\n case UPLOAD_ERR_INI_SIZE:\n case UPLOAD_ERR_FORM_SIZE:\n $this->params['_formError'] = gt('The file you attempted to upload is too large. Contact your system administrator if this is a problem.');\n break;\n case UPLOAD_ERR_PARTIAL:\n $this->params['_formError'] = gt('The file was only partially uploaded.');\n break;\n case UPLOAD_ERR_NO_FILE:\n $this->params['_formError'] = gt('No file was uploaded.');\n break;\n default:\n $this->params['_formError'] = gt('A strange internal error has occurred. Please contact the Exponent Developers.');\n break;\n }\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n }\n }\n /*\n if (mime_content_type(BASE.$directory.\"/\".$file->filename) != \"text/plain\"){\n $this->params['_formError'] = \"File is not a delimited text file.\";\n expSession::set(\"last_POST\",$this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n }\n */",
" //split the line into its columns\n $headerinfo = null;\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $fh = fopen(BASE . $directory . \"/\" . $file->filename, \"r\");\n if (!empty($this->params[\"use_header\"])) $this->params[\"rowstart\"]++;\n for ($x = 0; $x < $this->params[\"rowstart\"]; $x++) {\n $lineInfo = fgetcsv($fh, 2000, $this->params[\"delimiter\"]);\n if ($x == 0 && !empty($this->params[\"use_header\"])) $headerinfo = $lineInfo;\n }\n fclose($fh);\n ini_set('auto_detect_line_endings',$line_end);",
" // get list of simple non-static controls if we are also creating a new form\n $types = expTemplate::listControlTypes(false);\n uasort($types, \"strnatcmp\");\n $types = array_merge(array('none'=>gt('--Disregard this column--')),$types);",
" //Check to see if the line got split, otherwise throw an error\n if ($lineInfo == null) {\n $this->params['_formError'] = sprintf(gt('This file does not appear to be delimited by \"%s\". <br />Please specify a different delimiter.<br /><br />'), $this->params[\"delimiter\"]);\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n } else {\n //Setup the meta data (hidden values)\n $form = new form();\n $form->meta(\"controller\", \"forms\");\n $form->meta(\"action\", \"import_csv_form_prep\"); // we are creating a new form first\n // $form->meta(\"action\", \"import_csv_data\"); // we are importing into an existing form //FIXME\n $form->meta(\"delimiter\", $this->params[\"delimiter\"]);\n $form->meta(\"filename\", $directory . \"/\" . $file->filename);\n $form->meta(\"use_header\", $this->params[\"use_header\"]);\n $form->meta(\"rowstart\", $this->params[\"rowstart\"]);\n for ($i = 0, $iMax = count($lineInfo); $i < $iMax; $i++) {\n if ($headerinfo != null) {\n $title = $headerinfo[$i] . ' (' . $lineInfo[$i] .')';\n // $label = str_replace('&', 'and', $headerinfo[$i]);\n // $label = preg_replace(\"/(-)$/\", \"\", preg_replace('/(-){2,}/', '-', strtolower(preg_replace(\"/([^0-9a-z-_\\+])/i\", '-', $label))));\n // $form->register(\"name[$i]\", null, new genericcontrol('hidden',$label));\n $form->register(\"name[$i]\", null, new genericcontrol('hidden',$headerinfo[$i]));\n } else {\n $form->register(\"name[$i]\", null, new genericcontrol('hidden','Field'.$i));\n $title = $lineInfo[$i];\n }\n $form->register(\"data[$i]\", null, new genericcontrol('hidden',$lineInfo[$i]));\n $form->register(\"control[$i]\", $title, new dropdowncontrol(\"none\", $types));\n }\n $form->register(\"submit\", \"\", new buttongroupcontrol(gt('Next'), \"\", gt('Cancel')));",
" assign_to_template(array(\n \"form_html\" => $form->tohtml(),\n ));\n }\n }\n }",
" public function import_csv_form_prep() {\n $form = new form();\n $form->meta(\"controller\", \"forms\");\n $form->meta(\"action\", \"import_csv_form_add\");\n $form->meta(\"delimiter\", $this->params[\"delimiter\"]);\n $form->meta(\"filename\", $this->params[\"filename\"]);\n $form->meta(\"use_header\", $this->params[\"use_header\"]);\n $form->meta(\"rowstart\", $this->params[\"rowstart\"]);",
" // condense our responses to present form shell for confirmation\n $form->register(\"title\", gt('Form Title'), new textcontrol(''));\n $formcontrols = array();\n foreach ($this->params['control'] as $key=>$control) {\n if ($control != \"none\") {\n $formcontrols[$key] = new stdClass();\n $formcontrols[$key]->control = $control;\n $label = str_replace('&', 'and', $this->params['name'][$key]);\n $label = preg_replace(\"/(-)$/\", \"\", preg_replace('/(-){2,}/', '_', strtolower(preg_replace(\"/([^0-9a-z-_\\+])/i\", '_', $label))));\n $formcontrols[$key]->name = $label;\n $formcontrols[$key]->caption = $this->params['name'][$key];\n $formcontrols[$key]->data = $this->params['data'][$key];\n }\n }",
" foreach ($formcontrols as $i=>$control) {\n $form->register(\"column[$i]\", ucfirst($control->control) . ' ' . gt('Field Identifier') . ' (' . $control->caption . ' - ' . $control->data . ')', new textcontrol($control->name));\n $form->register(\"control[$i]\", null, new genericcontrol('hidden',$control->control));\n $form->register(\"caption[$i]\", null, new genericcontrol('hidden',$control->caption));\n $form->register(\"data[$i]\", null, new genericcontrol('hidden',$control->data));\n }",
" $form->register(\"submit\", \"\", new buttongroupcontrol(gt('Next'), \"\", gt('Cancel')));",
" assign_to_template(array(\n \"form_html\" => $form->tohtml(),\n ));\n }",
" public function import_csv_form_add() {",
" // create the form\n $f = new forms();\n $f->title = $this->params['title'];\n $f->is_saved = true;\n $f->update();",
" // create the form controls\n foreach ($this->params['control'] as $key=>$control) {\n $params = array();\n $fc = new forms_control();\n $this->params['column'][$key] = str_replace('&', 'and', $this->params['column'][$key]);\n $this->params['column'][$key] = preg_replace(\"/(-)$/\", \"\", preg_replace('/(-){2,}/', '-', strtolower(preg_replace(\"/([^0-9a-z-_\\+])/i\", '-', $this->params['column'][$key]))));\n $fc->name = $params['identifier'] = $this->params['column'][$key];\n $fc->caption = $params['caption'] = $this->params['caption'][$key];\n $params['description'] = '';\n if ($control == 'datetimecontrol') {\n $params['showdate'] = $params['showtime'] = true;\n }\n// if ($control == 'htmlcontrol') {\n// $params['html'] = $this->params['data'][$key];\n// }\n if ($control == 'radiogroupcontrol' || $control == 'dropdowncontrol') {\n $params['default'] = $params['items'] = $this->params['data'][$key];\n }\n $fc->forms_id = $f->id;\n $ctl = null;\n $ctl = call_user_func(array($control, 'update'), $params, $ctl);\n $fc->data = serialize($ctl);\n $fc->update();\n }",
" flash('notice', gt('New Form Created'));\n $this->params['forms_id'] = $f->id;\n// unset($this->params['caption']);\n unset($this->params['control']);\n $this->import_csv_data_display();\n }",
" public function import_csv_data_mapper() {\n// global $template;\n //Get the temp directory to put the uploaded file\n $directory = \"tmp\";",
" //Get the file save it to the temp directory\n if ($_FILES[\"upload\"][\"error\"] == UPLOAD_ERR_OK) {\n //\t$file = file::update(\"upload\",$directory,null,time().\"_\".$_FILES['upload']['name']);\n $file = expFile::fileUpload(\"upload\", false, false, time() . \"_\" . $_FILES['upload']['name'], $directory.'/'); //FIXME quick hack to remove file model\n if ($file == null) {\n switch ($_FILES[\"upload\"][\"error\"]) {\n case UPLOAD_ERR_INI_SIZE:\n case UPLOAD_ERR_FORM_SIZE:\n $this->params['_formError'] = gt('The file you attempted to upload is too large. Contact your system administrator if this is a problem.');\n break;\n case UPLOAD_ERR_PARTIAL:\n $this->params['_formError'] = gt('The file was only partially uploaded.');\n break;\n case UPLOAD_ERR_NO_FILE:\n $this->params['_formError'] = gt('No file was uploaded.');\n break;\n default:\n $this->params['_formError'] = gt('A strange internal error has occurred. Please contact the Exponent Developers.');\n break;\n }\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n }\n }\n /*\n if (mime_content_type(BASE.$directory.\"/\".$file->filename) != \"text/plain\"){\n $this->params['_formError'] = \"File is not a delimited text file.\";\n expSession::set(\"last_POST\",$this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n }\n */",
" //split the line into its columns\n $headerinfo = null;\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $fh = fopen(BASE . $directory . \"/\" . $file->filename, \"r\");\n if (!empty($this->params[\"use_header\"])) $this->params[\"rowstart\"]++;\n for ($x = 0; $x < $this->params[\"rowstart\"]; $x++) {\n $lineInfo = fgetcsv($fh, 2000, $this->params[\"delimiter\"]);\n if ($x == 0 && !empty($this->params[\"use_header\"])) $headerinfo = $lineInfo;\n }\n fclose($fh);\n ini_set('auto_detect_line_endings',$line_end);",
" // pull in the form control definitions here\n $f = new forms($this->params['forms_id']);\n $fields = array(\n \"none\" => gt('--Disregard this column--'),\n );\n foreach ($f->forms_control as $control) {\n $fields[$control->name] = $control->caption;\n }",
" //Check to see if the line got split, otherwise throw an error\n if ($lineInfo == null) {\n $this->params['_formError'] = sprintf(gt('This file does not appear to be delimited by \"%s\". <br />Please specify a different delimiter.<br /><br />'), $this->params[\"delimiter\"]);\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n } else {\n //Setup the meta data (hidden values)\n $form = new form();\n $form->meta(\"controller\", \"forms\");\n $form->meta(\"action\", \"import_csv_data_display\");\n $form->meta(\"rowstart\", $this->params[\"rowstart\"]);\n $form->meta(\"use_header\", $this->params[\"use_header\"]);\n $form->meta(\"filename\", $directory . \"/\" . $file->filename);\n $form->meta(\"delimiter\", $this->params[\"delimiter\"]);\n $form->meta(\"forms_id\", $this->params[\"forms_id\"]);",
" for ($i = 0, $iMax = count($lineInfo); $i < $iMax; $i++) {\n if ($headerinfo != null) {\n $title = $headerinfo[$i] . ' (' . $lineInfo[$i] .')';\n } else {\n $title = $lineInfo[$i];\n }\n $form->register(\"column[$i]\", $title, new dropdowncontrol(\"none\", $fields));\n }\n $form->register(\"submit\", \"\", new buttongroupcontrol(gt('Next'), \"\", gt('Cancel')));",
" assign_to_template(array(\n \"form_html\" => $form->tohtml(),\n ));\n }\n }",
" public function import_csv_data_display() {\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $file = fopen(BASE . $this->params[\"filename\"], \"r\");\n $record = array();\n $records = array();\n $linenum = 1;",
" // pull in the form control definitions here\n $f = new forms($this->params['forms_id']);\n $fields = array();\n foreach ($f->forms_control as $control) {\n $fields[$control->name] = $control->caption;\n }",
" while (($filedata = fgetcsv($file, 2000, $this->params[\"delimiter\"])) != false) {\n if ($linenum >= $this->params[\"rowstart\"]) {\n $i = 0;\n foreach ($filedata as $field) {\n if (!empty($this->params[\"column\"][$i]) && $this->params[\"column\"][$i] != \"none\") {\n $colname = $this->params[\"column\"][$i];\n $record[$colname] = trim($field);\n $this->params['caption'][$i] = $fields[$colname];\n } else {\n unset($this->params['column'][$i]);\n }\n $i++;\n }\n $record['linenum'] = $linenum;\n $records[] = $record;\n }\n $linenum++;\n }\n fclose($file);\n ini_set('auto_detect_line_endings',$line_end);",
" assign_to_template(array(\n \"records\" => $records,\n \"params\" => $this->params,\n ));\n }",
" public function import_csv_data_add() {\n global $user;\n",
"",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $file = fopen(BASE . $this->params[\"filename\"], \"r\");\n $recordsdone = 0;\n $linenum = 1;\n $f = new forms($this->params['forms_id']);\n $f->updateTable();",
" $fields = array();\n $multi_item_control_items = array();\n $multi_item_control_ids = array();\n foreach ($f->forms_control as $control) {\n $fields[$control->name] = expUnserialize($control->data);\n $ctltype = get_class($fields[$control->name]);\n if (in_array($ctltype,array('radiogroupcontrol','dropdowncontrol'))) {\n if (!array_key_exists($control->id,$multi_item_control_items)) {\n $multi_item_control_items[$control->name] = null;\n $multi_item_control_ids[$control->name] = $control->id;\n }\n }\n }",
" while (($filedata = fgetcsv($file, 2000, $this->params[\"delimiter\"])) != false) {\n if ($linenum >= $this->params[\"rowstart\"] && in_array($linenum,$this->params['importrecord'])) {\n $i = 0;\n $db_data = new stdClass();\n $db_data->ip = '';\n $db_data->user_id = $user->id;\n $db_data->timestamp = time();\n $db_data->referrer = '';\n $db_data->location_data = '';\n foreach ($filedata as $field) {\n if (!empty($this->params[\"column\"][$i]) && $this->params[\"column\"][$i] != \"none\") {\n $colname = $this->params[\"column\"][$i];\n $control_type = get_class($fields[$colname]);\n $params[$colname] = $field;\n $def = call_user_func(array($control_type, \"getFieldDefinition\"));\n if (!empty($def)) {\n $db_data->$colname = call_user_func(array($control_type, 'convertData'), $colname, $params);\n }\n if (!empty($db_data->$colname) && array_key_exists($colname,$multi_item_control_items) && !in_array($db_data->$colname,$multi_item_control_items[$colname])) {\n $multi_item_control_items[$colname][] = $db_data->$colname;\n }\n }\n $i++;\n }\n $f->insertRecord($db_data);\n $recordsdone++;\n }\n $linenum++;\n }",
" fclose($file);\n ini_set('auto_detect_line_endings',$line_end);",
" // update multi-item forms controls\n if (!empty($multi_item_control_ids)) {\n foreach ($multi_item_control_ids as $key=>$control_id) {\n $fc = new forms_control($control_id);\n $ctl = expUnserialize($fc->data);\n $ctl->items = $multi_item_control_items[$key];\n $fc->data = serialize($ctl);\n $fc->update();\n }\n }\n unlink(BASE . $this->params[\"filename\"]);\n flash('notice', $recordsdone.' '.gt('Records Imported'));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class formsController extends expController {\n public $useractions = array(\n 'enterdata' => 'Input Records',\n 'showall' => 'Show All Records',\n 'show' => 'Show a Single Record',\n );",
" protected $add_permissions = array(\n 'viewdata' => \"View Data\",\n 'enter_data' => \"Enter Data\", // slight naming variation to not fully restrict enterdata method\n );\n protected $manage_permissions = array(\n 'design' => 'Design Form',\n );",
" public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n// 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
"",
"// public $codequality = 'beta';",
" static function displayname() {\n return gt(\"Forms\");\n }",
" static function description() {\n return gt(\"Allows the creation of forms that can be emailed, or even viewed if they are optionally stored in the database\");\n }",
" static function author() {\n return \"Dave Leffler\";\n }",
" static function isSearchable() {\n return false;\n }",
" function searchName() {\n return gt(\"Forms\");\n }",
" function searchCategory() {\n return gt('Form Data');\n }",
" static function requiresConfiguration()\n {\n return true;\n }",
" public function showall() {\n if ((!empty($this->config['unrestrict_view']) || expPermissions::check('viewdata', $this->loc))) {\n expHistory::set('viewable', $this->params);\n $f = null;\n if (!empty($this->config)) {\n $f = $this->forms->find('first', 'id=' . $this->config['forms_id']);\n } elseif (!empty($this->params['title'])) {",
" $f = $this->forms->find('first', 'sef_url=\"' . expString::escape($this->params['title']) . '\"');",
" $this->get_defaults($f);\n } elseif (!empty($this->params['id'])) {\n $f = $this->forms->find('first', 'id=' . $this->params['id']);\n $this->get_defaults($f);\n }",
" if (!empty($f)) {\n if (empty($this->config['report_filter']) && empty($this->params['filter'])) { // allow for param of 'filter' also\n $where = '1';\n } elseif (!empty($this->params['filter'])) {",
" $where = expString::escape($this->params['filter']);",
" } else {\n $where = $this->config['report_filter'];\n }\n $fc = new forms_control();\n if (empty($this->config['column_names_list'])) {\n //define some default columns...\n $controls = $fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly=0 AND is_static = 0', 'rank');\n foreach (array_slice($controls, 0, 5) as $control) { // default to only first 5 columns\n $this->config['column_names_list'][] = $control->name;\n }\n }",
" // pre-process records\n $items = $f->selectRecordsArray($where);\n $columns = array();\n foreach ($this->config['column_names_list'] as $column_name) {\n if ($column_name == \"ip\") {\n// $columns[gt('IP Address')] = 'ip';\n $columns['ip'] = gt('IP Address');\n } elseif ($column_name == \"referrer\") {\n// $columns[gt('Referrer')] = 'referrer';\n $columns['referrer'] = gt('Referrer');\n } elseif ($column_name == \"location_data\") {\n// $columns[gt('Entry Point')] = 'location_data';\n $columns['location_data'] = gt('Entry Point');\n } elseif ($column_name == \"user_id\") {\n foreach ($items as $key => $item) {\n if ($item[$column_name] != 0) {\n $locUser = user::getUserById($item[$column_name]);\n $item[$column_name] = $locUser->username;\n } else {\n $item[$column_name] = '';\n }\n $items[$key] = $item;\n }\n// $columns[gt('Posted by')] = 'user_id';\n $columns['user_id'] = gt('Posted by');\n } elseif ($column_name == \"timestamp\") {\n foreach ($items as $key => $item) {\n $item[$column_name] = strftime(DISPLAY_DATETIME_FORMAT, $item[$column_name]);\n $items[$key] = $item;\n }\n// $columns[gt('Timestamp')] = 'timestamp';\n $columns['timestamp'] = gt('Timestamp');\n } else {\n $control = $fc->find('first', \"name='\" . $column_name . \"' AND forms_id=\" . $f->id, 'rank');\n if ($control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n foreach ($items as $key => $item) {\n //We have to add special sorting for date time columns!!!\n $item[$column_name] = @call_user_func(\n array($control_type, 'templateFormat'),\n $item[$column_name],\n $ctl\n );\n $items[$key] = $item;\n }\n// $columns[$control->caption] = $column_name;\n $columns[$column_name] = $control->caption;\n }\n }\n }",
" $page = new expPaginator(\n array(\n 'records' => $items,\n 'where' => 1,\n// 'limit' => (isset($this->params['limit']) && $this->params['limit'] != '') ? $this->params['limit'] : 10,\n 'order' => (isset($this->params['order']) && $this->params['order'] != '') ? $this->params['order'] : (!empty($this->config['order']) ? $this->config['order'] : 'id'),\n 'dir' => (isset($this->params['dir']) && $this->params['dir'] != '') ? $this->params['dir'] : 'ASC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'src' => $this->loc->src,\n 'columns' => $columns\n )\n );",
" assign_to_template(\n array(\n// \"backlink\" => expHistory::getLastNotEditable(),\n \"backlink\" => expHistory::getLast('viewable'),\n \"f\" => $f,\n \"page\" => $page,\n \"title\" => !empty($this->config['report_name']) ? $this->config['report_name'] : '',\n \"description\" => !empty($this->config['report_desc']) ? $this->config['report_desc'] : null,\n \"filtered\" => !empty($this->config['report_filter']) ? $this->config['report_filter'] : ''\n )\n );\n }\n } else {\n assign_to_template(array(\n \"error\" => 1,\n ));\n }\n }",
" public function show() {\n if (!empty($this->config['unrestrict_view']) || expPermissions::check('viewdata', $this->loc)) {\n expHistory::set('viewable', $this->params);\n $f = null;\n if (!empty($this->config)) {\n $f = $this->forms->find('first', 'id=' . $this->config['forms_id']);\n } elseif (!empty($this->params['forms_id'])) {\n $f = $this->forms->find('first', 'id=' . $this->params['forms_id']);\n } elseif (!empty($this->params['title'])) {",
" $f = $this->forms->find('first', 'sef_url=\"' . expString::escape($this->params['title']) . '\"');",
" redirect_to(array('controller' => 'forms', 'action' => 'enterdata', 'forms_id' => $f->id));\n }",
" if (!empty($f)) {\n $fc = new forms_control();\n $controls = $fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly=0 AND is_static = 0', 'rank');\n $id = !empty($this->params['id']) ? $this->params['id'] : null;\n $data = $f->getRecord($id);",
" $fields = array();\n $captions = array();\n if ($controls && $data) {\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $control_type = get_class($ctl);\n $name = $c->name;\n $fields[$name] = call_user_func(array($control_type, 'templateFormat'), $data->$name, $ctl);\n $captions[$name] = $c->caption;\n }",
" // system added fields\n $captions['ip'] = gt('IP Address');\n $captions['timestamp'] = gt('Timestamp');\n $captions['user_id'] = gt('Posted by');\n $fields['ip'] = $data->ip;\n $fields['timestamp'] = strftime(DISPLAY_DATETIME_FORMAT, $data->timestamp);\n $locUser = user::getUserById($data->user_id);\n $fields['user_id'] = !empty($locUser->username) ? $locUser->username : '';",
" // add a browse other records (next/prev) feature here\n $field = !empty($this->config['order']) ? $this->config['order'] : 'id';\n $data->next = $f->getRecord($field . ' > ' . $data->$field . ' ORDER BY ' . $field);\n if (!empty($data->next) && $data->next != $data->id) {\n assign_to_template(\n array(\n \"next\" => $data->next,\n )\n );\n }\n $data->prev = $f->getRecord($field . ' < ' . $data->$field . ' ORDER BY ' . $field . ' DESC');\n if (!empty($data->prev) && $data->prev != $data->id) {\n assign_to_template(\n array(\n \"prev\" => $data->prev,\n )\n );\n }\n }",
" $count = $f->countRecords();\n assign_to_template(\n array(\n // \"backlink\"=>expHistory::getLastNotEditable(),\n // 'backlink' => expHistory::getLast('editable'),\n 'backlink' => makeLink(expHistory::getBack(1)),\n \"f\" => $f,\n // \"record_id\" => $this->params['id'],\n \"record_id\" => !empty($data->id) ? $data->id : null,\n \"title\" => !empty($this->config['report_name']) ? $this->config['report_name'] : gt(\n 'Viewing Record'\n ),\n \"description\" => !empty($this->config['report_desc']) ? $this->config['report_desc'] : null,\n 'fields' => $fields,\n 'captions' => $captions,\n \"count\" => $count,\n 'is_email' => 0,\n \"css\" => file_get_contents(BASE . \"framework/core/assets/css/tables.css\"),\n )\n );\n }\n } else {\n assign_to_template(array(\n \"error\" => 1,\n ));\n }\n }",
" public function enter_data() {\n $this->enterdata();\n }",
" public function enterdata() {\n if (empty($this->config['restrict_enter']) || expPermissions::check('enterdata', $this->loc)) {",
" global $user;",
" expHistory::set('viewable', $this->params);\n $f = null;\n if (!empty($this->config)) {\n $f = $this->forms->find('first', 'id=' . $this->config['forms_id']);\n } elseif (!empty($this->params['forms_id'])) {\n $f = $this->forms->find('first', 'id=' . $this->params['forms_id']);\n $this->get_defaults($f);\n }",
" if (!empty($f)) {\n $form = new form();\n $form->id = $f->sef_url;\n $form->horizontal = !empty($this->config['style']);\n if (!empty($this->params['id'])) {\n $fc = new forms_control();\n $controls = $fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly = 0 AND is_static = 0','rank');\n $data = $f->getRecord($this->params['id']);\n } else {\n if (!empty($f->forms_control)) {\n $controls = $f->forms_control;\n } else {\n $controls = array();\n }\n $data = expSession::get('forms_data_' . $f->id);\n }\n // display list of email addresses\n if (!empty($this->config['select_email'])) {\n //Building Email List...\n $emaillist = array();\n if (!empty($this->config['user_list'])) foreach ($this->config['user_list'] as $c) {\n $u = user::getUserById($c);\n if (!empty($u->email)) {\n if (!empty($u->firstname) || !empty($u->lastname)) {\n $title = $u->firstname . ' ' . $u->lastname . ' ('. $u->email . ')';\n } else {\n $title = $u->username . ' ('. $u->email . ')';\n }\n $emaillist[$u->email] = $title;\n }\n }\n if (!empty($this->config['group_list'])) foreach ($this->config['group_list'] as $c) {\n// $grpusers = group::getUsersInGroup($c);\n// foreach ($grpusers as $u) {\n// $emaillist[] = $u->email;\n// }\n $g = group::getGroupById($c);\n $emaillist[$c] = $g->name;\n }\n if (!empty($this->config['address_list'])) foreach ($this->config['address_list'] as $c) {\n $emaillist[$c] = $c;\n }\n //This is an easy way to remove duplicates\n $emaillist = array_flip(array_flip($emaillist));\n $emaillist = array_map('trim', $emaillist);\n $emaillist = array_reverse($emaillist, true);\n if (empty($this->config['select_exclude_all']))\n $emaillist[0] = gt('All Addresses');\n $emaillist = array_reverse($emaillist, true);\n if (!empty($this->config['select_dropdown']))\n $form->register('email_dest', gt('Send Response to'), new dropdowncontrol('', $emaillist));\n else\n $form->register('email_dest', gt('Send Response to'), new radiogroupcontrol('', $emaillist));\n }\n// $paged = false;\n foreach ($controls as $key=>$c) {\n $ctl = expUnserialize($c->data);\n $ctl->_id = $c->id;\n $ctl->_readonly = $c->is_readonly;\n $ctl->_ishidden = !empty($ctl->is_hidden) && empty($this->params['id']); // hide it if entering new data\n if (!empty($this->params['id'])) {\n if ($c->is_readonly == 0) {\n $name = $c->name;\n if ($c->is_static == 0) {\n $ctl->default = $data->$name;\n }\n }\n } else {\n if (!empty($data[$c->name])) $ctl->default = $data[$c->name];\n }\n if ($key == 0) $ctl->focus = true; // first control gets the focus\n $form->register($c->name, $c->caption, $ctl);\n// if (get_class($ctl) == 'pagecontrol') $paged = true;\n }",
" // if we are editing an existing record we'll need to do recaptcha here since we won't call confirm_data\n if (!empty($this->params['id'])) {\n $antispam = '';\n if (SITE_USE_ANTI_SPAM && ANTI_SPAM_CONTROL == 'recaptcha') {\n // make sure we have the proper config.\n if (!defined('RECAPTCHA_PUB_KEY')) {\n $antispam .= '<h2 style=\"color:red\">' . gt('reCaptcha configuration is missing the public key.') . '</h2>';\n }\n if ($user->isLoggedIn() && ANTI_SPAM_USERS_SKIP == 1) {\n // skip it for logged on users based on config\n } else {\n // include the library and show the form control\n require_once(BASE . 'external/ReCaptcha/autoload.php'); //FIXME not sure we need this here\n $re_theme = (RECAPTCHA_THEME == 'dark') ? 'dark' : 'light';\n $antispam .= '<input type=\"hidden\" class=\"hiddenRecaptcha required\" name=\"hiddenRecaptcha\" id=\"hiddenRecaptcha\">';\n $antispam .= '<div class=\"g-recaptcha\" data-sitekey=\"' . RECAPTCHA_PUB_KEY . '\" data-theme=\"' . $re_theme . '\"></div>';\n $antispam .= '<script type=\"text/javascript\" src=\"https://www.google.com/recaptcha/api.js?hl=' . LOCALE . '\" async defer></script>';\n $antispam .= '<p>' . gt('Fill out the above security question to submit your form.') . '</p>';\n }\n }\n $form->register(uniqid(''), '', new htmlcontrol($antispam));\n }",
" if (empty($this->config['submitbtn'])) $this->config['submitbtn'] = gt('Submit');\n if (!empty($this->params['id'])) {\n $cancel = gt('Cancel');\n $form->meta('action', 'submit_data');\n $form->meta('isedit', 1);\n $form->meta('data_id', $data->id);\n $form->location($this->loc);\n assign_to_template(array(\n 'edit_mode' => 1,\n ));\n } else {\n $cancel = '';\n $form->meta(\"action\", \"confirm_data\");\n }\n if (empty($this->config['submitbtn'])) $this->config['submitbtn'] = gt('Submit');\n if (empty($this->config['resetbtn'])) $this->config['resetbtn'] = '';\n $form->register(\"submit\", \"\", new buttongroupcontrol($this->config['submitbtn'], $this->config['resetbtn'], $cancel, 'finish'));",
" $form->meta(\"m\", $this->loc->mod);\n $form->meta(\"s\", $this->loc->src);\n $form->meta(\"i\", $this->loc->int);\n $form->meta(\"id\", $f->id);\n $formmsg = '';\n $form->location(expCore::makeLocation(\"forms\", $this->loc->src, $this->loc->int));\n if (count($controls) == 0) {\n $form->controls['submit']->disabled = true;\n $formmsg .= gt('This form is blank. Select \"Design Form\" to add input fields.') . '<br>';\n } elseif (empty($f->is_saved) && empty($this->config['is_email'])) {\n $form->controls['submit']->disabled = true;\n $formmsg .= gt('There are no actions assigned to this form. Select \"Configure Settings\" then either select \"Email Form Data\" and/or \"Save Submissions to Database\".');\n }\n $count = $f->countRecords();\n if ($formmsg) {\n flash('notice', $formmsg);\n }\n if (empty($this->config['description'])) $this->config['description'] = '';\n assign_to_template(array(\n \"description\" => $this->config['description'],\n \"form_html\" => $form->toHTML(),\n \"form\" => $f,\n \"count\" => $count,\n// 'paged' => $paged,\n ));\n }\n } else {\n assign_to_template(array(\n \"error\" => 1,\n ));\n }\n }",
" public function confirm_data() {\n $f = new forms($this->params['id']);\n $cols = $f->forms_control;\n $counts = array();\n $responses = array();\n $captions = array();",
" foreach ($cols as $col) {\n $newupload = false;\n $coldef = expUnserialize($col->data);\n $coldata = new ReflectionClass($coldef);\n if (empty($coldef->is_hidden)) {\n $coltype = $coldata->getName();\n if ($coltype == 'uploadcontrol' && !empty($_FILES)) {\n $newupload = true;\n $value = call_user_func(array($coltype, 'parseData'), $col->name, $_FILES, true);\n } else {\n $value = call_user_func(array($coltype, 'parseData'), $col->name, $this->params, true);\n }\n $value = call_user_func(array($coltype, 'templateFormat'), $value, $coldef); // convert parsed value to user readable\n //eDebug($value);\n// $counts[$col->caption] = isset($counts[$col->caption]) ? $counts[$col->caption] + 1 : 1;\n// $num = $counts[$col->caption] > 1 ? $counts[$col->caption] : '';",
" if (!empty($this->params[$col->name])) {\n// if ($coltype == 'checkboxcontrol') {\n// $responses[$col->caption . $num] = gt('Yes');\n// } else {\n// $responses[$col->caption . $num] = $value;\n $responses[$col->name] = $value;\n $captions[$col->name] = $col->caption;\n// }\n } else {\n if ($coltype == 'checkboxcontrol') {\n// $responses[$col->caption . $num] = gt('No');\n $responses[$col->name] = gt('No');\n $captions[$col->name] = $col->caption;\n } elseif ($coltype == 'datetimecontrol' || $coltype == 'calendarcontrol') {\n// $responses[$col->name] = $value;\n $responses[$col->name] = $value;\n $captions[$col->name] = $col->caption;\n } elseif ($coltype == 'uploadcontrol') {\n if ($newupload) {\n $this->params[$col->name] = PATH_RELATIVE . call_user_func(\n array($coltype, 'moveFile'),\n $col->name,\n $_FILES,\n true\n );\n }\n // $value = call_user_func(array($coltype,'buildDownloadLink'),$this->params[$col->name],$_FILES[$col->name]['name'],true);\n //eDebug($value);\n// $responses[$col->caption . $num] = $_FILES[$col->name]['name'];\n// $responses[$col->name] = $_FILES[$col->name]['name'];\n// $responses[$col->name] = $this->params[$col->name];\n $responses[$col->name] = call_user_func(array($coltype, 'templateFormat'), $this->params[$col->name], null); // convert parsed value to user readable\n $captions[$col->name] = $col->caption;\n } elseif ($coltype != 'htmlcontrol' && $coltype != 'pagecontrol') {\n// $responses[$col->caption . $num] = '';\n $responses[$col->name] = '';\n $captions[$col->name] = $col->caption;\n }\n }\n }\n }",
" // remove some post data we don't want to pass thru to the form\n unset(\n $this->params['controller'],\n $this->params['action'],\n $this->params['view']\n );\n foreach ($this->params as $k => $v) {\n // $this->params[$k]=htmlentities(htmlspecialchars($v,ENT_COMPAT,LANG_CHARSET));\n $this->params[$k] = htmlspecialchars($v, ENT_COMPAT, LANG_CHARSET);\n }\n expSession::set('forms_data_' . $this->params['id'], $this->params);",
" assign_to_template(array(\n 'responses' => $responses,\n 'captions' => $captions,\n 'postdata' => $this->params,\n ));\n }",
" public function submit_data() {\n // Check for form errors\n $this->params['manual_redirect'] = true;\n if (!expValidator::check_antispam($this->params)) {\n flash('error', gt('Security Validation Failed'));\n expHistory::back();\n }",
" global $db, $user;\n $f = new forms($this->params['id']);\n $fc = new forms_control();\n $controls = $fc->find('all', \"forms_id=\" . $f->id . \" AND is_readonly=0\",'rank');\n $this->get_defaults($f);",
" $db_data = new stdClass();\n $emailFields = array();\n $captions = array();\n $attachments = array();\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, \"getFieldDefinition\"));\n if ($def != null) {\n $emailValue = htmlspecialchars_decode(call_user_func(array($control_type, 'parseData'), $c->name, $this->params, true));\n $value = stripslashes(expString::escape($emailValue));",
" //eDebug($value);\n $varname = $c->name;\n $db_data->$varname = $value;\n // $fields[$c->name] = call_user_func(array($control_type,'templateFormat'),$value,$ctl);\n if (!$ctl->is_hidden) {\n $emailFields[$c->name] = call_user_func(array($control_type, 'templateFormat'), $value, $ctl);\n $captions[$c->name] = $c->caption;\n if (strtolower($c->name) == \"email\" && expValidator::isValidEmail($value)) {\n $from = $value;\n }\n if (strtolower($c->name) == \"name\") {\n $from_name = $value;\n }\n if (get_class($ctl) == 'uploadcontrol') {\n $attachments[] = htmlspecialchars_decode($this->params[$c->name]);\n }\n }\n }\n }",
" if (!isset($this->params['data_id']) || (isset($this->params['data_id']) && expPermissions::check(\"editdata\", $f->loc))) {\n if (!empty($f->is_saved)) {\n if (isset($this->params['data_id'])) {\n //if this is an edit we remove the record and insert a new one.\n $olddata = $f->getRecord($this->params['data_id']);\n $db_data->ip = $olddata->ip;\n $db_data->user_id = $olddata->user_id;\n $db_data->timestamp = $olddata->timestamp;\n $db_data->referrer = $olddata->referrer;\n $db_data->location_data = $olddata->location_data;\n $f->deleteRecord($this->params['data_id']);\n } else {\n $db_data->ip = $_SERVER['REMOTE_ADDR'];\n if (expSession::loggedIn()) {\n $db_data->user_id = $user->id;\n $from = $user->email;\n $from_name = $user->firstname . \" \" . $user->lastname . \" (\" . $user->username . \")\";\n } else {\n $db_data->user_id = 0;\n }\n $db_data->timestamp = time();\n $referrer = $db->selectValue(\"sessionticket\", \"referrer\", \"ticket = '\" . expSession::getTicketString() . \"'\");\n $db_data->referrer = $referrer;\n $location_data = null;\n if (!empty($this->params['src'])) {\n $mod = !empty($this->params['module']) ? $this->params['module'] : $this->params['controller'];\n expCore::makeLocation($mod,$this->params['src'],$this->params['int']);\n }\n $db_data->location_data = $location_data;\n }\n $f->insertRecord($db_data);\n } else {\n $referrer = $db->selectValue(\"sessionticket\", \"referrer\", \"ticket = '\" . expSession::getTicketString() . \"'\");\n }",
" //Email stuff here...\n //Don't send email if this is an edit.\n if (!empty($this->config['is_email']) && !isset($this->params['data_id'])) {\n //Building Email List...\n $emaillist = array();\n if (!empty($this->config['select_email']) && !empty($this->params['email_dest'])) {\n if (strval(intval($this->params['email_dest'])) == strval($this->params['email_dest'])) {\n foreach (group::getUsersInGroup($this->params['email_dest']) as $locUser) {\n if ($locUser->email != '') $emaillist[$locUser->email] = trim(user::getUserAttribution($locUser->id));\n }\n } else {\n $emaillist[] = $this->params['email_dest'];\n }\n } else { // send to all form addressee's\n $emaillist = array();\n if (!empty($this->config['user_list'])) foreach ($this->config['user_list'] as $c) {\n $u = user::getUserById($c);\n $emaillist[$u->email] = trim(user::getUserAttribution($u->id));\n }\n if (!empty($this->config['group_list'])) foreach ($this->config['group_list'] as $c) {\n $grpusers = group::getUsersInGroup($c);\n foreach ($grpusers as $u) {\n $emaillist[$u->email] = trim(user::getUserAttribution($u->id));\n }\n }\n if (!empty($this->config['address_list'])) foreach ($this->config['address_list'] as $c) {\n $emaillist[] = $c;\n }\n }\n //This is an easy way to remove duplicates\n $emaillist = array_flip(array_flip($emaillist));\n $emaillist = array_map('trim', $emaillist);",
" if (empty($this->config['report_def'])) {\n $msgtemplate = expTemplate::get_template_for_action($this, 'email/default_report', $this->loc);",
" } else {\n $msgtemplate = expTemplate::get_template_for_action($this, 'email/custom_report', $this->loc);\n $msgtemplate->assign('template', $this->config['report_def']);\n }\n $msgtemplate->assign(\"fields\", $emailFields);\n $msgtemplate->assign(\"captions\", $captions);\n $msgtemplate->assign('title', $this->config['report_name']);\n $msgtemplate->assign(\"is_email\", 1);\n if (!empty($referrer)) $msgtemplate->assign(\"referrer\", $referrer);\n $emailText = $msgtemplate->render();\n $emailText = trim(strip_tags(str_replace(array(\"<br />\", \"<br>\", \"br/>\"), \"\\n\", $emailText)));\n $msgtemplate->assign(\"css\", file_get_contents(BASE . \"framework/core/assets/css/tables.css\"));\n $emailHtml = $msgtemplate->render();",
" if (empty($from)) {\n $from = trim(SMTP_FROMADDRESS);\n }\n if (empty($from_name)) {\n $from_name = trim(ORGANIZATION_NAME);\n }\n // $headers = array(\n // \"MIME-Version\"=>\"1.0\",\n // \"Content-type\"=>\"text/html; charset=\".LANG_CHARSET\n // );\n if (count($emaillist)) {\n $mail = new expMail();\n if (!empty($attachments)) {\n foreach ($attachments as $attachment) {\n if (strlen(PATH_RELATIVE) != 1)\n $attachment = str_replace(PATH_RELATIVE, '', $attachment); // strip relative path for links coming from templates\n if (file_exists(BASE . $attachment)) {\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $ftype = finfo_file($finfo, $relpath . $attachment);\n// finfo_close($finfo);\n $mail->attach_file_on_disk(BASE . $attachment, expFile::getMimeType($attachment));\n }\n }\n }\n $mail->quickSend(array(\n //\t'headers'=>$headers,\n 'html_message' => $emailHtml,\n \"text_message\" => $emailText,\n 'to' => $emaillist,\n 'from' => array(trim($from) => $from_name),\n 'subject' => $this->config['subject'],\n ));\n }\n }",
" if (!empty($this->config['is_auto_respond']) && !isset($this->params['data_id']) && !empty($db_data->email)) {\n if (empty($from)) {\n $from = trim(SMTP_FROMADDRESS);\n }\n if (empty($from_name)) {\n $from_name = trim(ORGANIZATION_NAME);\n }\n// $headers = array(\n// \"MIME-Version\" => \"1.0\",\n// \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n// );",
" $tmsg = trim(strip_tags(str_replace(array(\"<br />\", \"<br>\", \"br/>\"), \"\\n\", $this->config['auto_respond_body'])));",
" if ($this->config['auto_respond_form'])",
" $tmsg .= \"\\n\" . $emailText;\n $hmsg = $this->config['auto_respond_body'];",
" if ($this->config['auto_respond_form'])",
" $hmsg .= \"\\n\" . $emailHtml;\n $mail = new expMail();\n $mail->quickSend(array(\n// 'headers' => $headers,\n \"text_message\" => $tmsg,\n 'html_message' => $hmsg,\n 'to' => $db_data->email,\n 'from' => array(trim($from) => $from_name),\n 'subject' => $this->config['auto_respond_subject'],\n ));\n }",
" // clear the users post data from the session.\n expSession::un_set('forms_data_' . $f->id);",
" //If is a new post show response, otherwise redirect to the flow.\n if (!isset($this->params['data_id'])) {\n if (empty($this->config['response'])) $this->config['response'] = gt('Thanks for your submission');\n assign_to_template(array(\n \"backlink\"=>expHistory::getLastNotEditable(),\n \"response_html\"=>$this->config['response'],\n ));\n } else {\n flash('message', gt('Record was updated!'));\n // expHistory::back();\n expHistory::returnTo('editable');\n }\n }\n }",
" /**\n * delete item in saved data\n *\n */\n function delete() {\n if (empty($this->params['id']) || empty($this->params['forms_id'])) {\n flash('error', gt('Missing id for the') . ' ' . gt('item') . ' ' . gt('you would like to delete'));\n expHistory::back();\n }",
" $f = new forms($this->params['forms_id']);\n $f->deleteRecord($this->params['id']);",
" expHistory::back();\n }",
" /**\n * delete all items in saved data\n *\n */\n function delete_records() {\n if (empty($this->params['forms_id'])) {\n flash('error', gt('Missing id for the') . ' ' . gt('form records') . ' ' . gt('you would like to delete'));\n expHistory::back();\n }",
" $f = new forms($this->params['forms_id']);\n $recs = $f->getRecords();\n foreach ($recs as $rec) {\n $f->deleteRecord($rec->id);\n }",
" flash('message', gt('All form records were deleted!'));\n expHistory::back();\n }",
" /**\n * Manage site forms\n *\n */\n public function manage() {\n expHistory::set('manageable', $this->params);\n $forms = $this->forms->find('all', 1);\n foreach($forms as $key=>$f) {\n if (!empty($f->table_name) && $f->tableExists() ) {\n $forms[$key]->count = $f->countRecords();\n }\n $forms[$key]->control_count = count($f->forms_control);\n }",
" assign_to_template(array(\n 'select' => !empty($this->params['select']),\n 'forms' => $forms\n ));\n }",
" /**\n * Assign selected form to current module\n *\n */\n public function activate() {\n // assign new form assigned\n $this->config['forms_id'] = $this->params['id'];\n // set default settings for this form\n $f = new forms($this->params['id']);\n if (!empty($f->description)) $this->config['description'] = $f->description;\n if (!empty($f->response)) $this->config['response'] = $f->response;\n if (!empty($f->report_name)) $this->config['report_name'] = $f->report_name;\n if (!empty($f->report_desc)) $this->config['report_desc'] = $f->report_desc;\n if (!empty($f->column_names_list)) $this->config['column_names_list'] = $f->column_names_list;\n if (!empty($f->report_def)) $this->config['report_def'] = $f->report_def;",
" // setup and save the config\n $config = new expConfig($this->loc);\n $config->update(array('config' => $this->config));",
" expHistory::back();\n }",
" public function edit_form() {\n expHistory::set('editable', $this->params);\n if (!empty($this->params['id'])) {\n $f = $this->forms->find('first', 'id=' . $this->params['id']);\n } else {\n $f = new forms();\n }\n $fields = array();\n $column_names = array();\n $cols = array();",
" if (!empty($f->column_names_list)) {\n $cols = explode('|!|', $f->column_names_list);\n }\n $fc = new forms_control();\n foreach ($fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly=0','rank') as $control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, 'getFieldDefinition'));\n if ($def != null) {\n $fields[$control->name] = $control->caption;\n if (in_array($control->name, $cols)) {\n $column_names[$control->name] = $control->caption;\n }\n }\n }\n $fields['ip'] = gt('IP Address');\n if (in_array('ip', $cols)) $column_names['ip'] = gt('IP Address');\n $fields['user_id'] = gt('Posted by');\n if (in_array('user_id', $cols)) $column_names['user_id'] = gt('Posted by');\n $fields['timestamp'] = gt('Timestamp');\n if (in_array('timestamp', $cols)) $column_names['timestamp'] = gt('Timestamp');\n// if (in_array('location_data', $cols)) $column_names['location_data'] = gt('Entry Point');",
" if (!empty($this->params['copy'])) {\n $f->old_id = $f->id;\n $f->id = null;\n $f->sef_url = null;\n $f->is_saved = false;\n $f->table_name = null;\n }\n $fieldlist = '[';\n if (isset($f->id)) {\n $fc = new forms_control();\n foreach ($fc->find('all', 'forms_id=' . $f->id . ' AND is_readonly=0','rank') as $control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, 'getFieldDefinition'));\n if ($def != null) {\n $fields[$control->name] = $control->caption;\n if (in_array($control->name, $cols)) {\n $column_names[$control->name] = $control->caption;\n }\n }\n if ($control_type != 'pagecontrol' && $control_type != 'htmlcontrol') {\n $fieldlist .= '[\"{\\$fields[\\'' . $control->name . '\\']}\",\"' . $control->caption . '\",\"' . gt('Insert') . ' ' . $control->caption . ' ' . gt('Field') . '\"],';\n }\n }\n $fields['ip'] = gt('IP Address');\n if (in_array('ip', $cols)) $column_names['ip'] = gt('IP Address');\n $fields['user_id'] = gt('Posted by');\n if (in_array('user_id', $cols)) $column_names['user_id'] = gt('Posted by');\n $fields['timestamp'] = gt('Timestamp');\n if (in_array('timestamp', $cols)) $column_names['timestamp'] = gt('Timestamp');\n// if (in_array('location_data', $cols)) $column_names['location_data'] = gt('Entry Point');\n }\n $fieldlist .= ']';",
" assign_to_template(array(\n 'column_names' => $column_names,\n 'fields' => $fields,\n 'form' => $f,\n 'fieldlist' => $fieldlist,\n ));\n }",
" /**\n * Updates the form\n */\n public function update_form() {\n $this->forms->update($this->params);\n if (!empty($this->params['old_id'])) {\n // copy all the controls to the new form\n $fc = new forms_control();\n $controls = $fc->find('all','forms_id='.$this->params['old_id'],'rank');\n foreach ($controls as $control) {\n $control->id = null;\n $control->forms_id = $this->forms->id;\n $control->update();\n }\n }\n// if (!empty($this->params['is_saved']) && empty($this->params['table_name'])) {\n if (!empty($this->params['is_saved'])) {\n // we are now saving data to the database and need to create it first\n// $form = new forms($this->params['id']);\n $this->params['table_name'] = $this->forms->updateTable();\n// $this->params['_validate'] = false; // we don't want a check for unique sef_name\n// parent::update(); // now with a form tablename\n }\n expHistory::back();\n }",
" public function delete_form() {\n expHistory::set('editable', $this->params);\n $modelname = $this->basemodel_name;\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the') . ' ' . $modelname . ' ' . gt('you would like to delete'));\n expHistory::back();\n }\n $form = new $modelname($this->params['id']);",
" $form->delete();\n expHistory::returnTo('manageable');\n }",
" public function design_form() {\n if (!empty($this->params['id'])) {\n expHistory::set('editable', $this->params);\n $f = new forms($this->params['id']);\n $controls = $f->forms_control;",
" $form = new fakeform();\n $form->horizontal = !empty($this->config['style']) ? $this->config['style'] : false;\n if (isset($this->params['style']))\n $form->horizontal = $this->params['style'];\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $ctl->_id = $c->id;\n $ctl->_readonly = $c->is_readonly;\n $ctl->_controltype = get_class($ctl);\n $form->register($c->name, $c->caption, $ctl);\n }",
" $types = expTemplate::listControlTypes();\n $types[\".break\"] = gt('Static - Spacer');\n $types[\".line\"] = gt('Static - Horizontal Line');\n uasort($types, \"strnatcmp\");\n if (!bs3())\n array_unshift($types, '[' . gt('Please Select' . ']'));",
" $forms_list = array();\n $forms = $f->find('all', 1);\n if (!empty($forms)) foreach ($forms as $frm) {\n if ($frm->id != $f->id)\n $forms_list[$frm->id] = $frm->title;\n }",
" assign_to_template(array(\n 'form' => $f,\n 'forms_list' => $forms_list,\n 'form_html' => $form->toHTML($f->id),\n 'backlink' => expHistory::getLastNotEditable(),\n 'types' => $types,\n 'style' => $form->horizontal\n ));\n }\n }",
" public function edit_control() {\n $f = new forms($this->params['forms_id']);\n if ($f) {\n if (bs2()) {\n expCSS::pushToHead(array(\n \"corecss\"=>\"forms-bootstrap\"\n ));\n } elseif (bs3()) {\n expCSS::pushToHead(array(\n \"corecss\"=>\"forms-bootstrap3\"\n ));\n } else {\n expCSS::pushToHead(array(\n \"corecss\" => \"forms\",\n ));\n }",
" if (isset($this->params['control_type']) && $this->params['control_type']{0} == \".\") {\n // there is nothing to edit for these type controls, so add it then return\n $htmlctl = new htmlcontrol();\n $htmlctl->identifier = uniqid(\"\");\n $htmlctl->caption = \"\";\n if (!empty($this->params['rank']))\n $htmlctl->rank = $this->params['rank'];\n switch ($this->params['control_type']) {\n case \".break\":\n $htmlctl->html = \"<br />\";\n break;\n case \".line\":\n $htmlctl->html = \"<hr size='1' />\";\n break;\n }\n $ctl = new forms_control();\n $ctl->name = uniqid(\"\");\n $ctl->caption = \"\";\n $ctl->data = serialize($htmlctl);\n $ctl->forms_id = $f->id;\n $ctl->is_readonly = 1;\n if (!empty($this->params['rank']))\n $ctl->rank = $this->params['rank'];\n $ctl->update();\n if (!expJavascript::inAjaxAction())\n expHistory::returnTo('editable');\n else { // we need a graceful exit for inAjaxAction\n assign_to_template(array(\n 'form_html' => ucfirst(substr($this->params['control_type'],1)) . ' ' . gt('control was added to form') . '<input type=\"hidden\" name=\"staticcontrol\" id=\"'.$ctl->id.'\" />',\n 'type' => 'static',\n ));\n }\n } else {\n $control_type = \"\";\n $ctl = null;\n if (isset($this->params['id'])) {\n $control = new forms_control($this->params['id']);\n if ($control) {\n $ctl = expUnserialize($control->data);\n $ctl->identifier = $control->name;\n $ctl->caption = $control->caption;\n $ctl->id = $control->id;\n $control_type = get_class($ctl);\n $f->id = $control->forms_id;\n }\n }\n if ($control_type == \"\") $control_type = $this->params['control_type'];\n $form = call_user_func(array($control_type, \"form\"), $ctl);\n $form->location($this->loc);\n if ($ctl) {\n if (isset($form->controls['identifier']->disabled)) $form->controls['identifier']->disabled = true;\n $form->meta(\"id\", $ctl->id);\n $form->meta(\"identifier\", $ctl->identifier);\n }\n $form->meta(\"action\", \"save_control\");\n// $form->meta('control_type', $control_type);\n $form->meta('forms_id', $f->id);\n $types = expTemplate::listControlTypes();\n $othertypes = expTemplate::listSimilarControlTypes($control_type);\n if (count($othertypes) > 1) {\n $otherlist = new dropdowncontrol($control_type,$othertypes);\n $form->registerBefore('identifier','control_type',gt('Control Type'),$otherlist);\n } else {\n $form->registerBefore('identifier','control_type',gt('Control Type'),new genericcontrol('hidden',$control_type));\n }\n assign_to_template(array(\n 'form_html' => $form->toHTML(),\n 'type' => $types[$control_type],\n 'is_edit' => ($ctl == null ? 0 : 1),\n ));\n }\n }\n }",
" public function save_control() {\n $f = new forms($this->params['forms_id']);\n if ($f) {\n $ctl = null;\n $control = null;\n // get previous data from existing control\n if (isset($this->params['id'])) {\n $control = new forms_control($this->params['id']);\n if ($control) {\n $ctl = expUnserialize($control->data);\n $ctl->identifier = $control->name;\n $ctl->caption = $control->caption;\n }\n } else {\n $control = new forms_control();\n }",
" // update control with data from form\n// $ctl1 = new $this->params['control_type']();\n// $ctl1 = expCore::cast($ctl1,$ctl);\n if (!empty($ctl)) {\n $ctl1 = expCore::cast($ctl,$this->params['control_type']);\n } else {\n $ctl1 = $ctl;\n }\n if (call_user_func(array($this->params['control_type'], 'useGeneric')) == true) {\n $ctl1 = call_user_func(array('genericcontrol', 'update'), $this->params, $ctl1);\n } else {\n $ctl1 = call_user_func(array($this->params['control_type'], 'update'), $this->params, $ctl1);\n }\n if (!empty($this->params['rank']))\n $ctl1->rank = $this->params['rank'];",
" //lets make sure the name submitted by the user is not a duplicate. if so we will fail back to the form\n if (!empty($control->id)) {\n //FIXME change this to an expValidator call\n $check = $control->getControl('name=\"' . $ctl1->identifier . '\" AND forms_id=' . $f->id . ' AND id != ' . $control->id);\n if (!empty($check) && empty($this->params['id'])) {\n //expValidator::failAndReturnToForm(gt('A field with the same name already exists for this form'), $_$this->params\n flash('error', gt('A field by the name\").\" \"' . $ctl1->identifier . '\" \".gt(\"already exists on this form'));\n expHistory::returnTo('editable');\n }\n }",
" if ($ctl1 != null) {\n $name = substr(preg_replace('/[^A-Za-z0-9]/', '_', $ctl1->identifier), 0, 20);\n if (!isset($this->params['id']) && $control->countControls(\"name='\" . $name . \"' AND forms_id=\" . $this->params['forms_id']) > 0) {\n $this->params['_formError'] = gt('Identifier must be unique.');\n expSession::set('last_POST', $this->params);\n } elseif ($name == 'id' || $name == 'ip' || $name == 'user_id' || $name == 'timestamp' || $name == 'location_data') {\n $this->params['_formError'] = sprintf(gt('Identifier cannot be \"%s\".'), $name);\n expSession::set('last_POST', $this->params);\n } else {\n if (!isset($this->params['id'])) {\n $control->name = $name;\n }\n $control->caption = $ctl1->caption;\n $control->forms_id = $this->params['forms_id'];\n $control->is_static = (!empty($ctl1->is_static) ? $ctl1->is_static : 0);\n if (!empty($ctl1->pattern)) $ctl1->pattern = addslashes($ctl1->pattern);\n $control->data = serialize($ctl1);",
" if (!empty($this->params['rank']))\n $control->rank = $this->params['rank'];\n if (!empty($control->id)) {\n $control->update();\n } else {\n $control->update();\n // reset summary report to all columns\n if (!$control->is_static) {\n $f->column_names_list = null;\n $f->update();\n //FIXME we also need to update any config column_names_list settings?\n }\n }\n $f->updateTable();\n }\n }\n }\n if (!expJavascript::inAjaxAction())\n expHistory::returnTo('editable');\n else {\n echo $control->id;\n }\n }",
" public function delete_control() {\n $ctl = null;\n if (isset($this->params['id'])) {\n $ctl = new forms_control($this->params['id']);\n }",
" if ($ctl) {\n $f = new forms($ctl->forms_id);\n $ctl->delete();\n $f->updateTable();\n if (!expJavascript::inAjaxAction())\n expHistory::returnTo('editable');\n }\n }",
" public function rerank_control() {\n if (!empty($this->params['id'])) {\n $fc = new forms_control($this->params['id']);\n $fc->rerank_control($this->params['rank']);\n // if we reranked a pagecontrol, we need to check/auto-correct the rank if needed\n $fc->update(array('rank'=>$this->params['rank'])); // force auto-validation of ranks\n }\n }",
" /**\n * Output a single control to an ajax request\n */\n public function build_control() {\n if (!empty($this->params['id'])) {\n $control = new forms_control($this->params['id']);\n $form = new fakeform();\n $form->horizontal = !empty($this->config['style']) ? $this->config['style'] : false;\n $ctl = expUnserialize($control->data);\n $ctl->_id = $control->id;\n $ctl->_readonly = $control->is_readonly;\n $ctl->_controltype = get_class($ctl);\n if (isset($this->params['style']))\n $form->horizontal = $this->params['style'];\n $form->register($control->name, $control->caption, $ctl);\n $form->style_form();\n echo $form->controlToHTML($control->name);\n }\n }",
" function configure() {\n $fields = array();\n $column_names = array();\n $cols = array();\n// $forms_list = array();\n// $forms = $this->forms->find('all', 1);\n// if (!empty($forms)) foreach ($forms as $form) {\n// $forms_list[$form->id] = $form->title;\n// } else {\n// $forms_list[0] = gt('You must select a form1');\n// }\n if (!empty($this->config['column_names_list'])) {\n $cols = $this->config['column_names_list'];\n }\n $fieldlist = '[';\n if (isset($this->config['forms_id'])) {\n $fc = new forms_control();\n foreach ($fc->find('all', 'forms_id=' . $this->config['forms_id'] . ' AND is_readonly=0','rank') as $control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, 'getFieldDefinition'));\n if ($def != null) {\n $fields[$control->name] = $control->caption;\n if (in_array($control->name, $cols)) {\n $column_names[$control->name] = $control->caption;\n }\n }\n if ($control_type != 'pagecontrol' && $control_type != 'htmlcontrol') {\n $fieldlist .= '[\"{\\$fields[\\'' . $control->name . '\\']}\",\"' . $control->caption . '\",\"' . gt('Insert') . ' ' . $control->caption . ' ' . gt('Field') . '\"],';\n }\n }\n $fields['ip'] = gt('IP Address');\n if (in_array('ip', $cols)) $column_names['ip'] = gt('IP Address');\n $fields['user_id'] = gt('Posted by');\n if (in_array('user_id', $cols)) $column_names['user_id'] = gt('Posted by');\n $fields['timestamp'] = gt('Timestamp');\n if (in_array('timestamp', $cols)) $column_names['timestamp'] = gt('Timestamp');\n// if (in_array('location_data', $cols)) $column_names['location_data'] = gt('Entry Point');\n }\n $fieldlist .= ']';\n $title = gt('No Form Assigned Yet!');\n if (!empty($this->config['forms_id'])) {\n $form = $this->forms->find('first', 'id=' . $this->config['forms_id']);\n $this->config['is_saved'] = $form->is_saved;\n $this->config['table_name'] = $form->table_name;\n $title = $form->title;\n }\n assign_to_template(array(\n// 'forms_list' => $forms_list,\n 'form_title' => $title,\n 'column_names' => $column_names,\n 'fields' => $fields,\n 'fieldlist' => $fieldlist,\n ));",
" parent::configure();\n }",
" /**\n * create a new default config array using the form defaults\n */\n private function get_defaults($form) {\n if (empty($this->config)) { // NEVER overwrite an existing config\n $this->config = array();\n $config = get_object_vars($form);\n if (!empty($config['column_names_list'])) {\n $config['column_names_list'] = explode('|!|', $config['column_names_list']); //fixme $form->column_names_list is a serialized array?\n }\n unset ($config['forms_control']);\n $this->config = $config;\n }\n }",
" /**\n * get the metainfo for this module\n *\n * @return array\n */\n function metainfo() {\n global $router;",
" if (empty($router->params['action'])) return false;\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);",
" // figure out what metadata to pass back based on the action we are in.\n switch ($router->params['action']) {\n case 'showall':\n $metainfo['title'] = gt(\"Showing Form Records\") . ' - ' . SITE_TITLE;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n break;\n case 'show':\n $metainfo['title'] = gt(\"Showing Form Record\") . ' - ' . SITE_TITLE;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n break;\n default:\n $metainfo = parent::metainfo();\n }\n return $metainfo;\n }",
" public function export_csv() {\n if (!empty($this->params['id'])) {\n $f = new forms($this->params['id']);\n $this->get_defaults($f); // fills $this->config with form defaults if needed\n $items = $f->getRecords();",
" $fc = new forms_control();\n //FIXME should we default to only 5 columns or all columns? and should we pick up modules columns ($this->config) or just form defaults ($f->)\n //$f->column_names_list is a serialized array\n //$this->config['column_names_list'] is an array\n if ($this->config['column_names_list'] == '') {\n //define some default columns...\n $controls = $fc->find('all', \"forms_id=\" . $f->id . \" AND is_readonly = 0 AND is_static = 0\", \"rank\");\n// foreach (array_slice($controls, 0, 5) as $control) {\n foreach ($controls as $control) {\n// if ($this->config['column_names_list'] != '')\n// $this->config['column_names_list'] .= '|!|';\n// $this->config['column_names_list'] .= $control->name;\n $this->config['column_names_list'][$control->name] = $control->name;\n }\n }",
"// $rpt_columns2 = explode(\"|!|\", $this->config['column_names_list']);",
" $rpt_columns = array();\n // popuplate field captions/labels\n foreach ($this->config['column_names_list'] as $column) {\n $control = $fc->find('first', \"forms_id=\" . $f->id . \" AND name = '\" . $column . \"' AND is_readonly = 0 AND is_static = 0\", \"rank\");\n if (!empty($control)) {\n $rpt_columns[$control->name] = $control->caption;\n } else {\n switch ($column) {\n case 'ip':\n $rpt_columns[$column] = gt('IP Address');\n break;\n case 'referrer':\n $rpt_columns[$column] = gt('Event ID');\n break;\n case 'user_id':\n $rpt_columns[$column] = gt('Posted by');\n break;\n case 'timestamp':\n $rpt_columns[$column] = gt('Timestamp');\n break;\n }\n }\n }",
" // populate field data\n foreach ($rpt_columns as $column_name=>$column_caption) {\n if ($column_name == \"ip\" || $column_name == \"referrer\" || $column_name == \"location_data\") {\n } elseif ($column_name == \"user_id\") {\n foreach ($items as $key => $item) {\n if ($item->$column_name != 0) {\n $locUser = user::getUserById($item->$column_name);\n $item->$column_name = $locUser->username;\n } else {\n $item->$column_name = '';\n }\n $items[$key] = $item;\n }\n } elseif ($column_name == \"timestamp\") {\n// $srt = $column_name . \"_srt\";\n foreach ($items as $key => $item) {\n// $item->$srt = $item->$column_name;\n $item->$column_name = strftime(\"%m/%d/%y %T\", $item->$column_name); // needs to be in a machine readable format\n $items[$key] = $item;\n }\n } else {\n $control = $fc->find('first', \"name='\" . $column_name . \"' AND forms_id=\" . $this->params['id'],'rank');\n if ($control) {\n// $ctl = unserialize($control->data);\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n// $srt = $column_name . \"_srt\";\n// $datadef = call_user_func(array($control_type, 'getFieldDefinition'));\n foreach ($items as $key => $item) {\n //We have to add special sorting for date time columns!!!\n// if (isset($datadef[DB_FIELD_TYPE]) && $datadef[DB_FIELD_TYPE] == DB_DEF_TIMESTAMP) {\n// $item->$srt = $item->$column_name;\n// }\n $item->$column_name = call_user_func(array($control_type, 'templateFormat'), $item->$column_name, $ctl);\n $items[$key] = $item;\n }\n }\n }\n }",
" if (LANG_CHARSET == 'UTF-8') {\n $file = chr(0xEF) . chr(0xBB) . chr(0xBF); // add utf-8 signature to file to open appropriately in Excel, etc...\n } else {\n $file = \"\";\n }",
" $file .= self::sql2csv($items, $rpt_columns);",
" // CREATE A TEMP FILE\n $tmpfname = tempnam(getcwd(), \"rep\"); // Rig",
" $handle = fopen($tmpfname, \"w\");\n fwrite($handle, $file);\n fclose($handle);",
" if (file_exists($tmpfname)) {",
" ob_end_clean();",
" // This code was lifted from phpMyAdmin, but this is Open Source, right?\n // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n // It seems that other headers I've added make IE prefer octet-stream again. - RAM",
" $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : 'text/comma-separated-values;';\n header('Content-Type: ' . $mime_type . ' charset=' . LANG_CHARSET . \"'\");\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n $filesize = filesize($tmpfname);\n header('Content-length: ' . $filesize);\n header('Content-Transfer-Encoding: binary');\n// header('Content-Encoding:');\n header('Content-Disposition: attachment; filename=\"report.csv\"');\n if ($filesize) header('Content-length: ' . $filesize); // for some reason the webserver cant run stat on the files and this breaks.\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }\n //Read the file out directly\n readfile($tmpfname);",
"// if (DEVELOPMENT == 0) exit();\n unlink($tmpfname);\n exit();\n } else {\n error_log(\"error file doesn't exist\", 0);\n }\n }\n// expHistory::back();\n }",
" /**\n * This converts the sql statement into a nice CSV.\n * We grab the items array which is stored funkily in the DB in an associative array when we pull it.\n * So basically our aray looks like this:\n *\n * ITEMS\n * {[id]=>myID, [Name]=>name, [Address]=>myaddr}\n * {[id]=>myID1, [Name]=>name1, [Address]=>myaddr1}\n * {[id]=>myID2, [Name]=>name2, [Address]=>myaddr2}\n * {[id]=>myID3, [Name]=>name3, [Address]=>myaddr3}\n * {[id]=>myID4, [Name]=>name4, [Address]=>myaddr4}\n * {[id]=>myID5, [Name]=>name5, [Address]=>myaddr5}\n *\n * So by nature of the array, the keys are repetated in each line (id, name, etc)\n * So if we want to make a header row, we just run through once at the beginning and\n * use the array_keys function to strip out a functional header\n *\n * @param $items\n *\n * @param null $rptcols\n *\n * @return string\n */\n public static function sql2csv($items, $rptcols = null) {\n $str = \"\";\n foreach ($rptcols as $individual_Header) {\n if (!is_array($rptcols) || in_array($individual_Header, $rptcols)) $str .= $individual_Header . \",\"; //FIXME $individual_Header is ALWAYS in $rptcols?\n }\n $str .= \"\\r\\n\";\n foreach ($items as $item) {\n foreach ($rptcols as $key => $rowitem) {\n if (!is_array($rptcols) || property_exists($item, $key)) {\n $rowitem = str_replace(\",\", \" \", $item->$key);\n $str .= $rowitem . \",\";\n }\n } //foreach rowitem\n $str = substr($str, 0, strlen($str) - 1);\n $str .= \"\\r\\n\";\n } //end of foreach loop\n return $str;\n }",
" /**\n * Export form, controls and optionally the data table\n *\n */\n public function export_eql() {\n assign_to_template(array(\n \"id\" => $this->params['id'],\n ));\n }",
" /**\n * Export form, controls and optionally the data table\n *\n */\n public function export_eql_process() {\n if (!empty($this->params['id'])) {\n $f = new forms($this->params['id']);",
" $filename = preg_replace('/[^A-Za-z0-9_.-]/','-',$f->sef_url.'.eql');",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // This code was lifted from phpMyAdmin, but this is Open Source, right?",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n $tables = array(\n 'forms',\n 'forms_control'\n );\n if (!empty($this->params['include_data'])) {\n $tables[] = 'forms_'.$f->table_name;\n }\n echo expFile::dumpDatabase($tables, 'Form', $this->params['id']); //FIXME we need to echo inside call\n exit; // Exit, since we are exporting\n }\n// expHistory::back();\n }",
" /**\n * Import form, controls and optionally the data table\n *\n */\n public function import_eql() {\n }",
" /**\n * Import form, controls and optionally the data table\n *\n */\n public function import_eql_process() {\n $errors = array();",
" //FIXME check for duplicate form data table name before import?\n expFile::restoreDatabase($_FILES['file']['tmp_name'], $errors, 'Form');",
" if (empty($errors)) {\n flash('message',gt('Form was successfully imported'));\n } else {\n $message = gt('Form import encountered the following errors') . ':<br>';\n foreach ($errors as $error) {\n $message .= '* ' . $error . '<br>';\n }\n flash('error', $message);\n }\n expHistory::back();\n }",
" public function import_csv() {\n if (expFile::canCreate(BASE . \"tmp/test\") != SYS_FILES_SUCCESS) {\n assign_to_template(array(\n \"error\" => \"The /tmp directory is not writable. Please contact your administrator.\",\n ));\n } else {\n //Setup the arrays with the name/value pairs for the dropdown menus\n $delimiterArray = Array(\n ',' => gt('Comma'),\n ';' => gt('Semicolon'),\n ':' => gt('Colon'),\n ' ' => gt('Space'));",
" $forms = $this->forms->find('all', 1);\n $formslist = array();\n $formslist[0] = gt('--Create a New Form--');\n foreach ($forms as $aform) {\n if (!empty($aform->is_saved)) {\n $formslist[$aform->id] = $aform->title;\n if (empty($formslist[$aform->id])) $formslist[$aform->id] = gt('Untitled');\n }\n }",
"// //Setup the meta data (hidden values)\n// $form = new form();\n// $form->meta(\"controller\", \"forms\");\n// $form->meta(\"action\", \"import_csv_mapper\");\n//\n// //Register the dropdown menus\n// $form->register(\"delimiter\", gt('Delimiter Character'), new dropdowncontrol(\",\", $delimiterArray));\n// $form->register(\"upload\", gt('CSV File to Upload'), new uploadcontrol());\n// $form->register(\"use_header\", gt('First Row is a Header'), new checkboxcontrol(0, 0));\n// $form->register(\"rowstart\", gt('Forms Data begins in Row'), new textcontrol(\"1\", 1, 0, 6));\n// $form->register(\"forms_id\", gt('Target Form'), new dropdowncontrol(\"0\", $formslist));\n// $form->register(\"submit\", \"\", new buttongroupcontrol(gt('Next'), \"\", gt('Cancel')));",
" assign_to_template(array(\n// \"form_html\" => $form->tohtml(),\n 'delimiters' => $delimiterArray,\n 'forms_list' => $formslist,\n ));\n }\n }",
" public function import_csv_mapper() {\n //Check to make sure the user filled out the required input.\n if (!is_numeric($this->params[\"rowstart\"])) {\n unset($this->params[\"rowstart\"]);\n $this->params['_formError'] = gt('The starting row must be a number.');\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit('Redirecting...');\n }",
" if (!empty($this->params['forms_id'])) {\n // if we are importing to an existing form, jump to that step\n $this->import_csv_data_mapper();\n } else {\n //Get the temp directory to put the uploaded file\n $directory = \"tmp\";",
" //Get the file save it to the temp directory\n if ($_FILES[\"upload\"][\"error\"] == UPLOAD_ERR_OK) {\n //\t$file = file::update(\"upload\",$directory,null,time().\"_\".$_FILES['upload']['name']);\n $file = expFile::fileUpload(\"upload\", false, false, time() . \"_\" . $_FILES['upload']['name'], $directory.'/'); //FIXME quick hack to remove file model\n if ($file == null) {\n switch ($_FILES[\"upload\"][\"error\"]) {\n case UPLOAD_ERR_INI_SIZE:\n case UPLOAD_ERR_FORM_SIZE:\n $this->params['_formError'] = gt('The file you attempted to upload is too large. Contact your system administrator if this is a problem.');\n break;\n case UPLOAD_ERR_PARTIAL:\n $this->params['_formError'] = gt('The file was only partially uploaded.');\n break;\n case UPLOAD_ERR_NO_FILE:\n $this->params['_formError'] = gt('No file was uploaded.');\n break;\n default:\n $this->params['_formError'] = gt('A strange internal error has occurred. Please contact the Exponent Developers.');\n break;\n }\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n }\n }\n /*\n if (mime_content_type(BASE.$directory.\"/\".$file->filename) != \"text/plain\"){\n $this->params['_formError'] = \"File is not a delimited text file.\";\n expSession::set(\"last_POST\",$this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n }\n */",
" //split the line into its columns\n $headerinfo = null;\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $fh = fopen(BASE . $directory . \"/\" . $file->filename, \"r\");\n if (!empty($this->params[\"use_header\"])) $this->params[\"rowstart\"]++;\n for ($x = 0; $x < $this->params[\"rowstart\"]; $x++) {\n $lineInfo = fgetcsv($fh, 2000, $this->params[\"delimiter\"]);\n if ($x == 0 && !empty($this->params[\"use_header\"])) $headerinfo = $lineInfo;\n }\n fclose($fh);\n ini_set('auto_detect_line_endings',$line_end);",
" // get list of simple non-static controls if we are also creating a new form\n $types = expTemplate::listControlTypes(false);\n uasort($types, \"strnatcmp\");\n $types = array_merge(array('none'=>gt('--Disregard this column--')),$types);",
" //Check to see if the line got split, otherwise throw an error\n if ($lineInfo == null) {\n $this->params['_formError'] = sprintf(gt('This file does not appear to be delimited by \"%s\". <br />Please specify a different delimiter.<br /><br />'), $this->params[\"delimiter\"]);\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n } else {\n //Setup the meta data (hidden values)\n $form = new form();\n $form->meta(\"controller\", \"forms\");\n $form->meta(\"action\", \"import_csv_form_prep\"); // we are creating a new form first\n // $form->meta(\"action\", \"import_csv_data\"); // we are importing into an existing form //FIXME\n $form->meta(\"delimiter\", $this->params[\"delimiter\"]);\n $form->meta(\"filename\", $directory . \"/\" . $file->filename);\n $form->meta(\"use_header\", $this->params[\"use_header\"]);\n $form->meta(\"rowstart\", $this->params[\"rowstart\"]);\n for ($i = 0, $iMax = count($lineInfo); $i < $iMax; $i++) {\n if ($headerinfo != null) {\n $title = $headerinfo[$i] . ' (' . $lineInfo[$i] .')';\n // $label = str_replace('&', 'and', $headerinfo[$i]);\n // $label = preg_replace(\"/(-)$/\", \"\", preg_replace('/(-){2,}/', '-', strtolower(preg_replace(\"/([^0-9a-z-_\\+])/i\", '-', $label))));\n // $form->register(\"name[$i]\", null, new genericcontrol('hidden',$label));\n $form->register(\"name[$i]\", null, new genericcontrol('hidden',$headerinfo[$i]));\n } else {\n $form->register(\"name[$i]\", null, new genericcontrol('hidden','Field'.$i));\n $title = $lineInfo[$i];\n }\n $form->register(\"data[$i]\", null, new genericcontrol('hidden',$lineInfo[$i]));\n $form->register(\"control[$i]\", $title, new dropdowncontrol(\"none\", $types));\n }\n $form->register(\"submit\", \"\", new buttongroupcontrol(gt('Next'), \"\", gt('Cancel')));",
" assign_to_template(array(\n \"form_html\" => $form->tohtml(),\n ));\n }\n }\n }",
" public function import_csv_form_prep() {\n $form = new form();\n $form->meta(\"controller\", \"forms\");\n $form->meta(\"action\", \"import_csv_form_add\");\n $form->meta(\"delimiter\", $this->params[\"delimiter\"]);\n $form->meta(\"filename\", $this->params[\"filename\"]);\n $form->meta(\"use_header\", $this->params[\"use_header\"]);\n $form->meta(\"rowstart\", $this->params[\"rowstart\"]);",
" // condense our responses to present form shell for confirmation\n $form->register(\"title\", gt('Form Title'), new textcontrol(''));\n $formcontrols = array();\n foreach ($this->params['control'] as $key=>$control) {\n if ($control != \"none\") {\n $formcontrols[$key] = new stdClass();\n $formcontrols[$key]->control = $control;\n $label = str_replace('&', 'and', $this->params['name'][$key]);\n $label = preg_replace(\"/(-)$/\", \"\", preg_replace('/(-){2,}/', '_', strtolower(preg_replace(\"/([^0-9a-z-_\\+])/i\", '_', $label))));\n $formcontrols[$key]->name = $label;\n $formcontrols[$key]->caption = $this->params['name'][$key];\n $formcontrols[$key]->data = $this->params['data'][$key];\n }\n }",
" foreach ($formcontrols as $i=>$control) {\n $form->register(\"column[$i]\", ucfirst($control->control) . ' ' . gt('Field Identifier') . ' (' . $control->caption . ' - ' . $control->data . ')', new textcontrol($control->name));\n $form->register(\"control[$i]\", null, new genericcontrol('hidden',$control->control));\n $form->register(\"caption[$i]\", null, new genericcontrol('hidden',$control->caption));\n $form->register(\"data[$i]\", null, new genericcontrol('hidden',$control->data));\n }",
" $form->register(\"submit\", \"\", new buttongroupcontrol(gt('Next'), \"\", gt('Cancel')));",
" assign_to_template(array(\n \"form_html\" => $form->tohtml(),\n ));\n }",
" public function import_csv_form_add() {",
" // create the form\n $f = new forms();\n $f->title = $this->params['title'];\n $f->is_saved = true;\n $f->update();",
" // create the form controls\n foreach ($this->params['control'] as $key=>$control) {\n $params = array();\n $fc = new forms_control();\n $this->params['column'][$key] = str_replace('&', 'and', $this->params['column'][$key]);\n $this->params['column'][$key] = preg_replace(\"/(-)$/\", \"\", preg_replace('/(-){2,}/', '-', strtolower(preg_replace(\"/([^0-9a-z-_\\+])/i\", '-', $this->params['column'][$key]))));\n $fc->name = $params['identifier'] = $this->params['column'][$key];\n $fc->caption = $params['caption'] = $this->params['caption'][$key];\n $params['description'] = '';\n if ($control == 'datetimecontrol') {\n $params['showdate'] = $params['showtime'] = true;\n }\n// if ($control == 'htmlcontrol') {\n// $params['html'] = $this->params['data'][$key];\n// }\n if ($control == 'radiogroupcontrol' || $control == 'dropdowncontrol') {\n $params['default'] = $params['items'] = $this->params['data'][$key];\n }\n $fc->forms_id = $f->id;\n $ctl = null;\n $ctl = call_user_func(array($control, 'update'), $params, $ctl);\n $fc->data = serialize($ctl);\n $fc->update();\n }",
" flash('notice', gt('New Form Created'));\n $this->params['forms_id'] = $f->id;\n// unset($this->params['caption']);\n unset($this->params['control']);\n $this->import_csv_data_display();\n }",
" public function import_csv_data_mapper() {\n// global $template;\n //Get the temp directory to put the uploaded file\n $directory = \"tmp\";",
" //Get the file save it to the temp directory\n if ($_FILES[\"upload\"][\"error\"] == UPLOAD_ERR_OK) {\n //\t$file = file::update(\"upload\",$directory,null,time().\"_\".$_FILES['upload']['name']);\n $file = expFile::fileUpload(\"upload\", false, false, time() . \"_\" . $_FILES['upload']['name'], $directory.'/'); //FIXME quick hack to remove file model\n if ($file == null) {\n switch ($_FILES[\"upload\"][\"error\"]) {\n case UPLOAD_ERR_INI_SIZE:\n case UPLOAD_ERR_FORM_SIZE:\n $this->params['_formError'] = gt('The file you attempted to upload is too large. Contact your system administrator if this is a problem.');\n break;\n case UPLOAD_ERR_PARTIAL:\n $this->params['_formError'] = gt('The file was only partially uploaded.');\n break;\n case UPLOAD_ERR_NO_FILE:\n $this->params['_formError'] = gt('No file was uploaded.');\n break;\n default:\n $this->params['_formError'] = gt('A strange internal error has occurred. Please contact the Exponent Developers.');\n break;\n }\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n }\n }\n /*\n if (mime_content_type(BASE.$directory.\"/\".$file->filename) != \"text/plain\"){\n $this->params['_formError'] = \"File is not a delimited text file.\";\n expSession::set(\"last_POST\",$this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n }\n */",
" //split the line into its columns\n $headerinfo = null;\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $fh = fopen(BASE . $directory . \"/\" . $file->filename, \"r\");\n if (!empty($this->params[\"use_header\"])) $this->params[\"rowstart\"]++;\n for ($x = 0; $x < $this->params[\"rowstart\"]; $x++) {\n $lineInfo = fgetcsv($fh, 2000, $this->params[\"delimiter\"]);\n if ($x == 0 && !empty($this->params[\"use_header\"])) $headerinfo = $lineInfo;\n }\n fclose($fh);\n ini_set('auto_detect_line_endings',$line_end);",
" // pull in the form control definitions here\n $f = new forms($this->params['forms_id']);\n $fields = array(\n \"none\" => gt('--Disregard this column--'),\n );\n foreach ($f->forms_control as $control) {\n $fields[$control->name] = $control->caption;\n }",
" //Check to see if the line got split, otherwise throw an error\n if ($lineInfo == null) {\n $this->params['_formError'] = sprintf(gt('This file does not appear to be delimited by \"%s\". <br />Please specify a different delimiter.<br /><br />'), $this->params[\"delimiter\"]);\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n } else {\n //Setup the meta data (hidden values)\n $form = new form();\n $form->meta(\"controller\", \"forms\");\n $form->meta(\"action\", \"import_csv_data_display\");\n $form->meta(\"rowstart\", $this->params[\"rowstart\"]);\n $form->meta(\"use_header\", $this->params[\"use_header\"]);\n $form->meta(\"filename\", $directory . \"/\" . $file->filename);\n $form->meta(\"delimiter\", $this->params[\"delimiter\"]);\n $form->meta(\"forms_id\", $this->params[\"forms_id\"]);",
" for ($i = 0, $iMax = count($lineInfo); $i < $iMax; $i++) {\n if ($headerinfo != null) {\n $title = $headerinfo[$i] . ' (' . $lineInfo[$i] .')';\n } else {\n $title = $lineInfo[$i];\n }\n $form->register(\"column[$i]\", $title, new dropdowncontrol(\"none\", $fields));\n }\n $form->register(\"submit\", \"\", new buttongroupcontrol(gt('Next'), \"\", gt('Cancel')));",
" assign_to_template(array(\n \"form_html\" => $form->tohtml(),\n ));\n }\n }",
" public function import_csv_data_display() {\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $file = fopen(BASE . $this->params[\"filename\"], \"r\");\n $record = array();\n $records = array();\n $linenum = 1;",
" // pull in the form control definitions here\n $f = new forms($this->params['forms_id']);\n $fields = array();\n foreach ($f->forms_control as $control) {\n $fields[$control->name] = $control->caption;\n }",
" while (($filedata = fgetcsv($file, 2000, $this->params[\"delimiter\"])) != false) {\n if ($linenum >= $this->params[\"rowstart\"]) {\n $i = 0;\n foreach ($filedata as $field) {\n if (!empty($this->params[\"column\"][$i]) && $this->params[\"column\"][$i] != \"none\") {\n $colname = $this->params[\"column\"][$i];\n $record[$colname] = trim($field);\n $this->params['caption'][$i] = $fields[$colname];\n } else {\n unset($this->params['column'][$i]);\n }\n $i++;\n }\n $record['linenum'] = $linenum;\n $records[] = $record;\n }\n $linenum++;\n }\n fclose($file);\n ini_set('auto_detect_line_endings',$line_end);",
" assign_to_template(array(\n \"records\" => $records,\n \"params\" => $this->params,\n ));\n }",
" public function import_csv_data_add() {\n global $user;\n",
" if (!empty($this->params['filename']) && (strpos($this->params['filename'], 'tmp/') === false || strpos($this->params['folder'], '..') !== false)) {\n header('Location: ' . URL_FULL);\n exit(); // attempt to hack the site\n }",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $file = fopen(BASE . $this->params[\"filename\"], \"r\");\n $recordsdone = 0;\n $linenum = 1;\n $f = new forms($this->params['forms_id']);\n $f->updateTable();",
" $fields = array();\n $multi_item_control_items = array();\n $multi_item_control_ids = array();\n foreach ($f->forms_control as $control) {\n $fields[$control->name] = expUnserialize($control->data);\n $ctltype = get_class($fields[$control->name]);\n if (in_array($ctltype,array('radiogroupcontrol','dropdowncontrol'))) {\n if (!array_key_exists($control->id,$multi_item_control_items)) {\n $multi_item_control_items[$control->name] = null;\n $multi_item_control_ids[$control->name] = $control->id;\n }\n }\n }",
" while (($filedata = fgetcsv($file, 2000, $this->params[\"delimiter\"])) != false) {\n if ($linenum >= $this->params[\"rowstart\"] && in_array($linenum,$this->params['importrecord'])) {\n $i = 0;\n $db_data = new stdClass();\n $db_data->ip = '';\n $db_data->user_id = $user->id;\n $db_data->timestamp = time();\n $db_data->referrer = '';\n $db_data->location_data = '';\n foreach ($filedata as $field) {\n if (!empty($this->params[\"column\"][$i]) && $this->params[\"column\"][$i] != \"none\") {\n $colname = $this->params[\"column\"][$i];\n $control_type = get_class($fields[$colname]);\n $params[$colname] = $field;\n $def = call_user_func(array($control_type, \"getFieldDefinition\"));\n if (!empty($def)) {\n $db_data->$colname = call_user_func(array($control_type, 'convertData'), $colname, $params);\n }\n if (!empty($db_data->$colname) && array_key_exists($colname,$multi_item_control_items) && !in_array($db_data->$colname,$multi_item_control_items[$colname])) {\n $multi_item_control_items[$colname][] = $db_data->$colname;\n }\n }\n $i++;\n }\n $f->insertRecord($db_data);\n $recordsdone++;\n }\n $linenum++;\n }",
" fclose($file);\n ini_set('auto_detect_line_endings',$line_end);",
" // update multi-item forms controls\n if (!empty($multi_item_control_ids)) {\n foreach ($multi_item_control_ids as $key=>$control_id) {\n $fc = new forms_control($control_id);\n $ctl = expUnserialize($fc->data);\n $ctl->items = $multi_item_control_items[$key];\n $fc->data = serialize($ctl);\n $fc->update();\n }\n }\n unlink(BASE . $this->params[\"filename\"]);\n flash('notice', $recordsdone.' '.gt('Records Imported'));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class helpController extends expController {\n\tpublic $useractions = array(\n 'showall'=>'Show all',\n 'select_version'=>'Select Help Version'\n );\n public $remove_configs = array(\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Help\"); }\n static function description() { return gt(\"Manage Exponent CMS help files.\"); }\n static function isSearchable() { return true; }",
"\t",
" function __construct($src=null, $params=array()) {\n parent::__construct($src,$params);\n // only set the system help version if it's not already set as a session variable\n if (!expSession::is_set('help-version')) {\n $version = help_version::getCurrentHelpVersion();\n if (empty($version)) {\n // there is no help version set to 'is_current'\n $hv = new help_version();\n \t $newversion = $hv->find('first','1');\n if (!empty($newversion)) {\n $this->params['is_current'] = 1;\n \t $newversion->update($this->params);\n $version = $newversion->version;\n }\n }\n if(!empty($params['version'])) {\n $version = isset($params['version']) ? (($params['version'] == 'current') ? $version : $params['version']) : $version;\n }\n expSession::set('help-version',$version);\n }\n $this->help_version = expSession::get('help-version');\n\t}",
" /**\n * Display list of help documents\n */\n\tpublic function showall() {\n\t expHistory::set('viewable', $this->params);\n\t $hv = new help_version();\n\t //$current_version = $hv->find('first', 'is_current=1');\n\t $ref_version = $hv->find('first', 'version=\\''.$this->help_version.'\\'');\n",
" // pagination parameter..hard coded for now.\t ",
"\t\t$where = $this->aggregateWhereClause();\n\t $where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id);\n if (empty($this->params['parent'])) {\n $where .= ' AND (parent=0 OR parent IS NULL)';\n } else {",
" $where .= ' AND parent=' . $this->params['parent'];",
" }\n//\t $limit = 999;\n\t $order = isset($this->config['order']) ? $this->config['order'] : 'rank';",
"\t // grab the pagination object\n\t\t$page = new expPaginator(array(\n 'model'=>'help',\n 'where'=> $where,\n//\t 'limit'=>$limit,\n 'order'=>$order,\n 'dir'=>'ASC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title',\n gt('Details')=>'body',\n gt('Version')=>'help_version_id'\n ),\n ));\n $help = new help();\n\t foreach ($page->records as $key=>$doc) {\n $page->records[$key]->children = $help->find('count','parent='.$doc->id);\n }\n\t assign_to_template(array(\n 'current_version'=>$ref_version,\n 'page'=>$page,\n 'rank'=>($order==='rank')?1:0\n ));\n\t}",
" /**\n * Display a help document\n */\n\tpublic function show() {\n\t expHistory::set('viewable', $this->params);\n\t $help = new help();\n if (empty($this->params['version']) || $this->params['version'] == 'current') {\n $version_id = help_version::getCurrentHelpVersionId();\n\t } else {\n $version_id = help_version::getHelpVersionId($this->params['version']);\n if (empty($version_id)) {\n $version_id = help_version::getCurrentHelpVersionId();\n }\n\t }",
"",
"\t $doc = $help->find('first', 'help_version_id='.$version_id.' AND sef_url=\"'.$this->params['title'].'\"');\n $children = $help->find('count','parent='.$doc->id);\n if (empty($doc)) {\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));\n }\n $config = expConfig::getConfig($doc->location_data);",
"\t assign_to_template(array(\n 'doc'=>$doc,\n 'children'=>$children,\n \"hv\"=>$this->help_version,\n 'config'=>$config\n ));\n\t}",
" /**\n * Create or Edit a help document\n */\n\tpublic function edit() {\n global $db;",
"\t expHistory::set('editable', $this->params);\n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $help = new help($id);\n if (!empty($this->params['copy'])) $help->id = null;",
"\t // get the id of the current version and use it if we need to.\n if (expSession::is_set('help-version')) {\n $version_id = help_version::getHelpVersionId(expSession::get('help-version')); // version the site is currently using\n } else {\n $version_id = help_version::getCurrentHelpVersionId();\n }\n\t if (empty($help->help_version_id)) $help->help_version_id = $version_id;",
" $parentlist = array('0'=>'-- '.gt('Top Level Help Doc').' --');\n $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n $helpdocs = $help->find('all',\"help_version_id=\".$help->help_version_id.\" AND location_data='\".serialize($help->loc).\"'\",$order);\n foreach ($helpdocs as $helpdoc) {\n $parentlist[$helpdoc->id] = $helpdoc->title;\n }",
"\t\t$sectionlist = array();\n// $helpsections = $help->find('all',\"help_version_id=\".$help->help_version_id);\n//\t\tforeach ($helpsections as $helpsection) {\n//\t\t\tif (!empty($helpsection->location_data)) {\n//\t\t\t\t$helpsrc = expUnserialize($helpsection->location_data);\n//\t\t\t\tif (!array_key_exists($helpsrc->src, $sectionlist)) {\n// $sectionlist[$helpsrc->src] = $db->selectValue('section', 'name', 'id=\"' . $db->selectValue('sectionref', 'section', 'module = \"help\" AND source=\"' . $helpsrc->src .'\"').'\"');\n//\t\t\t\t}\n//\t\t\t}\n//\t\t}\n $helplocs = $help->findValue('all', 'location_data', \"help_version_id=\" . $version_id, null, true);\n foreach ($helplocs as $helploc) {\n if (!empty($helploc)) {\n $helpsrc = expUnserialize($helploc);\n $sectionlist[$helpsrc->src] = $db->selectValue('sectionref', 'section', 'module = \"help\" AND source=\"' . $helpsrc->src . '\"');\n }\n }\n $sectionlist[$this->loc->src] .= ' '.gt(\"(current section)\");",
"\t assign_to_template(array(\n 'record'=>$help,\n 'parents'=>$parentlist,\n \"current_section\"=>$this->loc->src,\n \"sections\"=>$sectionlist\n ));\n\t}",
" /**\n * Manage help documents\n */\n\tpublic function manage() {\n\t expHistory::set('manageable', $this->params);\n\t global $db;",
"\t ",
"\t $hv = new help_version();\n\t $current_version = $hv->find('first', 'is_current=1');",
"\t ",
"\t if (empty($current_version)) {\n\t flash('error', gt(\"You don't have any software versions created yet. Please do so now.\"));\n\t redirect_to(array('controller'=>'help', 'action'=>'edit_version'));\n// $this->edit_version();\n\t }",
" $sections = array();\n foreach ($db->selectObjects('sectionref','module=\"help\"') as $sectionref) {\n if (!empty($sectionref->source) && empty($sections[$sectionref->source])) {\n $sections[$sectionref->source] = $db->selectValue('section', 'name', 'id=\"' . $sectionref->section .'\"');\n }\n }\n",
"\t $where = empty($this->params['version']) ? 1 : 'help_version_id='.$this->params['version'];",
"\t $page = new expPaginator(array(\n 'model'=>'help',\n 'where'=>$where,\n 'limit'=>30,\n 'order' => (isset($this->params['order']) ? $this->params['order'] : 'help_version_id'),\n 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title',\n gt('Version')=>'help_version_id',\n gt('Section')=>'section',\n// gt('Location')=>'location_data'\n ),\n ));",
"\t assign_to_template(array(\n 'current_version'=>$current_version,\n 'page'=>$page,\n 'sections'=>$sections\n ));\n\t}",
" /**\n * Routine to copy all existing help docs from a version to the new version\n * @static\n * @param $from\n * @param $to\n * @return bool\n */\n\tprivate static function copydocs($from, $to) {\n\t $help = new help();\n $order = 'rank DESC';\n $old_parents = $help->getHelpParents($from);\n $new_parents = array();",
" // copy parent help docs\n\t $current_docs = $help->find('all', 'help_version_id='.$from.' AND parent=0',$order);\n\t foreach ($current_docs as $doc) {\n $origid = $doc->id;\n\t unset($doc->id);\n\t $doc->help_version_id = $to;",
"\t\t ",
"//\t $tmpsef = $doc->sef_url;\n//\t $doc->sef_url = \"\";\n//\t $doc->save();\n//\t $doc->sef_url = $tmpsef;\n//\t $doc->do_not_validate = array('sef_url');\n\t $doc->save();\n if (in_array($origid, $old_parents)) {\n $new_parents[$origid] = $doc->id;\n }",
"//\t $doc->sef_url = $doc->makeSefUrl();\n//\t $doc->save();",
"\t foreach($doc->expFile as $subtype=>$files) {\n\t foreach($files as $file) {\n\t $doc->attachItem($file, $subtype);\n\t }\n\t }\n\t }",
" // copy child help docs\n $current_docs = $help->find('all', 'help_version_id='.$from.' AND parent!=0',$order);\n \t foreach ($current_docs as $key=>$doc) {\n \t unset($doc->id);\n $doc->parent = $new_parents[$doc->parent];\n \t $doc->help_version_id = $to;\n \t $doc->save();\n \t foreach($doc->expFile as $subtype=>$files) {\n \t foreach($files as $file) {\n \t $doc->attachItem($file, $subtype);\n \t }",
" \t }\n \t }",
"\t // get version #'s for the two versions\n $oldvers = help_version::getHelpVersion($from);\n $newvers = help_version::getHelpVersion($to);",
"\t // send a message saying what we've done\n\t flash('message', gt('Copied all docs from version').' '.$oldvers.' '.gt('to new version').' '.$newvers);\n\t return true;\n\t}",
" /**\n * Manage help versions\n */\n\tpublic function manage_versions() {\n\t expHistory::set('manageable', $this->params);",
"\t ",
"\t $hv = new help_version();\n\t $current_version = $hv->find('first', 'is_current=1');",
"\t ",
"\t $sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h ';\n\t $sql .= 'RIGHT JOIN '.DB_TABLE_PREFIX.'_help_version hv ON h.help_version_id=hv.id GROUP BY hv.version';",
"\t $page = new expPaginator(array(\n 'sql'=>$sql,\n 'limit'=>30,\n 'order' => (isset($this->params['order']) ? $this->params['order'] : 'version'),\n 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Version')=>'version',\n gt('Title')=>'title',\n gt('Current')=>'is_current',\n gt('# of Docs')=>'num_docs'\n ),\n ));",
"\t ",
"\t assign_to_template(array(\n 'current_version'=>$current_version,\n 'page'=>$page\n ));\n\t}",
" /**\n * Create or Edit details about a help version\n */\n\tpublic function edit_version() {\n\t expHistory::set('editable', $this->params);\n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $version = new help_version($id);\n\t assign_to_template(array(\n 'record'=>$version\n ));\n\t}",
" /**\n * Delete a help version and all assoc docs\n */\n\tpublic function delete_version() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('The version you are trying to delete could not be found'));\n\t }",
"\t ",
"\t // get the version\n\t $version = new help_version($this->params['id']);\n\t if (empty($version->id)) {\n\t flash('error', gt('The version you are trying to delete could not be found'));\n\t }",
"\t ",
"\t // if we have errors than lets get outta here!\n\t if (!expQueue::isQueueEmpty('error')) expHistory::back();",
"\t ",
"\t // delete the version\n\t $version->delete();",
"\t ",
"\t expSession::un_set('help-version');",
"\t flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.'));",
"\t expHistory::back();\t ",
"\t}",
" /**\n * Creates a new help version, possibly based on existing help version\n */\n\tpublic function update_version() {\n\t // get the current version\n\t $hv = new help_version();\n\t $current_version = $hv->find('first', 'is_current=1');",
"\t ",
"\t // check to see if the we have a new current version and unset the old current version.\n\t if (!empty($this->params['is_current'])) {\n//\t $db->sql('UPDATE '.DB_TABLE_PREFIX.'_help_version set is_current=0');\n help_version::clearHelpVersion();\n\t }\n\t expSession::un_set('help-version');",
"\t // save the version\n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $version = new help_version();\n\t // if we don't have a current version yet so we will force this one to be it\n\t if (empty($current_version->id)) $this->params['is_current'] = 1;\n\t $version->update($this->params);",
"\t ",
"\t // if this is a new version we need to copy over docs\n\t if (empty($id)) {",
"\t self::copydocs($current_version->id, $version->id);\t ",
"\t }\n // let's update the search index to reflect the current help version\n searchController::spider();",
"\t flash('message', gt('Saved help version').' '.$version->version);\n\t expHistory::back();\n\t}",
" /**\n * Switches current help version globally\n */\n\tpublic function activate_version() {\n\t // unset the old current version.\n help_version::clearHelpVersion();\n\t expSession::un_set('help-version');",
"\t\t$id = $this->params['id'];\n\t $version = new help_version($id);\n\t $this->params['is_current'] = 1;\n\t $version->update($this->params);\n // let's update the search index to reflect the current help version\n searchController::spider();",
"\t flash('message', gt('Changed active help version to').' '.$version->version);\n\t expHistory::back();\n\t}",
" /**\n * Displays available help versions\n */\n\tpublic function select_version() {\n \t $hv = expSession::get('help-version');\n $selected = help_version::getHelpVersionId($hv);\n $versions = help_version::getHelpVersionsDropdown();\n \t assign_to_template(array(\n 'current_version'=>$hv,\n 'selected'=>$selected,\n 'versions'=>$versions\n ));\n\t}",
" /**\n * Switches current help version temporarily\n */\n\tpublic function switch_version() {\n\t // unset the current version.\n\t expSession::un_set('help-version');\n // set the requested version.\n $version = help_version::getHelpVersion($this->params['version']);\n expSession::set('help-version',$version);\n\t flash('message', gt('Now displaying Help version').' '.$version);\n expHistory::back();\n\t}",
" /**\n \t * add only current version of docs to search index\n \t * @return int\n \t */\n \tfunction addContentToSearch() {\n global $db;",
" $count = 0;\n $help = new help();\n $where = 'help_version_id=\"'.help_version::getCurrentHelpVersionId().'\"';\n $where .= (!empty($this->params['id'])) ? ' AND id='.$this->params['id'] : null;\n $content = $db->selectArrays($help->tablename,$where);\n foreach ($content as $cnt) {\n $origid = $cnt['id'];\n unset($cnt['id']);",
" // get the location data for this content\n// if (isset($cnt['location_data'])) $loc = expUnserialize($cnt['location_data']);\n// $src = isset($loc->src) ? $loc->src : null;\n// $search_record = new search($cnt, false, false);\n //build the search record and save it.\n $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->baseclassname . \"'\";\n $oldindex = $db->selectObject('search', $sql);\n if (!empty($oldindex)) {\n $search_record = new search($oldindex->id, false, false);\n $search_record->update($cnt);\n } else {\n $search_record = new search($cnt, false, false);\n }",
" $search_record->original_id = $origid;\n $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];\n// $link = str_replace(URL_FULL,'', makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$cnt['sef_url'])));\n $link = str_replace(URL_FULL,'', makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$cnt['sef_url'])));\n//\t if (empty($search_record->title)) $search_record->title = 'Untitled';\n $search_record->view_link = $link;\n// $search_record->ref_module = $this->classname;\n $search_record->ref_module = $this->baseclassname;\n $search_record->category = $this->searchName();\n $search_record->ref_type = $this->searchCategory();\n $search_record->save();\n $count++;\n }",
" return $count;\n }",
" /**\n * Hack to try and determine page which help doc is assoc with\n * @static\n * @param $params\n * @return null|void\n */\n\tpublic static function getSection($params) {\n\t global $db;",
" $help = new help();\n if (empty($params['version']) || $params['version']=='current') {\n $version_id = help_version::getCurrentHelpVersionId();\n } else {\n $version_id = help_version::getHelpVersionId($params['version']);\n if (empty($version_id)) {\n $version_id = help_version::getCurrentHelpVersionId();\n }\n }\n $doc = $help->find('first','help_version_id='.$version_id.' and sef_url=\"'.$params['title'].'\"');\n\t $session_section = expSession::get('last_section') ? expSession::get('last_section') : 1 ;\n $help_sectionref = $db->selectObject('sectionref','module=\"help\" AND source=\"'. expUnserialize($doc->location_data)->src.'\"');\n $sid = !empty($help_sectionref) ? $help_sectionref->section : (($doc->section!=0) ? $doc->section : $session_section);\n if (!expSession::get('last_section')) {\n expSession::set('last_section',$sid);\n }\n//\t $section = $db->selectObject('section','id='. intval($sid));\n $section = new section(intval($sid));\n\t return $section;\n\t}",
"\t",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class helpController extends expController {\n\tpublic $useractions = array(\n 'showall'=>'Show all',\n 'select_version'=>'Select Help Version'\n );\n public $remove_configs = array(\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Help\"); }\n static function description() { return gt(\"Manage Exponent CMS help files.\"); }\n static function isSearchable() { return true; }",
"",
" function __construct($src=null, $params=array()) {\n parent::__construct($src,$params);\n // only set the system help version if it's not already set as a session variable\n if (!expSession::is_set('help-version')) {\n $version = help_version::getCurrentHelpVersion();\n if (empty($version)) {\n // there is no help version set to 'is_current'\n $hv = new help_version();\n \t $newversion = $hv->find('first','1');\n if (!empty($newversion)) {\n $this->params['is_current'] = 1;\n \t $newversion->update($this->params);\n $version = $newversion->version;\n }\n }\n if(!empty($params['version'])) {\n $version = isset($params['version']) ? (($params['version'] == 'current') ? $version : $params['version']) : $version;\n }\n expSession::set('help-version',$version);\n }\n $this->help_version = expSession::get('help-version');\n\t}",
" /**\n * Display list of help documents\n */\n\tpublic function showall() {\n\t expHistory::set('viewable', $this->params);\n\t $hv = new help_version();\n\t //$current_version = $hv->find('first', 'is_current=1');\n\t $ref_version = $hv->find('first', 'version=\\''.$this->help_version.'\\'');\n",
" // pagination parameter..hard coded for now.",
"\t\t$where = $this->aggregateWhereClause();\n\t $where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id);\n if (empty($this->params['parent'])) {\n $where .= ' AND (parent=0 OR parent IS NULL)';\n } else {",
" $where .= ' AND parent=' . intval($this->params['parent']);",
" }\n//\t $limit = 999;\n\t $order = isset($this->config['order']) ? $this->config['order'] : 'rank';",
"\t // grab the pagination object\n\t\t$page = new expPaginator(array(\n 'model'=>'help',\n 'where'=> $where,\n//\t 'limit'=>$limit,\n 'order'=>$order,\n 'dir'=>'ASC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title',\n gt('Details')=>'body',\n gt('Version')=>'help_version_id'\n ),\n ));\n $help = new help();\n\t foreach ($page->records as $key=>$doc) {\n $page->records[$key]->children = $help->find('count','parent='.$doc->id);\n }\n\t assign_to_template(array(\n 'current_version'=>$ref_version,\n 'page'=>$page,\n 'rank'=>($order==='rank')?1:0\n ));\n\t}",
" /**\n * Display a help document\n */\n\tpublic function show() {\n\t expHistory::set('viewable', $this->params);\n\t $help = new help();\n if (empty($this->params['version']) || $this->params['version'] == 'current') {\n $version_id = help_version::getCurrentHelpVersionId();\n\t } else {\n $version_id = help_version::getHelpVersionId($this->params['version']);\n if (empty($version_id)) {\n $version_id = help_version::getCurrentHelpVersionId();\n }\n\t }",
"\t $this->params['title'] = expString::escape($this->params['title']); // escape title to prevent sql injection",
"\t $doc = $help->find('first', 'help_version_id='.$version_id.' AND sef_url=\"'.$this->params['title'].'\"');\n $children = $help->find('count','parent='.$doc->id);\n if (empty($doc)) {\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));\n }\n $config = expConfig::getConfig($doc->location_data);",
"\t assign_to_template(array(\n 'doc'=>$doc,\n 'children'=>$children,\n \"hv\"=>$this->help_version,\n 'config'=>$config\n ));\n\t}",
" /**\n * Create or Edit a help document\n */\n\tpublic function edit() {\n global $db;",
"\t expHistory::set('editable', $this->params);\n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $help = new help($id);\n if (!empty($this->params['copy'])) $help->id = null;",
"\t // get the id of the current version and use it if we need to.\n if (expSession::is_set('help-version')) {\n $version_id = help_version::getHelpVersionId(expSession::get('help-version')); // version the site is currently using\n } else {\n $version_id = help_version::getCurrentHelpVersionId();\n }\n\t if (empty($help->help_version_id)) $help->help_version_id = $version_id;",
" $parentlist = array('0'=>'-- '.gt('Top Level Help Doc').' --');\n $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n $helpdocs = $help->find('all',\"help_version_id=\".$help->help_version_id.\" AND location_data='\".serialize($help->loc).\"'\",$order);\n foreach ($helpdocs as $helpdoc) {\n $parentlist[$helpdoc->id] = $helpdoc->title;\n }",
"\t\t$sectionlist = array();\n// $helpsections = $help->find('all',\"help_version_id=\".$help->help_version_id);\n//\t\tforeach ($helpsections as $helpsection) {\n//\t\t\tif (!empty($helpsection->location_data)) {\n//\t\t\t\t$helpsrc = expUnserialize($helpsection->location_data);\n//\t\t\t\tif (!array_key_exists($helpsrc->src, $sectionlist)) {\n// $sectionlist[$helpsrc->src] = $db->selectValue('section', 'name', 'id=\"' . $db->selectValue('sectionref', 'section', 'module = \"help\" AND source=\"' . $helpsrc->src .'\"').'\"');\n//\t\t\t\t}\n//\t\t\t}\n//\t\t}\n $helplocs = $help->findValue('all', 'location_data', \"help_version_id=\" . $version_id, null, true);\n foreach ($helplocs as $helploc) {\n if (!empty($helploc)) {\n $helpsrc = expUnserialize($helploc);\n $sectionlist[$helpsrc->src] = $db->selectValue('sectionref', 'section', 'module = \"help\" AND source=\"' . $helpsrc->src . '\"');\n }\n }\n $sectionlist[$this->loc->src] .= ' '.gt(\"(current section)\");",
"\t assign_to_template(array(\n 'record'=>$help,\n 'parents'=>$parentlist,\n \"current_section\"=>$this->loc->src,\n \"sections\"=>$sectionlist\n ));\n\t}",
" /**\n * Manage help documents\n */\n\tpublic function manage() {\n\t expHistory::set('manageable', $this->params);\n\t global $db;",
"",
"\t $hv = new help_version();\n\t $current_version = $hv->find('first', 'is_current=1');",
"",
"\t if (empty($current_version)) {\n\t flash('error', gt(\"You don't have any software versions created yet. Please do so now.\"));\n\t redirect_to(array('controller'=>'help', 'action'=>'edit_version'));\n// $this->edit_version();\n\t }",
" $sections = array();\n foreach ($db->selectObjects('sectionref','module=\"help\"') as $sectionref) {\n if (!empty($sectionref->source) && empty($sections[$sectionref->source])) {\n $sections[$sectionref->source] = $db->selectValue('section', 'name', 'id=\"' . $sectionref->section .'\"');\n }\n }\n",
"\t $where = empty($this->params['version']) ? 1 : 'help_version_id='.intval($this->params['version']);",
"\t $page = new expPaginator(array(\n 'model'=>'help',\n 'where'=>$where,\n 'limit'=>30,\n 'order' => (isset($this->params['order']) ? $this->params['order'] : 'help_version_id'),\n 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title',\n gt('Version')=>'help_version_id',\n gt('Section')=>'section',\n// gt('Location')=>'location_data'\n ),\n ));",
"\t assign_to_template(array(\n 'current_version'=>$current_version,\n 'page'=>$page,\n 'sections'=>$sections\n ));\n\t}",
" /**\n * Routine to copy all existing help docs from a version to the new version\n * @static\n * @param $from\n * @param $to\n * @return bool\n */\n\tprivate static function copydocs($from, $to) {\n\t $help = new help();\n $order = 'rank DESC';\n $old_parents = $help->getHelpParents($from);\n $new_parents = array();",
" // copy parent help docs\n\t $current_docs = $help->find('all', 'help_version_id='.$from.' AND parent=0',$order);\n\t foreach ($current_docs as $doc) {\n $origid = $doc->id;\n\t unset($doc->id);\n\t $doc->help_version_id = $to;",
"",
"//\t $tmpsef = $doc->sef_url;\n//\t $doc->sef_url = \"\";\n//\t $doc->save();\n//\t $doc->sef_url = $tmpsef;\n//\t $doc->do_not_validate = array('sef_url');\n\t $doc->save();\n if (in_array($origid, $old_parents)) {\n $new_parents[$origid] = $doc->id;\n }",
"//\t $doc->sef_url = $doc->makeSefUrl();\n//\t $doc->save();",
"\t foreach($doc->expFile as $subtype=>$files) {\n\t foreach($files as $file) {\n\t $doc->attachItem($file, $subtype);\n\t }\n\t }\n\t }",
" // copy child help docs\n $current_docs = $help->find('all', 'help_version_id='.$from.' AND parent!=0',$order);\n \t foreach ($current_docs as $key=>$doc) {\n \t unset($doc->id);\n $doc->parent = $new_parents[$doc->parent];\n \t $doc->help_version_id = $to;\n \t $doc->save();\n \t foreach($doc->expFile as $subtype=>$files) {\n \t foreach($files as $file) {\n \t $doc->attachItem($file, $subtype);\n \t }",
" \t }\n \t }",
"\t // get version #'s for the two versions\n $oldvers = help_version::getHelpVersion($from);\n $newvers = help_version::getHelpVersion($to);",
"\t // send a message saying what we've done\n\t flash('message', gt('Copied all docs from version').' '.$oldvers.' '.gt('to new version').' '.$newvers);\n\t return true;\n\t}",
" /**\n * Manage help versions\n */\n\tpublic function manage_versions() {\n\t expHistory::set('manageable', $this->params);",
"",
"\t $hv = new help_version();\n\t $current_version = $hv->find('first', 'is_current=1');",
"",
"\t $sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h ';\n\t $sql .= 'RIGHT JOIN '.DB_TABLE_PREFIX.'_help_version hv ON h.help_version_id=hv.id GROUP BY hv.version';",
"\t $page = new expPaginator(array(\n 'sql'=>$sql,\n 'limit'=>30,\n 'order' => (isset($this->params['order']) ? $this->params['order'] : 'version'),\n 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Version')=>'version',\n gt('Title')=>'title',\n gt('Current')=>'is_current',\n gt('# of Docs')=>'num_docs'\n ),\n ));",
"",
"\t assign_to_template(array(\n 'current_version'=>$current_version,\n 'page'=>$page\n ));\n\t}",
" /**\n * Create or Edit details about a help version\n */\n\tpublic function edit_version() {\n\t expHistory::set('editable', $this->params);\n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $version = new help_version($id);\n\t assign_to_template(array(\n 'record'=>$version\n ));\n\t}",
" /**\n * Delete a help version and all assoc docs\n */\n\tpublic function delete_version() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('The version you are trying to delete could not be found'));\n\t }",
"",
"\t // get the version\n\t $version = new help_version($this->params['id']);\n\t if (empty($version->id)) {\n\t flash('error', gt('The version you are trying to delete could not be found'));\n\t }",
"",
"\t // if we have errors than lets get outta here!\n\t if (!expQueue::isQueueEmpty('error')) expHistory::back();",
"",
"\t // delete the version\n\t $version->delete();",
"",
"\t expSession::un_set('help-version');",
"\t flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.'));",
"\t expHistory::back();",
"\t}",
" /**\n * Creates a new help version, possibly based on existing help version\n */\n\tpublic function update_version() {\n\t // get the current version\n\t $hv = new help_version();\n\t $current_version = $hv->find('first', 'is_current=1');",
"",
"\t // check to see if the we have a new current version and unset the old current version.\n\t if (!empty($this->params['is_current'])) {\n//\t $db->sql('UPDATE '.DB_TABLE_PREFIX.'_help_version set is_current=0');\n help_version::clearHelpVersion();\n\t }\n\t expSession::un_set('help-version');",
"\t // save the version\n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $version = new help_version();\n\t // if we don't have a current version yet so we will force this one to be it\n\t if (empty($current_version->id)) $this->params['is_current'] = 1;\n\t $version->update($this->params);",
"",
"\t // if this is a new version we need to copy over docs\n\t if (empty($id)) {",
"\t self::copydocs($current_version->id, $version->id);",
"\t }\n // let's update the search index to reflect the current help version\n searchController::spider();",
"\t flash('message', gt('Saved help version').' '.$version->version);\n\t expHistory::back();\n\t}",
" /**\n * Switches current help version globally\n */\n\tpublic function activate_version() {\n\t // unset the old current version.\n help_version::clearHelpVersion();\n\t expSession::un_set('help-version');",
"\t\t$id = $this->params['id'];\n\t $version = new help_version($id);\n\t $this->params['is_current'] = 1;\n\t $version->update($this->params);\n // let's update the search index to reflect the current help version\n searchController::spider();",
"\t flash('message', gt('Changed active help version to').' '.$version->version);\n\t expHistory::back();\n\t}",
" /**\n * Displays available help versions\n */\n\tpublic function select_version() {\n \t $hv = expSession::get('help-version');\n $selected = help_version::getHelpVersionId($hv);\n $versions = help_version::getHelpVersionsDropdown();\n \t assign_to_template(array(\n 'current_version'=>$hv,\n 'selected'=>$selected,\n 'versions'=>$versions\n ));\n\t}",
" /**\n * Switches current help version temporarily\n */\n\tpublic function switch_version() {\n\t // unset the current version.\n\t expSession::un_set('help-version');\n // set the requested version.\n $version = help_version::getHelpVersion($this->params['version']);\n expSession::set('help-version',$version);\n\t flash('message', gt('Now displaying Help version').' '.$version);\n expHistory::back();\n\t}",
" /**\n \t * add only current version of docs to search index\n \t * @return int\n \t */\n \tfunction addContentToSearch() {\n global $db;",
" $count = 0;\n $help = new help();\n $where = 'help_version_id=\"'.help_version::getCurrentHelpVersionId().'\"';\n $where .= (!empty($this->params['id'])) ? ' AND id='.$this->params['id'] : null;\n $content = $db->selectArrays($help->tablename,$where);\n foreach ($content as $cnt) {\n $origid = $cnt['id'];\n unset($cnt['id']);",
" // get the location data for this content\n// if (isset($cnt['location_data'])) $loc = expUnserialize($cnt['location_data']);\n// $src = isset($loc->src) ? $loc->src : null;\n// $search_record = new search($cnt, false, false);\n //build the search record and save it.\n $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->baseclassname . \"'\";\n $oldindex = $db->selectObject('search', $sql);\n if (!empty($oldindex)) {\n $search_record = new search($oldindex->id, false, false);\n $search_record->update($cnt);\n } else {\n $search_record = new search($cnt, false, false);\n }",
" $search_record->original_id = $origid;\n $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];\n// $link = str_replace(URL_FULL,'', makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$cnt['sef_url'])));\n $link = str_replace(URL_FULL,'', makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$cnt['sef_url'])));\n//\t if (empty($search_record->title)) $search_record->title = 'Untitled';\n $search_record->view_link = $link;\n// $search_record->ref_module = $this->classname;\n $search_record->ref_module = $this->baseclassname;\n $search_record->category = $this->searchName();\n $search_record->ref_type = $this->searchCategory();\n $search_record->save();\n $count++;\n }",
" return $count;\n }",
" /**\n * Hack to try and determine page which help doc is assoc with\n * @static\n * @param $params\n * @return null|void\n */\n\tpublic static function getSection($params) {\n\t global $db;",
" $help = new help();\n if (empty($params['version']) || $params['version']=='current') {\n $version_id = help_version::getCurrentHelpVersionId();\n } else {\n $version_id = help_version::getHelpVersionId($params['version']);\n if (empty($version_id)) {\n $version_id = help_version::getCurrentHelpVersionId();\n }\n }\n $doc = $help->find('first','help_version_id='.$version_id.' and sef_url=\"'.$params['title'].'\"');\n\t $session_section = expSession::get('last_section') ? expSession::get('last_section') : 1 ;\n $help_sectionref = $db->selectObject('sectionref','module=\"help\" AND source=\"'. expUnserialize($doc->location_data)->src.'\"');\n $sid = !empty($help_sectionref) ? $help_sectionref->section : (($doc->section!=0) ? $doc->section : $session_section);\n if (!expSession::get('last_section')) {\n expSession::set('last_section',$sid);\n }\n//\t $section = $db->selectObject('section','id='. intval($sid));\n $section = new section(intval($sid));\n\t return $section;\n\t}",
"",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Models\n * @package Modules\n */",
"class help_version extends expRecord {\n//\tpublic $table = 'help_version';\n\tpublic $validates = array(\n\t\t'uniqueness_of'=>array(\n\t\t\t'version'=>array('message'=>'This version number is already in use.'),\n\t\t));",
" public function afterDelete() {\n\t // get and delete the docs for this version\n\t $help = new help();\n\t $docs = $help->find('all', 'help_version_id='.$this->id);\n\t foreach ($docs as $doc) {\n\t $doc->delete();\n\t }\n }",
" public static function getCurrentHelpVersionId() {\n global $db;",
" return $db->selectValue('help_version', 'id', 'is_current=1');\n }",
" public static function getCurrentHelpVersion() {\n global $db;",
" return $db->selectValue('help_version','version','is_current=1');\n }",
" public static function getHelpVersionId($version) {\n global $db;\n",
" return $db->selectValue('help_version', 'id', 'version=\"'.$version.'\"');",
" }",
" public static function getHelpVersion($version_id) {\n global $db;\n",
" return $db->selectValue('help_version', 'version', 'id=\"'.$version_id.'\"');",
" }",
" public static function getHelpVersionsDropdown() {\n global $db;",
" return $db->selectDropdown('help_version','version',1,'version DESC');\n }",
" public static function clearHelpVersion() {\n global $db;",
" \t // unset the old current version.\n \t $db->toggle('help_version',\"is_current\",'is_current=1');\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Models\n * @package Modules\n */",
"class help_version extends expRecord {\n//\tpublic $table = 'help_version';\n\tpublic $validates = array(\n\t\t'uniqueness_of'=>array(\n\t\t\t'version'=>array('message'=>'This version number is already in use.'),\n\t\t));",
" public function afterDelete() {\n\t // get and delete the docs for this version\n\t $help = new help();\n\t $docs = $help->find('all', 'help_version_id='.$this->id);\n\t foreach ($docs as $doc) {\n\t $doc->delete();\n\t }\n }",
" public static function getCurrentHelpVersionId() {\n global $db;",
" return $db->selectValue('help_version', 'id', 'is_current=1');\n }",
" public static function getCurrentHelpVersion() {\n global $db;",
" return $db->selectValue('help_version','version','is_current=1');\n }",
" public static function getHelpVersionId($version) {\n global $db;\n",
" return $db->selectValue('help_version', 'id', 'version=\"'.$db->escapeString($version).'\"');",
" }",
" public static function getHelpVersion($version_id) {\n global $db;\n",
" return $db->selectValue('help_version', 'version', 'id=\"'.intval($version_id).'\"');",
" }",
" public static function getHelpVersionsDropdown() {\n global $db;",
" return $db->selectDropdown('help_version','version',1,'version DESC');\n }",
" public static function clearHelpVersion() {\n global $db;",
" \t // unset the old current version.\n \t $db->toggle('help_version',\"is_current\",'is_current=1');\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class importexportController extends expController {",
"",
" // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)\n",
" //protected $permissions = array_merge(array(\"test\"=>'Test'), array('copyProduct'=>\"Copy Product\"));\n protected $add_permissions = array(\n 'import' => 'Import Data',\n 'export' => 'Export Data'\n );",
"\n static function displayname() {\n return gt(\"Data Import / Export Module\");\n }",
" static function description() {\n return gt(\"Use this module to import and export data from your Exponent website.\");\n }",
" static function hasSources() {\n return false;\n }",
" static function hasContent() {\n return false;\n }",
"// function __construct($src = null, $params = array()) {\n// parent::__construct($src, $params);\n// }",
" function manage() {\n global $available_controllers;",
" expHistory::set('manageable', $this->params);\n $importDD = array();\n $exportDD = array();\n foreach ($available_controllers as $key => $path) {\n if (strpos($key, \"Controller\") !== false) {\n $c = new $key();\n if ($c->canImportData()) $importDD[$key] = $c->name();\n if ($c->canExportData()) $exportDD[$key] = $c->name();\n }\n }\n assign_to_template(array(\n 'importDD' => $importDD,\n 'exportDD' => $exportDD,\n ));\n }",
" function import() {\n $type = expModules::getController($this->params['import_type']);\n if (method_exists($type, 'import')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'import'));\n }",
" $pullable_modules = expModules::listInstalledControllers($type->baseclassname);\n $modules = new expPaginator(array(\n 'records' => $pullable_modules,\n 'controller' => $this->loc->mod,\n 'action' => $this->params['action'],\n 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns' => array(\n gt('Title') => 'title',\n gt('Page') => 'section'\n ),\n ));",
" assign_to_template(array(\n 'modules' => $modules,\n 'import_type' => $type->baseclassname\n ));\n }",
" function import_select() {\n $type = expModules::getController($this->params['import_type']);\n if (method_exists($type, 'import_select')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'import_select'));\n }",
" if (empty($this->params['import_aggregate'])) {\n expValidator::setErrorField('import_aggregate[]');\n expValidator::failAndReturnToForm(gt('You must select a module.'), $this->params);\n }",
" //Get the temp directory to put the uploaded file\n $directory = \"tmp\";",
" //Get the file save it to the temp directory\n if (!empty($_FILES[\"import_file\"]) && $_FILES[\"import_file\"][\"error\"] == UPLOAD_ERR_OK) {\n $file = expFile::fileUpload(\"import_file\", false, false, time() . \"_\" . $_FILES['import_file']['name'], $directory.'/');\n if ($file === null) {\n switch ($_FILES[\"import_file\"][\"error\"]) {\n case UPLOAD_ERR_INI_SIZE:\n case UPLOAD_ERR_FORM_SIZE:\n $this->params['_formError'] = gt('The file you attempted to upload is too large. Contact your system administrator if this is a problem.');\n break;\n case UPLOAD_ERR_PARTIAL:\n $this->params['_formError'] = gt('The file was only partially uploaded.');\n break;\n case UPLOAD_ERR_NO_FILE:\n $this->params['_formError'] = gt('No file was uploaded.');\n break;\n default:\n $this->params['_formError'] = gt('A strange internal error has occurred. Please contact the Exponent Developers.');\n break;\n }\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n } else {\n $errors = array();\n $data = expFile::parseDatabase(BASE . $directory . \"/\" . $file->filename, $errors, $type->model_table); //FIXME this may crash on large .eql files\n if (!empty($errors)) {\n $message = gt('Importing encountered the following errors') . ':<br>';\n foreach ($errors as $error) {\n $message .= '* ' . $error . '<br>';\n }\n flash('error', $message);\n }",
" assign_to_template(array(\n 'import_type' => $this->params['import_type'],\n 'items' => $data[$type->model_table]->records,\n 'filename' => $directory . \"/\" . $file->filename,\n 'source' => $this->params['import_aggregate'][0]\n ));\n }\n } else {\n expValidator::setErrorField('import_file');\n expValidator::failAndReturnToForm(gt('File failed to upload.'), $this->params); // file upload error\n }\n }",
" function import_process() {\n $type = expModules::getController($this->params['import_type']);\n if (method_exists($type, 'import_process')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'import_process'));\n }",
" if (!count($this->params['items'])) {\n expValidator::setErrorField('items');\n expValidator::failAndReturnToForm(gt('You must select at least one item.'), $this->params);",
"",
" }",
" $filename = $this->params['filename'];\n $src = $this->params['source'];\n $selected = $this->params['items'];\n $errors = array();\n $model = new $type->basemodel_name;\n $tables = array();\n $attached = $model->getAttachableItemTables();\n foreach ($attached as $link=>$model) {\n $tables[] = $link;\n $attach = new $model;\n $tables[] = $attach->tablename;\n }\n array_unshift($tables, $type->model_table);\n $data = expFile::parseDatabase(BASE . $filename, $errors, $tables); //FIXME this may crash on large .eql files",
" // parse out attachments data using the content_id for easier access\n $attachments = array();\n foreach ($attached as $link=>$model) {\n if (!empty($data[$link]->records)) {\n $attachments[$link] = array();\n foreach ($data[$link]->records as $item) {\n $attachments[$link][$item['content_id']] = $item;\n }\n $attach = new $model;\n foreach ($data[$attach->tablename]->records as $item) {\n $attachments[$link][$item['id']]['content'] = $item;\n }\n }\n }",
" foreach ($selected as $select) {\n $current_id = $data[$type->model_table]->records[$select]['id'];\n unset( // clear out the stuff that gets auto-set when integrated into existing records\n $data[$type->model_table]->records[$select]['id'],\n $data[$type->model_table]->records[$select]['sef_url'],\n $data[$type->model_table]->records[$select]['rank']\n );\n $data[$type->model_table]->records[$select]['location_data'] = serialize(expCore::makeLocation($type->baseclassname, $src));\n $item = new $type->basemodel_name($data[$type->model_table]->records[$select]); // create new populated record to auto-set things\n $item->update();",
" if ($this->params['import_attached']) {\n $params = array();;\n foreach ($attached as $link=>$model) {\n foreach ($attachments[$link] as $aitem) {\n if ($aitem['content_id'] == $current_id) {\n //$item is content_ record\n //$item['content'] is the attachment\n switch ($model) {\n case 'expCat':\n foreach ($data['expCats']->records as $key=>$ct) {\n if ($ct['id'] == $aitem['expcats_id']) {\n $cat = new expCat($ct['title']);\n if (empty($cat->id)) {\n $cat->title = $ct['title'];\n $cat->module = $type->baseclassname;\n $cat->save();\n }\n $params['expCat'][] = $cat->id;\n }\n }\n break;\n case 'expComment':\n foreach ($data['expComments']->records as $key=>$cm) {\n unset($cm['id']);\n $cm['parent_id'] = 0; //fixme this flattens reply comments\n $comment = new expComment($cm);\n $comment->update(); // create and attach the comment\n $comment->attachComment($type->baseclassname, $item->id, $aitem['subtype']);\n }\n break;\n case 'expFile':\n //FIXME we can't handle file attachments since this is only a db import\n break;\n case 'expTag':\n foreach ($data['expTags']->records as $key=>$tg) {\n if ($tg['id'] == $aitem['exptags_id']) {\n $tag = new expTag($tg['title']);\n if (empty($tag->id))\n $tag->update(array('title'=>$tg['title']));\n $params['expTag'][] = $tag->id;\n }\n }\n break;\n }\n }\n }\n }\n $item->update($params); // add expCat & expTag attachments to item\n }\n }\n unlink($this->params['filename']);",
" // update search index\n $type->addContentToSearch();",
" flashAndFlow('message', count($selected) . ' ' . $type->baseclassname . ' ' . gt('items were imported.'));\n }",
" function export() {\n $type = expModules::getController($this->params['export_type']);\n if (method_exists($type, 'export')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'export'));\n }",
" $pullable_modules = expModules::listInstalledControllers($type->baseclassname);\n $modules = new expPaginator(array(\n 'records' => $pullable_modules,\n 'controller' => $this->loc->mod,\n 'action' => $this->params['action'],\n 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns' => array(\n gt('Title') => 'title',\n gt('Page') => 'section'\n ),\n ));\n assign_to_template(array(\n 'modules' => $modules,\n 'export_type' => $type->baseclassname\n ));\n }",
" function export_process() {\n $type = expModules::getController($this->params['export_type']);\n if (method_exists($type, 'export_process')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'export_process'));\n }",
" if (!empty($this->params['export_aggregate'])) {\n $tables = array($type->model_table);\n $selected = $this->params['export_aggregate'];\n $where = '(';\n foreach ($selected as $key=>$src) {\n if ($key) $where .= ' OR ';\n $where .= \"location_data='\" . serialize(expCore::makeLocation($type->baseclassname, $src)) . \"'\";\n }\n $where .= ')';\n $awhere[] = $where;",
" if ($this->params['export_attached']) {\n $model = new $type->basemodel_name;\n foreach ($model->getAttachableItemTables() as $link=>$model) {\n $tables[] = $link;\n $awhere[] = \"content_type='\" . $type->baseclassname . \"'\";\n $attach = new $model;\n $tables[] = $attach->tablename;\n $awhere[] = '';\n }\n }",
" $filename = $type->baseclassname . '.eql';",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo expFile::dumpDatabase($tables, 'export', $awhere); //FIXME we need to echo inside call\n exit; // Exit, since we are exporting\n }\n expHistory::back();\n }",
" function validate() {\n// global $db;",
" //eDebug($this->params,true); ",
" set_time_limit(0);\n //$file = new expFile($this->params['expFile']['import_file'][0]);\n if (!empty($_FILES['import_file']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n }",
" $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n echo gt(\"Attempting import\").\"...<br/>\";",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);",
" $count = 1;\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo gt(\"Line \") . $count . \" \".gt(\"of your CSV import file does not contain the correct number of columns.\").\"<br/>\";\n echo gt(\"Found\").\" \" . $fieldCount . \" \".gt(\"header fields, but only\").\" \" . count($checkdata) . \" \".gt(\"field in row\").\" \" . $count . \" \".gt(\"Please check your file and try again.\");\n exit();\n }\n }\n fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>\" . gt(\"CSV File passed validation\") . \"...<br/>\";",
" if ($this->params['import_type'] == 'store') $this->importProduct($file);\n //else if($this->params['import_type'] == 'address') $this->importAddresses($file);\n }",
" /*function importAddresses($file)\n {\n $handle = fopen($file->path, \"r\");\n $data = fgetcsv($handle, 10000, \",\");",
" //eDebug($data); \n $source = ''; ",
" foreach ($data as $key=>$value)\n {",
" $dataset[$value] = ''; ",
" if($key == 2 && $value=='Unique_Bill_Name') $source = '1'; //SMC\n }",
" ",
" //eDebug($source);\n //eDebug($dataset,true);\n $count = 1;\n $errorSet = array();\n $successSet = array();\n eDebug($dataset);",
" ",
" $extAddy = null;\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;",
" $extAddy = new external_address(); ",
" $bName = explode(' ',$data[3]);\n eDebug($bName);\n $extAddy->firstname = $bName[0];\n if(count($bName) == 3)\n {\n $extAddy->middlename = $bName[1];",
" $extAddy->lastname = $bName[2]; ",
" }\n else if (count($bName) ==1)\n {\n $extAddy->middlename = '';",
" $extAddy->lastname = ''; ",
" }\n else\n {\n $extAddy->middlename = '';",
" $extAddy->lastname = $bName[1]; \n }\n ",
" $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];",
" $extAddy->address2 = $data[6]; \n $extAddy->address2 = $data[6]; \n $extAddy->city = $data[7]; \n ",
" $s = new geoRegion();\n $state = $s->find('first','code=\"'.trim($data[8]).'\"');\n eDebug($state);",
" $extAddy->state = $state->id; \n $extAddy->zip = str_ireplace(\"'\",'',$data[9]); \n $extAddy->phone = $data[20]; \n $extAddy->email = $data[21]; ",
" $extAddy->source = $source;",
" \n ",
" //shipping\n if($data[3] == $data[12] && $data[5] == $data[14] && $data[6] == $data[15]) //shipping and billing same\n {\n $extAddy->is_billing = 1;",
" $extAddy->is_shipping = 1; \n $extAddy->save(false); ",
" }\n else",
" { ",
" $extAddy->is_billing = 1;",
" $extAddy->is_shipping = 0; \n $extAddy->save(false); \n \n $extAddy = new external_address(); ",
" $sName = explode(' ',$data[12]);\n eDebug($sName);\n $extAddy->firstname = $sName[0];\n if(count($sName) == 3)\n {\n $extAddy->middlename = $sName[1];",
" $extAddy->lastname = $sName[2]; ",
" }\n else if (count($sName) ==1)\n {\n $extAddy->middlename = '';",
" $extAddy->lastname = ''; ",
" }\n else\n {\n $extAddy->middlename = '';",
" $extAddy->lastname = $sName[1]; \n }\n ",
" $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];",
" $extAddy->address2 = $data[15]; \n $extAddy->city = $data[16]; \n ",
" $s = new geoRegion();\n $state = $s->find('first','code=\"'.trim($data[17]).'\"');\n eDebug($state);",
" $extAddy->state = $state->id; \n $extAddy->zip = str_ireplace(\"'\",'',$data[18]); \n $extAddy->phone = $data[20]; \n $extAddy->email = $data[21]; ",
" $extAddy->is_billing = 0;\n $extAddy->is_shipping = 1;",
" $extAddy->source = $source; \n ",
" $extAddy->save(false);\n }",
" ",
" echo \"Successfully imported row \" . $count . \", name: \" . $extAddy->firstname . \" \" . $extAddy->lastname . \"<br/>\";\n //eDebug($product);",
" \n } \n ",
" if(count($errorSet))\n {\n echo \"<br/><hr><br/><font color='red'>The following records were NOT imported:<br/>\";\n foreach ($errorSet as $row=>$err)\n {\n echo \"Row: \" . $row . \". Reason:<br/>\";\n if (is_array($err))\n {\n foreach ($err as $e)\n {\n echo \"--\" . $e . \"<br/>\";\n }\n }\n else echo \"--\" . $err . \"<br/>\";\n }\n echo \"</font>\";",
" } ",
" }*/",
" function importProduct($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Product Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!($header[0] == 'id' || $header[0] == 'model')) {\n echo gt('Not a Product Import CSV File');\n return;\n }",
" $count = 1;\n $errorSet = array();\n $product = null;\n /* original order of columns\n 0=id\n 1=parent_id\n 2=child_rank\n 3=title\n 4=body\n 5=model\n 6=warehouse_location\n 7=sef_url\n//FIXME this is where canonical should be\n 8=meta_title\n 9=meta_keywords\n 10=meta_description\n 11=tax_class_id\n 12=quantity\n 13=availability_type\n 14=base_price\n 15=special_price\n 16=use_special_price\n 17=active_type\n 18=product_status_id\n 19=category1\n 20=category2\n 21=category3\n 22=category4\n ..\n 30=category12\n 31=surcharge\n 32=rank category_rank\n 33=feed_title\n 34=feed_body\n 35=weight\n 36=height\n 37=width\n 38=length\n 39=companies_id\n 40=image1 url to mainimage to download\n 41=image2 url to additional image to download\n ..\n 44=image5 url to additional image to download\n*/",
" // read in the data lines\n// while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $createCats = array();\n $createCatsRank = array();\n $data = array_combine($header, $row);",
" //eDebug($data, true);\n if ($header[0] == 'id') {\n if (isset($data['id']) && $data['id'] != 0) {\n $product = new product($data['id'], false, false);\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product ID.\");\n continue;\n }\n } else {\n //$errorSet[$count] = \"Product ID not supplied.\";\n //continue;\n $product = new product();\n //$product->save(false);\n }\n } elseif ($header[0] == 'model') {\n if (!empty($data['model'])) {\n $p = new product();\n $product = $p->find('first','model=\"' . $data['model'] . '\"');\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product SKU/Model.\");\n continue;\n }\n } else {\n $product = new product();\n }\n }\n if ($product->product_type != 'product') {\n $errorSet[$count] = gt(\"Existing product is wrong product type.\");\n continue;\n }",
" // new products must have a title\n if (empty($product->id)) { // new product require mandatory values\n $checkTitle = trim($data['title']);\n if (empty($checkTitle)) {\n $errorSet[$count] = gt(\"No product name (title) supplied.\");\n continue;\n }\n $product->minimum_order_quantity = 1;\n }",
" // parse $data columns\n foreach ($data as $key=>$value) {\n $value = trim($value);\n switch ($key) {\n case 'parent_id': // integer\n case 'child_rank':\n case 'tax_class_id':\n case 'quantity':\n case 'availability_type':\n case 'use_special_price':\n case 'active_type':\n case 'product_status_id':\n $product->$key = intval($value);\n break;\n case 'companies_id':\n if (is_numeric($value)) {\n $product->$key = intval($value);\n } elseif (!empty($value)) { // it's a company name, not a company id#\n $co = new company();\n $company = $co->find('first', 'title=' . $value);\n if (empty($company->id)) {\n $params['title'] = $value;\n $company->update();\n }\n $product->$key = $company->id;\n }\n break;\n case 'sef_url':\n $product->$key = stripslashes(stripslashes($value));\n if (!is_bool(expValidator::uniqueness_of('sef_url', $product, array()))) {\n $product->makeSefUrl();\n }\n break;\n case 'title': // string\n case 'model':\n case 'warehouse_location':\n case 'meta_title':\n case 'meta_keywords':\n case 'meta_description':\n case 'feed_title':\n case 'feed_body':\n $product->$key = stripslashes(stripslashes($value));\n break;\n case 'body':\n $product->$key = utf8_encode(stripslashes(expString::parseAndTrimImport(($value), true)));\n break;\n case 'base_price': // float\n case 'special_price':\n case 'surcharge':\n case 'weight':\n case 'height':\n case 'width':\n case 'length':\n $product->$key = floatval($value);\n break;\n case 'image1':\n case 'image2':\n case 'image3':\n case 'image4':\n case 'image5':\n if (!empty($value)) {\n $product->save(false);\n if (is_integer($value)) {\n $_objFile = new expFile ($value);\n } else {\n // import image from url\n $_destFile = basename($value); // get filename from end of url\n $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n $_destFullPath = BASE . $_destDir . $_destFile;\n if (file_exists($_destFullPath)) {\n $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }",
" expCore::saveData($value, $_destFullPath); // download the image",
" if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);",
" // Create a new expFile Object\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);\n $_objFile->save();\n }\n }\n // attach product images expFile object\n if (!empty($_objFile->id)) {\n if ($key == 'image1') {\n $product->attachItem($_objFile, 'mainimage');\n } else {\n $product->attachItem($_objFile, 'images', false);\n }\n }\n }\n break;\n case 'category1':\n case 'category2':\n case 'category3':\n case 'category4':\n case 'category5':\n case 'category6':\n case 'category7':\n case 'category8':\n case 'category9':\n case 'category10':\n case 'category11':\n case 'category12':\n if ($product->parent_id == 0) {\n// $rank = !empty($data['rank']) ? $data['rank'] : 1;\n $rank = intval(str_replace('category', '', $key));\n// if (!empty($value)) $result = storeCategory::parseCategory($value);\n if (!empty($value)) $result = storeCategory::importCategoryString($value);\n else continue;",
"// if (is_numeric($result)) {\n if ($result) {\n $createCats[] = $result;\n $createCatsRank[$result] = $rank;\n } else {\n $errorSet[$count][] = $result;\n continue 2;\n }\n }\n break;\n default:\n if (property_exists('product', $key)) {\n $product->key = $value;\n }\n }\n }",
"// $checkTitle = trim($data['title']);\n// if (empty($checkTitle)) {\n// $errorSet[$count] = gt(\"No product name (title) supplied, skipping this record...\");\n// continue;\n// }\n// $product->parent_id = $data[1];\n// $product->child_rank = $data[2];\n// $product->title = stripslashes(stripslashes($data[3]));\n// $product->body = utf8_encode(stripslashes(expString::parseAndTrimImport(($data[4]), true)));\n// //$product->body = utf8_encode(stripslashes(stripslashes(($data[4]))));\n// $product->model = stripslashes(stripslashes($data[5]));\n// $product->warehouse_location = stripslashes(stripslashes($data[6]));\n// $product->sef_url = stripslashes(stripslashes($data[7]));\n////FIXME this is where canonical should be\n// $product->meta_title = stripslashes(stripslashes($data[8]));\n// $product->meta_keywords = stripslashes(stripslashes($data[9]));\n// $product->meta_description = stripslashes(stripslashes($data[10]));\n//\n// $product->tax_class_id = $data[11];\n//\n// $product->quantity = $data[12];\n//\n// $product->availability_type = $data[13];\n//\n// $product->base_price = $data[14];\n// $product->special_price = $data[15];\n// $product->use_special_price = $data[16];\n// $product->active_type = $data[17];\n// $product->product_status_id = $data[18];\n//\n// $product->surcharge = $data[31];\n// $product->feed_title = stripslashes(stripslashes($data[33]));\n// $product->feed_body = stripslashes(stripslashes($data[34]));\n// if (!empty($data[35])) $product->weight = $data[35];\n// if (!empty($data[36])) $product->height = $data[36];\n// if (!empty($data[37])) $product->width = $data[37];\n// if (!empty($data[38])) $product->length = $data[38];\n// if (!empty($data[39])) $product->companies_id = $data[39];\n// if (!empty($data[40])) {\n// // import image from url\n// $_destFile = basename($data[40]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[40], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach/replace product main image with new expFile object\n// $product->attachItem($_objFile, 'mainimage');\n// }\n// }\n// for ($i=41; $i<=44; $i++) {\n// if (!empty($data[$i])) {\n// // import image from url\n// $_destFile = basename($data[$i]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[$i], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach product additional images with new expFile object\n// $product->attachItem($_objFile, 'images', false);\n// }\n// }\n// }\n//\n// if (empty($product->id)) $product->minimum_order_quantity = 1;\n//\n// if ($product->parent_id == 0) {\n// $createCats = array();\n// $createCatsRank = array();\n// for ($x = 19; $x <= 30; $x++) {\n// if (!empty($data[$x])) $result = storeCategory::parseCategory($data[$x]);\n// else continue;\n//\n// if (is_numeric($result)) {\n// $createCats[] = $result;\n// $createCatsRank[$result] = $data[32];\n// } else {\n// $errorSet[$count][] = $result;\n// continue 2;\n// }\n// }\n// }",
" //NOTE: we manipulate existing user input fields to store them properly?\n //eDebug($createCats,true);\n if (!empty($product->user_input_fields) && is_array($product->user_input_fields))\n $product->user_input_fields = serialize($product->user_input_fields);\n //eDebug($product->user_input_fields);",
" if (!empty($product->user_input_fields) && !is_array($product->user_input_fields))\n $product->user_input_fields = str_replace(\"'\", \"\\'\", $product->user_input_fields);",
" //eDebug($product->user_input_fields,true);\n $product->save(true);\n //eDebug($product->body);",
" //sort order and categories\n if ($product->parent_id == 0) {\n $product->saveCategories($createCats, $createCatsRank);\n //eDebug($createCatsRank);\n }\n echo \"Successfully imported/updated row \" . $count . \", product: \" . $product->title . \"<br/>\";\n //eDebug($product);",
" }",
" if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }",
" fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" // update search index\n $this->addContentToSearch();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class importexportController extends expController {",
" protected $add_permissions = array(\n 'import' => 'Import Data',\n 'export' => 'Export Data'\n );\n protected $manage_permissions = array(\n 'importProduct' => 'Import Product',\n );",
" // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)\n",
"",
"\n static function displayname() {\n return gt(\"Data Import / Export Module\");\n }",
" static function description() {\n return gt(\"Use this module to import and export data from your Exponent website.\");\n }",
" static function hasSources() {\n return false;\n }",
" static function hasContent() {\n return false;\n }",
"// function __construct($src = null, $params = array()) {\n// parent::__construct($src, $params);\n// }",
" function manage() {\n global $available_controllers;",
" expHistory::set('manageable', $this->params);\n $importDD = array();\n $exportDD = array();\n foreach ($available_controllers as $key => $path) {\n if (strpos($key, \"Controller\") !== false) {\n $c = new $key();\n if ($c->canImportData()) $importDD[$key] = $c->name();\n if ($c->canExportData()) $exportDD[$key] = $c->name();\n }\n }\n assign_to_template(array(\n 'importDD' => $importDD,\n 'exportDD' => $exportDD,\n ));\n }",
" function import() {\n $type = expModules::getController($this->params['import_type']);\n if (method_exists($type, 'import')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'import'));\n }",
" $pullable_modules = expModules::listInstalledControllers($type->baseclassname);\n $modules = new expPaginator(array(\n 'records' => $pullable_modules,\n 'controller' => $this->loc->mod,\n 'action' => $this->params['action'],\n 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns' => array(\n gt('Title') => 'title',\n gt('Page') => 'section'\n ),\n ));",
" assign_to_template(array(\n 'modules' => $modules,\n 'import_type' => $type->baseclassname\n ));\n }",
" function import_select() {\n $type = expModules::getController($this->params['import_type']);\n if (method_exists($type, 'import_select')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'import_select'));\n }",
" if (empty($this->params['import_aggregate'])) {\n expValidator::setErrorField('import_aggregate[]');\n expValidator::failAndReturnToForm(gt('You must select a module.'), $this->params);\n }",
" //Get the temp directory to put the uploaded file\n $directory = \"tmp\";",
" //Get the file save it to the temp directory\n if (!empty($_FILES[\"import_file\"]) && $_FILES[\"import_file\"][\"error\"] == UPLOAD_ERR_OK) {\n $file = expFile::fileUpload(\"import_file\", false, false, time() . \"_\" . $_FILES['import_file']['name'], $directory.'/');\n if ($file === null) {\n switch ($_FILES[\"import_file\"][\"error\"]) {\n case UPLOAD_ERR_INI_SIZE:\n case UPLOAD_ERR_FORM_SIZE:\n $this->params['_formError'] = gt('The file you attempted to upload is too large. Contact your system administrator if this is a problem.');\n break;\n case UPLOAD_ERR_PARTIAL:\n $this->params['_formError'] = gt('The file was only partially uploaded.');\n break;\n case UPLOAD_ERR_NO_FILE:\n $this->params['_formError'] = gt('No file was uploaded.');\n break;\n default:\n $this->params['_formError'] = gt('A strange internal error has occurred. Please contact the Exponent Developers.');\n break;\n }\n expSession::set(\"last_POST\", $this->params);\n header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n exit(\"\");\n } else {\n $errors = array();\n $data = expFile::parseDatabase(BASE . $directory . \"/\" . $file->filename, $errors, $type->model_table); //FIXME this may crash on large .eql files\n if (!empty($errors)) {\n $message = gt('Importing encountered the following errors') . ':<br>';\n foreach ($errors as $error) {\n $message .= '* ' . $error . '<br>';\n }\n flash('error', $message);\n }",
" assign_to_template(array(\n 'import_type' => $this->params['import_type'],\n 'items' => $data[$type->model_table]->records,\n 'filename' => $directory . \"/\" . $file->filename,\n 'source' => $this->params['import_aggregate'][0]\n ));\n }\n } else {\n expValidator::setErrorField('import_file');\n expValidator::failAndReturnToForm(gt('File failed to upload.'), $this->params); // file upload error\n }\n }",
" function import_process() {\n $type = expModules::getController($this->params['import_type']);\n if (method_exists($type, 'import_process')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'import_process'));\n }",
" if (!count($this->params['items'])) {\n expValidator::setErrorField('items');\n expValidator::failAndReturnToForm(gt('You must select at least one item.'), $this->params);",
" }",
" if (!empty($this->params['filename']) && (strpos($this->params['filename'], 'tmp/') === false || strpos($this->params['folder'], '..') !== false)) {\n header('Location: ' . URL_FULL);\n exit(); // attempt to hack the site",
" }",
" $filename = $this->params['filename'];\n $src = $this->params['source'];\n $selected = $this->params['items'];\n $errors = array();\n $model = new $type->basemodel_name;\n $tables = array();\n $attached = $model->getAttachableItemTables();\n foreach ($attached as $link=>$model) {\n $tables[] = $link;\n $attach = new $model;\n $tables[] = $attach->tablename;\n }\n array_unshift($tables, $type->model_table);\n $data = expFile::parseDatabase(BASE . $filename, $errors, $tables); //FIXME this may crash on large .eql files",
" // parse out attachments data using the content_id for easier access\n $attachments = array();\n foreach ($attached as $link=>$model) {\n if (!empty($data[$link]->records)) {\n $attachments[$link] = array();\n foreach ($data[$link]->records as $item) {\n $attachments[$link][$item['content_id']] = $item;\n }\n $attach = new $model;\n foreach ($data[$attach->tablename]->records as $item) {\n $attachments[$link][$item['id']]['content'] = $item;\n }\n }\n }",
" foreach ($selected as $select) {\n $current_id = $data[$type->model_table]->records[$select]['id'];\n unset( // clear out the stuff that gets auto-set when integrated into existing records\n $data[$type->model_table]->records[$select]['id'],\n $data[$type->model_table]->records[$select]['sef_url'],\n $data[$type->model_table]->records[$select]['rank']\n );\n $data[$type->model_table]->records[$select]['location_data'] = serialize(expCore::makeLocation($type->baseclassname, $src));\n $item = new $type->basemodel_name($data[$type->model_table]->records[$select]); // create new populated record to auto-set things\n $item->update();",
" if ($this->params['import_attached']) {\n $params = array();;\n foreach ($attached as $link=>$model) {\n foreach ($attachments[$link] as $aitem) {\n if ($aitem['content_id'] == $current_id) {\n //$item is content_ record\n //$item['content'] is the attachment\n switch ($model) {\n case 'expCat':\n foreach ($data['expCats']->records as $key=>$ct) {\n if ($ct['id'] == $aitem['expcats_id']) {\n $cat = new expCat($ct['title']);\n if (empty($cat->id)) {\n $cat->title = $ct['title'];\n $cat->module = $type->baseclassname;\n $cat->save();\n }\n $params['expCat'][] = $cat->id;\n }\n }\n break;\n case 'expComment':\n foreach ($data['expComments']->records as $key=>$cm) {\n unset($cm['id']);\n $cm['parent_id'] = 0; //fixme this flattens reply comments\n $comment = new expComment($cm);\n $comment->update(); // create and attach the comment\n $comment->attachComment($type->baseclassname, $item->id, $aitem['subtype']);\n }\n break;\n case 'expFile':\n //FIXME we can't handle file attachments since this is only a db import\n break;\n case 'expTag':\n foreach ($data['expTags']->records as $key=>$tg) {\n if ($tg['id'] == $aitem['exptags_id']) {\n $tag = new expTag($tg['title']);\n if (empty($tag->id))\n $tag->update(array('title'=>$tg['title']));\n $params['expTag'][] = $tag->id;\n }\n }\n break;\n }\n }\n }\n }\n $item->update($params); // add expCat & expTag attachments to item\n }\n }\n unlink($this->params['filename']);",
" // update search index\n $type->addContentToSearch();",
" flashAndFlow('message', count($selected) . ' ' . $type->baseclassname . ' ' . gt('items were imported.'));\n }",
" function export() {\n $type = expModules::getController($this->params['export_type']);\n if (method_exists($type, 'export')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'export'));\n }",
" $pullable_modules = expModules::listInstalledControllers($type->baseclassname);\n $modules = new expPaginator(array(\n 'records' => $pullable_modules,\n 'controller' => $this->loc->mod,\n 'action' => $this->params['action'],\n 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns' => array(\n gt('Title') => 'title',\n gt('Page') => 'section'\n ),\n ));\n assign_to_template(array(\n 'modules' => $modules,\n 'export_type' => $type->baseclassname\n ));\n }",
" function export_process() {\n $type = expModules::getController($this->params['export_type']);\n if (method_exists($type, 'export_process')) { // allow for controller specific method\n redirect_to(array('controller'=>$type->baseclassname, 'action'=>'export_process'));\n }",
" if (!empty($this->params['export_aggregate'])) {\n $tables = array($type->model_table);\n $selected = $this->params['export_aggregate'];\n $where = '(';\n foreach ($selected as $key=>$src) {\n if ($key) $where .= ' OR ';\n $where .= \"location_data='\" . serialize(expCore::makeLocation($type->baseclassname, $src)) . \"'\";\n }\n $where .= ')';\n $awhere[] = $where;",
" if ($this->params['export_attached']) {\n $model = new $type->basemodel_name;\n foreach ($model->getAttachableItemTables() as $link=>$model) {\n $tables[] = $link;\n $awhere[] = \"content_type='\" . $type->baseclassname . \"'\";\n $attach = new $model;\n $tables[] = $attach->tablename;\n $awhere[] = '';\n }\n }",
" $filename = $type->baseclassname . '.eql';",
" ob_end_clean();\n ob_start(\"ob_gzhandler\");",
" // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';",
" header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo expFile::dumpDatabase($tables, 'export', $awhere); //FIXME we need to echo inside call\n exit; // Exit, since we are exporting\n }\n expHistory::back();\n }",
" function validate() {\n// global $db;",
" //eDebug($this->params,true);",
" set_time_limit(0);\n //$file = new expFile($this->params['expFile']['import_file'][0]);\n if (!empty($_FILES['import_file']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n }",
" $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n echo gt(\"Attempting import\").\"...<br/>\";",
" $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);",
" $count = 1;\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo gt(\"Line \") . $count . \" \".gt(\"of your CSV import file does not contain the correct number of columns.\").\"<br/>\";\n echo gt(\"Found\").\" \" . $fieldCount . \" \".gt(\"header fields, but only\").\" \" . count($checkdata) . \" \".gt(\"field in row\").\" \" . $count . \" \".gt(\"Please check your file and try again.\");\n exit();\n }\n }\n fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);",
" echo \"<br/>\" . gt(\"CSV File passed validation\") . \"...<br/>\";",
" if ($this->params['import_type'] == 'store') $this->importProduct($file);\n //else if($this->params['import_type'] == 'address') $this->importAddresses($file);\n }",
" /*function importAddresses($file)\n {\n $handle = fopen($file->path, \"r\");\n $data = fgetcsv($handle, 10000, \",\");",
" //eDebug($data);\n $source = '';",
" foreach ($data as $key=>$value)\n {",
" $dataset[$value] = '';",
" if($key == 2 && $value=='Unique_Bill_Name') $source = '1'; //SMC\n }",
"",
" //eDebug($source);\n //eDebug($dataset,true);\n $count = 1;\n $errorSet = array();\n $successSet = array();\n eDebug($dataset);",
"",
" $extAddy = null;\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;",
" $extAddy = new external_address();",
" $bName = explode(' ',$data[3]);\n eDebug($bName);\n $extAddy->firstname = $bName[0];\n if(count($bName) == 3)\n {\n $extAddy->middlename = $bName[1];",
" $extAddy->lastname = $bName[2];",
" }\n else if (count($bName) ==1)\n {\n $extAddy->middlename = '';",
" $extAddy->lastname = '';",
" }\n else\n {\n $extAddy->middlename = '';",
" $extAddy->lastname = $bName[1];\n }\n",
" $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];",
" $extAddy->address2 = $data[6];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n",
" $s = new geoRegion();\n $state = $s->find('first','code=\"'.trim($data[8]).'\"');\n eDebug($state);",
" $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\",'',$data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];",
" $extAddy->source = $source;",
"\n",
" //shipping\n if($data[3] == $data[12] && $data[5] == $data[14] && $data[6] == $data[15]) //shipping and billing same\n {\n $extAddy->is_billing = 1;",
" $extAddy->is_shipping = 1;\n $extAddy->save(false);",
" }\n else",
" {",
" $extAddy->is_billing = 1;",
" $extAddy->is_shipping = 0;\n $extAddy->save(false);",
" $extAddy = new external_address();",
" $sName = explode(' ',$data[12]);\n eDebug($sName);\n $extAddy->firstname = $sName[0];\n if(count($sName) == 3)\n {\n $extAddy->middlename = $sName[1];",
" $extAddy->lastname = $sName[2];",
" }\n else if (count($sName) ==1)\n {\n $extAddy->middlename = '';",
" $extAddy->lastname = '';",
" }\n else\n {\n $extAddy->middlename = '';",
" $extAddy->lastname = $sName[1];\n }\n",
" $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];",
" $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n",
" $s = new geoRegion();\n $state = $s->find('first','code=\"'.trim($data[17]).'\"');\n eDebug($state);",
" $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\",'',$data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];",
" $extAddy->is_billing = 0;\n $extAddy->is_shipping = 1;",
" $extAddy->source = $source;\n",
" $extAddy->save(false);\n }",
"",
" echo \"Successfully imported row \" . $count . \", name: \" . $extAddy->firstname . \" \" . $extAddy->lastname . \"<br/>\";\n //eDebug($product);",
"\n }\n",
" if(count($errorSet))\n {\n echo \"<br/><hr><br/><font color='red'>The following records were NOT imported:<br/>\";\n foreach ($errorSet as $row=>$err)\n {\n echo \"Row: \" . $row . \". Reason:<br/>\";\n if (is_array($err))\n {\n foreach ($err as $e)\n {\n echo \"--\" . $e . \"<br/>\";\n }\n }\n else echo \"--\" . $err . \"<br/>\";\n }\n echo \"</font>\";",
" }",
" }*/",
" function importProduct($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Product Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");",
" // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!($header[0] == 'id' || $header[0] == 'model')) {\n echo gt('Not a Product Import CSV File');\n return;\n }",
" $count = 1;\n $errorSet = array();\n $product = null;\n /* original order of columns\n 0=id\n 1=parent_id\n 2=child_rank\n 3=title\n 4=body\n 5=model\n 6=warehouse_location\n 7=sef_url\n//FIXME this is where canonical should be\n 8=meta_title\n 9=meta_keywords\n 10=meta_description\n 11=tax_class_id\n 12=quantity\n 13=availability_type\n 14=base_price\n 15=special_price\n 16=use_special_price\n 17=active_type\n 18=product_status_id\n 19=category1\n 20=category2\n 21=category3\n 22=category4\n ..\n 30=category12\n 31=surcharge\n 32=rank category_rank\n 33=feed_title\n 34=feed_body\n 35=weight\n 36=height\n 37=width\n 38=length\n 39=companies_id\n 40=image1 url to mainimage to download\n 41=image2 url to additional image to download\n ..\n 44=image5 url to additional image to download\n*/",
" // read in the data lines\n// while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $createCats = array();\n $createCatsRank = array();\n $data = array_combine($header, $row);",
" //eDebug($data, true);\n if ($header[0] == 'id') {\n if (isset($data['id']) && $data['id'] != 0) {\n $product = new product($data['id'], false, false);\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product ID.\");\n continue;\n }\n } else {\n //$errorSet[$count] = \"Product ID not supplied.\";\n //continue;\n $product = new product();\n //$product->save(false);\n }\n } elseif ($header[0] == 'model') {\n if (!empty($data['model'])) {\n $p = new product();\n $product = $p->find('first','model=\"' . $data['model'] . '\"');\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product SKU/Model.\");\n continue;\n }\n } else {\n $product = new product();\n }\n }\n if ($product->product_type != 'product') {\n $errorSet[$count] = gt(\"Existing product is wrong product type.\");\n continue;\n }",
" // new products must have a title\n if (empty($product->id)) { // new product require mandatory values\n $checkTitle = trim($data['title']);\n if (empty($checkTitle)) {\n $errorSet[$count] = gt(\"No product name (title) supplied.\");\n continue;\n }\n $product->minimum_order_quantity = 1;\n }",
" // parse $data columns\n foreach ($data as $key=>$value) {\n $value = trim($value);\n switch ($key) {\n case 'parent_id': // integer\n case 'child_rank':\n case 'tax_class_id':\n case 'quantity':\n case 'availability_type':\n case 'use_special_price':\n case 'active_type':\n case 'product_status_id':\n $product->$key = intval($value);\n break;\n case 'companies_id':\n if (is_numeric($value)) {\n $product->$key = intval($value);\n } elseif (!empty($value)) { // it's a company name, not a company id#\n $co = new company();\n $company = $co->find('first', 'title=' . $value);\n if (empty($company->id)) {\n $params['title'] = $value;\n $company->update();\n }\n $product->$key = $company->id;\n }\n break;\n case 'sef_url':\n $product->$key = stripslashes(stripslashes($value));\n if (!is_bool(expValidator::uniqueness_of('sef_url', $product, array()))) {\n $product->makeSefUrl();\n }\n break;\n case 'title': // string\n case 'model':\n case 'warehouse_location':\n case 'meta_title':\n case 'meta_keywords':\n case 'meta_description':\n case 'feed_title':\n case 'feed_body':\n $product->$key = stripslashes(stripslashes($value));\n break;\n case 'body':\n $product->$key = utf8_encode(stripslashes(expString::parseAndTrimImport(($value), true)));\n break;\n case 'base_price': // float\n case 'special_price':\n case 'surcharge':\n case 'weight':\n case 'height':\n case 'width':\n case 'length':\n $product->$key = floatval($value);\n break;\n case 'image1':\n case 'image2':\n case 'image3':\n case 'image4':\n case 'image5':\n if (!empty($value)) {\n $product->save(false);\n if (is_integer($value)) {\n $_objFile = new expFile ($value);\n } else {\n // import image from url\n $_destFile = basename($value); // get filename from end of url\n $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n $_destFullPath = BASE . $_destDir . $_destFile;\n if (file_exists($_destFullPath)) {\n $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }",
" expCore::saveData($value, $_destFullPath); // download the image",
" if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);",
" // Create a new expFile Object\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);\n $_objFile->save();\n }\n }\n // attach product images expFile object\n if (!empty($_objFile->id)) {\n if ($key == 'image1') {\n $product->attachItem($_objFile, 'mainimage');\n } else {\n $product->attachItem($_objFile, 'images', false);\n }\n }\n }\n break;\n case 'category1':\n case 'category2':\n case 'category3':\n case 'category4':\n case 'category5':\n case 'category6':\n case 'category7':\n case 'category8':\n case 'category9':\n case 'category10':\n case 'category11':\n case 'category12':\n if ($product->parent_id == 0) {\n// $rank = !empty($data['rank']) ? $data['rank'] : 1;\n $rank = intval(str_replace('category', '', $key));\n// if (!empty($value)) $result = storeCategory::parseCategory($value);\n if (!empty($value)) $result = storeCategory::importCategoryString($value);\n else continue;",
"// if (is_numeric($result)) {\n if ($result) {\n $createCats[] = $result;\n $createCatsRank[$result] = $rank;\n } else {\n $errorSet[$count][] = $result;\n continue 2;\n }\n }\n break;\n default:\n if (property_exists('product', $key)) {\n $product->key = $value;\n }\n }\n }",
"// $checkTitle = trim($data['title']);\n// if (empty($checkTitle)) {\n// $errorSet[$count] = gt(\"No product name (title) supplied, skipping this record...\");\n// continue;\n// }\n// $product->parent_id = $data[1];\n// $product->child_rank = $data[2];\n// $product->title = stripslashes(stripslashes($data[3]));\n// $product->body = utf8_encode(stripslashes(expString::parseAndTrimImport(($data[4]), true)));\n// //$product->body = utf8_encode(stripslashes(stripslashes(($data[4]))));\n// $product->model = stripslashes(stripslashes($data[5]));\n// $product->warehouse_location = stripslashes(stripslashes($data[6]));\n// $product->sef_url = stripslashes(stripslashes($data[7]));\n////FIXME this is where canonical should be\n// $product->meta_title = stripslashes(stripslashes($data[8]));\n// $product->meta_keywords = stripslashes(stripslashes($data[9]));\n// $product->meta_description = stripslashes(stripslashes($data[10]));\n//\n// $product->tax_class_id = $data[11];\n//\n// $product->quantity = $data[12];\n//\n// $product->availability_type = $data[13];\n//\n// $product->base_price = $data[14];\n// $product->special_price = $data[15];\n// $product->use_special_price = $data[16];\n// $product->active_type = $data[17];\n// $product->product_status_id = $data[18];\n//\n// $product->surcharge = $data[31];\n// $product->feed_title = stripslashes(stripslashes($data[33]));\n// $product->feed_body = stripslashes(stripslashes($data[34]));\n// if (!empty($data[35])) $product->weight = $data[35];\n// if (!empty($data[36])) $product->height = $data[36];\n// if (!empty($data[37])) $product->width = $data[37];\n// if (!empty($data[38])) $product->length = $data[38];\n// if (!empty($data[39])) $product->companies_id = $data[39];\n// if (!empty($data[40])) {\n// // import image from url\n// $_destFile = basename($data[40]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[40], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach/replace product main image with new expFile object\n// $product->attachItem($_objFile, 'mainimage');\n// }\n// }\n// for ($i=41; $i<=44; $i++) {\n// if (!empty($data[$i])) {\n// // import image from url\n// $_destFile = basename($data[$i]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[$i], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach product additional images with new expFile object\n// $product->attachItem($_objFile, 'images', false);\n// }\n// }\n// }\n//\n// if (empty($product->id)) $product->minimum_order_quantity = 1;\n//\n// if ($product->parent_id == 0) {\n// $createCats = array();\n// $createCatsRank = array();\n// for ($x = 19; $x <= 30; $x++) {\n// if (!empty($data[$x])) $result = storeCategory::parseCategory($data[$x]);\n// else continue;\n//\n// if (is_numeric($result)) {\n// $createCats[] = $result;\n// $createCatsRank[$result] = $data[32];\n// } else {\n// $errorSet[$count][] = $result;\n// continue 2;\n// }\n// }\n// }",
" //NOTE: we manipulate existing user input fields to store them properly?\n //eDebug($createCats,true);\n if (!empty($product->user_input_fields) && is_array($product->user_input_fields))\n $product->user_input_fields = serialize($product->user_input_fields);\n //eDebug($product->user_input_fields);",
" if (!empty($product->user_input_fields) && !is_array($product->user_input_fields))\n $product->user_input_fields = str_replace(\"'\", \"\\'\", $product->user_input_fields);",
" //eDebug($product->user_input_fields,true);\n $product->save(true);\n //eDebug($product->body);",
" //sort order and categories\n if ($product->parent_id == 0) {\n $product->saveCategories($createCats, $createCatsRank);\n //eDebug($createCatsRank);\n }\n echo \"Successfully imported/updated row \" . $count . \", product: \" . $product->title . \"<br/>\";\n //eDebug($product);",
" }",
" if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }",
" fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);",
" // update search index\n $this->addContentToSearch();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class migrationController extends expController {",
" protected $add_permissions = array(",
" 'analyze'=>'Analyze Data',\n 'migrate'=>'Migrate Data'\n );",
" // this is a list of modules that we can convert to exp2 type modules.\n public $new_modules = array(\n// 'addressbookmodule'=>'address',\n 'imagegallerymodule'=>'photo',\n 'linklistmodule'=>'links',\n 'newsmodule'=>'news',\n 'slideshowmodule'=>'photo',\n 'snippetmodule'=>'snippet',\n 'swfmodule'=>'text',\n 'textmodule'=>'text',\n 'resourcesmodule'=>'filedownload',\n 'rotatormodule'=>'text',\n 'faqmodule'=>'faq',\n 'headlinemodule'=>'text',\n 'linkmodule'=>'links',\n 'weblogmodule'=>'blog',\n 'listingmodule'=>'portfolio',\n 'youtubemodule'=>'media',\n 'mediaplayermodule'=>'media',\n 'bannermodule'=>'banner',\n 'feedlistmodule'=>'rss',\n 'simplepollmodule'=>'simplePoll',\n 'navigationmodule'=>'navigation',\n 'calendarmodule'=>'event',\n 'formmodule'=>'forms',\n 'contactmodule'=>'forms', // this module is converted to a functionally similar form\n 'containermodule'=>'container',\n );",
" // these are modules that have either been deprecated or have no content to migrate\n // Not sure we need to note deprecated modules...\n public $deprecated_modules = array(\n 'administrationmodule',\n// 'containermodule', // not really deprecated, but must be in this list to skip processing?\n// 'navigationmodule', // views are still used, so modules need to be imported?\n 'loginmodule',\n 'searchmodule', \n 'imagemanagermodule',\n 'imageworkshopmodule',\n 'inboxmodule',\n 'rssmodule',\n// the following 0.97/98 modules were added to this list\n 'articlemodule',\n 'bbmodule',\n 'pagemodule',\n 'previewmodule',\n 'tasklistmodule',\n 'wizardmodule',\n// other older or user-contributed modules we don't want to deal with\n 'addressbookmodule', // moved to deprecated list since this is NOT the type of address we use in 2.x\n 'cataloguemodule',\n 'codemapmodule',\n 'extendedlistingmodule',\n 'googlemapmodule',\n 'greekingmodule',\n 'guestbookmodule',\n 'keywordmodule',\n 'sharedcoremodule',\n 'svgallerymodule',\n 'uiswitchermodule',\n 'filemanagermodule',\n );",
"\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Content Migration Controller\"); }",
"\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"Use this module to pull Exponent 1 style content from your old site.\"); }",
"\t/**\n\t * if module has associated sources\n\t * @return bool\n\t */\n static function hasSources() { return false; }",
"\t/**\n\t * if module has associated content\n\t * @return bool\n\t */\n static function hasContent() { return false; }",
"\t/**\n\t * gather info about all pages in old site for user selection\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function manage_pages() {\n global $db;",
" expHistory::set('manageable', $this->params);\n $old_db = $this->connect();\n $pages = $old_db->selectObjects('section','id > 1');\n foreach($pages as $page) {\n\t\t\tif ($db->selectObject('section',\"id='\".$page->id.\"'\")) {\n\t\t\t\t$page->exists = true;\n\t\t\t} else {\n\t\t\t\t$page->exists = false;\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'pages'=>$pages\n ));\n }",
"\t/**\n\t * copy selected pages over from old site\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function migrate_pages() {\n global $db;",
"\t\t$del_pages = '';\n if (isset($this->params['wipe_pages'])) {\n $db->delete('section',\"id > '1'\");\n\t\t\t$del_pages = ' '.gt('after clearing database of pages');\n\t\t}\n $successful = 0;\n $failed = 0;\n $old_db = $this->connect();\n\t\tif (!empty($this->params['pages'])) {\n\t\t\tforeach($this->params['pages'] as $pageid) {\n\t\t\t\t$page = $old_db->selectObject('section', 'id='.$pageid);\n\t\t\t\t// make sure the SEF name is valid\n\t\t\t\tglobal $router;\n\t\t\t\tif (empty($page->sef_name)) {\n\t\t\t\t\tif (isset($page->name)) {\n\t\t\t\t\t\t$page->sef_name = $router->encode($page->name);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$page->sef_name = $router->encode('Untitled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$dupe = $db->selectValue('section', 'sef_name', 'sef_name=\"'.$page->sef_name.'\"');\n\t\t\t\tif (!empty($dupe)) {\n\t\t\t\t\tlist($u, $s) = explode(' ',microtime());\n $page->sef_name .= '-'.$s.'-'.$u;\n\t\t\t\t}\n// $page->sef_name = $page->sef_name;\n// unset($page->sef_name);\n\t\t\t\t$ret = $db->insertObject($page, 'section');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$failed++;\n\t\t\t\t} else {\n\t\t\t\t\t$successful++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!empty($this->params['rep_pages'])) {\n\t\t\tforeach($this->params['rep_pages'] as $pageid) {\n\t\t\t\t$db->delete('section','id='.$pageid);\n\t\t\t\t$page = $old_db->selectObject('section', 'id='.$pageid);\n\t\t\t\t// make sure the SEF name is valid\n\t\t\t\tglobal $router;\n\t\t\t\tif (empty($page->sef_name)) {\n\t\t\t\t\tif (isset($page->name)) {\n\t\t\t\t\t\t$page->sef_name = $router->encode($page->name);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$page->sef_name = $router->encode('Untitled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$dupe = $db->selectValue('section', 'sef_name', 'sef_name=\"'.$page->sef_name.'\"');\n\t\t\t\tif (!empty($dupe)) {\n\t\t\t\t\tlist($u, $s) = explode(' ',microtime());\n $page->sef_name .= '-'.$s.'-'.$u;\n\t\t\t\t}\n// $page->sef_name = $page->sef_name;\n// unset($page->sef_name);\n\t\t\t\t$ret = $db->insertObject($page, 'section');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$failed++;\n\t\t\t\t} else {\n\t\t\t\t\t$successful++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\tif (isset($this->params['copy_permissions'])) {\n\t\t\t$db->delete('userpermission',\"module = 'navigation' AND source = ''\");\n\t\t\t$db->delete('grouppermission',\"module = 'navigation' AND source = ''\");\n\t\t\t\n\t\t\t$users = $db->selectObjects('user','id > 1');\n\t\t\tforeach($users as $user) {\n\t\t\t\t$pages = $old_db->selectObjects('userpermission',\"uid='\".$user->id.\"' AND module = 'navigationmodule' AND source = ''\");\n\t\t\t\tforeach($pages as $page) {\n\t\t\t\t\tif ($db->selectObject('section','id = '.$page->internal)) {\n\t\t\t\t\t\t if ($page->permission != 'administrate') {\n $page->module = 'navigation';\n\t\t\t\t\t\t\t $db->insertObject($page,'userpermission');\n\t\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t\t$groups = $db->selectObjects('group','1');\n\t\t\tforeach($groups as $group) {\n\t\t\t\t$pages = $old_db->selectObjects('grouppermission',\"gid='\".$group->id.\"' AND module = 'navigationmodule' AND source = ''\");\n\t\t\t\tforeach($pages as $page) {\n\t\t\t\t\tif ($db->selectObject('section','id = '.$page->internal)) {\n\t\t\t\t\t\t if ($page->permission != 'administrate') {\n $page->module = 'navigation';\n\t\t\t\t\t\t\t $db->insertObject($page,'grouppermission');\n\t\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}",
" flash('message', $successful.' '.gt('pages were imported from').' '.$this->config['database'].$del_pages);\n if ($failed > 0) {\n flash('error', $failed.' '.gt('pages could not be imported from').' '.$this->config['database'].' '.gt('This is usually because a page with the same ID already exists in the database you importing to.'));\n }",
" expSession::clearCurrentUserSessionCache();\n expHistory::back();\n }",
"\t/**\n\t * gather info about all files in old site for user selection\n\t * @return void\n\t */\n public function manage_files() {\n expHistory::set('manageable', $this->params);\n $old_db = $this->connect();\n $files = $old_db->selectObjects('file');\n assign_to_template(array(\n 'count'=>count($files)\n ));\n }",
"\t/**\n\t * copy selected file information (not the files themselves) over from old site\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function migrate_files() {\n global $db;",
" expHistory::set('manageable', $this->params);\n $old_db = $this->connect();\n $db->delete('expFiles');",
" //import the files\n $oldfiles = $old_db->selectObjects('file');\n foreach ($oldfiles as $oldfile) {\n unset(\n $oldfile->name,\n $oldfile->collection_id\n );\n $file = $oldfile;\n $file->directory = $file->directory.\"/\";\n $db->insertObject($file,'expFiles');\n\t\t\t$oldfile->exists = file_exists(BASE.$oldfile->directory.\"/\".$oldfile->filename);\n\t\t}\n assign_to_template(array(\n 'files'=>$oldfiles,\n 'count'=>count($oldfiles)\n ));\n }",
"\t/**\n\t * gather info about all modules in old site for user selection\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function manage_content() {\n //global $db;\n //$containers = $db->selectObjects('container', 'external=\"N;\"');\n //eDebug($containers);\n $old_db = $this->connect();",
" $sql = 'SELECT *, COUNT(module) as count FROM '.$this->config['prefix'].'_sectionref WHERE is_original=1 GROUP BY module';\n $modules = $old_db->selectObjectsBySql($sql);\n\t\tfor ($i = 0, $iMax = count($modules); $i < $iMax; $i++) {\n if (array_key_exists($modules[$i]->module, $this->new_modules)) {\n $newmod = expModules::getController($this->new_modules[$modules[$i]->module]);\n// $newmod = $this->new_modules[$modules[$i]->module];\n $modules[$i]->action = '<span style=\"color:green;\">'.gt('Converting content to').' '.$newmod->displayname().\"</span>\";\n// $modules[$i]->action = '<span style=\"color:green;\">'.gt('Converting content to').' '.$newmod::displayname().\"</span>\"; //TODO this doesn't work w/ php 5.2\n } elseif (in_array($modules[$i]->module, $this->deprecated_modules)) {\n // $modules[$i]->action = '<span style=\"color:red;\">This module is deprecated and will not be migrated.</span>';\n $modules[$i]->notmigrating = 1;\n// } elseif (in_array($modules[$i]->module, $this->needs_written)) {\n// $modules[$i]->action = '<span style=\"color:orange;\">'.gt('Still needs migration script written').'</span>';\n } else {\n $modules[$i]->action = gt('Migrating as is.');\n }\n }\n //eDebug($modules);",
" assign_to_template(array(\n 'modules'=>$modules\n ));\n }",
"\t/**\n\t * copy selected modules and their contents over from old site\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function migrate_content() {\n global $db;",
" $old_db = $this->connect();\n if (isset($this->params['wipe_content'])) {\n $db->delete('sectionref');\n $db->delete('container');\n $db->delete('text');\n $db->delete('snippet');\n $db->delete('links');\n $db->delete('news');\n// $db->delete('filedownloads');\n $db->delete('filedownload');\n $db->delete('photo');\n $db->delete('headline');\n $db->delete('blog');\n// $db->delete('faqs');\n $db->delete('faq');\n $db->delete('portfolio');\n $db->delete('media');\n $db->delete('banner');\n $db->delete('companies');\n $db->delete('addresses');\n $db->delete('content_expComments');\n $db->delete('content_expFiles');\n $db->delete('content_expSimpleNote');\n $db->delete('content_expTags');\n $db->delete('content_expCats');\n $db->delete('expComments');\n $db->delete('expConfigs', 'id>1'); // don't delete migration config\n// $db->delete('expFiles');\t\t\t// deleted and rebuilt during (previous) file migration\n $db->delete('expeAlerts');\n $db->delete('expeAlerts_subscribers');\n $db->delete('expeAlerts_temp');\n $db->delete('expSimpleNote');\n $db->delete('expRss');\n $db->delete('expCats');\n $db->delete('calendar');\n $db->delete('eventdate');\n $db->delete('calendarmodule_config');\n $db->delete('calendar_external');\n $db->delete('calendar_reminder_address');\n $db->delete('event');\n $db->delete('poll_question');\n $db->delete('poll_answer');\n $db->delete('poll_timeblock');\n $db->delete('simplepollmodule_config');\n $db->delete('simplepoll_question');\n $db->delete('simplepoll_answer');\n $db->delete('simplepoll_timeblock');\n $db->delete('formbuilder_address');\n $db->delete('formbuilder_control');\n $db->delete('formbuilder_form');\n $db->delete('formbuilder_report');\n $db->delete('forms');\n $db->delete('forms_control');\n @$this->msg['clearedcontent']++;\n }\n\t\t\n\t\tif (!empty($this->params['replace'])) {\n\t\t\tforeach($this->params['replace'] as $replace) {\n\t\t\t\tswitch ($replace) {\n\t\t\t\t case 'containermodule':\n\t\t\t\t\t $db->delete('container');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'textmodule':\n\t\t\t\t\tcase 'rotatormodule':\n\t\t\t\t\tcase 'swfmodule':\n\t\t\t\t\t\t$db->delete('text');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'snippetmodule':\n\t\t\t\t\t\t$db->delete('snippet');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'linklistmodule':\n\t\t\t\t\tcase 'linkmodule':\n\t\t\t\t\t\t$db->delete('links');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'newsmodule':\n\t\t\t\t\t\t$db->delete('news');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'resourcesmodule':\n//\t\t\t\t\t\t$db->delete('filedownloads');\n $db->delete('filedownload');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'imagegallerymodule':\n\t\t\t\t\tcase 'slideshowmodule':\n\t\t\t\t\t\t$db->delete('photo');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'headlinemodule':\n\t\t\t\t\t\t$db->delete('headline');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'weblogmodule':\n\t\t\t\t\t\t$db->delete('blog');\n\t\t\t\t\t\t$db->delete('expComments');\n\t\t\t\t\t\t$db->delete('content_expComments');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'faqmodule':\n\t\t\t\t\t\t$db->delete('faq');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'listingmodule':\n\t\t\t\t\t\t$db->delete('portfolio');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'calendarmodule':\n\t\t\t\t\t\t$db->delete('calendar');\n\t\t\t\t\t\t$db->delete('eventdate');\n\t\t\t\t\t\t$db->delete('calendarmodule_config');\n $db->delete('calendar_external');\n $db->delete('calendar_reminder_address');\n $db->delete('event');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'simplepollmodule':\n\t\t\t\t\t\t$db->delete('poll_question');\n\t\t\t\t\t\t$db->delete('poll_answer');\n\t\t\t\t\t\t$db->delete('poll_timeblock');\n\t\t\t\t\t\t$db->delete('simplepollmodule_config');\n $db->delete('simplepoll_question');\n $db->delete('simplepoll_answer');\n $db->delete('simplepoll_timeblock');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'formmodule':\n\t\t\t\t\t\t$db->delete('formbuilder_address');\n\t\t\t\t\t\t$db->delete('formbuilder_control');\n\t\t\t\t\t\t$db->delete('formbuilder_form');\n\t\t\t\t\t\t$db->delete('formbuilder_report');\n $db->delete('forms');\n $db->delete('forms_control');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'youtubemodule':\n\t\t\t\t\tcase 'mediaplayermodule':\n\t\t\t\t\t\t$db->delete('media');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'bannermodule':\n\t\t\t\t\t\t$db->delete('banner');\n\t\t\t\t\t\t$db->delete('companies');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'addressmodule':\n\t\t\t\t\t\t$db->delete('addresses');\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
" //pull the sectionref data for selected modules\n\t\tif (empty($this->params['migrate'])) {\n\t\t\t$where = '1';\n\t\t} else {\n\t\t\t$where = '';\n\t\t\tforeach ($this->params['migrate'] as $key) {\n\t\t\t\tif (!empty($where)) {$where .= \" or\";}\n\t\t\t\t$where .= \" module='\".$key.\"'\";\n\t\t\t}\n\t\t}",
" // pull the sectionref data for selected modules\n $secref = $old_db->selectObjects('sectionref',$where);\n if (empty($this->params['migrate'])) $this->params['migrate'] = array();\n foreach ($secref as $sr) {\n // convert hard coded modules which are only found in sectionref\n if (array_key_exists($sr->module, $this->new_modules) && ($sr->refcount==1000)) {\n\t $iloc = expCore::makeLocation($sr->module,$sr->source,$sr->internal);\n $tmp = new stdClass();\n\t $tmp->module = '';\n// $this->convert($iloc,$iloc->mod,1);\n $this->convert($iloc,$tmp,1); // convert the hard-coded module",
" // convert the source to new exp controller\n $sr->module = $this->new_modules[$sr->module];\n }",
" // copy over and convert sectionrefs\n if (!in_array($sr->module, $this->deprecated_modules)) {\n // if the module is not in the deprecation list, we're hitting here\n if (!$db->selectObject('sectionref',\"source='\".$sr->source.\"'\")) {\n\t\t\t\t\tif (array_key_exists($sr->module, $this->new_modules)) {\n\t\t\t\t\t\t// convert the source to new exp controller\n\t\t\t\t\t\t$sr->module = $this->new_modules[$sr->module];\n\t\t\t\t\t}\n $db->insertObject($sr, 'sectionref');\n @$this->msg['sectionref']++;\n }\n }\n }",
" //pull over all the top level containers\n $containers = $old_db->selectObjects('container', 'external=\"N;\"');\n foreach ($containers as $cont) {\n $oldint = expUnserialize($cont->internal);\n $newint = expCore::makeLocation('container',$oldint->src);\n if (!$db->selectObject('container',\"internal='\".serialize($newint).\"'\")) {\n unset($cont->id);\n $cont->internal = serialize($newint);\n $cont->action = 'showall';\n if ($cont->view == 'Default') {\n $cont->view = 'showall';\n } else {\n $cont->view = 'showall_'.$cont->view;\n }\n $cont->view_data = null;\n $db->insertObject($cont, 'container');\n @$this->msg['container']++;\n }\n }\n // echo \"Imported containermodules<br>\";",
" // // this will pull all the old modules. if we have a exp2 equivalent module\n // // we will convert it to the new type of module before pulling.\n $cwhere = ' and (';\n $i=0;\n foreach ($this->params['migrate'] as $key) {\n $cwhere .= ($i==0) ? \"\" : \" or \";\n $cwhere .= \"internal like '%\".$key.\"%'\";\n $i=1;\n }\n $cwhere .= \")\";\n $modules = $old_db->selectObjects('container', 'external != \"N;\"'.$cwhere.' ORDER BY \"rank\"');\n foreach($modules as $module) {\n $iloc = expUnserialize($module->internal);\n if (array_key_exists($iloc->mod, $this->new_modules)) {\n // convert new modules added via container\n unset(\n $module->internal,\n $module->action\n );\n// unset($module->view);\n $this->convert($iloc, $module);\n// } else if (!in_array($iloc->mod, $this->deprecated_modules)) {\n// // add old school modules not in the deprecation list\n////\t\t\t\tif ($iloc->mod == 'calendarmodule' && $module->view == 'Upcoming Events - Summary') {\n////\t\t\t\t\t$module->view = 'Upcoming Events - Headlines';\n////\t\t\t\t}\n//\t\t\t\t$linked = $this->pulldata($iloc, $module);\n//\t\t\t\tif ($linked) {\n//\t\t\t\t\t$newmodule['i_mod'] = $iloc->mod;\n//\t\t\t\t\t$newmodule['modcntrol'] = $iloc->mod;\n//\t\t\t\t\t$newmodule['rank'] = $module->rank;\n//\t\t\t\t\t$newmodule['views'] = $module->view;\n//\t\t\t\t\t$newmodule['title'] = $module->title;\n//\t\t\t\t\t$newmodule['actions'] = '';\n// $section = $old_db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"' AND is_original='0'\");\n// $_POST['current_section'] = empty($section->section) ? 1 : $section->section;\n//\t\t\t\t\t$module = container::update($newmodule,$module,expUnserialize($module->external));\n//// if ($iloc->mod == 'calendarmodule') {\n//// $config = $old_db->selectObject('calendarmodule_config', \"location_data='\".serialize($iloc).\"'\");\n//// $config->id = '';\n//// $config->enable_categories = 1;\n//// $config->enable_tags = 0;\n//// $config->location_data = $module->internal;\n//// $config->aggregate = serialize(Array($iloc->src));\n//// $db->insertObject($config, 'calendarmodule_config');\n//// }\n//\t\t\t\t}\n//\t\t\t\t$res = $db->insertObject($module, 'container');\n//\t\t\t\tif ($res) { @$this->msg['container']++; }\n }\n }",
"\t\tif (isset($this->params['copy_permissions'])) {\n\t\t\t$db->delete('userpermission',\"module != 'navigation'\");\n\t\t\t$db->delete('grouppermission',\"module != 'navigation'\");",
"\t\t\t$users = $db->selectObjects('user','id > 1');\n\t\t\tforeach($users as $user) {\n\t\t\t\t$containers = $old_db->selectObjects('userpermission',\"uid='\".$user->id.\"' AND source != ''\");\n\t\t\t\tforeach($containers as $item) {\n $loc = expCore::makeLocation($item->module,$item->source);\n\t\t\t\t\tif (array_key_exists($item->module, $this->new_modules)) {\n\t\t\t\t\t\t$loc->mod = $this->new_modules[$item->module];\n\t\t\t\t\t\t$item->module = $this->new_modules[$item->module];\n $item = $this->convert_permission($item);\n }\n\t\t\t\t\tif ($item && $db->selectObject('container',\"internal = '\".serialize($loc).\"'\")) {\n\t\t\t\t\t\t$db->insertObject($item,'userpermission');\n\t\t\t\t\t\tif ($item->permission == 'edit') { // if they had edit permission, we'll also give them create permission\n\t\t\t\t\t\t\t$item->permission = 'create';\n\t\t\t\t\t\t\t@$db->insertObject($item,'userpermission');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$groups = $db->selectObjects('group','1');\n\t\t\tforeach($groups as $group) {\n\t\t\t\t$containers = $old_db->selectObjects('grouppermission',\"gid='\".$group->id.\"' AND source != ''\");\n\t\t\t\tforeach($containers as $item) {\n $loc = expCore::makeLocation($loc->mod = $item->module,$item->source);\n\t\t\t\t\tif (array_key_exists($item->module, $this->new_modules)) {\n\t\t\t\t\t\t$loc->mod = $this->new_modules[$item->module];\n\t\t\t\t\t\t$item->module = $this->new_modules[$item->module];\n\t\t\t\t\t\t$item = $this->convert_permission($item);\n\t\t\t\t\t}\n\t\t\t\t\tif ($item && $db->selectObject('container',\"internal = '\".serialize($loc).\"'\")) {\n\t\t\t\t\t\t$db->insertObject($item,'grouppermission');\n\t\t\t\t\t\tif ($item->permission == 'edit') { // if they had edit permission, we'll also give them create permission\n\t\t\t\t\t\t\t$item->permission = 'create';\n\t\t\t\t\t\t\t@$db->insertObject($item,'grouppermission');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
" // migrate the active controller list (modstate)\n $activemods = $old_db->selectObjects('modstate',1);\n foreach($activemods as $mod) {\n if (array_key_exists($mod->module, $this->new_modules)) {\n $mod->module = $this->new_modules[$mod->module];\n }\n if (array_key_exists($mod->module, $this->new_modules) || !in_array($mod->module, $this->deprecated_modules)) {\n// $mod->path = '';\n// $mod->user_runnable = 1;\n// $mod->controller = 1;\n// $mod->os_module = 1;\n// $mod->name = '';\n// $mod->author = '';\n// $mod->description = '';\n// $mod->codequality = '';\n if ($db->selectObject('modstate',\"module='\".$mod->module.\"'\")) {\n $db->updateObject($mod,'modstate',null,'module');\n } else {\n $db->insertObject($mod,'modstate');\n }\n }\n }",
"\t\tsearchController::spider();\n expSession::clearCurrentUserSessionCache();\n assign_to_template(array(\n 'msg'=>@$this->msg\n ));\n }",
"\t/**\n\t * gather info about all users/groups in old site for user selection\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n\tpublic function manage_users() {\n global $db;",
" expHistory::set('manageable', $this->params);\n $old_db = $this->connect();\n $users = $old_db->selectObjects('user','id > 1');\n foreach($users as $user) {\n\t\t\tif ($db->selectObject('user',\"id='\".$user->id.\"'\")) {\n\t\t\t\t$user->exists = true;\n\t\t\t} else {\n\t\t\t\t$user->exists = false;\n\t\t\t}\n\t\t}",
" $groups = $old_db->selectObjects('group');\n foreach($groups as $group) {\n\t\t\tif ($db->selectObject('group',\"id='\".$group->id.\"'\")) {\n\t\t\t\t$group->exists = true;\n\t\t\t} else {\n\t\t\t\t$group->exists = false;\n\t\t\t}\n\t\t}\n\t\tassign_to_template(array(\n 'users'=>$users,\n 'groups'=>$groups\n ));\n }",
"\t/**\n\t * copy selected users/groups over from old site\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function migrate_users() {\n global $db;",
"\t\tif (isset($this->params['wipe_groups'])) {\n\t\t\t$db->delete('group');\n\t\t\t$db->delete('groupmembership');\n\t\t}\n\t\tif (isset($this->params['wipe_users'])) {\n\t\t\t$db->delete('user','id > 1');\n\t\t}\n $old_db = $this->connect();\n//\t\tprint_r(\"<pre>\");\n//\t\tprint_r($old_db->selectAndJoinObjects('', '', 'group', 'groupmembership','id', 'group_id', 'name = \"Editors\"', ''));",
" $gsuccessful = 0;\n $gfailed = 0;\n\t\tif (!empty($this->params['groups'])) {\n\t\t\tforeach($this->params['groups'] as $groupid) {\n\t\t\t\t$group = $old_db->selectObject('group', 'id='.$groupid);\n\t\t\t\t$ret = $db->insertObject($group, 'group');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$gfailed++;\n\t\t\t\t} else {\n\t\t\t\t\t$gsuccessful++;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tif (!empty($this->params['rep_groups'])) {\n\t\t\tforeach($this->params['rep_groups'] as $groupid) {\n\t\t\t\t$db->delete('group','id='.$groupid);\n\t\t\t\t$group = $old_db->selectObject('group', 'id='.$groupid);\n\t\t\t\t$ret = $db->insertObject($group, 'group');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$gfailed++;\n\t\t\t\t} else {\n\t\t\t\t\t$gsuccessful++;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n $successful = 0;\n $failed = 0;\n\t\tif (!empty($this->params['users'])) {\n\t\t\tforeach($this->params['users'] as $userid) {\n\t\t\t\t$user = $old_db->selectObject('user', 'id='.$userid);\n\t\t\t\t$ret = $db->insertObject($user, 'user');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$failed++;\n\t\t\t\t} else {\n\t\t\t\t\t$successful++;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tif (!empty($this->params['rep_users'])) {\n\t\t\tforeach($this->params['rep_users'] as $userid) {\n\t\t\t\t$db->delete('user','id='.$userid);\n\t\t\t\t$user = $old_db->selectObject('user', 'id='.$userid);\n\t\t\t\t$ret = $db->insertObject($user, 'user');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$failed++;\n\t\t\t\t} else {\n\t\t\t\t\t$successful++;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t $users = new stdClass();\n\t $groups = new stdClass();\n\t\tif (!empty($this->params['groups']) && !empty($this->params['rep_groups'])) {\n\t\t\t$groups = array_merge($this->params['groups'],$this->params['rep_groups']);\n\t\t} elseif (!empty($this->params['groups'])) {\n\t\t\t$groups = $this->params['groups'];\n\t\t} elseif (!empty($this->params['rep_groups'])) {\n\t\t\t$groups = $this->params['rep_groups'];\n\t\t}\n\t\tif (!empty($this->params['users']) && !empty($this->params['rep_users'])) {\n\t\t\t$users = array_merge($this->params['users'],$this->params['rep_users']);\n\t\t} elseif (!empty($this->params['users'])) {\n\t\t\t$users = $this->params['users'];\n\t\t} elseif (!empty($this->params['rep_users'])) {\n\t\t\t$users = $this->params['rep_users'];\n\t\t}\n\t\tif (!empty($groups) && !empty($users)) {\n\t\t\tforeach($groups as $groupid) {\n\t\t\t\t$groupmembers = $old_db->selectObjects('groupmembership', 'group_id='.$groupid);\n\t\t\t\tforeach($groupmembers as $userid) {\n\t\t\t\t\tif (in_array($userid->member_id,$users)) {\n\t\t\t\t\t\t$db->insertObject($userid, 'groupmembership');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n flash('message', $successful.' '.gt('users and').' '.$gsuccessful.' '.gt('groups were imported from').' '.$this->config['database']);\n if ($failed > 0 || $gfailed > 0) {\n\t\t\t$msg = '';\n\t\t\tif ($failed > 0) {\n\t\t\t\t$msg = $failed.' users ';\n\t\t\t}\n\t\t\tif ($gfailed > 0) {\n\t\t\t\tif ($msg != '') { $msg .= ' and ';}\n\t\t\t\t$msg .= $gfailed.' groups ';\n\t\t\t}\n flash('error', $msg.' '.gt('could not be imported from').' '.$this->config['database'].' '.gt('This is usually because a user with the username or group with that name already exists in the database you importing to.'));\n }\n expSession::clearCurrentUserSessionCache();\n expHistory::back();\n }",
"\t/**\n\t * main routine to convert old school module data into new controller format\n\t * @var \\mysqli_database $db the exponent database object\n\t * @param $iloc\n\t * @param $module\n\t * @param int $hc\n\t * @return\n\t */\n private function convert($iloc, $module, $hc=0) {\n if (!in_array($iloc->mod, $this->params['migrate'])) return $module;\n global $db;\n $old_db = $this->connect();\n\t\t$linked = false;\n\t $loc = new stdClass();\n $newconfig = new expConfig();\n if ((!empty($module->is_existing) && $module->is_existing)) {\n $linked = true;\n }",
" switch ($iloc->mod) {\n case 'textmodule':\n\t\t\t\t@$module->view = 'showall';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n\t\t\t\t$ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"text\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'textmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'textmodule';\n $textitems = $old_db->selectObjects('textitem', \"location_data='\".serialize($iloc).\"'\");\n if ($textitems) {\n foreach ($textitems as $ti) {\n $text = new text();\n $loc = expUnserialize($ti->location_data);\n $loc->mod = \"text\";\n $text->location_data = serialize($loc);\n $text->body = $ti->text;\n $text->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n }\n\t\t\t\tbreak;\n case 'rotatormodule':\n $module->action = 'showRandom';\n $module->view = 'showRandom';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"text\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'rotatormodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'rotatormodule';\n $textitems = $old_db->selectObjects('rotator_item', \"location_data='\".serialize($iloc).\"'\");\n if ($textitems) {\n foreach ($textitems as $ti) {\n $text = new text();\n $loc = expUnserialize($ti->location_data);\n $loc->mod = \"text\";\n $text->location_data = serialize($loc);\n $text->body = $ti->text;\n $text->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n }\n\t\t\t\tbreak;\n case 'snippetmodule':\n\t\t\t\t$module->view = 'showall';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"snippet\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'snippetmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'snippetmodule';\n $textitems = $old_db->selectObjects('textitem', \"location_data='\".serialize($iloc).\"'\");\n if ($textitems) {\n foreach ($textitems as $ti) {\n $text = new snippet();\n $loc = expUnserialize($ti->location_data);\n $loc->mod = \"snippet\";\n $text->location_data = serialize($loc);\n $text->body = $ti->text;\n // if the item exists in the current db, we won't save it\n $te = $text->find('first',\"location_data='\".$text->location_data.\"'\");\n if (empty($te)) {\n $text->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n }\n }\n\t\t\t\tbreak;\n case 'linklistmodule':\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'Quick Links':\n\t\t\t\t\t\t@$module->view = \"showall_quicklinks\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t@$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"links\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'linklistmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'linklistmodule';\n $links = $old_db->selectArrays('linklist_link', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($links) {\n\t\t\t\t\tforeach ($links as $link) {\n\t\t\t\t\t\t$lnk = new links();\n\t\t\t\t\t\t$loc = expUnserialize($link['location_data']);\n\t\t\t\t\t\t$loc->mod = \"links\";\n\t\t\t\t\t\t$lnk->title = (!empty($link['name'])) ? $link['name'] : 'Untitled';\n\t\t\t\t\t\t$lnk->body = $link['description'];\n\t\t\t\t\t\t$lnk->new_window = $link['opennew'];\n\t\t\t\t\t\t$lnk->url = (!empty($link['url'])) ? $link['url'] : '#';\n\t\t\t\t\t\t$lnk->rank = $link['rank']+1;\n\t\t\t\t\t\t$lnk->poster = 1;\n\t\t\t\t\t\t$lnk->editor = 1;\n\t\t\t\t\t\t$lnk->location_data = serialize($loc);\n\t\t\t\t\t\t$lnk->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'linkmodule': // user mod, not widely distributed\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'Summary':\n\t\t\t\t\t\t@$module->view = \"showall_quicklinks\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t@$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('linkmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_rss == 1) {\n $newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['feed_desc'] = $oldconfig->feed_desc;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->orderhow)) {\n if ($oldconfig->orderby == 'name') $newconfig->config['order'] = 'title';\n switch ($oldconfig->orderhow) {\n case '1':\n $newconfig->config['order'] .= ' DESC';\n break;\n case '2':\n $newconfig->config['order'] = 'rank';\n break;\n }\n }\n if ($oldconfig->enable_categories == 1) {\n $newconfig->config['usecategories'] = true;\n }\n }",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"links\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'linkmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'linkmodule';\n $links = $old_db->selectArrays('link', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($links) {\n\t\t\t\t\tforeach ($links as $link) {\n\t\t\t\t\t\t$lnk = new links();\n\t\t\t\t\t\t$loc = expUnserialize($link['location_data']);\n\t\t\t\t\t\t$loc->mod = \"links\";\n\t\t\t\t\t\t$lnk->title = (!empty($link['name'])) ? $link['name'] : 'Untitled';\n\t\t\t\t\t\t$lnk->body = $link['description'];\n\t\t\t\t\t\t$lnk->new_window = $link['opennew'];\n\t\t\t\t\t\t$lnk->url = (!empty($link['url'])) ? $link['url'] : '#';\n\t\t\t\t\t\t$lnk->rank = $link['rank']+1;\n\t\t\t\t\t\t$lnk->poster = 1;\n\t\t\t\t\t\t$lnk->editor = 1;\n\t\t\t\t\t\t$lnk->location_data = serialize($loc);\n\t\t\t\t\t\t$lnk->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1 && $link['category_id']) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$link['category_id']);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank + 1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $lnk->update($params);\n }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'swfmodule':\n\t\t\t\t$module->view = 'showall';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"text\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'swfmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'swfmodule';\n $swfitems = $old_db->selectObjects('swfitem', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($swfitems) {\n\t\t\t\t\tforeach ($swfitems as $ti) {\n\t\t\t\t\t\t$text = new text();\n\t\t\t\t\t\t$file = new expFile($ti->swf_id);\n\t\t\t\t\t\t$loc = expUnserialize($ti->location_data);\n\t\t\t\t\t\t$loc->mod = \"text\";\n\t\t\t\t\t\t$text->location_data = serialize($loc);\n\t\t\t\t\t\t$text->title = $ti->name;\n\t\t\t\t\t\t$swfcode = '\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" height=\"'.$ti->height.'\" width=\"'.$ti->width.'\">\n\t\t\t\t\t\t\t\t <param name=\"bgcolor\" value=\"'.$ti->bgcolor.'\" />\n\t\t\t\t\t\t\t\t\t'.($ti->transparentbg?\"<param name=\\\"wmode\\\" value=\\\"transparent\\\" />\":\"\").'\n\t\t\t\t\t\t\t\t <param name=\"quality\" value=\"high\" />\n\t\t\t\t\t\t\t\t <param name=\"movie\" value=\"'.$file->path_relative.'\" />\n\t\t\t\t\t\t\t\t <embed bgcolor= \"'.$ti->bgcolor.'\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\"'.$file->path_relative.'\" type=\"application/x-shockwave-flash\" height=\"'.$ti->height.'\" width=\"'.$ti->width.'\"'.($ti->transparentbg?\" wmode=\\\"transparent\\\"\":\"\").'>\n\t\t\t\t\t\t\t\t </embed>\n\t\t\t\t\t\t\t </object>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t';\n\t\t\t\t\t\t$text->body = $swfcode;\n\t\t\t\t\t\t$text->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'newsmodule':\n $only_featured = false;\n $usebody = 0;\n\t\t\t\tswitch ($module->view) {\n case 'Featured News':\n $only_featured = true;\n $module->view = 'showall';\n break;\n\t\t\t\t\tcase 'Headlines':\n $usebody = 2;\n\t\t\t\t\t\t$module->view = 'showall_headlines';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Summary':\n case 'Default':\n $usebody = 1;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('newsmodule_config', \"location_data='\".serialize($iloc).\"'\");\n $oldviewconfig = expUnserialize($old_db->selectValue('container','view_data', \"internal='\".serialize($iloc).\"'\"));\n $ploc = clone($iloc);\n $ploc->mod = \"news\";\n // fudge a config to get attached files to appear\n $newconfig->config = expUnserialize('a:14:{s:9:\"feedmaker\";s:0:\"\";s:11:\"filedisplay\";s:7:\"Gallery\";s:6:\"ffloat\";s:4:\"Left\";s:6:\"fwidth\";s:3:\"120\";s:7:\"fmargin\";s:1:\"5\";s:7:\"piwidth\";s:3:\"100\";s:5:\"thumb\";s:3:\"100\";s:7:\"spacing\";s:2:\"10\";s:10:\"floatthumb\";s:8:\"No Float\";s:6:\"tclass\";s:0:\"\";s:5:\"limit\";s:0:\"\";s:9:\"pagelinks\";s:14:\"Top and Bottom\";s:10:\"feed_title\";s:0:\"\";s:9:\"feed_desc\";s:0:\"\";}');\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_rss == 1) {\n $newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['feed_desc'] = $oldconfig->feed_desc;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->item_limit)) {\n $newconfig->config['limit'] = $oldconfig->item_limit;\n $newconfig->config['multipageonly'] = true;\n }\n if (!empty($oldconfig->sortfield)) {\n switch ($oldconfig->sortfield) {\n case 'publish':\n $newconfig->config['order'] = 'publish';\n break;\n case 'edited':\n $newconfig->config['order'] = 'edited_at';\n break;\n case 'posted':\n default:\n $newconfig->config['order'] = 'created_at';\n break;\n }\n if ($oldconfig->sortorder == 'DESC') {\n $newconfig->config['order'] .= ' DESC';\n }\n }\n if (!empty($oldconfig->aggregate) && $oldconfig->aggregate != 'a:0:{}') {\n $merged = expUnserialize($oldconfig->aggregate);\n foreach ($merged as $merge) {\n $newconfig->config['aggregate'][] = $merge;\n }\n }\n if (!empty($oldconfig->pull_rss) && $oldconfig->pull_rss) {\n $pulled = expUnserialize($oldconfig->rss_feed);\n foreach ($pulled as $pull) {\n $newconfig->config['pull_rss'][] = $pull;\n }\n }\n }\n if ($usebody) {\n $newconfig->config['usebody'] = $usebody;\n }\n if (!empty($oldviewconfig['num_items'])) {\n $newconfig->config['limit'] = $oldviewconfig['num_items'];\n// $newconfig->config['pagelinks'] = \"Don't show page links\";\n }\n $only_featured = empty($oldviewconfig['featured_only']) ? 0 : 1;\n if ($only_featured) {\n $newconfig->config['only_featured'] = true;\n }",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'newsmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'newsmodule';\n $newsitems = $old_db->selectArrays('newsitem', \"location_data='\".serialize($iloc).\"'\");\n if ($newsitems) {\n foreach ($newsitems as $ni) {\n unset($ni['id']);\n $news = new news($ni);\n $loc = expUnserialize($ni['location_data']);\n $loc->mod = \"news\";\n $news->location_data = serialize($loc);\n $news->title = (!empty($ni['title'])) ? $ni['title'] : gt('Untitled');\n $news->body = (!empty($ni['body'])) ? $ni['body'] : gt('(empty)');\n $news->save();\n\t\t\t\t\t\t// default is to create with current time\n $news->created_at = $ni['posted'];\n $news->migrated_at = $ni['edited'];\n $news->update();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n if (!empty($ni['file_id'])) {\n $file = new expFile($ni['file_id']);\n $news->attachItem($file,'');\n }\n if (isset($oldconfig->enable_tags) && $oldconfig->enable_tags = true) {\n\t $params = null;;\n\t\t\t\t\t\t\t$oldtags = expUnserialize($ni['tags']);\n if (!empty($oldtags)) {\n foreach ($oldtags as $oldtag){\n $tagtitle = strtolower(trim($old_db->selectValue('tags','name','id = '.$oldtag)));\n $tag = new expTag($tagtitle);\n //\t\t\t\t\t\t\t\t$tag->title = $old_db->selectValue('tags','name','id = '.$oldtag);\n if (empty($tag->id))\n $tag->update(array('title'=>$tagtitle));\n $params['expTag'][] = $tag->id;\n }\n }\n $news->update($params);\n }\n }\n }\n\t\t\t\tbreak;\n case 'resourcesmodule':\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'One Click Download - Descriptive':\n\t\t\t\t\t\t$module->view = 'showall_headlines';\n\t\t\t\t\t\tbreak;\n case 'Recent':\n $module->view = 'showall_recent';\n $newconfig->config['usebody'] = 2;\n break;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('resourcesmodule_config', \"location_data='\".serialize($iloc).\"'\");\n $oldviewconfig = expUnserialize($old_db->selectValue('container','view_data', \"internal='\".serialize($iloc).\"'\"));\n $ploc = clone($iloc);\n $ploc->mod = \"filedownload\";\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_categories == 1 && $module->view != 'showall_recent') {\n $newconfig->config['usecategories'] = true;\n }\n if (!empty($oldconfig->description)) {\n $newconfig->config['moduledescription'] = $oldconfig->description;\n }\n if (isset($oldconfig->enable_rss)) {\n $dorss = $oldconfig->enable_rss;\n } elseif (isset($oldconfig->enable_podcasting)) {\n $dorss = $oldconfig->enable_podcasting;\n } else {\n $dorss = false;\n }\n if ($dorss) {\n $newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['feed_desc'] = $oldconfig->feed_desc;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->orderhow)) {\n switch ($oldconfig->orderby) {\n case 'edited':\n $newconfig->config['order'] = 'edited_at';\n break;\n case 'downloads':\n $newconfig->config['order'] = 'downloads';\n break;\n case 'name':\n $newconfig->config['order'] = 'title';\n break;\n case 'posted':\n default:\n $newconfig->config['order'] = 'created_at';\n break;\n }\n switch ($oldconfig->orderhow) {\n case '2':\n $newconfig->config['order'] = 'rank';\n break;\n case '1':\n $newconfig->config['order'] .= ' DESC';\n break;\n }\n }\n }\n if (!empty($oldviewconfig['num_posts'])) {\n $newconfig->config['limit'] = $oldviewconfig['num_posts'];\n// $newconfig->config['pagelinks'] = \"Don't show page links\";\n }\n $newconfig->config['usebody'] = 2;\n if (!empty($oldviewconfig['show_descriptions'])) {\n $newconfig->config['show_info'] = $oldviewconfig['show_descriptions'] ? 1 : 0;\n if ($oldviewconfig['show_descriptions']) {\n $newconfig->config['usebody'] = 0;\n }\n }\n $newconfig->config['quick_download'] = !empty($oldviewconfig['direct_download']) ? $oldviewconfig['direct_download'] : 0;\n $newconfig->config['show_icon'] = !empty($oldviewconfig['show_icons']) ? $oldviewconfig['show_icons'] : 0;\n $newconfig->config['show_player'] = !empty($oldviewconfig['show_player']) ? $oldviewconfig['show_player'] : 0;",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n//\t\t\t\tif ($db->countObjects('filedownloads', \"location_data='\".serialize($ploc).\"'\")) {\n if ($db->countObjects('filedownload', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'resourcesmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'resourcesmodule';\n $resourceitems = $old_db->selectArrays('resourceitem', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($resourceitems) {\n\t\t\t\t\tforeach ($resourceitems as $ri) {\n\t\t\t\t\t\tunset($ri['id']);\n\t\t\t\t\t\t$filedownload = new filedownload($ri);\n\t\t\t\t\t\t$loc = expUnserialize($ri['location_data']);\n\t\t\t\t\t\t$loc->mod = \"filedownload\";\n\t\t\t\t\t\t$filedownload->title = (!empty($ri['name'])) ? $ri['name'] : 'Untitled';\n\t\t\t\t\t\t$filedownload->body = $ri['description'];\n\t\t\t\t\t\t$filedownload->downloads = $ri['num_downloads'];\n\t\t\t\t\t\t$filedownload->location_data = serialize($loc);\n\t\t\t\t\t\tif (!empty($ri['file_id'])) {\n\t\t\t\t\t\t\t$filedownload->save();\n\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t\t\t$file = new expFile($ri['file_id']);\n\t\t\t\t\t\t\t$filedownload->attachItem($file,'downloadable');\n\t\t\t\t\t\t\t// default is to create with current time\t\t\t\t\t\t\n\t\t\t\t\t\t\t$filedownload->created_at = $ri['posted'];\n\t\t\t\t\t\t\t$filedownload->migrated_at = $ri['edited'];\n $filedownload->publish = $ri['posted'];\n\t\t\t\t\t\t\t$filedownload->update();\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1 && $ri['category_id']) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$ri['category_id']);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank +1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $filedownload->update($params);\n }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'imagegallerymodule':\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'Slideshow':\n\t\t\t\t\t\t$module->action = 'slideshow';\n\t\t\t\t\t\t$module->view = 'slideshow';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldviewconfig = expUnserialize($old_db->selectValue('container','view_data', \"internal='\".serialize($iloc).\"'\"));\n $newconfig->config['usecategories'] = true;\n $newconfig->config['multipageonly'] = true;\n $newconfig->config['speed'] = empty($oldviewconfig['delay']) ? 0: $oldviewconfig['delay']/1000;\n $newconfig->config['pa_show_controls'] = empty($oldviewconfig['controller']) ? 0 : 1;",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"photo\";\n\t\t\t\tif ($db->countObjects('photo', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'imagegallerymodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'imagegallerymodule';\n $galleries = $old_db->selectArrays('imagegallery_gallery', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($galleries) {\n\t\t\t\t\tforeach ($galleries as $gallery) {\n $params = null;;\n $cat = new expCat($gallery['name']);\n if (empty($cat->id)) {\n $cat->title = $gallery['name'];\n $cat->rank = $gallery['galleryorder']+1;\n $cat->module = 'photo';\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n\t\t\t\t\t\t$gis = $old_db->selectArrays('imagegallery_image', \"gallery_id='\".$gallery['id'].\"'\");\n\t\t\t\t\t\tforeach ($gis as $gi) {\n\t\t\t\t\t\t\t$photo = new photo();\n\t\t\t\t\t\t\t$loc = expUnserialize($gallery['location_data']);\n\t\t\t\t\t\t\t$loc->mod = \"photo\";\n\t\t\t\t\t\t\t$photo->title = (!empty($gi['name'])) ? $gi['name'] : 'Untitled';\n\t\t\t\t\t\t\t$photo->body = $gi['description'];\n\t\t\t\t\t\t\t$photo->alt = !empty($gi['alt']) ? $gi['alt'] : $photo->title;\n\t\t\t\t\t\t\t$photo->location_data = serialize($loc);\n\t\t\t\t\t\t\tif (!empty($gi['file_id'])) {\n\t\t\t\t\t\t\t\t$photo->save();\n\t\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t\t\t\t$file = new expFile($gi['file_id']);\n\t\t\t\t\t\t\t\t$photo->attachItem($file,'');\n\t\t\t\t\t\t\t\t$photo->created_at = $gi['posted'];\n\t\t\t\t\t\t\t\t$photo->migrated_at = $gi['posted'];\n\t\t\t\t\t\t\t\t$photo->update(array(\"validate\"=>false));\t\t\t\t\t\t\t\t\n $photo->update($params); // save gallery name as category\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n // pick up some module config settings based on last gallery\n $newconfig->config['pa_showall_thumbbox'] = $gallery['box_size'];\n $newconfig->config['pa_showall_enlarged'] = $gallery['pop_size'];\n $newconfig->config['limit'] = $gallery['perpage'];\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'slideshowmodule':\n $module->action = 'slideshow';\n $module->view = 'slideshow';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"photo\";\n\t\t\t\tif ($db->countObjects('photo', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'slideshowmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'slideshowmodule';\n $gis = $old_db->selectArrays('slideshow_slide', \"location_data='\".serialize($iloc).\"'\");\n if ($gis) {\n foreach ($gis as $gi) {\n $photo = new photo();\n $loc->mod = \"photo\";\n $loc->src = $iloc->src;\n $loc->int = $iloc->int;\n $photo->title = (!empty($gi['name'])) ? $gi['name'] : 'Untitled';\n $photo->body = $gi['description'];\n $photo->alt = !empty($gi['alt']) ? $gi['alt'] : $photo->title;\n $photo->location_data = serialize($loc);\n $te = $photo->find('first',\"location_data='\".$photo->location_data.\"'\");\n if (empty($te)) {\n if (!empty($gi['file_id'])) {\n $photo->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n $file = new expFile($gi['file_id']);\n $photo->attachItem($file,'');\n $photo->update(array(\"validate\"=>false));\n }\n }\n }\n }\n\t\t\t\tbreak;\n case 'headlinemodule':\n $module->view = 'showall_headline';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"text\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'headlinemodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'headlinemodule';\n $headlines = $old_db->selectObjects('headline', \"location_data='\".serialize($iloc).\"'\");\n if ($headlines) {\n foreach ($headlines as $hl) {\n $headline = new text();\n $loc = expUnserialize($hl->location_data);\n $loc->mod = \"text\";\n $headline->location_data = serialize($loc);\n $headline->title = $hl->headline;\n $headline->poster = 1;\n// $headline->created_at = time();\n// $headline->migrated_at = time();\n $headline->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n }\n\t\t\t\tbreak;\n case 'weblogmodule':\n $usebody = 0;\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'By Author':\n\t\t\t\t\t\t$module->action = 'authors';\n\t\t\t\t\t\t$module->view = 'authors';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'By Tag':\n\t\t\t\t\t\t$module->action = 'tags';\n\t\t\t\t\t\t$module->view = 'tags_list';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Monthly':\n\t\t\t\t\t\t$module->action = 'dates';\n\t\t\t\t\t\t$module->view = 'dates';\n\t\t\t\t\t\tbreak;\n case 'Summary':\n $usebody = 2;\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n case 'Default':\n $usebody = 1;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('weblogmodule_config', \"location_data='\".serialize($iloc).\"'\");\n $oldviewconfig = expUnserialize($old_db->selectValue('container','view_data', \"internal='\".serialize($iloc).\"'\"));\n $ploc = clone($iloc);\n $ploc->mod = \"blog\";\n $newconfig->config['add_source'] = '1';\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_rss == 1) {\n $newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['feed_desc'] = $oldconfig->feed_desc;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->items_per_page)) {\n $newconfig->config['limit'] = $oldconfig->items_per_page;\n $newconfig->config['multipageonly'] = true;\n }\n if (!empty($oldviewconfig['num_posts'])) {\n $newconfig->config['limit'] = $oldviewconfig['num_posts'];\n // $newconfig->config['pagelinks'] = \"Don't show page links\";\n }\n if (!empty($oldconfig->allow_comments)) {\n $newconfig->config['usescomments'] = !$oldconfig->allow_comments;\n }\n if (!empty($oldconfig->aggregate) && $oldconfig->aggregate != 'a:0:{}') {\n $merged = expUnserialize($oldconfig->aggregate);\n foreach ($merged as $merge) {\n $newconfig->config['aggregate'][] = $merge;\n }\n }\n }\n if ($usebody) {\n $newconfig->config['usebody'] = $usebody;\n }",
" //check to see if it's already pulled in (circumvent !is_original)\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'weblogmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'weblogmodule';\n $blogitems = $old_db->selectArrays('weblog_post', \"location_data='\".serialize($iloc).\"'\");\n if ($blogitems) {\n foreach ($blogitems as $bi) {\n unset($bi['id']);\n $post = new blog($bi);\n $loc = expUnserialize($bi['location_data']);\n $loc->mod = \"blog\";\n $post->location_data = serialize($loc);\n $post->title = (!empty($bi['title'])) ? $bi['title'] : gt('Untitled');\n $post->body = (!empty($bi['body'])) ? $bi['body'] : gt('(empty)');\n $post->save();\n\t\t\t\t\t\t// default is to create with current time\t\t\t\t\t\t\n $post->created_at = $bi['posted'];\n $post->migrated_at = $bi['edited'];\n $post->update();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t\t// this next section is moot since there are no attachments to blogs\n // if (!empty($bi['file_id'])) {\n // $file = new expFile($bi['file_id']);\n // $post->attachItem($file,'downloadable');\n // }",
" if (isset($oldconfig->enable_tags) && $oldconfig->enable_tags = true) {\n\t $params = null;;\n\t\t\t\t\t\t\t$oldtags = expUnserialize($bi['tags']);\n\t\t\t\t\t\t\tforeach ($oldtags as $oldtag){\n\t\t\t\t\t\t\t\t$tagtitle = strtolower(trim($old_db->selectValue('tags','name','id = '.$oldtag)));\n\t\t\t\t\t\t\t\t$tag = new expTag($tagtitle);\n//\t\t\t\t\t\t\t\t$tag->title = $old_db->selectValue('tags','name','id = '.$oldtag);\n\t\t\t\t\t\t\t\tif (empty($tag->id))\n $tag->update(array('title'=>$tagtitle));\n\t\t\t\t\t\t\t\t$params['expTag'][] = $tag->id;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$post->update($params);\n }",
"\t\t\t\t\t\t$comments = $old_db->selectArrays('weblog_comment', \"parent_id='\".$post->id.\"'\");\n\t\t\t\t\t\tforeach($comments as $comment) {\n\t\t\t\t\t\t\tunset($comment['id']);\n\t\t\t\t\t\t\t$newcomment = new expComment($comment);\n\t\t\t\t\t\t\t$newcomment->created_at = $comment['posted'];\n\t\t\t\t\t\t\t$newcomment->migrated_at = $comment['edited'];\n $newcomment->publish = $comment['posted'];\n\t\t\t\t\t\t\t$newcomment->update();\n\t\t\t\t\t\t\t// attach the comment to the blog post it belongs to\n// $obj = new stdClass();\n//\t\t\t\t\t\t\t$obj->content_type = 'blog';\n//\t\t\t\t\t\t\t$obj->content_id = $post->id;\n//\t\t\t\t\t\t\t$obj->expcomments_id = $newcomment->id;\n//\t\t\t\t\t\t\tif(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n//\t\t\t\t\t\t\t$db->insertObject($obj, $newcomment->attachable_table);\n $newcomment->attachComment('blog', $post->id);\n\t\t\t\t\t\t}\n }\n }\n\t\t\t\tbreak;\n case 'faqmodule':\n\t\t\t\t$module->view = 'showall';",
" $oldconfig = $old_db->selectObject('faqmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1) {\n $newconfig->config['usecategories'] = true;\n }\n $newconfig->config['use_toc'] = true;",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"faq\";\n//\t\t\t\tif ($db->countObjects('faqs', \"location_data='\".serialize($ploc).\"'\")) {\n if ($db->countObjects('faq', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'faqmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'faqmodule';\n $faqs = $old_db->selectArrays('faq', \"location_data='\".serialize($iloc).\"'\");\n if ($faqs) {\n foreach ($faqs as $fqi) {\n unset($fqi['id']);\n $faq = new faq($fqi);\n $loc = expUnserialize($fqi['location_data']);\n $loc->mod = \"faq\";\n $faq->location_data = serialize($loc);\n $faq->question = (!empty($fqi['question'])) ? $fqi['question'] : 'Untitled?';\n $faq->answer = $fqi['answer'];\n $faq->rank = $fqi['rank']+1;\n $faq->include_in_faq = 1;\n $faq->submitter_name = 'Unknown';\n $faq->submitter_email = 'address@website.com';\n $faq->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1 && $fqi['category_id']) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$fqi['category_id']);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank + 1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $faq->update($params);\n }\n }\n }\n\t\t\t\tbreak;\n case 'listingmodule':\n $usebody = 0;\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'Simple':\n $module->view = 'showall_simple_list';\n $usebody = 2;\n\t\t\t\t\t\tbreak;\n case 'Default':\n $usebody = 1;\n case 'Full':\n $module->view = 'showall';\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('listingmodule_config', \"location_data='\".serialize($iloc).\"'\");\n // fudge a config to get attached files to appear\n $newconfig->config = expUnserialize('a:11:{s:11:\"filedisplay\";s:7:\"Gallery\";s:6:\"ffloat\";s:4:\"Left\";s:6:\"fwidth\";s:3:\"120\";s:7:\"fmargin\";s:1:\"5\";s:7:\"piwidth\";s:3:\"100\";s:5:\"thumb\";s:3:\"100\";s:7:\"spacing\";s:2:\"10\";s:10:\"floatthumb\";s:8:\"No Float\";s:6:\"tclass\";s:0:\"\";s:5:\"limit\";s:0:\"\";s:9:\"pagelinks\";s:14:\"Top and Bottom\";}');\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_categories == 1) {\n $newconfig->config['usecategories'] = true;\n }\n if (!empty($oldconfig->items_perpage)) {\n $newconfig->config['limit'] = $oldconfig->items_perpage;\n $newconfig->config['multipageonly'] = true;\n }\n if (!empty($oldconfig->orderhow)) {\n if ($oldconfig->orderby == 'name') $newconfig->config['order'] = 'title';\n switch ($oldconfig->orderhow) {\n case '1':\n $newconfig->config['order'] .= ' DESC';\n break;\n case '2':\n $newconfig->config['order'] = 'rank';\n break;\n }\n }\n if (!empty($oldconfig->description)) {\n $newconfig->config['moduledescription'] = $oldconfig->description;\n }\n }\n if ($usebody) {\n $newconfig->config['usebody'] = $usebody;\n }",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"portfolio\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'listingmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'listingmodule';\n $listingitems = $old_db->selectArrays('listing', \"location_data='\".serialize($iloc).\"'\");\n if ($listingitems) {\n foreach ($listingitems as $li) {\n unset($li['id']);\n $listing = new portfolio($li);\n\t\t\t\t\t\t$listing->title = (!empty($li['name'])) ? $li['name'] : 'Untitled?';\n $loc = expUnserialize($li['location_data']);\n $loc->mod = \"portfolio\";\n $listing->location_data = serialize($loc);\n $listing->featured = true;\n $listing->poster = 1;\n $listing->body = \"<p>\".$li['summary'].\"</p>\".$li['body'];\n $listing->save();\n\t\t\t\t\t\t// default is to create with current time\t\t\t\t\t\t\n// $listing->created_at = time();\n// $listing->migrated_at = time();\n// $listing->update();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n if (!empty($li['file_id'])) {\n\t\t\t\t\t\t\t$file = new expFile($li['file_id']);\n\t\t\t\t\t\t\t$listing->attachItem($file,'');\n\t\t\t\t\t\t}\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1 && $li['category_id']) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$li['category_id']);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank + 1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $listing->update($params);\n }\n }\n }\n\t\t\t\tbreak;\n case 'youtubemodule': //must convert to media player\n\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"media\";\n\t\t\t\tif ($db->countObjects('media', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'youtubemodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'youtubemodule';\n $videos = $old_db->selectArrays('youtube', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($videos) {\n\t\t\t\t\tforeach ($videos as $vi) {\n\t\t\t\t\t\tunset ($vi['id']);\n\t\t\t\t\t\t$video = new media($vi);\n\t\t\t\t\t\t$loc = expUnserialize($vi['location_data']);\n\t\t\t\t\t\t$loc->mod = \"media\";\n\t\t\t\t\t\t$video->title = $vi['name'];\n\t\t\t\t\t\tif (empty($video->title)) { $video->title = 'Untitled'; }\n\t\t\t\t\t\t$video->location_data = serialize($loc);\n $video->body = $vi['description'];\n//\t\t\t\t\t\t$yt = explode(\"watch?v=\",$vi['url']);\n//\t\t\t\t\t\tif (empty($yt[1])) {\n//\t\t\t\t\t\t\tbreak;\n//\t\t\t\t\t\t} else {\n//\t\t\t\t\t\t\t$ytid = $yt[1];\n//\t\t\t\t\t\t}\n//\t\t\t\t\t\tunset ($video->url);\n//\t\t\t\t\t\t$video->embed_code = '<iframe title=\"YouTube video player\" width=\"'.$vi['width'].'\" height=\"'.$vi['height'].'\" src=\"http://www.youtube.com/embed/'.$ytid.'\" frameborder=\"0\" allowfullscreen></iframe>';\n\t\t\t\t\t\t$video->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'mediaplayermodule': // must convert media player\n\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"media\";\n\t\t\t\tif ($db->countObjects('media', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'mediaplayermodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'mediaplayermodule';\n $movies = $old_db->selectArrays('mediaitem', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($movies) {\n\t\t\t\t\tforeach ($movies as $mi) {\n\t\t\t\t\t\tunset ($mi['id']);\n\t\t\t\t\t\t$movie = new media($mi);\n\t\t\t\t\t\t$loc = expUnserialize($mi['location_data']);\n\t\t\t\t\t\t$loc->mod = \"media\";\n\t\t\t\t\t\t$movie->title = $mi['name'];\n\t\t\t\t\t\tif (empty($movie->title)) { $movie->title = 'Untitled'; }\n $movie->body = $mi['description'];\n\t\t\t\t\t\tunset (\n $mi['bgcolor'],\n $mi['alignment'],\n $mi['loop_media'],\n $mi['auto_rewind'],\n $mi['autoplay'],\n $mi['hide_controls']\n );\n\t\t\t\t\t\t$movie->location_data = serialize($loc);\n\t\t\t\t\t\t$movie->poster = 1;\n\t\t\t\t\t\t$movie->rank = 1;\n\t\t\t\t\t\tif (!empty($mi['media_id'])) {\n\t\t\t\t\t\t\t$movie->save();\n\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t\t\t$file = new expFile($mi['media_id']);\n\t\t\t\t\t\t\t$movie->attachItem($file,'files');\n\t\t\t\t\t\t\tif (!empty($mi['alt_image_id'])) {\n\t\t\t\t\t\t\t\t$file = new expFile($mi['alt_image_id']);\n\t\t\t\t\t\t\t\t$movie->attachItem($file,'splash');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'bannermodule':\n\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"banner\";\n\t\t\t\tif ($db->countObjects('banner', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'bannermodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'bannermodule';\n $banners = $old_db->selectArrays('banner_ad', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($banners) {\n\t\t\t\t\tforeach ($banners as $bi) {\n\t\t\t\t\t\t$oldclicks = $old_db->selectObjects('banner_click', \"ad_id='\".$bi['id'].\"'\");\n\t\t\t\t\t\t$oldcompany = $old_db->selectObject('banner_affiliate', \"id='\".$bi['affiliate_id'].\"'\");\n\t\t\t\t\t\tunset ($bi['id']);\n\t\t\t\t\t\t$banner = new banner($bi);\n\t\t\t\t\t\t$loc = expUnserialize($bi['location_data']);\n\t\t\t\t\t\t$loc->mod = \"banner\";\n\t\t\t\t\t\t$banner->title = $bi['name'];\n\t\t\t\t\t\t$banner->url = (!empty($bi['url'])) ? $bi['url'] : '#';\n\t\t\t\t\t\tif (empty($banner->title)) { $banner->title = 'Untitled'; }\n\t\t\t\t\t\t$banner->location_data = serialize($loc);\n\t\t\t\t\t\t$newcompany = $db->selectObject('companies', \"title='\".$oldcompany->name.\"'\");\n\t\t\t\t\t\tif ($newcompany == null) {\n\t\t\t\t\t\t\t$newcompany = new company();\n\t\t\t\t\t\t\t$newcompany->title = (!empty($oldcompany->name)) ? $oldcompany->name : 'Untitled';\n\t\t\t\t\t\t\t$newcompany->body = $oldcompany->contact_info;\n\t\t\t\t\t\t\t$newcompany->location_data = $banner->location_data;\n\t\t\t\t\t\t\t$newcompany->save();\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t\t$banner->companies_id = $newcompany->id;\n\t\t\t\t\t\t$banner->clicks = 0;\n\t\t\t\t\t\tforeach($oldclicks as $click) {\n\t\t\t\t\t\t\t$banner->clicks += $click->clicks;\n\t\t\t\t\t\t}\n if (!empty($bi['file_id'])) {\n $file = new expFile($bi['file_id']);\n $banner->attachItem($file,'');\n }\n\t\t\t\t\t\t$banner->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n// case 'addressbookmodule': // user mod, not widely distributed\n//\n//\t\t\t\t@$module->view = 'myaddressbook';\n//\t\t\t\t@$module->action = 'myaddressbook';\n//\n//\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n//\t\t\t\t// $ploc = $iloc;\n//\t\t\t\t// $ploc->mod = \"addresses\";\n//\t\t\t\t// if ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t// $iloc->mod = 'addressbookmodule';\n//\t\t\t\t\t// $linked = true;\n//\t\t\t\t\t// break;\n//\t\t\t\t// }\n//\n//// $iloc->mod = 'addressbookmodule';\n// $addresses = $old_db->selectArrays('addressbook_contact', \"location_data='\".serialize($iloc).\"'\");\n//\t\t\t\tif ($addresses) {\n//\t\t\t\t\tforeach ($addresses as $address) {\n////\t\t\t\t\t\tunset($address['id']);\n//\t\t\t\t\t\t$addr = new address();\n//\t\t\t\t\t\t$addr->user_id = 1;\n//\t\t\t\t\t\t$addr->is_default = 1;\n//\t\t\t\t\t\t$addr->is_billing = 1;\n//\t\t\t\t\t\t$addr->is_shipping = 1;\n//\t\t\t\t\t\t$addr->firstname = (!empty($address['firstname'])) ? $address['firstname'] : 'blank';\n//\t\t\t\t\t\t$addr->lastname = (!empty($address['lastname'])) ? $address['lastname'] : 'blank';\n//\t\t\t\t\t\t$addr->address1 = (!empty($address['address1'])) ? $address['address1'] : 'blank';\n//\t\t\t\t\t\t$addr->city = (!empty($address['city'])) ? $address['city'] : 'blank';\n//\t\t\t\t\t\t$address['state'] = (!empty($address['state'])) ? $address['state'] : 'CA';\n//\t\t\t\t\t\t$state = $db->selectObject('geo_region', 'code=\"'.strtoupper($address['state']).'\"');\n//\t\t\t\t\t\t$addr->state = empty($state->id) ? 0 : $state->id;\n//\t\t\t\t\t\t$addr->zip = (!empty($address['zip'])) ? $address['zip'] : '99999';\n//\t\t\t\t\t\t$addr->phone = (!empty($address['phone'])) ? $address['phone'] : '800-555-1212';\n//\t\t\t\t\t\t$addr->email = (!empty($address['email'])) ? $address['email'] : 'address@website.com';\n//\t\t\t\t\t\t$addr->organization = $address['business'];\n//\t\t\t\t\t\t$addr->phone2 = $address['cell'];\n//\t\t\t\t\t\t$addr->save();\n//\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n//\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t\tbreak;\n case 'feedlistmodule':\n\t\t\t\t@$module->view = 'showall';",
"// $iloc->mod = 'feedlistmodule';\n $feedlist = $old_db->selectObject('feedlistmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if ($feedlist->enable_rss == 1) {\n\t\t\t\t\t$loc = expUnserialize($feedlist->location_data);\n\t\t\t\t\t$loc->mod = \"rss\";\n\t\t\t\t\t$newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n\t\t\t\t\t$newconfig->config['feed_title'] = $feedlist->feed_title;\n\t\t\t\t\t$newconfig->config['feed_desc'] = $feedlist->feed_desc;\n\t\t\t\t\t$newconfig->config['rss_limit'] = isset($feedlist->rss_limit) ? $feedlist->rss_limit : 24;\n\t\t\t\t\t$newconfig->config['rss_cachetime'] = isset($feedlist->rss_cachetime) ? $feedlist->rss_cachetime : 1440;\n\t\t\t\t\t$newconfig->location_data = $loc;\n//\t\t\t\t\t$newconfig->save();\n\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n\t\t\t\tbreak;\n case 'simplepollmodule': // added v2.0.9\n $oldconfig = $old_db->selectObject('simplepollmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if (!empty($oldconfig)) {\n if (!empty($oldconfig->thank_you_message)) {\n $newconfig->config['thank_you_message'] = 'Thank you for voting.';\n }\n if (!empty($oldconfig->already_voted_message)) {\n $newconfig->config['already_voted_message'] = 'You have already voted in this poll.';\n }\n if (!empty($oldconfig->voting_closed_message)) {\n $newconfig->config['voting_closed_message'] = 'Voting has been closed for this poll.';\n }\n if (!empty($oldconfig->anonymous_timeout)) {\n $newconfig->config['anonymous_timeout'] = '5';\n }\n }",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"simplePoll\";\n\t\t\t\tif ($db->countObjects('simplepoll_question', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'simplepollmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'simplepollmodule';\n $oldquestions = $old_db->selectArrays('poll_question', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($oldquestions) {\n\t\t\t\t\tforeach ($oldquestions as $qi) {\n\t\t\t\t\t\t$oldanswers = $old_db->selectArrays('poll_answer', \"question_id='\".$qi['id'].\"'\");\n\t\t\t\t\t\t$oldblocks = $old_db->selectArrays('poll_timeblock', \"question_id='\".$qi['id'].\"'\");\n\t\t\t\t\t\tunset ($qi['id']);\n $active = $qi['is_active'];\n unset ($qi['is_active']);\n\t\t\t\t\t\t$question = new simplepoll_question($qi);\n\t\t\t\t\t\t$loc = expUnserialize($qi['location_data']);\n\t\t\t\t\t\t$loc->mod = \"simplePoll\";\n $question->active = $active;\n\t\t\t\t\t\tif (empty($question->question)) { $question->question = 'Untitled'; }\n $question->location_data = serialize($loc);\n $question->save();",
" foreach ($oldanswers as $oi) {\n unset (\n $oi['id'],\n $oi['question_id']\n );\n $newanswer = new simplepoll_answer($oi);\n $newanswer->simplepoll_question_id = $question->id;\n// $question->simplepoll_answer[] = $newanswer;\n $newanswer->update();\n }\n// $question->update();",
"\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'navigationmodule': // added v2.0.9\n if (!empty($module->view)) {\n if ($module->view == 'Breadcrumb') {\n @$module->view = 'breadcrumb';\n @$module->action = 'breadcrumb';\n } else {\n @$module->view = 'showall_'.$module->view;\n }\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n\t\t\t\tbreak;\n case 'calendarmodule': // added v2.1.0\n if ($module->view == 'Default') {\n @$module->view = 'showall';\n } elseif ($module->view == 'Upcoming Events - Summary') {\n $module->view = 'showall_Upcoming Events - Headlines';\n } else {\n @$module->view = 'showall_'.$module->view;\n }\n $oldconfig = $old_db->selectObject('calendarmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_ical == 1) {\n $newconfig->config['enable_ical'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->hidemoduletitle)) {\n $newconfig->config['hidemoduletitle'] = $oldconfig->hidemoduletitle;\n }\n if (!empty($oldconfig->moduledescription)) {\n $newconfig->config['moduledescription'] = $oldconfig->moduledescription;\n }\n if (!empty($oldconfig->aggregate) && $oldconfig->aggregate != 'a:0:{}') {\n $merged = expUnserialize($oldconfig->aggregate);\n foreach ($merged as $merge) {\n $newconfig->config['aggregate'][] = $merge;\n }\n }\n if (!empty($oldconfig->enable_feedback)) {\n $newconfig->config['enable_feedback'] = $oldconfig->enable_feedback;\n }\n if (!empty($oldconfig->email_title_reminder)) {\n $newconfig->config['email_title_reminder'] = $oldconfig->email_title_reminder;\n }\n if (!empty($oldconfig->email_from_reminder)) {\n $newconfig->config['email_from_reminder'] = $oldconfig->email_from_reminder;\n }\n if (!empty($oldconfig->email_address_reminder)) {\n $newconfig->config['email_address_reminder'] = $oldconfig->email_address_reminder;\n }\n if (!empty($oldconfig->email_reply_reminder)) {\n $newconfig->config['email_reply_reminder'] = $oldconfig->email_reply_reminder;\n }\n if (!empty($oldconfig->email_showdetail)) {\n $newconfig->config['email_showdetail'] = $oldconfig->email_showdetail;\n }\n if (!empty($oldconfig->email_signature)) {\n $newconfig->config['email_signature'] = $oldconfig->email_signature;\n }\n if (empty($oldconfig->enable_tags)) {\n $newconfig->config['disabletags'] = true;\n }\n if (!empty($oldconfig->enable_categories)) {\n $newconfig->config['usecategories'] = $oldconfig->enable_categories;\n }",
" // we have to pull in external addresses for reminders\n $addrs = $old_db->selectObjects('calendar_reminder_address',\"calendar_id=\".$oldconfig->id);\n foreach ($addrs as $addr) {\n if (!empty($addr->user_id)) {\n $newconfig->config['users'][] = $addr->user_id;\n } elseif (!empty($addr->group_id)) {\n $newconfig->config['groups'][] = $addr->group_id;\n } elseif (!empty($addr->email)) {\n $newconfig->config['addresses'][] = $addr->email;\n }\n }\n }",
" //check to see if it's already pulled in (circumvent !is_original)\n\t\t\t\t$ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"event\";\n\t\t\t\tif ($db->countObjects('event', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'calendarmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'calendarmodule';\n // convert each eventdate\n $eds = $old_db->selectObjects('eventdate',\"1\");\n foreach ($eds as $ed) {\n $cloc = expUnserialize($ed->location_data);\n $cloc->mod = 'event';\n $ed->location_data = serialize($cloc);\n $db->insertObject($ed,'eventdate');\n }",
" // convert each calendar to an event\n $cals = $old_db->selectObjects('calendar',\"1\");\n foreach ($cals as $cal) {\n unset($cal->approved);\n $cat = $cal->category_id;\n unset($cal->category_id);\n $tags = $cal->tags;\n unset(\n $cal->tags,\n $cal->file_id\n );\n $loc = expUnserialize($cal->location_data);\n $loc->mod = \"event\";\n $cal->location_data = serialize($loc);\n $cal->created_at = $cal->posted;\n unset($cal->posted);\n $cal->edited_at = $cal->edited;\n unset($cal->edited);\n $db->insertObject($cal,'event');",
" $ev = new event($cal->id);\n $ev->save();\n if (!empty($oldconfig->enable_tags)) {\n $params = null;;\n $oldtags = expUnserialize($tags);\n if (!empty($oldtags)) {\n foreach ($oldtags as $oldtag){\n $tagtitle = strtolower(trim($old_db->selectValue('tags','name','id = '.$oldtag)));\n $tag = new expTag($tagtitle);\n//\t\t\t\t\t\t\t\t$tag->title = $old_db->selectValue('tags','name','id = '.$oldtag);\n if (empty($tag->id))\n $tag->update(array('title'=>$tagtitle));\n $params['expTag'][] = $tag->id;\n }\n }\n $ev->update($params);\n }\n if (!empty($oldconfig->enable_categories) && $cat) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$cat);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank +1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $ev->update($params);\n }\n }\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n break;\n case 'contactmodule': // v2.1.1 now converted to a forms 2.0 module\n\t\t\t\t$module->view = \"enterdata\";\n $module->action = \"enterdata\";",
"// $iloc->mod = 'contactmodule';\n $contactform = $old_db->selectObject('contactmodule_config', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($contactform) {\n // for forms 2.0 we create a site form (form & report consolidated)\n $newform = new forms();\n $newform->title = 'Contact Form';\n $newform->is_saved = false;\n $newform->table_name = '';\n $newform->description = '';\n $newform->response = $contactform->final_message;\n $newform->update();",
" // now add the controls to the site form\n\t\t\t\t\t$control = new stdClass();\n\t\t\t\t\t$control->name = 'name';\n\t\t\t\t\t$control->caption = 'Your Name';\n\t\t\t\t\t$control->forms_id = $newform->id;\n\t\t\t\t\t$control->data = 'O:11:\"textcontrol\":14:{s:4:\"size\";i:0;s:9:\"maxlength\";i:0;s:7:\"caption\";s:9:\"Your Name\";s:11:\"placeholder\";s:8:\"John Doe\";s:9:\"accesskey\";s:0:\"\";s:7:\"default\";s:0:\"\";s:8:\"disabled\";b:0;s:8:\"required\";b:1;s:8:\"tabindex\";i:-1;s:7:\"inError\";i:0;s:4:\"type\";s:4:\"text\";s:6:\"filter\";s:0:\"\";s:10:\"identifier\";s:4:\"name\";s:11:\"description\";s:22:\"Please enter your name\";}';\n\t\t\t\t\t$control->rank = 1;\n\t\t\t\t\t$control->is_readonly = 0;\n\t\t\t\t\t$control->is_static = 0;\n\t\t\t\t\t$db->insertObject($control, 'forms_control');\n\t\t\t\t\t$control->name = 'email';\n\t\t\t\t\t$control->caption = 'Your Email';\n\t\t\t\t\t$control->data = 'O:11:\"textcontrol\":14:{s:4:\"size\";i:0;s:9:\"maxlength\";i:0;s:7:\"caption\";s:10:\"Your Email\";s:11:\"placeholder\";s:18:\"johndoe@mailer.org\";s:9:\"accesskey\";s:0:\"\";s:7:\"default\";s:0:\"\";s:8:\"disabled\";b:0;s:8:\"required\";b:1;s:8:\"tabindex\";i:-1;s:7:\"inError\";i:0;s:4:\"type\";s:4:\"text\";s:6:\"filter\";s:0:\"\";s:10:\"identifier\";s:5:\"email\";s:11:\"description\";s:31:\"Please enter your email address\";}';\n\t\t\t\t\t$control->rank = 2;\n\t\t\t\t\t$db->insertObject($control, 'forms_control');\n\t\t\t\t\t$control->name = 'subject';\n\t\t\t\t\t$control->caption = 'Subject';\n\t\t\t\t\t$control->data = 'O:11:\"textcontrol\":14:{s:4:\"size\";i:0;s:9:\"maxlength\";i:0;s:7:\"caption\";s:7:\"Subject\";s:11:\"placeholder\";s:22:\"Subject line for email\";s:9:\"accesskey\";s:0:\"\";s:7:\"default\";s:0:\"\";s:8:\"disabled\";b:0;s:8:\"required\";b:1;s:8:\"tabindex\";i:-1;s:7:\"inError\";i:0;s:4:\"type\";s:4:\"text\";s:6:\"filter\";s:0:\"\";s:10:\"identifier\";s:7:\"subject\";s:11:\"description\";s:21:\"Enter a quick summary\";}';\n\t\t\t\t\t$control->rank = 3;\n\t\t\t\t\t$db->insertObject($control, 'forms_control');\n\t\t\t\t\t$control->name = 'message';\n\t\t\t\t\t$control->caption = 'Message';\n\t\t\t\t\t$control->data = 'O:17:\"texteditorcontrol\":13:{s:4:\"cols\";i:60;s:4:\"rows\";i:8;s:9:\"accesskey\";s:0:\"\";s:7:\"default\";s:0:\"\";s:8:\"disabled\";b:0;s:8:\"required\";b:0;s:8:\"tabindex\";i:-1;s:7:\"inError\";i:0;s:4:\"type\";s:4:\"text\";s:8:\"maxchars\";i:0;s:10:\"identifier\";s:7:\"message\";s:7:\"caption\";s:7:\"Message\";s:11:\"description\";s:33:\"Enter the content of your message\";}';\n\t\t\t\t\t$control->rank = 4;\n\t\t\t\t\t$db->insertObject($control, 'forms_control');",
" // and then an expConfig to link to that site form with config settings\n $newconfig->config['forms_id'] = $newform->id;\n $newconfig->config['title'] = 'Send us an e-mail';\n $newconfig->config['description'] = '';\n $newconfig->config['is_email'] = true;\n if (!empty($contactform->subject)) {\n $newconfig->config['report_name'] = $contactform->subject;\n $newconfig->config['subject'] = $contactform->subject;\n }\n if (!empty($contactform->final_message)) $newconfig->config['response'] = $contactform->final_message;\n $newconfig->config['submitbtn'] = 'Send Message';\n $newconfig->config['resetbtn'] = 'Reset';",
" // we have to pull in addresses for emails\n $addrs = $old_db->selectObjects('contact_contact', \"location_data='\".serialize($iloc).\"'\");\n foreach ($addrs as $addr) {\n if (!empty($addr->user_id)) {\n $newconfig->config['user_list'][] = $addr->user_id;\n } elseif (!empty($addr->email)) {\n $newconfig->config['address_list'][] = $addr->email;\n }\n }",
"\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'formmodule': // convert to forms module\n $module->view = \"enterdata\";\n $module->action = \"enterdata\";",
" // new form update\n $oldform = $old_db->selectObject('formbuilder_form', \"location_data='\".serialize($iloc).\"'\");\n $oldreport = $old_db->selectObject('formbuilder_report', \"location_data='\".serialize($iloc).\"'\");",
" if (!empty($oldform->id)) {\n $newform = new forms();\n $newform->title = $oldform->name;\n $newform->is_saved = $oldform->is_saved;\n $newform->table_name = $oldform->table_name;\n if (empty($newform->title) && !empty($newform->table_name)) $newform->title = implode(' ',explode('_',$newform->table_name));\n $newform->description = $oldform->description;\n $newform->response = $oldform->response;\n $newform->report_name = $oldreport->name;\n $newform->report_desc = $oldreport->description;\n $newform->report_def = $oldreport->text;\n $newform->column_names_list = $oldreport->column_names;\n $newform->update();",
" // copy & convert each formbuilder_control to a forms_control\n $fcs = $old_db->selectObjects('formbuilder_control',\"form_id=\".$oldform->id);\n foreach ($fcs as $fc) {\n $fc->forms_id = $newform->id;\n unset (\n $fc->id,\n $fc->form_id\n );\n $db->insertObject($fc,'forms_control');\n }",
" // import form saved data\n if ($oldform->is_saved) {\n $newform->updateTable(); // creates the table in database\n $records = $old_db->selectObjects('formbuilder_'.$oldform->table_name, 1);\n foreach($records as $record) {\n //FIXME do we want to add a forms_id field?\n// $db->insertObject($record, 'forms_'.$oldform->table_name);\n $oldform->insertRecord($record);\n }\n }",
" // convert the form & report configs to an expConfig object for this module\n $newconfig = new expConfig();\n $newconfig->config['forms_id'] = $newform->id;\n if (!empty($oldform->name)) $newconfig->config['title'] = $oldform->name;\n if (!empty($oldform->description)) $newconfig->config['description'] = $oldform->description;\n if (!empty($oldform->response)) $newconfig->config['response'] = $oldform->response;\n if (!empty($oldform->is_email)) $newconfig->config['is_email'] = $oldform->is_email;\n if (!empty($oldform->select_email)) $newconfig->config['select_email'] = $oldform->select_email;\n if (!empty($oldform->submitbtn)) $newconfig->config['submitbtn'] = $oldform->submitbtn;\n if (!empty($oldform->resetbtn)) $newconfig->config['resetbtn'] = $oldform->resetbtn;\n if (!empty($oldform->style)) $newconfig->config['style'] = $oldform->style;\n if (!empty($oldform->subject)) $newconfig->config['subject'] = $oldform->subject;\n if (!empty($oldform->is_auto_respond)) $newconfig->config['is_auto_respond'] = $oldform->is_auto_respond;\n if (!empty($oldform->auto_respond_subject)) $newconfig->config['auto_respond_subject'] = $oldform->auto_respond_subject;\n if (!empty($oldform->auto_respond_body)) $newconfig->config['auto_respond_body'] = $oldform->auto_respond_body;\n if (!empty($oldreport->name)) $newconfig->config['report_name'] = $oldreport->name;\n if (!empty($oldreport->description)) $newconfig->config['report_desc'] = $oldreport->description;\n if (!empty($oldreport->text)) $newconfig->config['report_def'] = $oldreport->text;\n if (!empty($oldreport->column_names)) $newconfig->config['column_names_list'] = explode('|!|',$oldreport->column_names);",
" // we have to pull in addresses for emails\n $addrs = $old_db->selectObjects('formbuilder_address',\"form_id=\".$oldform->id);\n foreach ($addrs as $addr) {\n if (!empty($addr->user_id)) {\n $newconfig->config['user_list'][] = $addr->user_id;\n } elseif (!empty($addr->group_id)) {\n $newconfig->config['group_list'][] = $addr->group_id;\n } elseif (!empty($addr->email)) {\n $newconfig->config['address_list'][] = $addr->email;\n }\n }",
" // now save/attach the expConfig\n if ($newconfig->config != null) {\n $newconfig->location_data = expCore::makeLocation($this->new_modules[$iloc->mod],$iloc->src);\n }\n }",
" @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n break;\n case 'containermodule':\n if (!$hc) {\n $module->action = 'showall';\n if ($module->view == 'Default') {\n @$module->view = 'showall';\n } else {\n @$module->view = 'showall_'.$module->view;\n }\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n\t\t\t\tbreak;\n default:\n @$this->msg['noconverter'][$iloc->mod]++;\n\t\t\t\tbreak;\n\t\t}\n // quick check for non hard coded modules\n // We add a container if they're not hard coded.\n (!$hc) ? $this->add_container($iloc,$module,$linked,$newconfig) : \"\";",
" return $module;\n }",
"//\t/**\n//\t * pull over extra/related data required for old school modules\n//\t * @var \\mysqli_database $db the exponent database object\n//\t * @param $iloc\n//\t * @param $module\n//\t * @return bool\n//\t */\n// private function pulldata($iloc, $module) {\n// global $db;\n// $old_db = $this->connect();\n//\t\t$linked = false;\n// if ((!empty($module->is_existing) && $module->is_existing)) {\n// $linked = true;\n// }\n//\n// switch ($iloc->mod) {\n//// case 'calendarmodule':\n////\t\t\t\tif ($db->countObjects('calendar', \"location_data='\".serialize($iloc).\"'\")) {\n////\t\t\t\t\t$linked = true;\n////\t\t\t\t\tbreak;\n////\t\t\t\t}\n//// $events = $old_db->selectObjects('eventdate', \"location_data='\".serialize($iloc).\"'\");\n//// foreach($events as $event) {\n//// $res = $db->insertObject($event, 'eventdate');\n////\t\t\t\t\tif ($res) { @$this->msg['migrated'][$iloc->mod]['count']++; }\n//// }\n//// $cals = $old_db->selectObjects('calendar', \"location_data='\".serialize($iloc).\"'\");\n//// foreach($cals as $cal) {\n//// unset($cal->allow_registration);\n//// unset($cal->registration_limit);\n//// unset($cal->registration_allow_multiple);\n//// unset($cal->registration_cutoff);\n//// unset($cal->registration_price);\n//// unset($cal->registration_count);\n//// $db->insertObject($cal, 'calendar');\n//// }\n//// $configs = $old_db->selectObjects('calendarmodule_config', \"location_data='\".serialize($iloc).\"'\");\n//// foreach ($configs as $config) {\n//// $reminders = $old_db->selectObjects('calendar_reminder_address', \"calendar_id='\".$config->id.\"'\");\n////\t\t\t\t\t$config->id = '';\n////\t\t\t\t\t$config->enable_categories = 0;\n////\t\t\t\t\t$config->enable_tags = 0;\n//// $db->insertObject($config, 'calendarmodule_config');\n//// foreach($reminders as $reminder) {\n//// $reminder->calendar_id = $config->id;\n//// $db->insertObject($reminder, 'calendar_reminder_address');\n//// }\n//// }\n////\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $iloc->mod;\n////\t\t\t\tbreak;\n//// case 'simplepollmodule':\n////\t\t\t\tif ($db->countObjects('poll_question', \"location_data='\".serialize($iloc).\"'\")) {\n////\t\t\t\t\tbreak;\n////\t\t\t\t}\n//// $questions = $old_db->selectObjects('poll_question', \"location_data='\".serialize($iloc).\"'\");\n//// foreach($questions as $question) {\n//// $db->insertObject($question, 'poll_question');\n////\t\t\t\t\t$answers = $old_db->selectObjects('poll_answer', \"question_id='\".$question->id.\"'\");\n////\t\t\t\t\tforeach($answers as $answer) {\n////\t\t\t\t\t\t$db->insertObject($answer, 'poll_answer');\n////\t\t\t\t\t}\n////\t\t\t\t\t$timeblocks = $old_db->selectObjects('poll_timeblock', \"question_id='\".$question->id.\"'\");\n////\t\t\t\t\tforeach($timeblocks as $timeblock) {\n////\t\t\t\t\t\t$db->insertObject($timeblock, 'poll_timeblock');\n////\t\t\t\t\t}\n////\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n//// }\n//// $configs = $old_db->selectObjects('simplepollmodule_config', \"location_data='\".serialize($iloc).\"'\");\n//// foreach ($configs as $config) {\n//// $db->insertObject($config, 'simplepollmodule_config');\n//// }\n////\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $iloc->mod;\n////\t\t\t\tbreak;\n//// case 'formmodule':\n////\t\t\t\tif ($db->countObjects('formbuilder_form', \"location_data='\".serialize($iloc).\"'\")) {\n////\t\t\t\t\tbreak;\n////\t\t\t\t}\n//// $form = $old_db->selectObject('formbuilder_form', \"location_data='\".serialize($iloc).\"'\");\n////\t\t\t\t$oldformid = $form->id;\n////\t\t\t\tunset($form->id);\n//// $form->id = $db->insertObject($form, 'formbuilder_form');\n////\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n////\t\t\t\t$addresses = $old_db->selectObjects('formbuilder_address', \"form_id='\".$oldformid.\"'\");\n//// foreach($addresses as $address) {\n////\t\t\t\t\tunset($address->id);\n////\t\t\t\t\t$address->form_id = $form->id;\n//// $db->insertObject($address, 'formbuilder_address');\n////\t\t\t\t}\n////\t\t\t\t$controls = $old_db->selectObjects('formbuilder_control', \"form_id='\".$oldformid.\"'\");\n//// foreach($controls as $control) {\n////\t\t\t\t\tunset($control->id);\n////\t\t\t\t\t$control->form_id = $form->id;\n//// $db->insertObject($control, 'formbuilder_control');\n////\t\t\t\t}\n////\t\t\t\t$reports = $old_db->selectObjects('formbuilder_report', \"form_id='\".$oldformid.\"'\");\n//// foreach($reports as $report) {\n////\t\t\t\t\tunset($report->id);\n////\t\t\t\t\t$report->form_id = $form->id;\n//// $db->insertObject($report, 'formbuilder_report');\n////\t\t\t\t}\n////\t\t\t\tif (isset($form->table_name)) {\n////\t\t\t\t\tif (isset($this->params['wipe_content'])) {\n////\t\t\t\t\t\t$db->delete('formbuilder_'.$form->table_name);\n////\t\t\t\t\t}\n////\t\t\t\t\tformbuilder_form::updateTable($form);\n////\t\t\t\t\t$records = $old_db->selectObjects('formbuilder_'.$form->table_name, 1);\n////\t\t\t\t\tforeach($records as $record) {\n////\t\t\t\t\t\t$db->insertObject($record, 'formbuilder_'.$form->table_name);\n////\t\t\t\t\t}\n////\t\t\t\t}\n////\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $iloc->mod;\n////\t\t\t\tbreak;\n// }\n// return $linked;\n// }",
" /**\n * used to create containers, expConfigs, and expRss for new modules\n * @param $iloc\n * @param $m\n * @param bool $linked\n * @param $newconfig\n * @var \\mysqli_database $db the exponent database object\n * @return void\n */\n\tprivate function add_container($iloc,$m,$linked=false,$newconfig) {\n// global $db;",
" // first the container\n// $old_db = $this->connect();\n// $section = $old_db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"' AND is_original='0'\");\n// unset($m->id);\n// $oldext = expUnserialize($m->external);\n// $m->external = serialize(expCore::makeLocation('container',$oldext->src));\n////\t\tif ($iloc->mod != 'contactmodule') {\n//\t\t\t$iloc->mod = $this->new_modules[$iloc->mod];\n////\t\t\t$m->internal = (isset($m->internal) && strstr($m->internal,\"Controller\")) ? $m->internal : serialize($iloc);\n// $m->internal = serialize($iloc);\n//\t\t\t$m->action = isset($m->action) ? $m->action : 'showall';\n//\t\t\t$m->view = isset($m->view) ? $m->view : 'showall';\n//\t\t\tif ($m->view == \"Default\") {\n//\t\t\t\t$m->view = 'showall';\n//\t\t\t}\n//\t\t} else { // must be an old school contactmodule\n//\t\t\t$iloc->mod = $this->new_modules[$iloc->mod];\n//\t\t\t$m->internal = serialize($iloc);\n//\t\t}",
" $params = get_object_vars($m);\n unset($params['id']);\n $old_db = $this->connect();\n $section = $old_db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"' AND is_original='0'\");\n $params['current_section'] = empty($section->section) ? 1 : $section->section;\n $oldext = expUnserialize($params['external']);\n $params['external'] = serialize(expCore::makeLocation('container',$oldext->src));\n $iloc->mod = $this->new_modules[$iloc->mod];\n $params['modcntrol'] = $iloc->mod;\n $params['internal'] = serialize($iloc);\n $params['rank'] = $params['rank']+1;\n $params['action'] = !empty($params['action']) ? $params['action'] : 'showall';\n $params['view'] = !empty($params['view']) ? $params['view'] : 'showall';\n if ($params['view'] == \"Default\") {\n $params['view'] = 'showall';\n }",
" $m = new container();\n if (!$linked) {\n $params['existing_source'] = $iloc->src;\n }\n $m->update($params);\n\t\tif ($linked) {\n//\t\t\t$newmodule['i_mod'] = $iloc->mod;\n//\t\t\t$newmodule['modcntrol'] = $iloc->mod;\n//\t\t\t$newmodule['rank'] = $m->rank;\n//\t\t\t$newmodule['views'] = $m->view;\n//\t\t\t$newmodule['title'] = $m->title;\n//\t\t\t$newmodule['actions'] = $m->action;\n//\t\t\t$_POST['current_section'] = empty($section->section) ? 1 : $section->section;\n//\t\t\t$m = container::update($newmodule,$m,expUnserialize($m->external));\n// $params = array();\n// $params['rank'] = $newmod['rank'];\n// $params['view'] = $newmod['view'];\n// $params['title'] = $newmod['title'];\n// $params['action'] = $newmod['action'];\n// $params['is_private'] = $newmod['is_private'];\n $newconfig->config['aggregate'][] = $iloc->src;\n if ($iloc->mod == 'blog') {\n $newconfig->config['add_source'] = 1; // we need to make our blog aggregation discrete\n }\n }\n// $db->insertObject($m, 'container');",
" // now save the expConfig\n if (!empty($newconfig->config['enable_rss']) && $newconfig->config['enable_rss'] == true) {\n $newrss = new expRss();\n $newrss->enable_rss = $newconfig->config['enable_rss'];\n $newrss->advertise = $newconfig->config['enable_rss'];\n $newrss->title = $newconfig->config['feed_title'];\n// $newrss->sef_url = expCore::makeSefUrl($newrss->title,'expRss');\n\t\t\t$newrss->sef_url = $this->makeSefUrl($newrss->title);\n $newrss->feed_desc = $newconfig->config['feed_desc'];\n $newrss->rss_limit = $newconfig->config['rss_limit'];\n $newrss->rss_cachetime = $newconfig->config['rss_cachetime'];\n }\n if ($newconfig->config != null) {\n// $newmodinternal = expUnserialize($m->internal);\n// $newmod = expModules::getModuleName($newmodinternal->mod);\n// $newmodinternal->mod = $newmod;\n $newconfig->location_data = expUnserialize($m->internal);\n $newconfig->save();\n }",
" // and save the expRss table\n if (!empty($newrss->enable_rss)) {\n $newmodinternal = expUnserialize($m->internal);\n $newrss->module = $newmodinternal->mod;\n $newrss->src = $newmodinternal->src;\n $newrss->save();\n }\n }",
"\t/**\n\t * module customized function to circumvent going to previous page\n\t * @return void\n\t */\n\tfunction saveconfig() {\n \n // unset some unneeded params\n unset(\n $this->params['module'],\n $this->params['controller'],\n $this->params['src'],\n $this->params['int'],\n $this->params['id'],\n $this->params['action'],\n $this->params['PHPSESSID'],\n $this->params['__utma'],\n $this->params['__utmb'],\n $this->params['__utmc'],\n $this->params['__utmz'],\n $this->params['__utmt'],\n $this->params['__utmli'],\n $this->params['__cfduid']\n );\n \n // setup and save the config\n $config = new expConfig($this->loc);\n $config->update(array('config'=>$this->params));\n\t\t// update our object config\n\t\t$this->config = expUnserialize($config->config);\n// flash('message', 'Migration Configuration Saved');\n// expHistory::back();\n $this->connect(); // now make sure the parameters work",
"\t\tif (isset($this->params['fix_database'])) $this->fix_database();\n //NOTE we need to push the button.css file to head for coolwater theme?\n expCSS::pushToHead(array(\n// \t\t \"unique\"=>\"button\",\n \t\t \"corecss\"=>\"button\",\n \t\t ));\n\t\techo '<h2>'.gt('Migration Configuration Saved').'</h2><br />';\n\t\techo '<p>'.gt('We\\'ve successfully connected to the Old database').'</p><br />';\n if (bs()) {\n $btn_class = 'btn btn-default';\n } else {\n $btn_class = \"awesome \" . BTN_SIZE . \" \" . BTN_COLOR;\n };\n\t\techo \"<a class=\\\"\".$btn_class.\"\\\" href=\\\"\".expCore::makeLink(array('controller'=>'migration','action'=>'manage_users')).\"\\\">\".gt('Next Step -> Migrate Users & Groups').\"</a>\";\n }\n\t\n\t/**\n\t * connect to old site's database\n\t *\n\t * @return mysqli_database\n\t */\n private function connect() {\n // check for required info...then make the DB connection.\n if (\n empty($this->config['username']) ||\n empty($this->config['password']) ||\n empty($this->config['database']) ||\n empty($this->config['server']) ||\n empty($this->config['prefix']) ||\n empty($this->config['port'])\n ) {\n flash('error', gt('You are missing some required database connection information. Please enter DB information.'));\n redirect_to (array('controller'=>'migration', 'action'=>'configure'));\n// $this->configure();\n }",
" $database = expDatabase::connect($this->config['username'],$this->config['password'],$this->config['server'].':'.$this->config['port'],$this->config['database']);",
" if (empty($database->havedb)) {\n flash('error', gt('An error was encountered trying to connect to the database you specified. Please check your DB config.'));\n redirect_to (array('controller'=>'migration', 'action'=>'configure'));\n// $this->configure();\n }",
" $database->prefix = $this->config['prefix']. '_';;\n return $database;\n }",
"\t/**\n\t * several things that may clear up problems in the old database and do a better job of migrating data\n\t * @return void\n\t */\n\tprivate function fix_database() {\n\t\t// let's test the connection\n\t\t$old_db = $this->connect();\n\t\t\n\t\tprint_r(\"<h2>\".gt('We\\'re connected to the Old Database!').\"</h2><br><br><h3>\".gt('Running several checks and fixes on the old database').\"<br>\".gt('to enhance Migration.').\"</h3><br>\");",
"\t\tprint_r(\"<pre>\");\n\t// upgrade sectionref's that have lost their originals\n\t\tprint_r(\"<strong>\".gt('Searching for sectionrefs that have lost their originals').\"</strong><br><br>\");\n\t\t$sectionrefs = $old_db->selectObjects('sectionref',\"is_original=0\");\n\t\tprint_r(\"Found: \".count($sectionrefs).\" copies (not originals)<br>\");\n\t\tforeach ($sectionrefs as $sectionref) {\n\t\t\tif ($old_db->selectObject('sectionref',\"module='\".$sectionref->module.\"' AND source='\".$sectionref->source.\"' AND is_original='1'\") == null) {\n\t\t\t// There is no original for this sectionref so change it to the original\n//\t\t\t\t$sectionref->is_original = 1;\n\t\t\t\t$old_db->updateObject($sectionref,\"sectionref\");\n\t\t\t\tprint_r(\"Fixed: \".$sectionref->module.\" - \".$sectionref->source.\"<br>\");\n\t\t\t}\n\t\t}\n\t\tprint_r(\"</pre>\");\n\t\n\t\tprint_r(\"<pre>\");\n\t// upgrade sectionref's that point to missing sections (pages)\n\t\tprint_r(\"<strong>\".gt('Searching for sectionrefs pointing to missing sections/pages').\" <br>\".gt('to fix for the Recycle Bin').\"</strong><br><br>\");\n\t\t$sectionrefs = $old_db->selectObjects('sectionref',\"refcount!=0\");\n\t\tforeach ($sectionrefs as $sectionref) {\n\t\t\tif ($old_db->selectObject('section',\"id='\".$sectionref->section.\"'\") == null) {\n\t\t\t// There is no section/page for sectionref so change the refcount\n\t\t\t\t$sectionref->refcount = 0;\n\t\t\t\t$old_db->updateObject($sectionref,\"sectionref\");\n\t\t\t\tprint_r(\"Fixed: \".$sectionref->module.\" - \".$sectionref->source.\"<br>\");\n\t\t\t}\n\t\t}\n\t\tprint_r(\"</pre>\");",
"\t}",
"\t/**\n\t * Take an old school permission and convert it to a newmodule permission\n\t *\n\t * @param $item\n\t * @return mixed\n\t */\n\tprivate function convert_permission($item) {\n\t\tif ($item == null) return null;\n\t\tswitch ($item->permission) {\n\t\t case 'administrate':\n\t\t\t $item->permission = 'manage';\n\t\t\t\tbreak;\n\t\t\tcase 'post':\n\t\t\tcase 'create_slide':\n\t\t\tcase 'add':\n\t\t\tcase 'add_item':\n case 'add_module':\n\t\t\t\t$item->permission = 'create';\n\t\t\t\tbreak;\n\t\t\tcase 'edit_item':\n\t\t\tcase 'edit_slide':\n case 'edit_module':\n\t\t\t\t$item->permission = 'edit';\n\t\t\t\tbreak;\n\t\t\tcase 'delete_item':\n\t\t\tcase 'delete_slide':\n case 'delete_module':\n\t\t\t\t$item->permission = 'delete';\n\t\t\t\tbreak;\n\t\t\tcase 'order':\n\t\t\tcase 'import':\n case 'orders_modules':\n\t\t\t\t$item->permission = 'configure';\n\t\t\t\tbreak;\n\t\t\tcase 'view_unpublished':\n\t\t\t\t$item->permission = 'show_unpublished';\n\t\t\t\tbreak;\n case 'approve_comments':\n $item->permission = 'approve';\n break;\n\t\t\tcase 'manage_categories':\n\t\t\tcase 'manage_approval':\n\t\t\tcase 'approve':\n\t\t\tcase 'can_download':\n\t\t\tcase 'comment':\n\t\t\tcase 'edit_comments':\n\t\t\tcase 'delete_comments':\n\t\t\tcase 'view_private':\n $item = null;\n\t\t\t\tbreak;\n\t\t\tcase 'create':\n\t\t\tcase 'configure':\n\t\t\tcase 'delete':\n\t\t\tcase 'edit':\n\t\t\tcase 'manage':\n\t\t\tcase 'spider':\n\t\t\tcase 'view':\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $item;\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class migrationController extends expController {",
" protected $manage_permissions = array(",
" 'analyze'=>'Analyze Data',\n 'migrate'=>'Migrate Data'\n );",
" // this is a list of modules that we can convert to exp2 type modules.\n public $new_modules = array(\n// 'addressbookmodule'=>'address',\n 'imagegallerymodule'=>'photo',\n 'linklistmodule'=>'links',\n 'newsmodule'=>'news',\n 'slideshowmodule'=>'photo',\n 'snippetmodule'=>'snippet',\n 'swfmodule'=>'text',\n 'textmodule'=>'text',\n 'resourcesmodule'=>'filedownload',\n 'rotatormodule'=>'text',\n 'faqmodule'=>'faq',\n 'headlinemodule'=>'text',\n 'linkmodule'=>'links',\n 'weblogmodule'=>'blog',\n 'listingmodule'=>'portfolio',\n 'youtubemodule'=>'media',\n 'mediaplayermodule'=>'media',\n 'bannermodule'=>'banner',\n 'feedlistmodule'=>'rss',\n 'simplepollmodule'=>'simplePoll',\n 'navigationmodule'=>'navigation',\n 'calendarmodule'=>'event',\n 'formmodule'=>'forms',\n 'contactmodule'=>'forms', // this module is converted to a functionally similar form\n 'containermodule'=>'container',\n );",
" // these are modules that have either been deprecated or have no content to migrate\n // Not sure we need to note deprecated modules...\n public $deprecated_modules = array(\n 'administrationmodule',\n// 'containermodule', // not really deprecated, but must be in this list to skip processing?\n// 'navigationmodule', // views are still used, so modules need to be imported?\n 'loginmodule',\n 'searchmodule', \n 'imagemanagermodule',\n 'imageworkshopmodule',\n 'inboxmodule',\n 'rssmodule',\n// the following 0.97/98 modules were added to this list\n 'articlemodule',\n 'bbmodule',\n 'pagemodule',\n 'previewmodule',\n 'tasklistmodule',\n 'wizardmodule',\n// other older or user-contributed modules we don't want to deal with\n 'addressbookmodule', // moved to deprecated list since this is NOT the type of address we use in 2.x\n 'cataloguemodule',\n 'codemapmodule',\n 'extendedlistingmodule',\n 'googlemapmodule',\n 'greekingmodule',\n 'guestbookmodule',\n 'keywordmodule',\n 'sharedcoremodule',\n 'svgallerymodule',\n 'uiswitchermodule',\n 'filemanagermodule',\n );",
"\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Content Migration Controller\"); }",
"\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"Use this module to pull Exponent 1 style content from your old site.\"); }",
"\t/**\n\t * if module has associated sources\n\t * @return bool\n\t */\n static function hasSources() { return false; }",
"\t/**\n\t * if module has associated content\n\t * @return bool\n\t */\n static function hasContent() { return false; }",
"\t/**\n\t * gather info about all pages in old site for user selection\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function manage_pages() {\n global $db;",
" expHistory::set('manageable', $this->params);\n $old_db = $this->connect();\n $pages = $old_db->selectObjects('section','id > 1');\n foreach($pages as $page) {\n\t\t\tif ($db->selectObject('section',\"id='\".$page->id.\"'\")) {\n\t\t\t\t$page->exists = true;\n\t\t\t} else {\n\t\t\t\t$page->exists = false;\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'pages'=>$pages\n ));\n }",
"\t/**\n\t * copy selected pages over from old site\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function migrate_pages() {\n global $db;",
"\t\t$del_pages = '';\n if (isset($this->params['wipe_pages'])) {\n $db->delete('section',\"id > '1'\");\n\t\t\t$del_pages = ' '.gt('after clearing database of pages');\n\t\t}\n $successful = 0;\n $failed = 0;\n $old_db = $this->connect();\n\t\tif (!empty($this->params['pages'])) {\n\t\t\tforeach($this->params['pages'] as $pageid) {\n\t\t\t\t$page = $old_db->selectObject('section', 'id='.$pageid);\n\t\t\t\t// make sure the SEF name is valid\n\t\t\t\tglobal $router;\n\t\t\t\tif (empty($page->sef_name)) {\n\t\t\t\t\tif (isset($page->name)) {\n\t\t\t\t\t\t$page->sef_name = $router->encode($page->name);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$page->sef_name = $router->encode('Untitled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$dupe = $db->selectValue('section', 'sef_name', 'sef_name=\"'.$page->sef_name.'\"');\n\t\t\t\tif (!empty($dupe)) {\n\t\t\t\t\tlist($u, $s) = explode(' ',microtime());\n $page->sef_name .= '-'.$s.'-'.$u;\n\t\t\t\t}\n// $page->sef_name = $page->sef_name;\n// unset($page->sef_name);\n\t\t\t\t$ret = $db->insertObject($page, 'section');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$failed++;\n\t\t\t\t} else {\n\t\t\t\t\t$successful++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!empty($this->params['rep_pages'])) {\n\t\t\tforeach($this->params['rep_pages'] as $pageid) {\n\t\t\t\t$db->delete('section','id='.$pageid);\n\t\t\t\t$page = $old_db->selectObject('section', 'id='.$pageid);\n\t\t\t\t// make sure the SEF name is valid\n\t\t\t\tglobal $router;\n\t\t\t\tif (empty($page->sef_name)) {\n\t\t\t\t\tif (isset($page->name)) {\n\t\t\t\t\t\t$page->sef_name = $router->encode($page->name);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$page->sef_name = $router->encode('Untitled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$dupe = $db->selectValue('section', 'sef_name', 'sef_name=\"'.$page->sef_name.'\"');\n\t\t\t\tif (!empty($dupe)) {\n\t\t\t\t\tlist($u, $s) = explode(' ',microtime());\n $page->sef_name .= '-'.$s.'-'.$u;\n\t\t\t\t}\n// $page->sef_name = $page->sef_name;\n// unset($page->sef_name);\n\t\t\t\t$ret = $db->insertObject($page, 'section');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$failed++;\n\t\t\t\t} else {\n\t\t\t\t\t$successful++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\tif (isset($this->params['copy_permissions'])) {\n\t\t\t$db->delete('userpermission',\"module = 'navigation' AND source = ''\");\n\t\t\t$db->delete('grouppermission',\"module = 'navigation' AND source = ''\");\n\t\t\t\n\t\t\t$users = $db->selectObjects('user','id > 1');\n\t\t\tforeach($users as $user) {\n\t\t\t\t$pages = $old_db->selectObjects('userpermission',\"uid='\".$user->id.\"' AND module = 'navigationmodule' AND source = ''\");\n\t\t\t\tforeach($pages as $page) {\n\t\t\t\t\tif ($db->selectObject('section','id = '.$page->internal)) {\n\t\t\t\t\t\t if ($page->permission != 'administrate') {\n $page->module = 'navigation';\n\t\t\t\t\t\t\t $db->insertObject($page,'userpermission');\n\t\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t\t$groups = $db->selectObjects('group','1');\n\t\t\tforeach($groups as $group) {\n\t\t\t\t$pages = $old_db->selectObjects('grouppermission',\"gid='\".$group->id.\"' AND module = 'navigationmodule' AND source = ''\");\n\t\t\t\tforeach($pages as $page) {\n\t\t\t\t\tif ($db->selectObject('section','id = '.$page->internal)) {\n\t\t\t\t\t\t if ($page->permission != 'administrate') {\n $page->module = 'navigation';\n\t\t\t\t\t\t\t $db->insertObject($page,'grouppermission');\n\t\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}",
" flash('message', $successful.' '.gt('pages were imported from').' '.$this->config['database'].$del_pages);\n if ($failed > 0) {\n flash('error', $failed.' '.gt('pages could not be imported from').' '.$this->config['database'].' '.gt('This is usually because a page with the same ID already exists in the database you importing to.'));\n }",
" expSession::clearCurrentUserSessionCache();\n expHistory::back();\n }",
"\t/**\n\t * gather info about all files in old site for user selection\n\t * @return void\n\t */\n public function manage_files() {\n expHistory::set('manageable', $this->params);\n $old_db = $this->connect();\n $files = $old_db->selectObjects('file');\n assign_to_template(array(\n 'count'=>count($files)\n ));\n }",
"\t/**\n\t * copy selected file information (not the files themselves) over from old site\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function migrate_files() {\n global $db;",
" expHistory::set('manageable', $this->params);\n $old_db = $this->connect();\n $db->delete('expFiles');",
" //import the files\n $oldfiles = $old_db->selectObjects('file');\n foreach ($oldfiles as $oldfile) {\n unset(\n $oldfile->name,\n $oldfile->collection_id\n );\n $file = $oldfile;\n $file->directory = $file->directory.\"/\";\n $db->insertObject($file,'expFiles');\n\t\t\t$oldfile->exists = file_exists(BASE.$oldfile->directory.\"/\".$oldfile->filename);\n\t\t}\n assign_to_template(array(\n 'files'=>$oldfiles,\n 'count'=>count($oldfiles)\n ));\n }",
"\t/**\n\t * gather info about all modules in old site for user selection\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function manage_content() {\n //global $db;\n //$containers = $db->selectObjects('container', 'external=\"N;\"');\n //eDebug($containers);\n $old_db = $this->connect();",
" $sql = 'SELECT *, COUNT(module) as count FROM '.$this->config['prefix'].'_sectionref WHERE is_original=1 GROUP BY module';\n $modules = $old_db->selectObjectsBySql($sql);\n\t\tfor ($i = 0, $iMax = count($modules); $i < $iMax; $i++) {\n if (array_key_exists($modules[$i]->module, $this->new_modules)) {\n $newmod = expModules::getController($this->new_modules[$modules[$i]->module]);\n// $newmod = $this->new_modules[$modules[$i]->module];\n $modules[$i]->action = '<span style=\"color:green;\">'.gt('Converting content to').' '.$newmod->displayname().\"</span>\";\n// $modules[$i]->action = '<span style=\"color:green;\">'.gt('Converting content to').' '.$newmod::displayname().\"</span>\"; //TODO this doesn't work w/ php 5.2\n } elseif (in_array($modules[$i]->module, $this->deprecated_modules)) {\n // $modules[$i]->action = '<span style=\"color:red;\">This module is deprecated and will not be migrated.</span>';\n $modules[$i]->notmigrating = 1;\n// } elseif (in_array($modules[$i]->module, $this->needs_written)) {\n// $modules[$i]->action = '<span style=\"color:orange;\">'.gt('Still needs migration script written').'</span>';\n } else {\n $modules[$i]->action = gt('Migrating as is.');\n }\n }\n //eDebug($modules);",
" assign_to_template(array(\n 'modules'=>$modules\n ));\n }",
"\t/**\n\t * copy selected modules and their contents over from old site\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function migrate_content() {\n global $db;",
" $old_db = $this->connect();\n if (isset($this->params['wipe_content'])) {\n $db->delete('sectionref');\n $db->delete('container');\n $db->delete('text');\n $db->delete('snippet');\n $db->delete('links');\n $db->delete('news');\n// $db->delete('filedownloads');\n $db->delete('filedownload');\n $db->delete('photo');\n $db->delete('headline');\n $db->delete('blog');\n// $db->delete('faqs');\n $db->delete('faq');\n $db->delete('portfolio');\n $db->delete('media');\n $db->delete('banner');\n $db->delete('companies');\n $db->delete('addresses');\n $db->delete('content_expComments');\n $db->delete('content_expFiles');\n $db->delete('content_expSimpleNote');\n $db->delete('content_expTags');\n $db->delete('content_expCats');\n $db->delete('expComments');\n $db->delete('expConfigs', 'id>1'); // don't delete migration config\n// $db->delete('expFiles');\t\t\t// deleted and rebuilt during (previous) file migration\n $db->delete('expeAlerts');\n $db->delete('expeAlerts_subscribers');\n $db->delete('expeAlerts_temp');\n $db->delete('expSimpleNote');\n $db->delete('expRss');\n $db->delete('expCats');\n $db->delete('calendar');\n $db->delete('eventdate');\n $db->delete('calendarmodule_config');\n $db->delete('calendar_external');\n $db->delete('calendar_reminder_address');\n $db->delete('event');\n $db->delete('poll_question');\n $db->delete('poll_answer');\n $db->delete('poll_timeblock');\n $db->delete('simplepollmodule_config');\n $db->delete('simplepoll_question');\n $db->delete('simplepoll_answer');\n $db->delete('simplepoll_timeblock');\n $db->delete('formbuilder_address');\n $db->delete('formbuilder_control');\n $db->delete('formbuilder_form');\n $db->delete('formbuilder_report');\n $db->delete('forms');\n $db->delete('forms_control');\n @$this->msg['clearedcontent']++;\n }\n\t\t\n\t\tif (!empty($this->params['replace'])) {\n\t\t\tforeach($this->params['replace'] as $replace) {\n\t\t\t\tswitch ($replace) {\n\t\t\t\t case 'containermodule':\n\t\t\t\t\t $db->delete('container');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'textmodule':\n\t\t\t\t\tcase 'rotatormodule':\n\t\t\t\t\tcase 'swfmodule':\n\t\t\t\t\t\t$db->delete('text');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'snippetmodule':\n\t\t\t\t\t\t$db->delete('snippet');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'linklistmodule':\n\t\t\t\t\tcase 'linkmodule':\n\t\t\t\t\t\t$db->delete('links');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'newsmodule':\n\t\t\t\t\t\t$db->delete('news');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'resourcesmodule':\n//\t\t\t\t\t\t$db->delete('filedownloads');\n $db->delete('filedownload');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'imagegallerymodule':\n\t\t\t\t\tcase 'slideshowmodule':\n\t\t\t\t\t\t$db->delete('photo');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'headlinemodule':\n\t\t\t\t\t\t$db->delete('headline');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'weblogmodule':\n\t\t\t\t\t\t$db->delete('blog');\n\t\t\t\t\t\t$db->delete('expComments');\n\t\t\t\t\t\t$db->delete('content_expComments');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'faqmodule':\n\t\t\t\t\t\t$db->delete('faq');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'listingmodule':\n\t\t\t\t\t\t$db->delete('portfolio');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'calendarmodule':\n\t\t\t\t\t\t$db->delete('calendar');\n\t\t\t\t\t\t$db->delete('eventdate');\n\t\t\t\t\t\t$db->delete('calendarmodule_config');\n $db->delete('calendar_external');\n $db->delete('calendar_reminder_address');\n $db->delete('event');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'simplepollmodule':\n\t\t\t\t\t\t$db->delete('poll_question');\n\t\t\t\t\t\t$db->delete('poll_answer');\n\t\t\t\t\t\t$db->delete('poll_timeblock');\n\t\t\t\t\t\t$db->delete('simplepollmodule_config');\n $db->delete('simplepoll_question');\n $db->delete('simplepoll_answer');\n $db->delete('simplepoll_timeblock');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'formmodule':\n\t\t\t\t\t\t$db->delete('formbuilder_address');\n\t\t\t\t\t\t$db->delete('formbuilder_control');\n\t\t\t\t\t\t$db->delete('formbuilder_form');\n\t\t\t\t\t\t$db->delete('formbuilder_report');\n $db->delete('forms');\n $db->delete('forms_control');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'youtubemodule':\n\t\t\t\t\tcase 'mediaplayermodule':\n\t\t\t\t\t\t$db->delete('media');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'bannermodule':\n\t\t\t\t\t\t$db->delete('banner');\n\t\t\t\t\t\t$db->delete('companies');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'addressmodule':\n\t\t\t\t\t\t$db->delete('addresses');\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
" //pull the sectionref data for selected modules\n\t\tif (empty($this->params['migrate'])) {\n\t\t\t$where = '1';\n\t\t} else {\n\t\t\t$where = '';\n\t\t\tforeach ($this->params['migrate'] as $key) {\n\t\t\t\tif (!empty($where)) {$where .= \" or\";}\n\t\t\t\t$where .= \" module='\".$key.\"'\";\n\t\t\t}\n\t\t}",
" // pull the sectionref data for selected modules\n $secref = $old_db->selectObjects('sectionref',$where);\n if (empty($this->params['migrate'])) $this->params['migrate'] = array();\n foreach ($secref as $sr) {\n // convert hard coded modules which are only found in sectionref\n if (array_key_exists($sr->module, $this->new_modules) && ($sr->refcount==1000)) {\n\t $iloc = expCore::makeLocation($sr->module,$sr->source,$sr->internal);\n $tmp = new stdClass();\n\t $tmp->module = '';\n// $this->convert($iloc,$iloc->mod,1);\n $this->convert($iloc,$tmp,1); // convert the hard-coded module",
" // convert the source to new exp controller\n $sr->module = $this->new_modules[$sr->module];\n }",
" // copy over and convert sectionrefs\n if (!in_array($sr->module, $this->deprecated_modules)) {\n // if the module is not in the deprecation list, we're hitting here\n if (!$db->selectObject('sectionref',\"source='\".$sr->source.\"'\")) {\n\t\t\t\t\tif (array_key_exists($sr->module, $this->new_modules)) {\n\t\t\t\t\t\t// convert the source to new exp controller\n\t\t\t\t\t\t$sr->module = $this->new_modules[$sr->module];\n\t\t\t\t\t}\n $db->insertObject($sr, 'sectionref');\n @$this->msg['sectionref']++;\n }\n }\n }",
" //pull over all the top level containers\n $containers = $old_db->selectObjects('container', 'external=\"N;\"');\n foreach ($containers as $cont) {\n $oldint = expUnserialize($cont->internal);\n $newint = expCore::makeLocation('container',$oldint->src);\n if (!$db->selectObject('container',\"internal='\".serialize($newint).\"'\")) {\n unset($cont->id);\n $cont->internal = serialize($newint);\n $cont->action = 'showall';\n if ($cont->view == 'Default') {\n $cont->view = 'showall';\n } else {\n $cont->view = 'showall_'.$cont->view;\n }\n $cont->view_data = null;\n $db->insertObject($cont, 'container');\n @$this->msg['container']++;\n }\n }\n // echo \"Imported containermodules<br>\";",
" // // this will pull all the old modules. if we have a exp2 equivalent module\n // // we will convert it to the new type of module before pulling.\n $cwhere = ' and (';\n $i=0;\n foreach ($this->params['migrate'] as $key) {\n $cwhere .= ($i==0) ? \"\" : \" or \";\n $cwhere .= \"internal like '%\".$key.\"%'\";\n $i=1;\n }\n $cwhere .= \")\";\n $modules = $old_db->selectObjects('container', 'external != \"N;\"'.$cwhere.' ORDER BY \"rank\"');\n foreach($modules as $module) {\n $iloc = expUnserialize($module->internal);\n if (array_key_exists($iloc->mod, $this->new_modules)) {\n // convert new modules added via container\n unset(\n $module->internal,\n $module->action\n );\n// unset($module->view);\n $this->convert($iloc, $module);\n// } else if (!in_array($iloc->mod, $this->deprecated_modules)) {\n// // add old school modules not in the deprecation list\n////\t\t\t\tif ($iloc->mod == 'calendarmodule' && $module->view == 'Upcoming Events - Summary') {\n////\t\t\t\t\t$module->view = 'Upcoming Events - Headlines';\n////\t\t\t\t}\n//\t\t\t\t$linked = $this->pulldata($iloc, $module);\n//\t\t\t\tif ($linked) {\n//\t\t\t\t\t$newmodule['i_mod'] = $iloc->mod;\n//\t\t\t\t\t$newmodule['modcntrol'] = $iloc->mod;\n//\t\t\t\t\t$newmodule['rank'] = $module->rank;\n//\t\t\t\t\t$newmodule['views'] = $module->view;\n//\t\t\t\t\t$newmodule['title'] = $module->title;\n//\t\t\t\t\t$newmodule['actions'] = '';\n// $section = $old_db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"' AND is_original='0'\");\n// $_POST['current_section'] = empty($section->section) ? 1 : $section->section;\n//\t\t\t\t\t$module = container::update($newmodule,$module,expUnserialize($module->external));\n//// if ($iloc->mod == 'calendarmodule') {\n//// $config = $old_db->selectObject('calendarmodule_config', \"location_data='\".serialize($iloc).\"'\");\n//// $config->id = '';\n//// $config->enable_categories = 1;\n//// $config->enable_tags = 0;\n//// $config->location_data = $module->internal;\n//// $config->aggregate = serialize(Array($iloc->src));\n//// $db->insertObject($config, 'calendarmodule_config');\n//// }\n//\t\t\t\t}\n//\t\t\t\t$res = $db->insertObject($module, 'container');\n//\t\t\t\tif ($res) { @$this->msg['container']++; }\n }\n }",
"\t\tif (isset($this->params['copy_permissions'])) {\n\t\t\t$db->delete('userpermission',\"module != 'navigation'\");\n\t\t\t$db->delete('grouppermission',\"module != 'navigation'\");",
"\t\t\t$users = $db->selectObjects('user','id > 1');\n\t\t\tforeach($users as $user) {\n\t\t\t\t$containers = $old_db->selectObjects('userpermission',\"uid='\".$user->id.\"' AND source != ''\");\n\t\t\t\tforeach($containers as $item) {\n $loc = expCore::makeLocation($item->module,$item->source);\n\t\t\t\t\tif (array_key_exists($item->module, $this->new_modules)) {\n\t\t\t\t\t\t$loc->mod = $this->new_modules[$item->module];\n\t\t\t\t\t\t$item->module = $this->new_modules[$item->module];\n $item = $this->convert_permission($item);\n }\n\t\t\t\t\tif ($item && $db->selectObject('container',\"internal = '\".serialize($loc).\"'\")) {\n\t\t\t\t\t\t$db->insertObject($item,'userpermission');\n\t\t\t\t\t\tif ($item->permission == 'edit') { // if they had edit permission, we'll also give them create permission\n\t\t\t\t\t\t\t$item->permission = 'create';\n\t\t\t\t\t\t\t@$db->insertObject($item,'userpermission');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$groups = $db->selectObjects('group','1');\n\t\t\tforeach($groups as $group) {\n\t\t\t\t$containers = $old_db->selectObjects('grouppermission',\"gid='\".$group->id.\"' AND source != ''\");\n\t\t\t\tforeach($containers as $item) {\n $loc = expCore::makeLocation($loc->mod = $item->module,$item->source);\n\t\t\t\t\tif (array_key_exists($item->module, $this->new_modules)) {\n\t\t\t\t\t\t$loc->mod = $this->new_modules[$item->module];\n\t\t\t\t\t\t$item->module = $this->new_modules[$item->module];\n\t\t\t\t\t\t$item = $this->convert_permission($item);\n\t\t\t\t\t}\n\t\t\t\t\tif ($item && $db->selectObject('container',\"internal = '\".serialize($loc).\"'\")) {\n\t\t\t\t\t\t$db->insertObject($item,'grouppermission');\n\t\t\t\t\t\tif ($item->permission == 'edit') { // if they had edit permission, we'll also give them create permission\n\t\t\t\t\t\t\t$item->permission = 'create';\n\t\t\t\t\t\t\t@$db->insertObject($item,'grouppermission');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
" // migrate the active controller list (modstate)\n $activemods = $old_db->selectObjects('modstate',1);\n foreach($activemods as $mod) {\n if (array_key_exists($mod->module, $this->new_modules)) {\n $mod->module = $this->new_modules[$mod->module];\n }\n if (array_key_exists($mod->module, $this->new_modules) || !in_array($mod->module, $this->deprecated_modules)) {\n// $mod->path = '';\n// $mod->user_runnable = 1;\n// $mod->controller = 1;\n// $mod->os_module = 1;\n// $mod->name = '';\n// $mod->author = '';\n// $mod->description = '';\n// $mod->codequality = '';\n if ($db->selectObject('modstate',\"module='\".$mod->module.\"'\")) {\n $db->updateObject($mod,'modstate',null,'module');\n } else {\n $db->insertObject($mod,'modstate');\n }\n }\n }",
"\t\tsearchController::spider();\n expSession::clearCurrentUserSessionCache();\n assign_to_template(array(\n 'msg'=>@$this->msg\n ));\n }",
"\t/**\n\t * gather info about all users/groups in old site for user selection\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n\tpublic function manage_users() {\n global $db;",
" expHistory::set('manageable', $this->params);\n $old_db = $this->connect();\n $users = $old_db->selectObjects('user','id > 1');\n foreach($users as $user) {\n\t\t\tif ($db->selectObject('user',\"id='\".$user->id.\"'\")) {\n\t\t\t\t$user->exists = true;\n\t\t\t} else {\n\t\t\t\t$user->exists = false;\n\t\t\t}\n\t\t}",
" $groups = $old_db->selectObjects('group');\n foreach($groups as $group) {\n\t\t\tif ($db->selectObject('group',\"id='\".$group->id.\"'\")) {\n\t\t\t\t$group->exists = true;\n\t\t\t} else {\n\t\t\t\t$group->exists = false;\n\t\t\t}\n\t\t}\n\t\tassign_to_template(array(\n 'users'=>$users,\n 'groups'=>$groups\n ));\n }",
"\t/**\n\t * copy selected users/groups over from old site\n\t * @var \\mysqli_database $db the exponent database object\n\t * @return void\n\t */\n public function migrate_users() {\n global $db;",
"\t\tif (isset($this->params['wipe_groups'])) {\n\t\t\t$db->delete('group');\n\t\t\t$db->delete('groupmembership');\n\t\t}\n\t\tif (isset($this->params['wipe_users'])) {\n\t\t\t$db->delete('user','id > 1');\n\t\t}\n $old_db = $this->connect();\n//\t\tprint_r(\"<pre>\");\n//\t\tprint_r($old_db->selectAndJoinObjects('', '', 'group', 'groupmembership','id', 'group_id', 'name = \"Editors\"', ''));",
" $gsuccessful = 0;\n $gfailed = 0;\n\t\tif (!empty($this->params['groups'])) {\n\t\t\tforeach($this->params['groups'] as $groupid) {\n\t\t\t\t$group = $old_db->selectObject('group', 'id='.$groupid);\n\t\t\t\t$ret = $db->insertObject($group, 'group');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$gfailed++;\n\t\t\t\t} else {\n\t\t\t\t\t$gsuccessful++;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tif (!empty($this->params['rep_groups'])) {\n\t\t\tforeach($this->params['rep_groups'] as $groupid) {\n\t\t\t\t$db->delete('group','id='.$groupid);\n\t\t\t\t$group = $old_db->selectObject('group', 'id='.$groupid);\n\t\t\t\t$ret = $db->insertObject($group, 'group');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$gfailed++;\n\t\t\t\t} else {\n\t\t\t\t\t$gsuccessful++;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n $successful = 0;\n $failed = 0;\n\t\tif (!empty($this->params['users'])) {\n\t\t\tforeach($this->params['users'] as $userid) {\n\t\t\t\t$user = $old_db->selectObject('user', 'id='.$userid);\n\t\t\t\t$ret = $db->insertObject($user, 'user');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$failed++;\n\t\t\t\t} else {\n\t\t\t\t\t$successful++;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tif (!empty($this->params['rep_users'])) {\n\t\t\tforeach($this->params['rep_users'] as $userid) {\n\t\t\t\t$db->delete('user','id='.$userid);\n\t\t\t\t$user = $old_db->selectObject('user', 'id='.$userid);\n\t\t\t\t$ret = $db->insertObject($user, 'user');\n\t\t\t\tif (empty($ret)) {\n\t\t\t\t\t$failed++;\n\t\t\t\t} else {\n\t\t\t\t\t$successful++;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\t $users = new stdClass();\n\t $groups = new stdClass();\n\t\tif (!empty($this->params['groups']) && !empty($this->params['rep_groups'])) {\n\t\t\t$groups = array_merge($this->params['groups'],$this->params['rep_groups']);\n\t\t} elseif (!empty($this->params['groups'])) {\n\t\t\t$groups = $this->params['groups'];\n\t\t} elseif (!empty($this->params['rep_groups'])) {\n\t\t\t$groups = $this->params['rep_groups'];\n\t\t}\n\t\tif (!empty($this->params['users']) && !empty($this->params['rep_users'])) {\n\t\t\t$users = array_merge($this->params['users'],$this->params['rep_users']);\n\t\t} elseif (!empty($this->params['users'])) {\n\t\t\t$users = $this->params['users'];\n\t\t} elseif (!empty($this->params['rep_users'])) {\n\t\t\t$users = $this->params['rep_users'];\n\t\t}\n\t\tif (!empty($groups) && !empty($users)) {\n\t\t\tforeach($groups as $groupid) {\n\t\t\t\t$groupmembers = $old_db->selectObjects('groupmembership', 'group_id='.$groupid);\n\t\t\t\tforeach($groupmembers as $userid) {\n\t\t\t\t\tif (in_array($userid->member_id,$users)) {\n\t\t\t\t\t\t$db->insertObject($userid, 'groupmembership');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n flash('message', $successful.' '.gt('users and').' '.$gsuccessful.' '.gt('groups were imported from').' '.$this->config['database']);\n if ($failed > 0 || $gfailed > 0) {\n\t\t\t$msg = '';\n\t\t\tif ($failed > 0) {\n\t\t\t\t$msg = $failed.' users ';\n\t\t\t}\n\t\t\tif ($gfailed > 0) {\n\t\t\t\tif ($msg != '') { $msg .= ' and ';}\n\t\t\t\t$msg .= $gfailed.' groups ';\n\t\t\t}\n flash('error', $msg.' '.gt('could not be imported from').' '.$this->config['database'].' '.gt('This is usually because a user with the username or group with that name already exists in the database you importing to.'));\n }\n expSession::clearCurrentUserSessionCache();\n expHistory::back();\n }",
"\t/**\n\t * main routine to convert old school module data into new controller format\n\t * @var \\mysqli_database $db the exponent database object\n\t * @param $iloc\n\t * @param $module\n\t * @param int $hc\n\t * @return\n\t */\n private function convert($iloc, $module, $hc=0) {\n if (!in_array($iloc->mod, $this->params['migrate'])) return $module;\n global $db;\n $old_db = $this->connect();\n\t\t$linked = false;\n\t $loc = new stdClass();\n $newconfig = new expConfig();\n if ((!empty($module->is_existing) && $module->is_existing)) {\n $linked = true;\n }",
" switch ($iloc->mod) {\n case 'textmodule':\n\t\t\t\t@$module->view = 'showall';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n\t\t\t\t$ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"text\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'textmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'textmodule';\n $textitems = $old_db->selectObjects('textitem', \"location_data='\".serialize($iloc).\"'\");\n if ($textitems) {\n foreach ($textitems as $ti) {\n $text = new text();\n $loc = expUnserialize($ti->location_data);\n $loc->mod = \"text\";\n $text->location_data = serialize($loc);\n $text->body = $ti->text;\n $text->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n }\n\t\t\t\tbreak;\n case 'rotatormodule':\n $module->action = 'showRandom';\n $module->view = 'showRandom';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"text\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'rotatormodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'rotatormodule';\n $textitems = $old_db->selectObjects('rotator_item', \"location_data='\".serialize($iloc).\"'\");\n if ($textitems) {\n foreach ($textitems as $ti) {\n $text = new text();\n $loc = expUnserialize($ti->location_data);\n $loc->mod = \"text\";\n $text->location_data = serialize($loc);\n $text->body = $ti->text;\n $text->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n }\n\t\t\t\tbreak;\n case 'snippetmodule':\n\t\t\t\t$module->view = 'showall';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"snippet\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'snippetmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'snippetmodule';\n $textitems = $old_db->selectObjects('textitem', \"location_data='\".serialize($iloc).\"'\");\n if ($textitems) {\n foreach ($textitems as $ti) {\n $text = new snippet();\n $loc = expUnserialize($ti->location_data);\n $loc->mod = \"snippet\";\n $text->location_data = serialize($loc);\n $text->body = $ti->text;\n // if the item exists in the current db, we won't save it\n $te = $text->find('first',\"location_data='\".$text->location_data.\"'\");\n if (empty($te)) {\n $text->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n }\n }\n\t\t\t\tbreak;\n case 'linklistmodule':\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'Quick Links':\n\t\t\t\t\t\t@$module->view = \"showall_quicklinks\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t@$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"links\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'linklistmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'linklistmodule';\n $links = $old_db->selectArrays('linklist_link', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($links) {\n\t\t\t\t\tforeach ($links as $link) {\n\t\t\t\t\t\t$lnk = new links();\n\t\t\t\t\t\t$loc = expUnserialize($link['location_data']);\n\t\t\t\t\t\t$loc->mod = \"links\";\n\t\t\t\t\t\t$lnk->title = (!empty($link['name'])) ? $link['name'] : 'Untitled';\n\t\t\t\t\t\t$lnk->body = $link['description'];\n\t\t\t\t\t\t$lnk->new_window = $link['opennew'];\n\t\t\t\t\t\t$lnk->url = (!empty($link['url'])) ? $link['url'] : '#';\n\t\t\t\t\t\t$lnk->rank = $link['rank']+1;\n\t\t\t\t\t\t$lnk->poster = 1;\n\t\t\t\t\t\t$lnk->editor = 1;\n\t\t\t\t\t\t$lnk->location_data = serialize($loc);\n\t\t\t\t\t\t$lnk->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'linkmodule': // user mod, not widely distributed\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'Summary':\n\t\t\t\t\t\t@$module->view = \"showall_quicklinks\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t@$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('linkmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_rss == 1) {\n $newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['feed_desc'] = $oldconfig->feed_desc;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->orderhow)) {\n if ($oldconfig->orderby == 'name') $newconfig->config['order'] = 'title';\n switch ($oldconfig->orderhow) {\n case '1':\n $newconfig->config['order'] .= ' DESC';\n break;\n case '2':\n $newconfig->config['order'] = 'rank';\n break;\n }\n }\n if ($oldconfig->enable_categories == 1) {\n $newconfig->config['usecategories'] = true;\n }\n }",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"links\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'linkmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'linkmodule';\n $links = $old_db->selectArrays('link', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($links) {\n\t\t\t\t\tforeach ($links as $link) {\n\t\t\t\t\t\t$lnk = new links();\n\t\t\t\t\t\t$loc = expUnserialize($link['location_data']);\n\t\t\t\t\t\t$loc->mod = \"links\";\n\t\t\t\t\t\t$lnk->title = (!empty($link['name'])) ? $link['name'] : 'Untitled';\n\t\t\t\t\t\t$lnk->body = $link['description'];\n\t\t\t\t\t\t$lnk->new_window = $link['opennew'];\n\t\t\t\t\t\t$lnk->url = (!empty($link['url'])) ? $link['url'] : '#';\n\t\t\t\t\t\t$lnk->rank = $link['rank']+1;\n\t\t\t\t\t\t$lnk->poster = 1;\n\t\t\t\t\t\t$lnk->editor = 1;\n\t\t\t\t\t\t$lnk->location_data = serialize($loc);\n\t\t\t\t\t\t$lnk->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1 && $link['category_id']) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$link['category_id']);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank + 1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $lnk->update($params);\n }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'swfmodule':\n\t\t\t\t$module->view = 'showall';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"text\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'swfmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'swfmodule';\n $swfitems = $old_db->selectObjects('swfitem', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($swfitems) {\n\t\t\t\t\tforeach ($swfitems as $ti) {\n\t\t\t\t\t\t$text = new text();\n\t\t\t\t\t\t$file = new expFile($ti->swf_id);\n\t\t\t\t\t\t$loc = expUnserialize($ti->location_data);\n\t\t\t\t\t\t$loc->mod = \"text\";\n\t\t\t\t\t\t$text->location_data = serialize($loc);\n\t\t\t\t\t\t$text->title = $ti->name;\n\t\t\t\t\t\t$swfcode = '\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" height=\"'.$ti->height.'\" width=\"'.$ti->width.'\">\n\t\t\t\t\t\t\t\t <param name=\"bgcolor\" value=\"'.$ti->bgcolor.'\" />\n\t\t\t\t\t\t\t\t\t'.($ti->transparentbg?\"<param name=\\\"wmode\\\" value=\\\"transparent\\\" />\":\"\").'\n\t\t\t\t\t\t\t\t <param name=\"quality\" value=\"high\" />\n\t\t\t\t\t\t\t\t <param name=\"movie\" value=\"'.$file->path_relative.'\" />\n\t\t\t\t\t\t\t\t <embed bgcolor= \"'.$ti->bgcolor.'\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\"'.$file->path_relative.'\" type=\"application/x-shockwave-flash\" height=\"'.$ti->height.'\" width=\"'.$ti->width.'\"'.($ti->transparentbg?\" wmode=\\\"transparent\\\"\":\"\").'>\n\t\t\t\t\t\t\t\t </embed>\n\t\t\t\t\t\t\t </object>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t';\n\t\t\t\t\t\t$text->body = $swfcode;\n\t\t\t\t\t\t$text->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'newsmodule':\n $only_featured = false;\n $usebody = 0;\n\t\t\t\tswitch ($module->view) {\n case 'Featured News':\n $only_featured = true;\n $module->view = 'showall';\n break;\n\t\t\t\t\tcase 'Headlines':\n $usebody = 2;\n\t\t\t\t\t\t$module->view = 'showall_headlines';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Summary':\n case 'Default':\n $usebody = 1;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('newsmodule_config', \"location_data='\".serialize($iloc).\"'\");\n $oldviewconfig = expUnserialize($old_db->selectValue('container','view_data', \"internal='\".serialize($iloc).\"'\"));\n $ploc = clone($iloc);\n $ploc->mod = \"news\";\n // fudge a config to get attached files to appear\n $newconfig->config = expUnserialize('a:14:{s:9:\"feedmaker\";s:0:\"\";s:11:\"filedisplay\";s:7:\"Gallery\";s:6:\"ffloat\";s:4:\"Left\";s:6:\"fwidth\";s:3:\"120\";s:7:\"fmargin\";s:1:\"5\";s:7:\"piwidth\";s:3:\"100\";s:5:\"thumb\";s:3:\"100\";s:7:\"spacing\";s:2:\"10\";s:10:\"floatthumb\";s:8:\"No Float\";s:6:\"tclass\";s:0:\"\";s:5:\"limit\";s:0:\"\";s:9:\"pagelinks\";s:14:\"Top and Bottom\";s:10:\"feed_title\";s:0:\"\";s:9:\"feed_desc\";s:0:\"\";}');\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_rss == 1) {\n $newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['feed_desc'] = $oldconfig->feed_desc;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->item_limit)) {\n $newconfig->config['limit'] = $oldconfig->item_limit;\n $newconfig->config['multipageonly'] = true;\n }\n if (!empty($oldconfig->sortfield)) {\n switch ($oldconfig->sortfield) {\n case 'publish':\n $newconfig->config['order'] = 'publish';\n break;\n case 'edited':\n $newconfig->config['order'] = 'edited_at';\n break;\n case 'posted':\n default:\n $newconfig->config['order'] = 'created_at';\n break;\n }\n if ($oldconfig->sortorder == 'DESC') {\n $newconfig->config['order'] .= ' DESC';\n }\n }\n if (!empty($oldconfig->aggregate) && $oldconfig->aggregate != 'a:0:{}') {\n $merged = expUnserialize($oldconfig->aggregate);\n foreach ($merged as $merge) {\n $newconfig->config['aggregate'][] = $merge;\n }\n }\n if (!empty($oldconfig->pull_rss) && $oldconfig->pull_rss) {\n $pulled = expUnserialize($oldconfig->rss_feed);\n foreach ($pulled as $pull) {\n $newconfig->config['pull_rss'][] = $pull;\n }\n }\n }\n if ($usebody) {\n $newconfig->config['usebody'] = $usebody;\n }\n if (!empty($oldviewconfig['num_items'])) {\n $newconfig->config['limit'] = $oldviewconfig['num_items'];\n// $newconfig->config['pagelinks'] = \"Don't show page links\";\n }\n $only_featured = empty($oldviewconfig['featured_only']) ? 0 : 1;\n if ($only_featured) {\n $newconfig->config['only_featured'] = true;\n }",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'newsmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'newsmodule';\n $newsitems = $old_db->selectArrays('newsitem', \"location_data='\".serialize($iloc).\"'\");\n if ($newsitems) {\n foreach ($newsitems as $ni) {\n unset($ni['id']);\n $news = new news($ni);\n $loc = expUnserialize($ni['location_data']);\n $loc->mod = \"news\";\n $news->location_data = serialize($loc);\n $news->title = (!empty($ni['title'])) ? $ni['title'] : gt('Untitled');\n $news->body = (!empty($ni['body'])) ? $ni['body'] : gt('(empty)');\n $news->save();\n\t\t\t\t\t\t// default is to create with current time\n $news->created_at = $ni['posted'];\n $news->migrated_at = $ni['edited'];\n $news->update();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n if (!empty($ni['file_id'])) {\n $file = new expFile($ni['file_id']);\n $news->attachItem($file,'');\n }\n if (isset($oldconfig->enable_tags) && $oldconfig->enable_tags = true) {\n\t $params = null;;\n\t\t\t\t\t\t\t$oldtags = expUnserialize($ni['tags']);\n if (!empty($oldtags)) {\n foreach ($oldtags as $oldtag){\n $tagtitle = strtolower(trim($old_db->selectValue('tags','name','id = '.$oldtag)));\n $tag = new expTag($tagtitle);\n //\t\t\t\t\t\t\t\t$tag->title = $old_db->selectValue('tags','name','id = '.$oldtag);\n if (empty($tag->id))\n $tag->update(array('title'=>$tagtitle));\n $params['expTag'][] = $tag->id;\n }\n }\n $news->update($params);\n }\n }\n }\n\t\t\t\tbreak;\n case 'resourcesmodule':\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'One Click Download - Descriptive':\n\t\t\t\t\t\t$module->view = 'showall_headlines';\n\t\t\t\t\t\tbreak;\n case 'Recent':\n $module->view = 'showall_recent';\n $newconfig->config['usebody'] = 2;\n break;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('resourcesmodule_config', \"location_data='\".serialize($iloc).\"'\");\n $oldviewconfig = expUnserialize($old_db->selectValue('container','view_data', \"internal='\".serialize($iloc).\"'\"));\n $ploc = clone($iloc);\n $ploc->mod = \"filedownload\";\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_categories == 1 && $module->view != 'showall_recent') {\n $newconfig->config['usecategories'] = true;\n }\n if (!empty($oldconfig->description)) {\n $newconfig->config['moduledescription'] = $oldconfig->description;\n }\n if (isset($oldconfig->enable_rss)) {\n $dorss = $oldconfig->enable_rss;\n } elseif (isset($oldconfig->enable_podcasting)) {\n $dorss = $oldconfig->enable_podcasting;\n } else {\n $dorss = false;\n }\n if ($dorss) {\n $newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['feed_desc'] = $oldconfig->feed_desc;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->orderhow)) {\n switch ($oldconfig->orderby) {\n case 'edited':\n $newconfig->config['order'] = 'edited_at';\n break;\n case 'downloads':\n $newconfig->config['order'] = 'downloads';\n break;\n case 'name':\n $newconfig->config['order'] = 'title';\n break;\n case 'posted':\n default:\n $newconfig->config['order'] = 'created_at';\n break;\n }\n switch ($oldconfig->orderhow) {\n case '2':\n $newconfig->config['order'] = 'rank';\n break;\n case '1':\n $newconfig->config['order'] .= ' DESC';\n break;\n }\n }\n }\n if (!empty($oldviewconfig['num_posts'])) {\n $newconfig->config['limit'] = $oldviewconfig['num_posts'];\n// $newconfig->config['pagelinks'] = \"Don't show page links\";\n }\n $newconfig->config['usebody'] = 2;\n if (!empty($oldviewconfig['show_descriptions'])) {\n $newconfig->config['show_info'] = $oldviewconfig['show_descriptions'] ? 1 : 0;\n if ($oldviewconfig['show_descriptions']) {\n $newconfig->config['usebody'] = 0;\n }\n }\n $newconfig->config['quick_download'] = !empty($oldviewconfig['direct_download']) ? $oldviewconfig['direct_download'] : 0;\n $newconfig->config['show_icon'] = !empty($oldviewconfig['show_icons']) ? $oldviewconfig['show_icons'] : 0;\n $newconfig->config['show_player'] = !empty($oldviewconfig['show_player']) ? $oldviewconfig['show_player'] : 0;",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n//\t\t\t\tif ($db->countObjects('filedownloads', \"location_data='\".serialize($ploc).\"'\")) {\n if ($db->countObjects('filedownload', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'resourcesmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'resourcesmodule';\n $resourceitems = $old_db->selectArrays('resourceitem', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($resourceitems) {\n\t\t\t\t\tforeach ($resourceitems as $ri) {\n\t\t\t\t\t\tunset($ri['id']);\n\t\t\t\t\t\t$filedownload = new filedownload($ri);\n\t\t\t\t\t\t$loc = expUnserialize($ri['location_data']);\n\t\t\t\t\t\t$loc->mod = \"filedownload\";\n\t\t\t\t\t\t$filedownload->title = (!empty($ri['name'])) ? $ri['name'] : 'Untitled';\n\t\t\t\t\t\t$filedownload->body = $ri['description'];\n\t\t\t\t\t\t$filedownload->downloads = $ri['num_downloads'];\n\t\t\t\t\t\t$filedownload->location_data = serialize($loc);\n\t\t\t\t\t\tif (!empty($ri['file_id'])) {\n\t\t\t\t\t\t\t$filedownload->save();\n\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t\t\t$file = new expFile($ri['file_id']);\n\t\t\t\t\t\t\t$filedownload->attachItem($file,'downloadable');\n\t\t\t\t\t\t\t// default is to create with current time\t\t\t\t\t\t\n\t\t\t\t\t\t\t$filedownload->created_at = $ri['posted'];\n\t\t\t\t\t\t\t$filedownload->migrated_at = $ri['edited'];\n $filedownload->publish = $ri['posted'];\n\t\t\t\t\t\t\t$filedownload->update();\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1 && $ri['category_id']) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$ri['category_id']);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank +1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $filedownload->update($params);\n }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'imagegallerymodule':\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'Slideshow':\n\t\t\t\t\t\t$module->action = 'slideshow';\n\t\t\t\t\t\t$module->view = 'slideshow';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldviewconfig = expUnserialize($old_db->selectValue('container','view_data', \"internal='\".serialize($iloc).\"'\"));\n $newconfig->config['usecategories'] = true;\n $newconfig->config['multipageonly'] = true;\n $newconfig->config['speed'] = empty($oldviewconfig['delay']) ? 0: $oldviewconfig['delay']/1000;\n $newconfig->config['pa_show_controls'] = empty($oldviewconfig['controller']) ? 0 : 1;",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"photo\";\n\t\t\t\tif ($db->countObjects('photo', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'imagegallerymodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'imagegallerymodule';\n $galleries = $old_db->selectArrays('imagegallery_gallery', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($galleries) {\n\t\t\t\t\tforeach ($galleries as $gallery) {\n $params = null;;\n $cat = new expCat($gallery['name']);\n if (empty($cat->id)) {\n $cat->title = $gallery['name'];\n $cat->rank = $gallery['galleryorder']+1;\n $cat->module = 'photo';\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n\t\t\t\t\t\t$gis = $old_db->selectArrays('imagegallery_image', \"gallery_id='\".$gallery['id'].\"'\");\n\t\t\t\t\t\tforeach ($gis as $gi) {\n\t\t\t\t\t\t\t$photo = new photo();\n\t\t\t\t\t\t\t$loc = expUnserialize($gallery['location_data']);\n\t\t\t\t\t\t\t$loc->mod = \"photo\";\n\t\t\t\t\t\t\t$photo->title = (!empty($gi['name'])) ? $gi['name'] : 'Untitled';\n\t\t\t\t\t\t\t$photo->body = $gi['description'];\n\t\t\t\t\t\t\t$photo->alt = !empty($gi['alt']) ? $gi['alt'] : $photo->title;\n\t\t\t\t\t\t\t$photo->location_data = serialize($loc);\n\t\t\t\t\t\t\tif (!empty($gi['file_id'])) {\n\t\t\t\t\t\t\t\t$photo->save();\n\t\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t\t\t\t$file = new expFile($gi['file_id']);\n\t\t\t\t\t\t\t\t$photo->attachItem($file,'');\n\t\t\t\t\t\t\t\t$photo->created_at = $gi['posted'];\n\t\t\t\t\t\t\t\t$photo->migrated_at = $gi['posted'];\n\t\t\t\t\t\t\t\t$photo->update(array(\"validate\"=>false));\t\t\t\t\t\t\t\t\n $photo->update($params); // save gallery name as category\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n // pick up some module config settings based on last gallery\n $newconfig->config['pa_showall_thumbbox'] = $gallery['box_size'];\n $newconfig->config['pa_showall_enlarged'] = $gallery['pop_size'];\n $newconfig->config['limit'] = $gallery['perpage'];\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'slideshowmodule':\n $module->action = 'slideshow';\n $module->view = 'slideshow';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"photo\";\n\t\t\t\tif ($db->countObjects('photo', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'slideshowmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'slideshowmodule';\n $gis = $old_db->selectArrays('slideshow_slide', \"location_data='\".serialize($iloc).\"'\");\n if ($gis) {\n foreach ($gis as $gi) {\n $photo = new photo();\n $loc->mod = \"photo\";\n $loc->src = $iloc->src;\n $loc->int = $iloc->int;\n $photo->title = (!empty($gi['name'])) ? $gi['name'] : 'Untitled';\n $photo->body = $gi['description'];\n $photo->alt = !empty($gi['alt']) ? $gi['alt'] : $photo->title;\n $photo->location_data = serialize($loc);\n $te = $photo->find('first',\"location_data='\".$photo->location_data.\"'\");\n if (empty($te)) {\n if (!empty($gi['file_id'])) {\n $photo->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n $file = new expFile($gi['file_id']);\n $photo->attachItem($file,'');\n $photo->update(array(\"validate\"=>false));\n }\n }\n }\n }\n\t\t\t\tbreak;\n case 'headlinemodule':\n $module->view = 'showall_headline';",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"text\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'headlinemodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'headlinemodule';\n $headlines = $old_db->selectObjects('headline', \"location_data='\".serialize($iloc).\"'\");\n if ($headlines) {\n foreach ($headlines as $hl) {\n $headline = new text();\n $loc = expUnserialize($hl->location_data);\n $loc->mod = \"text\";\n $headline->location_data = serialize($loc);\n $headline->title = $hl->headline;\n $headline->poster = 1;\n// $headline->created_at = time();\n// $headline->migrated_at = time();\n $headline->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n }\n\t\t\t\tbreak;\n case 'weblogmodule':\n $usebody = 0;\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'By Author':\n\t\t\t\t\t\t$module->action = 'authors';\n\t\t\t\t\t\t$module->view = 'authors';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'By Tag':\n\t\t\t\t\t\t$module->action = 'tags';\n\t\t\t\t\t\t$module->view = 'tags_list';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Monthly':\n\t\t\t\t\t\t$module->action = 'dates';\n\t\t\t\t\t\t$module->view = 'dates';\n\t\t\t\t\t\tbreak;\n case 'Summary':\n $usebody = 2;\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n case 'Default':\n $usebody = 1;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$module->view = 'showall';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('weblogmodule_config', \"location_data='\".serialize($iloc).\"'\");\n $oldviewconfig = expUnserialize($old_db->selectValue('container','view_data', \"internal='\".serialize($iloc).\"'\"));\n $ploc = clone($iloc);\n $ploc->mod = \"blog\";\n $newconfig->config['add_source'] = '1';\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_rss == 1) {\n $newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['feed_desc'] = $oldconfig->feed_desc;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->items_per_page)) {\n $newconfig->config['limit'] = $oldconfig->items_per_page;\n $newconfig->config['multipageonly'] = true;\n }\n if (!empty($oldviewconfig['num_posts'])) {\n $newconfig->config['limit'] = $oldviewconfig['num_posts'];\n // $newconfig->config['pagelinks'] = \"Don't show page links\";\n }\n if (!empty($oldconfig->allow_comments)) {\n $newconfig->config['usescomments'] = !$oldconfig->allow_comments;\n }\n if (!empty($oldconfig->aggregate) && $oldconfig->aggregate != 'a:0:{}') {\n $merged = expUnserialize($oldconfig->aggregate);\n foreach ($merged as $merge) {\n $newconfig->config['aggregate'][] = $merge;\n }\n }\n }\n if ($usebody) {\n $newconfig->config['usebody'] = $usebody;\n }",
" //check to see if it's already pulled in (circumvent !is_original)\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'weblogmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'weblogmodule';\n $blogitems = $old_db->selectArrays('weblog_post', \"location_data='\".serialize($iloc).\"'\");\n if ($blogitems) {\n foreach ($blogitems as $bi) {\n unset($bi['id']);\n $post = new blog($bi);\n $loc = expUnserialize($bi['location_data']);\n $loc->mod = \"blog\";\n $post->location_data = serialize($loc);\n $post->title = (!empty($bi['title'])) ? $bi['title'] : gt('Untitled');\n $post->body = (!empty($bi['body'])) ? $bi['body'] : gt('(empty)');\n $post->save();\n\t\t\t\t\t\t// default is to create with current time\t\t\t\t\t\t\n $post->created_at = $bi['posted'];\n $post->migrated_at = $bi['edited'];\n $post->update();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t\t// this next section is moot since there are no attachments to blogs\n // if (!empty($bi['file_id'])) {\n // $file = new expFile($bi['file_id']);\n // $post->attachItem($file,'downloadable');\n // }",
" if (isset($oldconfig->enable_tags) && $oldconfig->enable_tags = true) {\n\t $params = null;;\n\t\t\t\t\t\t\t$oldtags = expUnserialize($bi['tags']);\n\t\t\t\t\t\t\tforeach ($oldtags as $oldtag){\n\t\t\t\t\t\t\t\t$tagtitle = strtolower(trim($old_db->selectValue('tags','name','id = '.$oldtag)));\n\t\t\t\t\t\t\t\t$tag = new expTag($tagtitle);\n//\t\t\t\t\t\t\t\t$tag->title = $old_db->selectValue('tags','name','id = '.$oldtag);\n\t\t\t\t\t\t\t\tif (empty($tag->id))\n $tag->update(array('title'=>$tagtitle));\n\t\t\t\t\t\t\t\t$params['expTag'][] = $tag->id;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$post->update($params);\n }",
"\t\t\t\t\t\t$comments = $old_db->selectArrays('weblog_comment', \"parent_id='\".$post->id.\"'\");\n\t\t\t\t\t\tforeach($comments as $comment) {\n\t\t\t\t\t\t\tunset($comment['id']);\n\t\t\t\t\t\t\t$newcomment = new expComment($comment);\n\t\t\t\t\t\t\t$newcomment->created_at = $comment['posted'];\n\t\t\t\t\t\t\t$newcomment->migrated_at = $comment['edited'];\n $newcomment->publish = $comment['posted'];\n\t\t\t\t\t\t\t$newcomment->update();\n\t\t\t\t\t\t\t// attach the comment to the blog post it belongs to\n// $obj = new stdClass();\n//\t\t\t\t\t\t\t$obj->content_type = 'blog';\n//\t\t\t\t\t\t\t$obj->content_id = $post->id;\n//\t\t\t\t\t\t\t$obj->expcomments_id = $newcomment->id;\n//\t\t\t\t\t\t\tif(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n//\t\t\t\t\t\t\t$db->insertObject($obj, $newcomment->attachable_table);\n $newcomment->attachComment('blog', $post->id);\n\t\t\t\t\t\t}\n }\n }\n\t\t\t\tbreak;\n case 'faqmodule':\n\t\t\t\t$module->view = 'showall';",
" $oldconfig = $old_db->selectObject('faqmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1) {\n $newconfig->config['usecategories'] = true;\n }\n $newconfig->config['use_toc'] = true;",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"faq\";\n//\t\t\t\tif ($db->countObjects('faqs', \"location_data='\".serialize($ploc).\"'\")) {\n if ($db->countObjects('faq', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'faqmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'faqmodule';\n $faqs = $old_db->selectArrays('faq', \"location_data='\".serialize($iloc).\"'\");\n if ($faqs) {\n foreach ($faqs as $fqi) {\n unset($fqi['id']);\n $faq = new faq($fqi);\n $loc = expUnserialize($fqi['location_data']);\n $loc->mod = \"faq\";\n $faq->location_data = serialize($loc);\n $faq->question = (!empty($fqi['question'])) ? $fqi['question'] : 'Untitled?';\n $faq->answer = $fqi['answer'];\n $faq->rank = $fqi['rank']+1;\n $faq->include_in_faq = 1;\n $faq->submitter_name = 'Unknown';\n $faq->submitter_email = 'address@website.com';\n $faq->save();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1 && $fqi['category_id']) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$fqi['category_id']);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank + 1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $faq->update($params);\n }\n }\n }\n\t\t\t\tbreak;\n case 'listingmodule':\n $usebody = 0;\n\t\t\t\tswitch ($module->view) {\n\t\t\t\t\tcase 'Simple':\n $module->view = 'showall_simple_list';\n $usebody = 2;\n\t\t\t\t\t\tbreak;\n case 'Default':\n $usebody = 1;\n case 'Full':\n $module->view = 'showall';\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}",
" $oldconfig = $old_db->selectObject('listingmodule_config', \"location_data='\".serialize($iloc).\"'\");\n // fudge a config to get attached files to appear\n $newconfig->config = expUnserialize('a:11:{s:11:\"filedisplay\";s:7:\"Gallery\";s:6:\"ffloat\";s:4:\"Left\";s:6:\"fwidth\";s:3:\"120\";s:7:\"fmargin\";s:1:\"5\";s:7:\"piwidth\";s:3:\"100\";s:5:\"thumb\";s:3:\"100\";s:7:\"spacing\";s:2:\"10\";s:10:\"floatthumb\";s:8:\"No Float\";s:6:\"tclass\";s:0:\"\";s:5:\"limit\";s:0:\"\";s:9:\"pagelinks\";s:14:\"Top and Bottom\";}');\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_categories == 1) {\n $newconfig->config['usecategories'] = true;\n }\n if (!empty($oldconfig->items_perpage)) {\n $newconfig->config['limit'] = $oldconfig->items_perpage;\n $newconfig->config['multipageonly'] = true;\n }\n if (!empty($oldconfig->orderhow)) {\n if ($oldconfig->orderby == 'name') $newconfig->config['order'] = 'title';\n switch ($oldconfig->orderhow) {\n case '1':\n $newconfig->config['order'] .= ' DESC';\n break;\n case '2':\n $newconfig->config['order'] = 'rank';\n break;\n }\n }\n if (!empty($oldconfig->description)) {\n $newconfig->config['moduledescription'] = $oldconfig->description;\n }\n }\n if ($usebody) {\n $newconfig->config['usebody'] = $usebody;\n }",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"portfolio\";\n\t\t\t\tif ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'listingmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'listingmodule';\n $listingitems = $old_db->selectArrays('listing', \"location_data='\".serialize($iloc).\"'\");\n if ($listingitems) {\n foreach ($listingitems as $li) {\n unset($li['id']);\n $listing = new portfolio($li);\n\t\t\t\t\t\t$listing->title = (!empty($li['name'])) ? $li['name'] : 'Untitled?';\n $loc = expUnserialize($li['location_data']);\n $loc->mod = \"portfolio\";\n $listing->location_data = serialize($loc);\n $listing->featured = true;\n $listing->poster = 1;\n $listing->body = \"<p>\".$li['summary'].\"</p>\".$li['body'];\n $listing->save();\n\t\t\t\t\t\t// default is to create with current time\t\t\t\t\t\t\n// $listing->created_at = time();\n// $listing->migrated_at = time();\n// $listing->update();\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n if (!empty($li['file_id'])) {\n\t\t\t\t\t\t\t$file = new expFile($li['file_id']);\n\t\t\t\t\t\t\t$listing->attachItem($file,'');\n\t\t\t\t\t\t}\n if (!empty($oldconfig) && $oldconfig->enable_categories == 1 && $li['category_id']) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$li['category_id']);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank + 1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $listing->update($params);\n }\n }\n }\n\t\t\t\tbreak;\n case 'youtubemodule': //must convert to media player\n\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"media\";\n\t\t\t\tif ($db->countObjects('media', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'youtubemodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'youtubemodule';\n $videos = $old_db->selectArrays('youtube', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($videos) {\n\t\t\t\t\tforeach ($videos as $vi) {\n\t\t\t\t\t\tunset ($vi['id']);\n\t\t\t\t\t\t$video = new media($vi);\n\t\t\t\t\t\t$loc = expUnserialize($vi['location_data']);\n\t\t\t\t\t\t$loc->mod = \"media\";\n\t\t\t\t\t\t$video->title = $vi['name'];\n\t\t\t\t\t\tif (empty($video->title)) { $video->title = 'Untitled'; }\n\t\t\t\t\t\t$video->location_data = serialize($loc);\n $video->body = $vi['description'];\n//\t\t\t\t\t\t$yt = explode(\"watch?v=\",$vi['url']);\n//\t\t\t\t\t\tif (empty($yt[1])) {\n//\t\t\t\t\t\t\tbreak;\n//\t\t\t\t\t\t} else {\n//\t\t\t\t\t\t\t$ytid = $yt[1];\n//\t\t\t\t\t\t}\n//\t\t\t\t\t\tunset ($video->url);\n//\t\t\t\t\t\t$video->embed_code = '<iframe title=\"YouTube video player\" width=\"'.$vi['width'].'\" height=\"'.$vi['height'].'\" src=\"http://www.youtube.com/embed/'.$ytid.'\" frameborder=\"0\" allowfullscreen></iframe>';\n\t\t\t\t\t\t$video->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'mediaplayermodule': // must convert media player\n\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"media\";\n\t\t\t\tif ($db->countObjects('media', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'mediaplayermodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'mediaplayermodule';\n $movies = $old_db->selectArrays('mediaitem', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($movies) {\n\t\t\t\t\tforeach ($movies as $mi) {\n\t\t\t\t\t\tunset ($mi['id']);\n\t\t\t\t\t\t$movie = new media($mi);\n\t\t\t\t\t\t$loc = expUnserialize($mi['location_data']);\n\t\t\t\t\t\t$loc->mod = \"media\";\n\t\t\t\t\t\t$movie->title = $mi['name'];\n\t\t\t\t\t\tif (empty($movie->title)) { $movie->title = 'Untitled'; }\n $movie->body = $mi['description'];\n\t\t\t\t\t\tunset (\n $mi['bgcolor'],\n $mi['alignment'],\n $mi['loop_media'],\n $mi['auto_rewind'],\n $mi['autoplay'],\n $mi['hide_controls']\n );\n\t\t\t\t\t\t$movie->location_data = serialize($loc);\n\t\t\t\t\t\t$movie->poster = 1;\n\t\t\t\t\t\t$movie->rank = 1;\n\t\t\t\t\t\tif (!empty($mi['media_id'])) {\n\t\t\t\t\t\t\t$movie->save();\n\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t\t\t$file = new expFile($mi['media_id']);\n\t\t\t\t\t\t\t$movie->attachItem($file,'files');\n\t\t\t\t\t\t\tif (!empty($mi['alt_image_id'])) {\n\t\t\t\t\t\t\t\t$file = new expFile($mi['alt_image_id']);\n\t\t\t\t\t\t\t\t$movie->attachItem($file,'splash');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'bannermodule':\n\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"banner\";\n\t\t\t\tif ($db->countObjects('banner', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'bannermodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'bannermodule';\n $banners = $old_db->selectArrays('banner_ad', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($banners) {\n\t\t\t\t\tforeach ($banners as $bi) {\n\t\t\t\t\t\t$oldclicks = $old_db->selectObjects('banner_click', \"ad_id='\".$bi['id'].\"'\");\n\t\t\t\t\t\t$oldcompany = $old_db->selectObject('banner_affiliate', \"id='\".$bi['affiliate_id'].\"'\");\n\t\t\t\t\t\tunset ($bi['id']);\n\t\t\t\t\t\t$banner = new banner($bi);\n\t\t\t\t\t\t$loc = expUnserialize($bi['location_data']);\n\t\t\t\t\t\t$loc->mod = \"banner\";\n\t\t\t\t\t\t$banner->title = $bi['name'];\n\t\t\t\t\t\t$banner->url = (!empty($bi['url'])) ? $bi['url'] : '#';\n\t\t\t\t\t\tif (empty($banner->title)) { $banner->title = 'Untitled'; }\n\t\t\t\t\t\t$banner->location_data = serialize($loc);\n\t\t\t\t\t\t$newcompany = $db->selectObject('companies', \"title='\".$oldcompany->name.\"'\");\n\t\t\t\t\t\tif ($newcompany == null) {\n\t\t\t\t\t\t\t$newcompany = new company();\n\t\t\t\t\t\t\t$newcompany->title = (!empty($oldcompany->name)) ? $oldcompany->name : 'Untitled';\n\t\t\t\t\t\t\t$newcompany->body = $oldcompany->contact_info;\n\t\t\t\t\t\t\t$newcompany->location_data = $banner->location_data;\n\t\t\t\t\t\t\t$newcompany->save();\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t\t$banner->companies_id = $newcompany->id;\n\t\t\t\t\t\t$banner->clicks = 0;\n\t\t\t\t\t\tforeach($oldclicks as $click) {\n\t\t\t\t\t\t\t$banner->clicks += $click->clicks;\n\t\t\t\t\t\t}\n if (!empty($bi['file_id'])) {\n $file = new expFile($bi['file_id']);\n $banner->attachItem($file,'');\n }\n\t\t\t\t\t\t$banner->save();\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n// case 'addressbookmodule': // user mod, not widely distributed\n//\n//\t\t\t\t@$module->view = 'myaddressbook';\n//\t\t\t\t@$module->action = 'myaddressbook';\n//\n//\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n//\t\t\t\t// $ploc = $iloc;\n//\t\t\t\t// $ploc->mod = \"addresses\";\n//\t\t\t\t// if ($db->countObjects($ploc->mod, \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t// $iloc->mod = 'addressbookmodule';\n//\t\t\t\t\t// $linked = true;\n//\t\t\t\t\t// break;\n//\t\t\t\t// }\n//\n//// $iloc->mod = 'addressbookmodule';\n// $addresses = $old_db->selectArrays('addressbook_contact', \"location_data='\".serialize($iloc).\"'\");\n//\t\t\t\tif ($addresses) {\n//\t\t\t\t\tforeach ($addresses as $address) {\n////\t\t\t\t\t\tunset($address['id']);\n//\t\t\t\t\t\t$addr = new address();\n//\t\t\t\t\t\t$addr->user_id = 1;\n//\t\t\t\t\t\t$addr->is_default = 1;\n//\t\t\t\t\t\t$addr->is_billing = 1;\n//\t\t\t\t\t\t$addr->is_shipping = 1;\n//\t\t\t\t\t\t$addr->firstname = (!empty($address['firstname'])) ? $address['firstname'] : 'blank';\n//\t\t\t\t\t\t$addr->lastname = (!empty($address['lastname'])) ? $address['lastname'] : 'blank';\n//\t\t\t\t\t\t$addr->address1 = (!empty($address['address1'])) ? $address['address1'] : 'blank';\n//\t\t\t\t\t\t$addr->city = (!empty($address['city'])) ? $address['city'] : 'blank';\n//\t\t\t\t\t\t$address['state'] = (!empty($address['state'])) ? $address['state'] : 'CA';\n//\t\t\t\t\t\t$state = $db->selectObject('geo_region', 'code=\"'.strtoupper($address['state']).'\"');\n//\t\t\t\t\t\t$addr->state = empty($state->id) ? 0 : $state->id;\n//\t\t\t\t\t\t$addr->zip = (!empty($address['zip'])) ? $address['zip'] : '99999';\n//\t\t\t\t\t\t$addr->phone = (!empty($address['phone'])) ? $address['phone'] : '800-555-1212';\n//\t\t\t\t\t\t$addr->email = (!empty($address['email'])) ? $address['email'] : 'address@website.com';\n//\t\t\t\t\t\t$addr->organization = $address['business'];\n//\t\t\t\t\t\t$addr->phone2 = $address['cell'];\n//\t\t\t\t\t\t$addr->save();\n//\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n//\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t\tbreak;\n case 'feedlistmodule':\n\t\t\t\t@$module->view = 'showall';",
"// $iloc->mod = 'feedlistmodule';\n $feedlist = $old_db->selectObject('feedlistmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if ($feedlist->enable_rss == 1) {\n\t\t\t\t\t$loc = expUnserialize($feedlist->location_data);\n\t\t\t\t\t$loc->mod = \"rss\";\n\t\t\t\t\t$newconfig->config['enable_rss'] = true;\n $newconfig->config['advertise'] = true;\n\t\t\t\t\t$newconfig->config['feed_title'] = $feedlist->feed_title;\n\t\t\t\t\t$newconfig->config['feed_desc'] = $feedlist->feed_desc;\n\t\t\t\t\t$newconfig->config['rss_limit'] = isset($feedlist->rss_limit) ? $feedlist->rss_limit : 24;\n\t\t\t\t\t$newconfig->config['rss_cachetime'] = isset($feedlist->rss_cachetime) ? $feedlist->rss_cachetime : 1440;\n\t\t\t\t\t$newconfig->location_data = $loc;\n//\t\t\t\t\t$newconfig->save();\n\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n\t\t\t\tbreak;\n case 'simplepollmodule': // added v2.0.9\n $oldconfig = $old_db->selectObject('simplepollmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if (!empty($oldconfig)) {\n if (!empty($oldconfig->thank_you_message)) {\n $newconfig->config['thank_you_message'] = 'Thank you for voting.';\n }\n if (!empty($oldconfig->already_voted_message)) {\n $newconfig->config['already_voted_message'] = 'You have already voted in this poll.';\n }\n if (!empty($oldconfig->voting_closed_message)) {\n $newconfig->config['voting_closed_message'] = 'Voting has been closed for this poll.';\n }\n if (!empty($oldconfig->anonymous_timeout)) {\n $newconfig->config['anonymous_timeout'] = '5';\n }\n }",
"\t\t\t\t//check to see if it's already pulled in (circumvent !is_original)\n $ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"simplePoll\";\n\t\t\t\tif ($db->countObjects('simplepoll_question', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'simplepollmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"//\t\t\t\t$iloc->mod = 'simplepollmodule';\n $oldquestions = $old_db->selectArrays('poll_question', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($oldquestions) {\n\t\t\t\t\tforeach ($oldquestions as $qi) {\n\t\t\t\t\t\t$oldanswers = $old_db->selectArrays('poll_answer', \"question_id='\".$qi['id'].\"'\");\n\t\t\t\t\t\t$oldblocks = $old_db->selectArrays('poll_timeblock', \"question_id='\".$qi['id'].\"'\");\n\t\t\t\t\t\tunset ($qi['id']);\n $active = $qi['is_active'];\n unset ($qi['is_active']);\n\t\t\t\t\t\t$question = new simplepoll_question($qi);\n\t\t\t\t\t\t$loc = expUnserialize($qi['location_data']);\n\t\t\t\t\t\t$loc->mod = \"simplePoll\";\n $question->active = $active;\n\t\t\t\t\t\tif (empty($question->question)) { $question->question = 'Untitled'; }\n $question->location_data = serialize($loc);\n $question->save();",
" foreach ($oldanswers as $oi) {\n unset (\n $oi['id'],\n $oi['question_id']\n );\n $newanswer = new simplepoll_answer($oi);\n $newanswer->simplepoll_question_id = $question->id;\n// $question->simplepoll_answer[] = $newanswer;\n $newanswer->update();\n }\n// $question->update();",
"\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'navigationmodule': // added v2.0.9\n if (!empty($module->view)) {\n if ($module->view == 'Breadcrumb') {\n @$module->view = 'breadcrumb';\n @$module->action = 'breadcrumb';\n } else {\n @$module->view = 'showall_'.$module->view;\n }\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n\t\t\t\tbreak;\n case 'calendarmodule': // added v2.1.0\n if ($module->view == 'Default') {\n @$module->view = 'showall';\n } elseif ($module->view == 'Upcoming Events - Summary') {\n $module->view = 'showall_Upcoming Events - Headlines';\n } else {\n @$module->view = 'showall_'.$module->view;\n }\n $oldconfig = $old_db->selectObject('calendarmodule_config', \"location_data='\".serialize($iloc).\"'\");\n if (!empty($oldconfig)) {\n if ($oldconfig->enable_ical == 1) {\n $newconfig->config['enable_ical'] = true;\n $newconfig->config['feed_title'] = $oldconfig->feed_title;\n $newconfig->config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;\n $newconfig->config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;\n }\n if (!empty($oldconfig->hidemoduletitle)) {\n $newconfig->config['hidemoduletitle'] = $oldconfig->hidemoduletitle;\n }\n if (!empty($oldconfig->moduledescription)) {\n $newconfig->config['moduledescription'] = $oldconfig->moduledescription;\n }\n if (!empty($oldconfig->aggregate) && $oldconfig->aggregate != 'a:0:{}') {\n $merged = expUnserialize($oldconfig->aggregate);\n foreach ($merged as $merge) {\n $newconfig->config['aggregate'][] = $merge;\n }\n }\n if (!empty($oldconfig->enable_feedback)) {\n $newconfig->config['enable_feedback'] = $oldconfig->enable_feedback;\n }\n if (!empty($oldconfig->email_title_reminder)) {\n $newconfig->config['email_title_reminder'] = $oldconfig->email_title_reminder;\n }\n if (!empty($oldconfig->email_from_reminder)) {\n $newconfig->config['email_from_reminder'] = $oldconfig->email_from_reminder;\n }\n if (!empty($oldconfig->email_address_reminder)) {\n $newconfig->config['email_address_reminder'] = $oldconfig->email_address_reminder;\n }\n if (!empty($oldconfig->email_reply_reminder)) {\n $newconfig->config['email_reply_reminder'] = $oldconfig->email_reply_reminder;\n }\n if (!empty($oldconfig->email_showdetail)) {\n $newconfig->config['email_showdetail'] = $oldconfig->email_showdetail;\n }\n if (!empty($oldconfig->email_signature)) {\n $newconfig->config['email_signature'] = $oldconfig->email_signature;\n }\n if (empty($oldconfig->enable_tags)) {\n $newconfig->config['disabletags'] = true;\n }\n if (!empty($oldconfig->enable_categories)) {\n $newconfig->config['usecategories'] = $oldconfig->enable_categories;\n }",
" // we have to pull in external addresses for reminders\n $addrs = $old_db->selectObjects('calendar_reminder_address',\"calendar_id=\".$oldconfig->id);\n foreach ($addrs as $addr) {\n if (!empty($addr->user_id)) {\n $newconfig->config['users'][] = $addr->user_id;\n } elseif (!empty($addr->group_id)) {\n $newconfig->config['groups'][] = $addr->group_id;\n } elseif (!empty($addr->email)) {\n $newconfig->config['addresses'][] = $addr->email;\n }\n }\n }",
" //check to see if it's already pulled in (circumvent !is_original)\n\t\t\t\t$ploc = clone($iloc);\n\t\t\t\t$ploc->mod = \"event\";\n\t\t\t\tif ($db->countObjects('event', \"location_data='\".serialize($ploc).\"'\")) {\n//\t\t\t\t\t$iloc->mod = 'calendarmodule';\n//\t\t\t\t\t$linked = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"// $iloc->mod = 'calendarmodule';\n // convert each eventdate\n $eds = $old_db->selectObjects('eventdate',\"1\");\n foreach ($eds as $ed) {\n $cloc = expUnserialize($ed->location_data);\n $cloc->mod = 'event';\n $ed->location_data = serialize($cloc);\n $db->insertObject($ed,'eventdate');\n }",
" // convert each calendar to an event\n $cals = $old_db->selectObjects('calendar',\"1\");\n foreach ($cals as $cal) {\n unset($cal->approved);\n $cat = $cal->category_id;\n unset($cal->category_id);\n $tags = $cal->tags;\n unset(\n $cal->tags,\n $cal->file_id\n );\n $loc = expUnserialize($cal->location_data);\n $loc->mod = \"event\";\n $cal->location_data = serialize($loc);\n $cal->created_at = $cal->posted;\n unset($cal->posted);\n $cal->edited_at = $cal->edited;\n unset($cal->edited);\n $db->insertObject($cal,'event');",
" $ev = new event($cal->id);\n $ev->save();\n if (!empty($oldconfig->enable_tags)) {\n $params = null;;\n $oldtags = expUnserialize($tags);\n if (!empty($oldtags)) {\n foreach ($oldtags as $oldtag){\n $tagtitle = strtolower(trim($old_db->selectValue('tags','name','id = '.$oldtag)));\n $tag = new expTag($tagtitle);\n//\t\t\t\t\t\t\t\t$tag->title = $old_db->selectValue('tags','name','id = '.$oldtag);\n if (empty($tag->id))\n $tag->update(array('title'=>$tagtitle));\n $params['expTag'][] = $tag->id;\n }\n }\n $ev->update($params);\n }\n if (!empty($oldconfig->enable_categories) && $cat) {\n $params = null;\n $oldcat = $old_db->selectObject('category','id = '.$cat);\n $cat = new expCat($oldcat->name);\n if (empty($cat->id)) {\n $cat->title = $oldcat->name;\n $cat->color = $oldcat->color;\n $catloc = expUnserialize($oldcat->location_data);\n if (array_key_exists($catloc->mod, $this->new_modules)) {\n $mod = expModules::getModuleName($this->new_modules[$catloc->mod]);\n $cat->module = $mod;\n }\n $cat->save();\n $cat->rank = $oldcat->rank +1;\n $cat->update();\n }\n $params['expCat'][] = $cat->id;\n $ev->update($params);\n }\n }\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n break;\n case 'contactmodule': // v2.1.1 now converted to a forms 2.0 module\n\t\t\t\t$module->view = \"enterdata\";\n $module->action = \"enterdata\";",
"// $iloc->mod = 'contactmodule';\n $contactform = $old_db->selectObject('contactmodule_config', \"location_data='\".serialize($iloc).\"'\");\n\t\t\t\tif ($contactform) {\n // for forms 2.0 we create a site form (form & report consolidated)\n $newform = new forms();\n $newform->title = 'Contact Form';\n $newform->is_saved = false;\n $newform->table_name = '';\n $newform->description = '';\n $newform->response = $contactform->final_message;\n $newform->update();",
" // now add the controls to the site form\n\t\t\t\t\t$control = new stdClass();\n\t\t\t\t\t$control->name = 'name';\n\t\t\t\t\t$control->caption = 'Your Name';\n\t\t\t\t\t$control->forms_id = $newform->id;\n\t\t\t\t\t$control->data = 'O:11:\"textcontrol\":14:{s:4:\"size\";i:0;s:9:\"maxlength\";i:0;s:7:\"caption\";s:9:\"Your Name\";s:11:\"placeholder\";s:8:\"John Doe\";s:9:\"accesskey\";s:0:\"\";s:7:\"default\";s:0:\"\";s:8:\"disabled\";b:0;s:8:\"required\";b:1;s:8:\"tabindex\";i:-1;s:7:\"inError\";i:0;s:4:\"type\";s:4:\"text\";s:6:\"filter\";s:0:\"\";s:10:\"identifier\";s:4:\"name\";s:11:\"description\";s:22:\"Please enter your name\";}';\n\t\t\t\t\t$control->rank = 1;\n\t\t\t\t\t$control->is_readonly = 0;\n\t\t\t\t\t$control->is_static = 0;\n\t\t\t\t\t$db->insertObject($control, 'forms_control');\n\t\t\t\t\t$control->name = 'email';\n\t\t\t\t\t$control->caption = 'Your Email';\n\t\t\t\t\t$control->data = 'O:11:\"textcontrol\":14:{s:4:\"size\";i:0;s:9:\"maxlength\";i:0;s:7:\"caption\";s:10:\"Your Email\";s:11:\"placeholder\";s:18:\"johndoe@mailer.org\";s:9:\"accesskey\";s:0:\"\";s:7:\"default\";s:0:\"\";s:8:\"disabled\";b:0;s:8:\"required\";b:1;s:8:\"tabindex\";i:-1;s:7:\"inError\";i:0;s:4:\"type\";s:4:\"text\";s:6:\"filter\";s:0:\"\";s:10:\"identifier\";s:5:\"email\";s:11:\"description\";s:31:\"Please enter your email address\";}';\n\t\t\t\t\t$control->rank = 2;\n\t\t\t\t\t$db->insertObject($control, 'forms_control');\n\t\t\t\t\t$control->name = 'subject';\n\t\t\t\t\t$control->caption = 'Subject';\n\t\t\t\t\t$control->data = 'O:11:\"textcontrol\":14:{s:4:\"size\";i:0;s:9:\"maxlength\";i:0;s:7:\"caption\";s:7:\"Subject\";s:11:\"placeholder\";s:22:\"Subject line for email\";s:9:\"accesskey\";s:0:\"\";s:7:\"default\";s:0:\"\";s:8:\"disabled\";b:0;s:8:\"required\";b:1;s:8:\"tabindex\";i:-1;s:7:\"inError\";i:0;s:4:\"type\";s:4:\"text\";s:6:\"filter\";s:0:\"\";s:10:\"identifier\";s:7:\"subject\";s:11:\"description\";s:21:\"Enter a quick summary\";}';\n\t\t\t\t\t$control->rank = 3;\n\t\t\t\t\t$db->insertObject($control, 'forms_control');\n\t\t\t\t\t$control->name = 'message';\n\t\t\t\t\t$control->caption = 'Message';\n\t\t\t\t\t$control->data = 'O:17:\"texteditorcontrol\":13:{s:4:\"cols\";i:60;s:4:\"rows\";i:8;s:9:\"accesskey\";s:0:\"\";s:7:\"default\";s:0:\"\";s:8:\"disabled\";b:0;s:8:\"required\";b:0;s:8:\"tabindex\";i:-1;s:7:\"inError\";i:0;s:4:\"type\";s:4:\"text\";s:8:\"maxchars\";i:0;s:10:\"identifier\";s:7:\"message\";s:7:\"caption\";s:7:\"Message\";s:11:\"description\";s:33:\"Enter the content of your message\";}';\n\t\t\t\t\t$control->rank = 4;\n\t\t\t\t\t$db->insertObject($control, 'forms_control');",
" // and then an expConfig to link to that site form with config settings\n $newconfig->config['forms_id'] = $newform->id;\n $newconfig->config['title'] = 'Send us an e-mail';\n $newconfig->config['description'] = '';\n $newconfig->config['is_email'] = true;\n if (!empty($contactform->subject)) {\n $newconfig->config['report_name'] = $contactform->subject;\n $newconfig->config['subject'] = $contactform->subject;\n }\n if (!empty($contactform->final_message)) $newconfig->config['response'] = $contactform->final_message;\n $newconfig->config['submitbtn'] = 'Send Message';\n $newconfig->config['resetbtn'] = 'Reset';",
" // we have to pull in addresses for emails\n $addrs = $old_db->selectObjects('contact_contact', \"location_data='\".serialize($iloc).\"'\");\n foreach ($addrs as $addr) {\n if (!empty($addr->user_id)) {\n $newconfig->config['user_list'][] = $addr->user_id;\n } elseif (!empty($addr->email)) {\n $newconfig->config['address_list'][] = $addr->email;\n }\n }",
"\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n\t\t\t\t}\n\t\t\t\tbreak;\n case 'formmodule': // convert to forms module\n $module->view = \"enterdata\";\n $module->action = \"enterdata\";",
" // new form update\n $oldform = $old_db->selectObject('formbuilder_form', \"location_data='\".serialize($iloc).\"'\");\n $oldreport = $old_db->selectObject('formbuilder_report', \"location_data='\".serialize($iloc).\"'\");",
" if (!empty($oldform->id)) {\n $newform = new forms();\n $newform->title = $oldform->name;\n $newform->is_saved = $oldform->is_saved;\n $newform->table_name = $oldform->table_name;\n if (empty($newform->title) && !empty($newform->table_name)) $newform->title = implode(' ',explode('_',$newform->table_name));\n $newform->description = $oldform->description;\n $newform->response = $oldform->response;\n $newform->report_name = $oldreport->name;\n $newform->report_desc = $oldreport->description;\n $newform->report_def = $oldreport->text;\n $newform->column_names_list = $oldreport->column_names;\n $newform->update();",
" // copy & convert each formbuilder_control to a forms_control\n $fcs = $old_db->selectObjects('formbuilder_control',\"form_id=\".$oldform->id);\n foreach ($fcs as $fc) {\n $fc->forms_id = $newform->id;\n unset (\n $fc->id,\n $fc->form_id\n );\n $db->insertObject($fc,'forms_control');\n }",
" // import form saved data\n if ($oldform->is_saved) {\n $newform->updateTable(); // creates the table in database\n $records = $old_db->selectObjects('formbuilder_'.$oldform->table_name, 1);\n foreach($records as $record) {\n //FIXME do we want to add a forms_id field?\n// $db->insertObject($record, 'forms_'.$oldform->table_name);\n $oldform->insertRecord($record);\n }\n }",
" // convert the form & report configs to an expConfig object for this module\n $newconfig = new expConfig();\n $newconfig->config['forms_id'] = $newform->id;\n if (!empty($oldform->name)) $newconfig->config['title'] = $oldform->name;\n if (!empty($oldform->description)) $newconfig->config['description'] = $oldform->description;\n if (!empty($oldform->response)) $newconfig->config['response'] = $oldform->response;\n if (!empty($oldform->is_email)) $newconfig->config['is_email'] = $oldform->is_email;\n if (!empty($oldform->select_email)) $newconfig->config['select_email'] = $oldform->select_email;\n if (!empty($oldform->submitbtn)) $newconfig->config['submitbtn'] = $oldform->submitbtn;\n if (!empty($oldform->resetbtn)) $newconfig->config['resetbtn'] = $oldform->resetbtn;\n if (!empty($oldform->style)) $newconfig->config['style'] = $oldform->style;\n if (!empty($oldform->subject)) $newconfig->config['subject'] = $oldform->subject;\n if (!empty($oldform->is_auto_respond)) $newconfig->config['is_auto_respond'] = $oldform->is_auto_respond;\n if (!empty($oldform->auto_respond_subject)) $newconfig->config['auto_respond_subject'] = $oldform->auto_respond_subject;\n if (!empty($oldform->auto_respond_body)) $newconfig->config['auto_respond_body'] = $oldform->auto_respond_body;\n if (!empty($oldreport->name)) $newconfig->config['report_name'] = $oldreport->name;\n if (!empty($oldreport->description)) $newconfig->config['report_desc'] = $oldreport->description;\n if (!empty($oldreport->text)) $newconfig->config['report_def'] = $oldreport->text;\n if (!empty($oldreport->column_names)) $newconfig->config['column_names_list'] = explode('|!|',$oldreport->column_names);",
" // we have to pull in addresses for emails\n $addrs = $old_db->selectObjects('formbuilder_address',\"form_id=\".$oldform->id);\n foreach ($addrs as $addr) {\n if (!empty($addr->user_id)) {\n $newconfig->config['user_list'][] = $addr->user_id;\n } elseif (!empty($addr->group_id)) {\n $newconfig->config['group_list'][] = $addr->group_id;\n } elseif (!empty($addr->email)) {\n $newconfig->config['address_list'][] = $addr->email;\n }\n }",
" // now save/attach the expConfig\n if ($newconfig->config != null) {\n $newconfig->location_data = expCore::makeLocation($this->new_modules[$iloc->mod],$iloc->src);\n }\n }",
" @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n break;\n case 'containermodule':\n if (!$hc) {\n $module->action = 'showall';\n if ($module->view == 'Default') {\n @$module->view = 'showall';\n } else {\n @$module->view = 'showall_'.$module->view;\n }\n @$this->msg['migrated'][$iloc->mod]['count']++;\n @$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];\n }\n\t\t\t\tbreak;\n default:\n @$this->msg['noconverter'][$iloc->mod]++;\n\t\t\t\tbreak;\n\t\t}\n // quick check for non hard coded modules\n // We add a container if they're not hard coded.\n (!$hc) ? $this->add_container($iloc,$module,$linked,$newconfig) : \"\";",
" return $module;\n }",
"//\t/**\n//\t * pull over extra/related data required for old school modules\n//\t * @var \\mysqli_database $db the exponent database object\n//\t * @param $iloc\n//\t * @param $module\n//\t * @return bool\n//\t */\n// private function pulldata($iloc, $module) {\n// global $db;\n// $old_db = $this->connect();\n//\t\t$linked = false;\n// if ((!empty($module->is_existing) && $module->is_existing)) {\n// $linked = true;\n// }\n//\n// switch ($iloc->mod) {\n//// case 'calendarmodule':\n////\t\t\t\tif ($db->countObjects('calendar', \"location_data='\".serialize($iloc).\"'\")) {\n////\t\t\t\t\t$linked = true;\n////\t\t\t\t\tbreak;\n////\t\t\t\t}\n//// $events = $old_db->selectObjects('eventdate', \"location_data='\".serialize($iloc).\"'\");\n//// foreach($events as $event) {\n//// $res = $db->insertObject($event, 'eventdate');\n////\t\t\t\t\tif ($res) { @$this->msg['migrated'][$iloc->mod]['count']++; }\n//// }\n//// $cals = $old_db->selectObjects('calendar', \"location_data='\".serialize($iloc).\"'\");\n//// foreach($cals as $cal) {\n//// unset($cal->allow_registration);\n//// unset($cal->registration_limit);\n//// unset($cal->registration_allow_multiple);\n//// unset($cal->registration_cutoff);\n//// unset($cal->registration_price);\n//// unset($cal->registration_count);\n//// $db->insertObject($cal, 'calendar');\n//// }\n//// $configs = $old_db->selectObjects('calendarmodule_config', \"location_data='\".serialize($iloc).\"'\");\n//// foreach ($configs as $config) {\n//// $reminders = $old_db->selectObjects('calendar_reminder_address', \"calendar_id='\".$config->id.\"'\");\n////\t\t\t\t\t$config->id = '';\n////\t\t\t\t\t$config->enable_categories = 0;\n////\t\t\t\t\t$config->enable_tags = 0;\n//// $db->insertObject($config, 'calendarmodule_config');\n//// foreach($reminders as $reminder) {\n//// $reminder->calendar_id = $config->id;\n//// $db->insertObject($reminder, 'calendar_reminder_address');\n//// }\n//// }\n////\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $iloc->mod;\n////\t\t\t\tbreak;\n//// case 'simplepollmodule':\n////\t\t\t\tif ($db->countObjects('poll_question', \"location_data='\".serialize($iloc).\"'\")) {\n////\t\t\t\t\tbreak;\n////\t\t\t\t}\n//// $questions = $old_db->selectObjects('poll_question', \"location_data='\".serialize($iloc).\"'\");\n//// foreach($questions as $question) {\n//// $db->insertObject($question, 'poll_question');\n////\t\t\t\t\t$answers = $old_db->selectObjects('poll_answer', \"question_id='\".$question->id.\"'\");\n////\t\t\t\t\tforeach($answers as $answer) {\n////\t\t\t\t\t\t$db->insertObject($answer, 'poll_answer');\n////\t\t\t\t\t}\n////\t\t\t\t\t$timeblocks = $old_db->selectObjects('poll_timeblock', \"question_id='\".$question->id.\"'\");\n////\t\t\t\t\tforeach($timeblocks as $timeblock) {\n////\t\t\t\t\t\t$db->insertObject($timeblock, 'poll_timeblock');\n////\t\t\t\t\t}\n////\t\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n//// }\n//// $configs = $old_db->selectObjects('simplepollmodule_config', \"location_data='\".serialize($iloc).\"'\");\n//// foreach ($configs as $config) {\n//// $db->insertObject($config, 'simplepollmodule_config');\n//// }\n////\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $iloc->mod;\n////\t\t\t\tbreak;\n//// case 'formmodule':\n////\t\t\t\tif ($db->countObjects('formbuilder_form', \"location_data='\".serialize($iloc).\"'\")) {\n////\t\t\t\t\tbreak;\n////\t\t\t\t}\n//// $form = $old_db->selectObject('formbuilder_form', \"location_data='\".serialize($iloc).\"'\");\n////\t\t\t\t$oldformid = $form->id;\n////\t\t\t\tunset($form->id);\n//// $form->id = $db->insertObject($form, 'formbuilder_form');\n////\t\t\t\t@$this->msg['migrated'][$iloc->mod]['count']++;\n////\t\t\t\t$addresses = $old_db->selectObjects('formbuilder_address', \"form_id='\".$oldformid.\"'\");\n//// foreach($addresses as $address) {\n////\t\t\t\t\tunset($address->id);\n////\t\t\t\t\t$address->form_id = $form->id;\n//// $db->insertObject($address, 'formbuilder_address');\n////\t\t\t\t}\n////\t\t\t\t$controls = $old_db->selectObjects('formbuilder_control', \"form_id='\".$oldformid.\"'\");\n//// foreach($controls as $control) {\n////\t\t\t\t\tunset($control->id);\n////\t\t\t\t\t$control->form_id = $form->id;\n//// $db->insertObject($control, 'formbuilder_control');\n////\t\t\t\t}\n////\t\t\t\t$reports = $old_db->selectObjects('formbuilder_report', \"form_id='\".$oldformid.\"'\");\n//// foreach($reports as $report) {\n////\t\t\t\t\tunset($report->id);\n////\t\t\t\t\t$report->form_id = $form->id;\n//// $db->insertObject($report, 'formbuilder_report');\n////\t\t\t\t}\n////\t\t\t\tif (isset($form->table_name)) {\n////\t\t\t\t\tif (isset($this->params['wipe_content'])) {\n////\t\t\t\t\t\t$db->delete('formbuilder_'.$form->table_name);\n////\t\t\t\t\t}\n////\t\t\t\t\tformbuilder_form::updateTable($form);\n////\t\t\t\t\t$records = $old_db->selectObjects('formbuilder_'.$form->table_name, 1);\n////\t\t\t\t\tforeach($records as $record) {\n////\t\t\t\t\t\t$db->insertObject($record, 'formbuilder_'.$form->table_name);\n////\t\t\t\t\t}\n////\t\t\t\t}\n////\t\t\t\t@$this->msg['migrated'][$iloc->mod]['name'] = $iloc->mod;\n////\t\t\t\tbreak;\n// }\n// return $linked;\n// }",
" /**\n * used to create containers, expConfigs, and expRss for new modules\n * @param $iloc\n * @param $m\n * @param bool $linked\n * @param $newconfig\n * @var \\mysqli_database $db the exponent database object\n * @return void\n */\n\tprivate function add_container($iloc,$m,$linked=false,$newconfig) {\n// global $db;",
" // first the container\n// $old_db = $this->connect();\n// $section = $old_db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"' AND is_original='0'\");\n// unset($m->id);\n// $oldext = expUnserialize($m->external);\n// $m->external = serialize(expCore::makeLocation('container',$oldext->src));\n////\t\tif ($iloc->mod != 'contactmodule') {\n//\t\t\t$iloc->mod = $this->new_modules[$iloc->mod];\n////\t\t\t$m->internal = (isset($m->internal) && strstr($m->internal,\"Controller\")) ? $m->internal : serialize($iloc);\n// $m->internal = serialize($iloc);\n//\t\t\t$m->action = isset($m->action) ? $m->action : 'showall';\n//\t\t\t$m->view = isset($m->view) ? $m->view : 'showall';\n//\t\t\tif ($m->view == \"Default\") {\n//\t\t\t\t$m->view = 'showall';\n//\t\t\t}\n//\t\t} else { // must be an old school contactmodule\n//\t\t\t$iloc->mod = $this->new_modules[$iloc->mod];\n//\t\t\t$m->internal = serialize($iloc);\n//\t\t}",
" $params = get_object_vars($m);\n unset($params['id']);\n $old_db = $this->connect();\n $section = $old_db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"' AND is_original='0'\");\n $params['current_section'] = empty($section->section) ? 1 : $section->section;\n $oldext = expUnserialize($params['external']);\n $params['external'] = serialize(expCore::makeLocation('container',$oldext->src));\n $iloc->mod = $this->new_modules[$iloc->mod];\n $params['modcntrol'] = $iloc->mod;\n $params['internal'] = serialize($iloc);\n $params['rank'] = $params['rank']+1;\n $params['action'] = !empty($params['action']) ? $params['action'] : 'showall';\n $params['view'] = !empty($params['view']) ? $params['view'] : 'showall';\n if ($params['view'] == \"Default\") {\n $params['view'] = 'showall';\n }",
" $m = new container();\n if (!$linked) {\n $params['existing_source'] = $iloc->src;\n }\n $m->update($params);\n\t\tif ($linked) {\n//\t\t\t$newmodule['i_mod'] = $iloc->mod;\n//\t\t\t$newmodule['modcntrol'] = $iloc->mod;\n//\t\t\t$newmodule['rank'] = $m->rank;\n//\t\t\t$newmodule['views'] = $m->view;\n//\t\t\t$newmodule['title'] = $m->title;\n//\t\t\t$newmodule['actions'] = $m->action;\n//\t\t\t$_POST['current_section'] = empty($section->section) ? 1 : $section->section;\n//\t\t\t$m = container::update($newmodule,$m,expUnserialize($m->external));\n// $params = array();\n// $params['rank'] = $newmod['rank'];\n// $params['view'] = $newmod['view'];\n// $params['title'] = $newmod['title'];\n// $params['action'] = $newmod['action'];\n// $params['is_private'] = $newmod['is_private'];\n $newconfig->config['aggregate'][] = $iloc->src;\n if ($iloc->mod == 'blog') {\n $newconfig->config['add_source'] = 1; // we need to make our blog aggregation discrete\n }\n }\n// $db->insertObject($m, 'container');",
" // now save the expConfig\n if (!empty($newconfig->config['enable_rss']) && $newconfig->config['enable_rss'] == true) {\n $newrss = new expRss();\n $newrss->enable_rss = $newconfig->config['enable_rss'];\n $newrss->advertise = $newconfig->config['enable_rss'];\n $newrss->title = $newconfig->config['feed_title'];\n// $newrss->sef_url = expCore::makeSefUrl($newrss->title,'expRss');\n\t\t\t$newrss->sef_url = $this->makeSefUrl($newrss->title);\n $newrss->feed_desc = $newconfig->config['feed_desc'];\n $newrss->rss_limit = $newconfig->config['rss_limit'];\n $newrss->rss_cachetime = $newconfig->config['rss_cachetime'];\n }\n if ($newconfig->config != null) {\n// $newmodinternal = expUnserialize($m->internal);\n// $newmod = expModules::getModuleName($newmodinternal->mod);\n// $newmodinternal->mod = $newmod;\n $newconfig->location_data = expUnserialize($m->internal);\n $newconfig->save();\n }",
" // and save the expRss table\n if (!empty($newrss->enable_rss)) {\n $newmodinternal = expUnserialize($m->internal);\n $newrss->module = $newmodinternal->mod;\n $newrss->src = $newmodinternal->src;\n $newrss->save();\n }\n }",
"\t/**\n\t * module customized function to circumvent going to previous page\n\t * @return void\n\t */\n\tfunction saveconfig() {\n \n // unset some unneeded params\n unset(\n $this->params['module'],\n $this->params['controller'],\n $this->params['src'],\n $this->params['int'],\n $this->params['id'],\n $this->params['action'],\n $this->params['PHPSESSID'],\n $this->params['__utma'],\n $this->params['__utmb'],\n $this->params['__utmc'],\n $this->params['__utmz'],\n $this->params['__utmt'],\n $this->params['__utmli'],\n $this->params['__cfduid']\n );\n \n // setup and save the config\n $config = new expConfig($this->loc);\n $config->update(array('config'=>$this->params));\n\t\t// update our object config\n\t\t$this->config = expUnserialize($config->config);\n// flash('message', 'Migration Configuration Saved');\n// expHistory::back();\n $this->connect(); // now make sure the parameters work",
"\t\tif (isset($this->params['fix_database'])) $this->fix_database();\n //NOTE we need to push the button.css file to head for coolwater theme?\n expCSS::pushToHead(array(\n// \t\t \"unique\"=>\"button\",\n \t\t \"corecss\"=>\"button\",\n \t\t ));\n\t\techo '<h2>'.gt('Migration Configuration Saved').'</h2><br />';\n\t\techo '<p>'.gt('We\\'ve successfully connected to the Old database').'</p><br />';\n if (bs()) {\n $btn_class = 'btn btn-default';\n } else {\n $btn_class = \"awesome \" . BTN_SIZE . \" \" . BTN_COLOR;\n };\n\t\techo \"<a class=\\\"\".$btn_class.\"\\\" href=\\\"\".expCore::makeLink(array('controller'=>'migration','action'=>'manage_users')).\"\\\">\".gt('Next Step -> Migrate Users & Groups').\"</a>\";\n }\n\t\n\t/**\n\t * connect to old site's database\n\t *\n\t * @return mysqli_database\n\t */\n private function connect() {\n // check for required info...then make the DB connection.\n if (\n empty($this->config['username']) ||\n empty($this->config['password']) ||\n empty($this->config['database']) ||\n empty($this->config['server']) ||\n empty($this->config['prefix']) ||\n empty($this->config['port'])\n ) {\n flash('error', gt('You are missing some required database connection information. Please enter DB information.'));\n redirect_to (array('controller'=>'migration', 'action'=>'configure'));\n// $this->configure();\n }",
" $database = expDatabase::connect($this->config['username'],$this->config['password'],$this->config['server'].':'.$this->config['port'],$this->config['database']);",
" if (empty($database->havedb)) {\n flash('error', gt('An error was encountered trying to connect to the database you specified. Please check your DB config.'));\n redirect_to (array('controller'=>'migration', 'action'=>'configure'));\n// $this->configure();\n }",
" $database->prefix = $this->config['prefix']. '_';;\n return $database;\n }",
"\t/**\n\t * several things that may clear up problems in the old database and do a better job of migrating data\n\t * @return void\n\t */\n\tprivate function fix_database() {\n\t\t// let's test the connection\n\t\t$old_db = $this->connect();\n\t\t\n\t\tprint_r(\"<h2>\".gt('We\\'re connected to the Old Database!').\"</h2><br><br><h3>\".gt('Running several checks and fixes on the old database').\"<br>\".gt('to enhance Migration.').\"</h3><br>\");",
"\t\tprint_r(\"<pre>\");\n\t// upgrade sectionref's that have lost their originals\n\t\tprint_r(\"<strong>\".gt('Searching for sectionrefs that have lost their originals').\"</strong><br><br>\");\n\t\t$sectionrefs = $old_db->selectObjects('sectionref',\"is_original=0\");\n\t\tprint_r(\"Found: \".count($sectionrefs).\" copies (not originals)<br>\");\n\t\tforeach ($sectionrefs as $sectionref) {\n\t\t\tif ($old_db->selectObject('sectionref',\"module='\".$sectionref->module.\"' AND source='\".$sectionref->source.\"' AND is_original='1'\") == null) {\n\t\t\t// There is no original for this sectionref so change it to the original\n//\t\t\t\t$sectionref->is_original = 1;\n\t\t\t\t$old_db->updateObject($sectionref,\"sectionref\");\n\t\t\t\tprint_r(\"Fixed: \".$sectionref->module.\" - \".$sectionref->source.\"<br>\");\n\t\t\t}\n\t\t}\n\t\tprint_r(\"</pre>\");\n\t\n\t\tprint_r(\"<pre>\");\n\t// upgrade sectionref's that point to missing sections (pages)\n\t\tprint_r(\"<strong>\".gt('Searching for sectionrefs pointing to missing sections/pages').\" <br>\".gt('to fix for the Recycle Bin').\"</strong><br><br>\");\n\t\t$sectionrefs = $old_db->selectObjects('sectionref',\"refcount!=0\");\n\t\tforeach ($sectionrefs as $sectionref) {\n\t\t\tif ($old_db->selectObject('section',\"id='\".$sectionref->section.\"'\") == null) {\n\t\t\t// There is no section/page for sectionref so change the refcount\n\t\t\t\t$sectionref->refcount = 0;\n\t\t\t\t$old_db->updateObject($sectionref,\"sectionref\");\n\t\t\t\tprint_r(\"Fixed: \".$sectionref->module.\" - \".$sectionref->source.\"<br>\");\n\t\t\t}\n\t\t}\n\t\tprint_r(\"</pre>\");",
"\t}",
"\t/**\n\t * Take an old school permission and convert it to a newmodule permission\n\t *\n\t * @param $item\n\t * @return mixed\n\t */\n\tprivate function convert_permission($item) {\n\t\tif ($item == null) return null;\n\t\tswitch ($item->permission) {\n\t\t case 'administrate':\n\t\t\t $item->permission = 'manage';\n\t\t\t\tbreak;\n\t\t\tcase 'post':\n\t\t\tcase 'create_slide':\n\t\t\tcase 'add':\n\t\t\tcase 'add_item':\n case 'add_module':\n\t\t\t\t$item->permission = 'create';\n\t\t\t\tbreak;\n\t\t\tcase 'edit_item':\n\t\t\tcase 'edit_slide':\n case 'edit_module':\n\t\t\t\t$item->permission = 'edit';\n\t\t\t\tbreak;\n\t\t\tcase 'delete_item':\n\t\t\tcase 'delete_slide':\n case 'delete_module':\n\t\t\t\t$item->permission = 'delete';\n\t\t\t\tbreak;\n\t\t\tcase 'order':\n\t\t\tcase 'import':\n case 'orders_modules':\n\t\t\t\t$item->permission = 'configure';\n\t\t\t\tbreak;\n\t\t\tcase 'view_unpublished':\n\t\t\t\t$item->permission = 'show_unpublished';\n\t\t\t\tbreak;\n case 'approve_comments':\n $item->permission = 'approve';\n break;\n\t\t\tcase 'manage_categories':\n\t\t\tcase 'manage_approval':\n\t\t\tcase 'approve':\n\t\t\tcase 'can_download':\n\t\t\tcase 'comment':\n\t\t\tcase 'edit_comments':\n\t\t\tcase 'delete_comments':\n\t\t\tcase 'view_private':\n $item = null;\n\t\t\t\tbreak;\n\t\t\tcase 'create':\n\t\t\tcase 'configure':\n\t\t\tcase 'delete':\n\t\t\tcase 'edit':\n\t\t\tcase 'manage':\n\t\t\tcase 'spider':\n\t\t\tcase 'view':\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $item;\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\r\n\r\n##################################################\r\n#\r\n# Copyright (c) 2004-2016 OIC Group, Inc.\r\n#\r\n# This file is part of Exponent\r\n#\r\n# Exponent is free software; you can redistribute\r\n# it and/or modify it under the terms of the GNU\r\n# General Public License as published by the Free\r\n# Software Foundation; either version 2 of the\r\n# License, or (at your option) any later version.\r\n#\r\n# GPL: http://www.gnu.org/licenses/gpl.txt\r\n#\r\n##################################################\r\n/**\r\n * @subpackage Controllers\r\n * @package Modules\r\n */\r\nclass navigationController extends expController {\r\n public $basemodel_name = 'section';\r\n public $useractions = array(\r\n 'showall' => 'Show Navigation',\r\n 'breadcrumb' => 'Breadcrumb',\r\n );\r\n public $remove_configs = array(\r\n 'aggregation',\r\n 'categories',\r\n 'comments',\r\n 'ealerts',\r\n 'facebook',\r\n 'files',\r\n 'pagination',\r\n 'rss',\r\n 'tags',\r\n 'twitter',\r\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)\r\n protected $add_permissions = array(\r\n 'view' => \"View Page\"\r\n );\r\n protected $remove_permissions = array(\r\n// 'configure',\r\n// 'create',\r\n// 'delete',\r\n// 'edit'\r\n );\r\n\r\n static function displayname() { return gt(\"Navigation\"); }\r\n\r\n static function description() { return gt(\"Places navigation links/menus on the page.\"); }\r\n\r\n static function isSearchable() { return true; }\r\n\r\n function searchName() { return gt('Webpage'); }\r\n\r\n /**\r\n * @param null $src\r\n * @param array $params\r\n *\r\n */\r\n function __construct($src = null, $params = array())\r\n {\r\n parent::__construct($src, $params);\r\n if (!empty($params['id'])) // we normally throw out the $loc->int EXCEPT with navigation pages\r\n $this->loc = expCore::makeLocation($this->baseclassname, $src, $params['id']);\r\n }\r\n\r\n public function showall() {\r\n global $user, $sectionObj, $sections;\r\n\r\n expHistory::set('viewable', $this->params);\r\n $id = $sectionObj->id;\r\n $current = null;\r\n // all we need to do is determine the current section\r\n $navsections = $sections;\r\n if ($sectionObj->parent == -1) {\r\n $current = $sectionObj;\r\n } else {\r\n foreach ($navsections as $section) {\r\n if ($section->id == $id) {\r\n $current = $section;\r\n break;\r\n }\r\n }\r\n }\r\n assign_to_template(array(\r\n 'sections' => $navsections,\r\n 'current' => $current,\r\n 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),\r\n ));\r\n }\r\n\r\n public function breadcrumb() {\r\n global $sectionObj;\r\n\r\n expHistory::set('viewable', $this->params);\r\n $id = $sectionObj->id;\r\n $current = null;\r\n // Show not only the location of a page in the hierarchy but also the location of a standalone page\r\n $current = new section($id);\r\n if ($current->parent == -1) { // standalone page\r\n $navsections = section::levelTemplate(-1, 0);\r\n foreach ($navsections as $section) {\r\n if ($section->id == $id) {\r\n $current = $section;\r\n break;\r\n }\r\n }\r\n } else {\r\n $navsections = section::levelTemplate(0, 0);\r\n foreach ($navsections as $section) {\r\n if ($section->id == $id) {\r\n $current = $section;\r\n break;\r\n }\r\n }\r\n }\r\n assign_to_template(array(\r\n 'sections' => $navsections,\r\n 'current' => $current,\r\n ));\r\n }\r\n\r\n /**\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function navhierarchy($notyui=false) {\r\n global $sections;\r\n\r\n $json_array = array();\r\n for ($i = 0, $iMax = count($sections); $i < $iMax; $i++) {\r\n if ($sections[$i]->depth == 0) {\r\n $obj = new stdClass();\r\n// \t\t\t\t$obj->id = $sections[$i]->name.$sections[$i]->id;\r\n $obj->id = $sections[$i]->id;\r\n $obj->text = $sections[$i]->name;\r\n $obj->title = $sections[$i]->page_title;\r\n $obj->description = $sections[$i]->description;\r\n $obj->new_window = $sections[$i]->new_window;\r\n $obj->expFile = $sections[$i]->expFile;\r\n $obj->glyph = $sections[$i]->glyph;\r\n $obj->glyph_only = $sections[$i]->glyph_only;\r\n $obj->type = $sections[$i]->alias_type;\r\n if ($sections[$i]->active == 1) {\r\n $obj->url = $sections[$i]->link;\r\n if ($obj->type == 1 && substr($obj->url, 0, 4) != 'http') {\r\n $obj->url = 'http://' . $obj->url;\r\n }\r\n } else {\r\n $obj->url = \"#\";\r\n $obj->onclick = \"onclick: { fn: return false }\";\r\n }\r\n if ($obj->type == 3) { // mostly a hack instead of adding more table fields\r\n $obj->width = $sections[$i]->internal_id;\r\n $obj->class = $sections[$i]->external_link;\r\n }\r\n /*if ($sections[$i]->active == 1) {\r\n $obj->disabled = false;\r\n } else {\r\n $obj->disabled = true;\r\n }*/\r\n //$obj->disabled = true;\r\n $obj->itemdata = self::getChildren($i,$notyui);\r\n $obj->maxitems = count($obj->itemdata);\r\n $obj->maxdepth = 0;\r\n foreach ($obj->itemdata as $menu) {\r\n if ($menu->maxdepth > $obj->maxdepth) $obj->maxdepth = $menu->maxdepth;\r\n }\r\n }\r\n $json_array[] = $obj;\r\n }\r\n return $json_array;\r\n }\r\n\r\n /**\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function navtojson() {\r\n return json_encode(self::navhierarchy());\r\n }\r\n\r\n /**\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function getChildren(&$i, $notyui=false) {\r\n global $sections;\r\n\r\n //\t\techo \"i=\".$i.\"<br>\";\r\n if ($i + 1 == count($sections)) { // last entry\r\n return array();\r\n } elseif ($sections[$i]->depth == $sections[$i + 1]->depth) {\r\n return array();\r\n } else {\r\n $ret_depth = $sections[$i]->depth;\r\n $i++;\r\n $ret_array = array();\r\n for ($iMax = count($sections); $i < $iMax; $i++) {\r\n // start setting up the objects to return\r\n $obj = new stdClass();\r\n $obj->id = $sections[$i]->id;\r\n $obj->text = $sections[$i]->name;\r\n $obj->title = $sections[$i]->page_title;\r\n $obj->description = $sections[$i]->description;\r\n $obj->new_window = $sections[$i]->new_window;\r\n $obj->expFile = $sections[$i]->expFile;\r\n $obj->glyph = $sections[$i]->glyph;\r\n $obj->glyph_only = $sections[$i]->glyph_only;\r\n $obj->depth = $sections[$i]->depth;\r\n if ($sections[$i]->active == 1) {\r\n $obj->url = $sections[$i]->link;\r\n if ($sections[$i]->alias_type == 1 && substr($obj->url, 0, 4) != 'http') {\r\n $obj->url = 'http://' . $obj->url;\r\n }\r\n } else {\r\n $obj->url = \"#\";\r\n $obj->onclick = \"onclick: { fn: return false }\";\r\n }\r\n //echo \"i=\".$i.\"<br>\";\r\n if (self::hasChildren($i)) {\r\n if ($notyui) {\r\n $obj->itemdata = self::getChildren($i,$notyui);\r\n $obj->maxitems = count($obj->itemdata);\r\n $obj->maxdepth = 0;\r\n foreach ($obj->itemdata as $menu) {\r\n if (!empty($menu->maxdepth)) {\r\n if ($menu->maxdepth > $obj->maxdepth) $obj->maxdepth = $menu->maxdepth;\r\n } else {\r\n if ($menu->depth > $obj->maxdepth) $obj->maxdepth = $menu->depth;\r\n }\r\n }\r\n } else {\r\n $obj->submenu = new stdClass();\r\n $obj->submenu->id = $sections[$i]->name . $sections[$i]->id;\r\n //echo \"getting children of \".$sections[$i]->name;\r\n $obj->submenu->itemdata = self::getChildren($i,$notyui);\r\n $obj->maxitems = count($obj->submenu->itemdata);\r\n $obj->maxdepth = 0;\r\n foreach ($obj->submenu->itemdata as $menu) {\r\n if (!empty($menu->maxdepth)) {\r\n if ($menu->maxdepth > $obj->maxdepth) $obj->maxdepth = $menu->maxdepth;\r\n } else {\r\n if ($menu->depth > $obj->maxdepth) $obj->maxdepth = $menu->depth;\r\n }\r\n }\r\n }\r\n $ret_array[] = $obj;\r\n } else {\r\n $obj->maxdepth = $obj->depth;\r\n $ret_array[] = $obj;\r\n }\r\n if (($i + 1) >= count($sections) || $sections[$i + 1]->depth <= $ret_depth) {\r\n return $ret_array;\r\n }\r\n }\r\n return array();\r\n }\r\n }\r\n\r\n /**\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function hasChildren($i) {\r\n global $sections;\r\n\r\n if (($i + 1) >= count($sections)) return false;\r\n return ($sections[$i]->depth < $sections[$i + 1]->depth) ? true : false;\r\n }\r\n\r\n /** exdoc\r\n * Creates a location object, based off of the three arguments passed, and returns it.\r\n *\r\n * @return array\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function initializeNavigation() {\r\n $sections = section::levelTemplate(0, 0);\r\n return $sections;\r\n }\r\n\r\n /**\r\n * returns all the section's children\r\n *\r\n * @static\r\n *\r\n * @param int $parent top level parent id\r\n * @param int $depth variable to hold level of recursion\r\n * @param array $parents\r\n *\r\n * @return array\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function levelTemplate($parent, $depth = 0, $parents = array()) {\r\n global $user;\r\n\r\n if ($parent != 0) $parents[] = $parent;\r\n $nodes = array();\r\n $cache = expSession::getCacheValue('navigation');\r\n $sect = new section();\r\n if (!isset($cache['kids'][$parent])) {\r\n $kids = $sect->find('all','parent=' . $parent);\r\n $cache['kids'][$parent] = $kids;\r\n expSession::setCacheValue('navigation', $cache);\r\n } else {\r\n $kids = $cache['kids'][$parent];\r\n }\r\n $kids = expSorter::sort(array('array' => $kids, 'sortby' => 'rank', 'order' => 'ASC'));\r\n for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) {\r\n $child = $kids[$i];\r\n //foreach ($kids as $child) {\r\n if ($child->public == 1 || expPermissions::check('view', expCore::makeLocation('navigation', '', $child->id))) {\r\n $child->numParents = count($parents);\r\n $child->depth = $depth;\r\n $child->first = ($i == 0 ? 1 : 0);\r\n $child->last = ($i == count($kids) - 1 ? 1 : 0);\r\n $child->parents = $parents;\r\n $child->canManage = (isset($user->is_acting_admin) && $user->is_acting_admin == 1 ? 1 : 0);\r\n $child->canManageRank = $child->canManage;\r\n if (!isset($child->sef_name)) {\r\n $child->sef_name = '';\r\n }\r\n // Generate the link attribute base on alias type.\r\n if ($child->alias_type == 1) {\r\n // External link. Set the link to the configured website URL.\r\n // This is guaranteed to be a full URL because of the\r\n // section::updateExternalAlias() method in models-1/section.php\r\n $child->link = $child->external_link;\r\n } else if ($child->alias_type == 2) {\r\n // Internal link.\r\n // Need to check and see if the internal_id is pointing at an external link.\r\n// $dest = $db->selectObject('section', 'id=' . $child->internal_id);\r\n $dest = $sect->find('first','id=' . $child->internal_id);\r\n if (!empty($dest->alias_type) && $dest->alias_type == 1) {\r\n // This internal alias is pointing at an external alias.\r\n // Use the external_link of the destination section for the link\r\n $child->link = $dest->external_link;\r\n } else {\r\n // Pointing at a regular section. This is guaranteed to be\r\n // a regular section because aliases cannot be turned into sections,\r\n // (and vice-versa) and because the section::updateInternalLink\r\n // does 'alias to alias' dereferencing before the section is saved\r\n // (see models-1/section.php)\r\n //added by Tyler to pull the descriptions through for the children view\r\n $child->description = !empty($dest->description) ? $dest->description : '';\r\n $child->link = expCore::makeLink(array('section' => $child->internal_id));\r\n }\r\n } else {\r\n // Normal link, alias_type == 0. Just create the URL from the section's id.\r\n $child->link = expCore::makeLink(array('section' => $child->id), '', $child->sef_name);\r\n }\r\n //$child->numChildren = $db->countObjects('section','parent='.$child->id);\r\n $nodes[] = $child;\r\n $nodes = array_merge($nodes, section::levelTemplate($child->id, $depth + 1, $parents));\r\n }\r\n }\r\n return $nodes;\r\n }\r\n\r\n /**\r\n * Returns a flat representation of the full site hierarchy.\r\n *\r\n * @param int $parent top level parent id\r\n * @param int $depth variable to hold level of recursion\r\n * @param array $ignore_ids array of pages to ignore\r\n * @param bool $full include a 'top' level entry\r\n * @param string $perm permission level to build list\r\n * @param bool $addstandalones should we add the stand-alone pages also\r\n * @param bool $addinternalalias\r\n *\r\n * @return array\r\n * @deprecated 2.3.4 moved to section model, HOWEVER still used in theme config\r\n */\r\n public static function levelDropdownControlArray($parent, $depth = 0, $ignore_ids = array(), $full = false, $perm = 'view', $addstandalones = false, $addinternalalias = true) {\r\n global $db;\r\n\r\n $ar = array();\r\n if ($parent == 0 && $full) {\r\n $ar[0] = '<' . gt('Top of Hierarchy') . '>';\r\n }\r\n if ($addinternalalias) {\r\n $intalias = '';\r\n } else {\r\n $intalias = ' AND alias_type != 2';\r\n }\r\n $nodes = $db->selectObjects('section', 'parent=' . $parent . $intalias, 'rank');\r\n foreach ($nodes as $node) {\r\n if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) {\r\n if ($node->active == 1) {\r\n $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . $node->name;\r\n } else {\r\n $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';\r\n }\r\n $ar[$node->id] = $text;\r\n foreach (self::levelDropdownControlArray($node->id, $depth + 1, $ignore_ids, $full, $perm, $addstandalones, $addinternalalias) as $id => $text) {\r\n $ar[$id] = $text;\r\n }\r\n }\r\n }\r\n if ($addstandalones && $parent == 0) {\r\n $sections = $db->selectObjects('section', 'parent=-1');\r\n foreach ($sections as $node) {\r\n if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) {\r\n if ($node->active == 1) {\r\n $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . $node->name;\r\n } else {\r\n $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';\r\n }\r\n $ar[$node->id] = '(' . gt('Standalone') . ') ' . $text;\r\n }\r\n }\r\n// $ar = array_merge($ar,$sections);\r\n }\r\n return $ar;\r\n }\r\n\r\n /**\r\n * add all module items to search index\r\n *\r\n * @return int\r\n */\r\n function addContentToSearch() {\r\n global $db;\r\n\r\n //global $sections;\r\n //\t\tglobal $router;\r\n// $db->delete('search', \"ref_module='navigation' AND ref_type='section'\");\r\n $db->delete('search', \"ref_module='\".$this->baseclassname.\"' AND ref_type='section'\");\r\n // this now ensures we get internal pages, instead of relying on the global $sections, which does not.\r\n $sections = $db->selectObjects('section', 'active=1');\r\n foreach ($sections as $section) {\r\n $search_record = new stdClass();\r\n// $search_record->category = 'Webpages';\r\n// $search_record->ref_module = 'navigationController';\r\n// $search_record->ref_type = 'section';\r\n// $search_record->ref_module = $this->classname;\r\n $search_record->ref_module = $this->baseclassname;\r\n $search_record->category = $this->searchName();\r\n $search_record->ref_type = $this->searchCategory();\r\n $search_record->original_id = $section->id;\r\n $search_record->title = $section->name;\r\n //$search_record->view_link = $router->buildUrlByPageId($section->id);\r\n $link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));\r\n if ($link . '/' == URL_FULL) $link = '';\r\n $search_record->view_link = $link;\r\n $search_record->body = $section->description;\r\n $search_record->keywords = $section->keywords;\r\n // now we're going to grab all the textmodules on this page and build the body for the page based off the content\r\n // of all the text module added together.\r\n $loc = expCore::makeLocation('text');\r\n $controllername = 'text';\r\n foreach ($db->selectObjects('sectionref', \"module='\" . $controllername . \"' AND section=\" . $section->id) as $module) {\r\n $loc->src = $module->source;\r\n// $controller = new $controllername();\r\n $controller = expModules::getController($controllername);\r\n $textitems = $db->selectObjects($controller->model_table, \"location_data='\" . serialize($loc) . \"'\");\r\n foreach ($textitems as $textitem) {\r\n if (!empty($textitem)) {\r\n $search_record->body .= ' ' . search::removeHTML($textitem->body) . ' ';\r\n $search_record->keywords .= \" \" . $textitem->title;\r\n }\r\n }\r\n }\r\n $db->insertObject($search_record, 'search');\r\n }\r\n return count($sections);\r\n }\r\n\r\n /**\r\n * Retrieve either the entire hierarchy, or a subset of the hierarchy, as an array suitable for use\r\n * in a dropdowncontrol. This is used primarily by the section datatype for moving and adding\r\n * sections to specific parts of the site hierarchy.\r\n *\r\n * @param int $parent The id of the subtree parent. If passed as 0 (the default), the entire subtree is parsed.\r\n * @param int $depth\r\n * @param int $default\r\n * @param array $ignore_ids a value-array of IDs to be ignored when generating the list. This is used\r\n * when moving a section, since a section cannot be made a subsection of itself or any of its subsections.\r\n *\r\n * @return string\r\n */\r\n function levelShowDropdown($parent, $depth = 0, $default = 0, $ignore_ids = array()) {\r\n global $db;\r\n\r\n $html = '';\r\n $nodes = $db->selectObjects('section', 'parent=' . $parent, 'rank');\r\n//\t\t$nodes = expSorter::sort(array('array'=>$nodes,'sortby'=>'rank', 'order'=>'ASC'));\r\n foreach ($nodes as $node) {\r\n if (($node->public == 1 || expPermissions::check('view', expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) {\r\n $html .= '<option value=\"' . $node->id . '\" ';\r\n if ($default == $node->id) $html .= 'selected';\r\n $html .= '>';\r\n if ($node->active == 1) {\r\n $html .= str_pad('', $depth * 3, '.', STR_PAD_LEFT) . $node->name;\r\n } else {\r\n $html .= str_pad('', $depth * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';\r\n }\r\n $html .= '</option>';\r\n $html .= self::levelShowDropdown($node->id, $depth + 1, $default, $ignore_ids);\r\n }\r\n }\r\n return $html;\r\n }\r\n\r\n /**\r\n * recursively lists the template hierarchy\r\n *\r\n * @static\r\n *\r\n * @param int $parent top level parent id\r\n * @param int $depth variable to hold level of recursion\r\n *\r\n * @return array\r\n * @deprecated 2.0.0 this only for deprecated templates\r\n */\r\n public static function getTemplateHierarchyFlat($parent, $depth = 1) {\r\n global $db;\r\n\r\n $arr = array();\r\n $kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank');\r\n//\t\t$kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC'));\r\n for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) {\r\n $page = $kids[$i];\r\n $page->depth = $depth;\r\n $page->first = ($i == 0 ? 1 : 0);\r\n $page->last = ($i == count($kids) - 1 ? 1 : 0);\r\n $arr[] = $page;\r\n $arr = array_merge($arr, self::getTemplateHierarchyFlat($page->id, $depth + 1));\r\n }\r\n return $arr;\r\n }\r\n\r\n /**\r\n * @deprecated 2.0.0 this only for deprecated templates\r\n */\r\n public static function process_section($section, $template) {\r\n global $db;\r\n\r\n if (!is_object($template)) {\r\n $template = $db->selectObject('section_template', 'id=' . $template);\r\n $section->subtheme = $template->subtheme;\r\n $db->updateObject($section, 'section');\r\n }\r\n $prefix = '@st' . $template->id;\r\n $refs = $db->selectObjects('sectionref', \"source LIKE '$prefix%'\");\r\n // Copy all modules and content for this section\r\n foreach ($refs as $ref) {\r\n $src = substr($ref->source, strlen($prefix)) . $section->id;\r\n if (call_user_func(array($ref->module, 'hasContent'))) {\r\n $oloc = expCore::makeLocation($ref->module, $ref->source);\r\n $nloc = expCore::makeLocation($ref->module, $src);\r\n if ($ref->module != \"container\") {\r\n call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc);\r\n } else {\r\n call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc, $section->id);\r\n }\r\n }\r\n }\r\n // Grab sub pages\r\n foreach ($db->selectObjects('section_template', 'parent=' . $template->id) as $t) {\r\n self::process_subsections($section, $t);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * @deprecated 2.0.0 this only for deprecated templates\r\n */\r\n function process_subsections($parent_section, $subtpl) {\r\n global $db, $router;\r\n\r\n $section = new stdClass();\r\n $section->parent = $parent_section->id;\r\n $section->name = $subtpl->name;\r\n $section->sef_name = $router->encode($section->name);\r\n $section->subtheme = $subtpl->subtheme;\r\n $section->active = $subtpl->active;\r\n $section->public = $subtpl->public;\r\n $section->rank = $subtpl->rank;\r\n $section->page_title = $subtpl->page_title;\r\n $section->keywords = $subtpl->keywords;\r\n $section->description = $subtpl->description;\r\n $section->id = $db->insertObject($section, 'section');\r\n self::process_section($section, $subtpl);\r\n }\r\n\r\n /**\r\n * Delete page and send its contents to the recycle bin\r\n *\r\n * @param $parent\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function deleteLevel($parent) {\r\n global $db;\r\n\r\n $kids = $db->selectObjects('section', 'parent=' . $parent);\r\n foreach ($kids as $kid) {\r\n self::deleteLevel($kid->id);\r\n }\r\n $secrefs = $db->selectObjects('sectionref', 'section=' . $parent);\r\n foreach ($secrefs as $secref) {\r\n $loc = expCore::makeLocation($secref->module, $secref->source, $secref->internal);\r\n recyclebin::sendToRecycleBin($loc, $parent);\r\n //FIXME if we delete the module & sectionref the module completely disappears\r\n// if (class_exists($secref->module)) {\r\n// $modclass = $secref->module;\r\n// //FIXME: more module/controller glue code\r\n// if (expModules::controllerExists($modclass)) {\r\n// $modclass = expModules::getControllerClassName($modclass);\r\n// $mod = new $modclass($loc->src);\r\n// $mod->delete_instance();\r\n// } else {\r\n// $mod = new $modclass();\r\n// $mod->deleteIn($loc);\r\n// }\r\n// }\r\n }\r\n// $db->delete('sectionref', 'section=' . $parent);\r\n $db->delete('section', 'parent=' . $parent);\r\n }\r\n\r\n /**\r\n * Move content page and its children to stand-alones\r\n *\r\n * @param $parent\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function removeLevel($parent) {\r\n global $db;\r\n\r\n $kids = $db->selectObjects('section', 'parent=' . $parent);\r\n foreach ($kids as $kid) {\r\n $kid->parent = -1;\r\n $db->updateObject($kid, 'section');\r\n self::removeLevel($kid->id);\r\n }\r\n }\r\n\r\n /**\r\n * Check for cascading page view permission, esp. if not public\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function canView($section) {\r\n global $db;\r\n\r\n if ($section == null) {\r\n return false;\r\n }\r\n if ($section->public == 0) {\r\n // Not a public section. Check permissions.\r\n return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id));\r\n } else { // Is public. check parents.\r\n if ($section->parent <= 0) {\r\n // Out of parents, and since we are still checking, we haven't hit a private section.\r\n return true;\r\n } else {\r\n $s = $db->selectObject('section', 'id=' . $section->parent);\r\n return self::canView($s);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Check to see if page is public with cascading\r\n * @deprecated 2.3.4 moved to section model\r\n */\r\n public static function isPublic($s) {\r\n if ($s == null) {\r\n return false;\r\n }\r\n while ($s->public && $s->parent > 0) {\r\n $s = new section($s->parent);\r\n }\r\n $lineage = (($s->public) ? 1 : 0);\r\n return $lineage;\r\n }\r\n\r\n public static function canManageStandalones() {\r\n global $user;\r\n\r\n if ($user->isAdmin()) return true;\r\n $standalones = section::levelTemplate(-1, 0);\r\n //\t\t$canmanage = false;\r\n foreach ($standalones as $standalone) {\r\n $loc = expCore::makeLocation('navigation', '', $standalone->id);\r\n if (expPermissions::check('manage', $loc)) return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Reassign permissions based on a check/change in menu/page hierarchy\r\n *\r\n * @static\r\n *\r\n * @param $id\r\n */\r\n public static function checkForSectionalAdmins($id) {\r\n global $db;\r\n\r\n $section = $db->selectObject('section', 'id=' . $id);\r\n $branch = section::levelTemplate($id, 0);\r\n array_unshift($branch, $section);\r\n $allusers = array();\r\n $allgroups = array();\r\n while ($section->parent > 0) {\r\n //\t\t\t$ploc = expCore::makeLocation('navigationController', null, $section);\r\n $allusers = array_merge($allusers, $db->selectColumn('userpermission', 'uid', \"permission='manage' AND module='navigation' AND internal=\" . $section->parent));\r\n $allgroups = array_merge($allgroups, $db->selectColumn('grouppermission', 'gid', \"permission='manage' AND module='navigation' AND internal=\" . $section->parent));\r\n $section = $db->selectObject('section', 'id=' . $section->parent);\r\n }\r\n foreach ($branch as $section) {\r\n $sloc = expCore::makeLocation('navigation', null, $section->id);\r\n // remove any manage permissions for this page and it's children\r\n // $db->delete('userpermission', \"module='navigationController' AND internal=\".$section->id);\r\n // $db->delete('grouppermission', \"module='navigationController' AND internal=\".$section->id);\r\n foreach ($allusers as $uid) {\r\n $u = user::getUserById($uid);\r\n expPermissions::grant($u, 'manage', $sloc);\r\n }\r\n foreach ($allgroups as $gid) {\r\n $g = group::getGroupById($gid);\r\n expPermissions::grantGroup($g, 'manage', $sloc);\r\n }\r\n }\r\n }\r\n\r\n function manage() {\r\n global $db, $router, $user;\r\n\r\n expHistory::set('manageable', $router->params);\r\n assign_to_template(array(\r\n 'canManageStandalones' => self::canManageStandalones(),\r\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\r\n 'user' => $user,\r\n// 'canManagePagesets' => $user->isAdmin(),\r\n// 'templates' => $db->selectObjects('section_template', 'parent=0'),\r\n ));\r\n }\r\n\r\n public function manage_sitemap() {\r\n global $db, $user, $sectionObj, $sections;\r\n\r\n expHistory::set('viewable', $this->params);\r\n $id = $sectionObj->id;\r\n $current = null;\r\n // all we need to do is determine the current section\r\n $navsections = $sections;\r\n if ($sectionObj->parent == -1) {\r\n $current = $sectionObj;\r\n } else {\r\n foreach ($navsections as $section) {\r\n if ($section->id == $id) {\r\n $current = $section;\r\n break;\r\n }\r\n }\r\n }\r\n assign_to_template(array(\r\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\r\n 'sections' => $navsections,\r\n 'current' => $current,\r\n 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),\r\n ));\r\n }\r\n\r\n /**\r\n * Ajax request for specific pages as json date to yui tree\r\n */\r\n public static function returnChildrenAsJSON() {\r\n global $db;\r\n\r\n //$nav = section::levelTemplate(intval($_REQUEST['id'], 0));\r\n $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;\r\n $nav = $db->selectObjects('section', 'parent=' . $id, 'rank');\r\n //FIXME $manage_all is moot w/ cascading perms now?\r\n $manage_all = false;\r\n if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) {\r\n $manage_all = true;\r\n }\r\n //FIXME recode to use foreach $key=>$value\r\n $navcount = count($nav);\r\n for ($i = 0; $i < $navcount; $i++) {\r\n if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) {\r\n $nav[$i]->manage = 1;\r\n $view = true;\r\n } else {\r\n $nav[$i]->manage = 0;\r\n $view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id));\r\n }\r\n $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name);\r\n if (!$view) unset($nav[$i]);\r\n }\r\n $nav= array_values($nav);\r\n// $nav[$navcount - 1]->last = true;\r\n if (count($nav)) $nav[count($nav) - 1]->last = true;\r\n// echo expJavascript::ajaxReply(201, '', $nav);\r\n $ar = new expAjaxReply(201, '', $nav);\r\n $ar->send();\r\n }\r\n\r\n /**\r\n * Ajax request for all pages as json date to jstree\r\n */\r\n public static function returnChildrenAsJSON2() {\r\n global $db;\r\n\r\n $icons = array(\r\n 0 => 'addpage',\r\n 1 => 'addextpage',\r\n 2 => 'addintpage',\r\n 3 => 'addfreeform',\r\n );\r\n\r\n $navs = $db->selectObjects('section', 'parent!=-1', 'rank');\r\n foreach ($navs as $i=>$nav) {\r\n $navs[$i]->parent = $nav->parent?$nav->parent:'#';\r\n $navs[$i]->text = $nav->name;\r\n $navs[$i]->icon = $icons[$nav->alias_type];\r\n if (!$nav->active) {\r\n $navs[$i]->icon .= ' inactive';\r\n $attr = new stdClass();\r\n $attr->class = 'inactive'; // class to obscure elements\r\n $navs[$i]->a_attr = $attr;\r\n }\r\n if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $navs[$i]->id))) {\r\n $navs[$i]->manage = 1;\r\n $view = true;\r\n } else {\r\n $navs[$i]->manage = 0;\r\n $navs[$i]->state->disabled = true;\r\n $view = $navs[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $navs[$i]->id));\r\n }\r\n $navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name);\r\n if (!$view) {\r\n// unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child\r\n $attr = new stdClass();\r\n $attr->class = 'hidden'; // bs3 class to hide elements\r\n $navs[$i]->li_attr = $attr;\r\n }\r\n }\r\n $navs= array_values($navs);\r\n// header('Content-Type: application/json; charset=utf8');\r\n\t\techo json_encode($navs);\r\n// echo expJavascript::ajaxReply(201, '', $navs);\r\n exit;\r\n }\r\n\r\n /**\r\n * Ajax function to reorder page hierarchy from yui tree control\r\n */\r\n public static function DragnDropReRank() {\r\n global $db, $router;\r\n\r\n $move = $router->params['move'];\r\n $target = $router->params['target'];\r\n $type = $router->params['type'];\r\n $targSec = $db->selectObject(\"section\",\"id=\".$target);\r\n// $targSec = new section($target);\r\n $check_id = $targSec->parent;\r\n $moveSec = $db->selectObject(\"section\",\"id=\".$move);\r\n// $moveSec = new section($move);\r\n\r\n // dropped on top of page\r\n if ($type == \"append\") {\r\n //save the old parent in case we are changing the depth of the moving section\r\n $oldParent = $moveSec->parent;\r\n //assign the parent of the moving section to the ID of the target section\r\n $moveSec->parent = $targSec->id;\r\n //set the rank of the moving section to 0 since it will appear first in the new order\r\n $moveSec->rank = 1;\r\n //select all children currently of the parent we're about to append to\r\n $targSecChildren = $db->selectObjects(\"section\", \"parent=\" . $targSec->id . \" ORDER BY rank\");\r\n //update the ranks of the children to +1 higher to accommodate our new rank 0 section being moved in.\r\n $newrank = 1;\r\n foreach ($targSecChildren as $value) {\r\n if ($value->id != $moveSec->id) {\r\n $value->rank = $newrank;\r\n $db->updateObject($value, 'section');\r\n $newrank++;\r\n }\r\n }\r\n $db->updateObject($moveSec, 'section');\r\n if ($oldParent != $moveSec->parent) {\r\n //we need to re-rank the children of the parent that the miving section has just left\r\n $childOfLastMove = $db->selectObjects(\"section\", \"parent=\" . $oldParent . \" ORDER BY rank\");\r\n for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) {\r\n $childOfLastMove[$i]->rank = $i;\r\n $db->updateObject($childOfLastMove[$i], 'section');\r\n }\r\n\r\n }\r\n// echo $moveSec->name . \" was appended to \" . $targSec->name;\r\n\r\n } elseif ($type == \"after\") { // dropped between (after) pages\r\n if ($targSec->parent == $moveSec->parent) {\r\n //are we moving up...\r\n if ($targSec->rank < $moveSec->rank) {\r\n $moveSec->rank = $targSec->rank + 1;\r\n $moveNextSiblings = $db->selectObjects(\"section\", \"id!=\" . $moveSec->id . \" AND parent=\" . $targSec->parent . \" AND rank>\" . $targSec->rank . \" ORDER BY rank\");\r\n $rerank = $moveSec->rank + 1;\r\n foreach ($moveNextSiblings as $value) {\r\n if ($value->id != $moveSec->id) {\r\n $value->rank = $rerank;\r\n $db->updateObject($value, 'section');\r\n $rerank++;\r\n }\r\n }\r\n $db->updateObject($targSec, 'section');\r\n// $targSec->update();\r\n $db->updateObject($moveSec, 'section');\r\n// $moveSec->update();\r\n //or are we moving down...\r\n } else {\r\n $targSec->rank = $targSec->rank - 1;\r\n $moveSec->rank = $targSec->rank + 1;\r\n $movePreviousSiblings = $db->selectObjects(\"section\", \"id!=\" . $moveSec->id . \" AND parent=\" . $targSec->parent . \" AND rank<=\" . $targSec->rank . \" ORDER BY rank\");\r\n $rerank = 1;\r\n foreach ($movePreviousSiblings as $value) {\r\n if ($value->id != $moveSec->id) {\r\n $value->rank = $rerank;\r\n $db->updateObject($value, 'section');\r\n $rerank++;\r\n }\r\n }\r\n $db->updateObject($targSec, 'section');\r\n// $targSec->update();\r\n $db->updateObject($moveSec, 'section');\r\n// $moveSec->update();\r\n }\r\n } else { // 'before', is this used?\r\n //store ranks from the depth we're moving from. Used to re-rank the level depth the moving section is moving from.\r\n $oldRank = $moveSec->rank;\r\n $oldParent = $moveSec->parent;\r\n //select all children of the target sections parent with a rank higher than it's own\r\n $moveNextSiblings = $db->selectObjects(\"section\", \"parent=\" . $targSec->parent . \" AND rank>\" . $targSec->rank . \" ORDER BY rank\");\r\n //update moving sections rank and parent\r\n $moveSec->rank = $targSec->rank + 1;\r\n $moveSec->parent = $targSec->parent;\r\n //$rerank=$moveSec->rank+1;\r\n foreach ($moveNextSiblings as $value) {\r\n $value->rank = $value->rank + 1;\r\n $db->updateObject($value, 'section');\r\n }\r\n $db->updateObject($moveSec, 'section');\r\n //handle re-ranking of previous parent\r\n $oldSiblings = $db->selectObjects(\"section\", \"parent=\" . $oldParent . \" AND rank>\" . $oldRank . \" ORDER BY rank\");\r\n $rerank = 1;\r\n foreach ($oldSiblings as $value) {\r\n if ($value->id != $moveSec->id) {\r\n $value->rank = $rerank;\r\n $db->updateObject($value, 'section');\r\n $rerank++;\r\n }\r\n }\r\n if ($oldParent != $moveSec->parent) {\r\n //we need to re-rank the children of the parent that the moving section has just left\r\n $childOfLastMove = $db->selectObjects(\"section\", \"parent=\" . $oldParent . \" ORDER BY rank\");\r\n for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) {\r\n $childOfLastMove[$i]->rank = $i;\r\n $db->updateObject($childOfLastMove[$i], 'section');\r\n }\r\n }\r\n }\r\n }\r\n self::checkForSectionalAdmins($move);\r\n expSession::clearAllUsersSessionCache('navigation');\r\n }\r\n\r\n /**\r\n * Ajax function to reorder page hierarchy from jstree control\r\n */\r\n public static function DragnDropReRank2() {\r\n global $router, $db;\r\n\r\n $id = $router->params['id'];\r\n $page = new section($id);\r\n $old_rank = $page->rank;\r\n $old_parent = $page->parent;\r\n $new_rank = $router->params['position'] + 1; // rank\r\n $new_parent = intval($router->params['parent']);\r\n\r\n $db->decrement($page->tablename, 'rank', 1, 'rank>' . $old_rank . ' AND parent=' . $old_parent); // close in hole\r\n $db->increment($page->tablename, 'rank', 1, 'rank>=' . $new_rank . ' AND parent=' . $new_parent); // make room\r\n\r\n $params = array();\r\n $params['parent'] = $new_parent;\r\n $params['rank'] = $new_rank;\r\n $page->update($params);\r\n\r\n self::checkForSectionalAdmins($id);\r\n expSession::clearAllUsersSessionCache('navigation');\r\n }\r\n\r\n function edit_section() {\r\n global $db, $user;\r\n\r\n $parent = new section($this->params['parent']);\r\n if (empty($parent->id)) $parent->id = 0;\r\n assign_to_template(array(\r\n 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0),\r\n 'parent' => $parent,\r\n 'isAdministrator' => $user->isAdmin(),\r\n ));\r\n }\r\n\r\n function edit_contentpage() {\r\n //FIXME we come here for new/edit content/standalone pages\r\n // FIXME: Allow non-administrative users to manage certain parts of the section hierarchy.\r\n //if ($user->is_acting_admin == 1 /*TODO: section admin*/) {\r\n// $section = null;\r\n $section = new stdClass();\r\n if (isset($this->params['id'])) {\r\n // Check to see if an id was passed in get. If so, retrieve that section from\r\n // the database, and perform an edit on it.\r\n $section = $this->section->find($this->params['id']);\r\n } elseif (isset($this->params['parent'])) {\r\n // The isset check is merely a precaution. This action should\r\n // ALWAYS be invoked with a parent or id value.\r\n $section = new section($this->params);\r\n } else {\r\n notfoundController::handle_not_found();\r\n exit;\r\n }\r\n if (!empty($section->id)) {\r\n $check_id = $section->id;\r\n } else {\r\n $check_id = $section->parent;\r\n }\r\n if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) {\r\n if (empty($section->id)) {\r\n $section->active = 1;\r\n $section->public = 1;\r\n if (!isset($section->parent)) {\r\n // This is another precaution. The parent attribute\r\n // should ALWAYS be set by the caller.\r\n //FJD - if that's the case, then we should die.\r\n notfoundController::handle_not_authorized();\r\n exit;\r\n //$section->parent = 0;\r\n }\r\n }\r\n assign_to_template(array(\r\n 'section' => $section,\r\n 'glyphs' => self::get_glyphs(),\r\n ));\r\n } else { // User does not have permission to manage sections. Throw a 403\r\n notfoundController::handle_not_authorized();\r\n }\r\n }\r\n\r\n private static function get_glyphs() {\r\n if (bs()) {\r\n require_once(BASE . 'external/font-awesome.class.php');\r\n $fa = new Smk_FontAwesome;\r\n if (bs3()) {\r\n $icons = $fa->getArray(BASE . 'external/font-awesome4/css/font-awesome.css');\r\n $icons = $fa->sortByName($icons);\r\n return $fa->nameGlyph($icons);\r\n } elseif (bs2()) {\r\n expCSS::auto_compile_less(\r\n 'external/font-awesome/less/font-awesome.less',\r\n 'external/font-awesome/css/font-awesome.css'\r\n ); // font-awesome is included within bootstrap2, but not as a separate .css file\r\n $icons = $fa->getArray(BASE . 'external/font-awesome/css/font-awesome.css', 'icon-');\r\n return $fa->nameGlyph($icons, 'icon-');\r\n }\r\n } else {\r\n return array();\r\n }\r\n }\r\n\r\n function edit_internalalias() {\r\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\r\n if ($section->parent == -1) {\r\n notfoundController::handle_not_found();\r\n exit;\r\n } // doesn't work for standalone pages\r\n if (empty($section->id)) {\r\n $section->public = 1;\r\n if (!isset($section->parent)) {\r\n // This is another precaution. The parent attribute\r\n // should ALWAYS be set by the caller.\r\n //FJD - if that's the case, then we should die.\r\n notfoundController::handle_not_authorized();\r\n exit;\r\n //$section->parent = 0;\r\n }\r\n }\r\n assign_to_template(array(\r\n 'section' => $section,\r\n 'glyphs' => self::get_glyphs(),\r\n ));\r\n }\r\n\r\n function edit_freeform() {\r\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\r\n if ($section->parent == -1) {\r\n notfoundController::handle_not_found();\r\n exit;\r\n } // doesn't work for standalone pages\r\n if (empty($section->id)) {\r\n $section->public = 1;\r\n if (!isset($section->parent)) {\r\n // This is another precaution. The parent attribute\r\n // should ALWAYS be set by the caller.\r\n //FJD - if that's the case, then we should die.\r\n notfoundController::handle_not_authorized();\r\n exit;\r\n //$section->parent = 0;\r\n }\r\n }\r\n assign_to_template(array(\r\n 'section' => $section,\r\n 'glyphs' => self::get_glyphs(),\r\n ));\r\n }\r\n\r\n function edit_externalalias() {\r\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\r\n if ($section->parent == -1) {\r\n notfoundController::handle_not_found();\r\n exit;\r\n } // doesn't work for standalone pages\r\n if (empty($section->id)) {\r\n $section->public = 1;\r\n if (!isset($section->parent)) {\r\n // This is another precaution. The parent attribute\r\n // should ALWAYS be set by the caller.\r\n //FJD - if that's the case, then we should die.\r\n notfoundController::handle_not_authorized();\r\n exit;\r\n //$section->parent = 0;\r\n }\r\n }\r\n assign_to_template(array(\r\n 'section' => $section,\r\n 'glyphs' => self::get_glyphs(),\r\n ));\r\n }\r\n\r\n function update() {\r\n parent::update();\r\n expSession::clearAllUsersSessionCache('navigation');\r\n }\r\n\r\n function move_standalone() {\r\n expSession::clearAllUsersSessionCache('navigation');\r\n assign_to_template(array(\r\n 'parent' => $this->params['parent'],\r\n ));\r\n }\r\n\r\n /**\r\n * Move standalone back to hierarchy\r\n *\r\n */\r\n function reparent_standalone() {\r\n $standalone = $this->section->find($this->params['page']);\r\n if ($standalone) {\r\n $standalone->parent = $this->params['parent'];\r\n $standalone->update();\r\n expSession::clearAllUsersSessionCache('navigation');\r\n expHistory::back();\r\n } else {\r\n notfoundController::handle_not_found();\r\n }\r\n }\r\n\r\n /**\r\n * Move content page to standalones\r\n *\r\n */\r\n function remove() {\r\n global $db;\r\n\r\n $section = $db->selectObject('section', 'id=' . $this->params['id']);\r\n if ($section) {\r\n section::removeLevel($section->id);\r\n $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent);\r\n $section->parent = -1;\r\n $db->updateObject($section, 'section');\r\n expSession::clearAllUsersSessionCache('navigation');\r\n expHistory::back();\r\n } else {\r\n notfoundController::handle_not_authorized();\r\n }\r\n }\r\n\r\n function delete_standalones() {\r\n if (!empty($this->params['deleteit'])) {\r\n foreach ($this->params['deleteit'] as $page) {\r\n $section = new section(intval($page));\r\n if ($section) {\r\n// self::deleteLevel($section->id);\r\n $section->delete();\r\n }\r\n }\r\n }\r\n expSession::clearAllUsersSessionCache('navigation');\r\n expHistory::back();\r\n }\r\n\r\n // create a psuedo global manage pages permission\r\n public static function checkPermissions($permission,$location) {\r\n global $exponent_permissions_r, $router;\r\n\r\n // only applies to the 'manage' method\r\n if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) {\r\n if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) {\r\n foreach ($page as $pageperm) {\r\n if (!empty($pageperm['manage'])) return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Rebuild the sectionref table as a list of modules on a page\r\n * @deprecated 2.3.4 moved to sectionref model\r\n */\r\n public static function rebuild_sectionrefs() {\r\n global $db;\r\n\r\n // recursive run though all the nested containers\r\n function scan_container($container_id, $page_id) {\r\n global $db;\r\n\r\n $containers = $db->selectObjects('container',\"external='\" . $container_id . \"'\");\r\n $ret = '';\r\n foreach ($containers as $container) {\r\n $iLoc = expUnserialize($container->internal);\r\n $newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id);\r\n if (!empty($newret)) $ret .= $newret . '<br>';\r\n if ($iLoc->mod == 'container') {\r\n $ret .= scan_container($container->internal, $page_id);\r\n }\r\n }\r\n return $ret;\r\n }\r\n\r\n // recursive run through all the nested pages\r\n function scan_page($parent_id) {\r\n global $db;\r\n\r\n $sections = $db->selectObjects('section','parent=' . $parent_id);\r\n $ret = '';\r\n foreach ($sections as $page) {\r\n $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));\r\n $ret .= scan_container($cLoc, $page->id);\r\n $ret .= scan_page($page->id);\r\n }\r\n return $ret;\r\n }\r\n\r\n // first remove duplicate records\r\n $db->sql('DELETE FROM ' . $db->prefix . 'sectionref WHERE id NOT IN (SELECT * FROM (SELECT MIN(n.id) FROM ' . $db->prefix . 'sectionref n GROUP BY n.module, n.source) x)');\r\n $ret = scan_page(0); // the page hierarchy\r\n $ret .= scan_page(-1); // now the stand alone pages\r\n\r\n // we need to get the non-main containers such as sidebars, footers, etc...\r\n $hardcodedmods = $db->selectObjects('sectionref',\"refcount=1000 AND source NOT LIKE '%@section%' AND source NOT LIKE '%@random%'\");\r\n foreach ($hardcodedmods as $hardcodedmod) {\r\n if ($hardcodedmod->module == 'container') {\r\n $page_id = intval(preg_replace('/\\D/', '', $hardcodedmod->source));\r\n if (empty($page_id)) {\r\n $page_id = SITE_DEFAULT_SECTION; // we'll default to the home page\r\n }\r\n $ret .= scan_container(serialize(expCore::makeLocation($hardcodedmod->module, $hardcodedmod->source)), $page_id);\r\n } else {\r\n $hardcodedmod->section = 0; // this is a hard-coded non-container module\r\n $db->updateObject($hardcodedmod, 'sectionref');\r\n }\r\n }\r\n\r\n // mark modules in the recycle bin as section 0\r\n $db->columnUpdate('sectionref', 'section', 0, \"refcount=0\");\r\n// $recycledmods = $db->selectObjects('sectionref',\"refcount=0\");\r\n// foreach ($recycledmods as $recycledmod) {\r\n// $recycledmod->section = 0; // this is a module in the recycle bin\r\n// $db->updateObject($recycledmod, 'sectionref');\r\n// }\r\n return $ret;\r\n }\r\n\r\n}\r\n\r",
"?>"
] |
[
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################\n/**\n * @subpackage Controllers\n * @package Modules\n */\nclass navigationController extends expController {\n public $basemodel_name = 'section';\n public $useractions = array(\n 'showall' => 'Show Navigation',\n 'breadcrumb' => 'Breadcrumb',\n );\n protected $remove_permissions = array(\n// 'configure',\n// 'create',\n// 'delete',\n// 'edit'\n );\n protected $add_permissions = array(\n 'manage' => 'Manage',\n 'view' => \"View Page\"\n );\n protected $manage_permissions = array(\n 'move' => 'Move Page',\n 'remove' => 'Remove Page',\n 'reparent' => 'Reparent Page',\n );\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Navigation\"); }",
" static function description() { return gt(\"Places navigation links/menus on the page.\"); }",
" static function isSearchable() { return true; }",
" function searchName() { return gt('Webpage'); }",
" /**\n * @param null $src\n * @param array $params\n *\n */\n function __construct($src = null, $params = array())\n {\n parent::__construct($src, $params);\n if (!empty($params['id'])) // we normally throw out the $loc->int EXCEPT with navigation pages\n $this->loc = expCore::makeLocation($this->baseclassname, $src, $params['id']);\n }",
" public function showall() {\n global $user, $sectionObj, $sections;",
" expHistory::set('viewable', $this->params);\n $id = $sectionObj->id;\n $current = null;\n // all we need to do is determine the current section\n $navsections = $sections;\n if ($sectionObj->parent == -1) {\n $current = $sectionObj;\n } else {\n foreach ($navsections as $section) {\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n assign_to_template(array(\n 'sections' => $navsections,\n 'current' => $current,\n 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),\n ));\n }",
" public function breadcrumb() {\n global $sectionObj;",
" expHistory::set('viewable', $this->params);\n $id = $sectionObj->id;\n $current = null;\n // Show not only the location of a page in the hierarchy but also the location of a standalone page\n $current = new section($id);\n if ($current->parent == -1) { // standalone page\n $navsections = section::levelTemplate(-1, 0);\n foreach ($navsections as $section) {\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n } else {\n $navsections = section::levelTemplate(0, 0);\n foreach ($navsections as $section) {\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n assign_to_template(array(\n 'sections' => $navsections,\n 'current' => $current,\n ));\n }",
" /**\n * @deprecated 2.3.4 moved to section model\n */\n public static function navhierarchy($notyui=false) {\n global $sections;",
" $json_array = array();\n for ($i = 0, $iMax = count($sections); $i < $iMax; $i++) {\n if ($sections[$i]->depth == 0) {\n $obj = new stdClass();\n// \t\t\t\t$obj->id = $sections[$i]->name.$sections[$i]->id;\n $obj->id = $sections[$i]->id;\n $obj->text = $sections[$i]->name;\n $obj->title = $sections[$i]->page_title;\n $obj->description = $sections[$i]->description;\n $obj->new_window = $sections[$i]->new_window;\n $obj->expFile = $sections[$i]->expFile;\n $obj->glyph = $sections[$i]->glyph;\n $obj->glyph_only = $sections[$i]->glyph_only;\n $obj->type = $sections[$i]->alias_type;\n if ($sections[$i]->active == 1) {\n $obj->url = $sections[$i]->link;\n if ($obj->type == 1 && substr($obj->url, 0, 4) != 'http') {\n $obj->url = 'http://' . $obj->url;\n }\n } else {\n $obj->url = \"#\";\n $obj->onclick = \"onclick: { fn: return false }\";\n }\n if ($obj->type == 3) { // mostly a hack instead of adding more table fields\n $obj->width = $sections[$i]->internal_id;\n $obj->class = $sections[$i]->external_link;\n }\n /*if ($sections[$i]->active == 1) {\n $obj->disabled = false;\n } else {\n $obj->disabled = true;\n }*/\n //$obj->disabled = true;\n $obj->itemdata = self::getChildren($i,$notyui);\n $obj->maxitems = count($obj->itemdata);\n $obj->maxdepth = 0;\n foreach ($obj->itemdata as $menu) {\n if ($menu->maxdepth > $obj->maxdepth) $obj->maxdepth = $menu->maxdepth;\n }\n }\n $json_array[] = $obj;\n }\n return $json_array;\n }",
" /**\n * @deprecated 2.3.4 moved to section model\n */\n public static function navtojson() {\n return json_encode(self::navhierarchy());\n }",
" /**\n * @deprecated 2.3.4 moved to section model\n */\n public static function getChildren(&$i, $notyui=false) {\n global $sections;",
" //\t\techo \"i=\".$i.\"<br>\";\n if ($i + 1 == count($sections)) { // last entry\n return array();\n } elseif ($sections[$i]->depth == $sections[$i + 1]->depth) {\n return array();\n } else {\n $ret_depth = $sections[$i]->depth;\n $i++;\n $ret_array = array();\n for ($iMax = count($sections); $i < $iMax; $i++) {\n // start setting up the objects to return\n $obj = new stdClass();\n $obj->id = $sections[$i]->id;\n $obj->text = $sections[$i]->name;\n $obj->title = $sections[$i]->page_title;\n $obj->description = $sections[$i]->description;\n $obj->new_window = $sections[$i]->new_window;\n $obj->expFile = $sections[$i]->expFile;\n $obj->glyph = $sections[$i]->glyph;\n $obj->glyph_only = $sections[$i]->glyph_only;\n $obj->depth = $sections[$i]->depth;\n if ($sections[$i]->active == 1) {\n $obj->url = $sections[$i]->link;\n if ($sections[$i]->alias_type == 1 && substr($obj->url, 0, 4) != 'http') {\n $obj->url = 'http://' . $obj->url;\n }\n } else {\n $obj->url = \"#\";\n $obj->onclick = \"onclick: { fn: return false }\";\n }\n //echo \"i=\".$i.\"<br>\";\n if (self::hasChildren($i)) {\n if ($notyui) {\n $obj->itemdata = self::getChildren($i,$notyui);\n $obj->maxitems = count($obj->itemdata);\n $obj->maxdepth = 0;\n foreach ($obj->itemdata as $menu) {\n if (!empty($menu->maxdepth)) {\n if ($menu->maxdepth > $obj->maxdepth) $obj->maxdepth = $menu->maxdepth;\n } else {\n if ($menu->depth > $obj->maxdepth) $obj->maxdepth = $menu->depth;\n }\n }\n } else {\n $obj->submenu = new stdClass();\n $obj->submenu->id = $sections[$i]->name . $sections[$i]->id;\n //echo \"getting children of \".$sections[$i]->name;\n $obj->submenu->itemdata = self::getChildren($i,$notyui);\n $obj->maxitems = count($obj->submenu->itemdata);\n $obj->maxdepth = 0;\n foreach ($obj->submenu->itemdata as $menu) {\n if (!empty($menu->maxdepth)) {\n if ($menu->maxdepth > $obj->maxdepth) $obj->maxdepth = $menu->maxdepth;\n } else {\n if ($menu->depth > $obj->maxdepth) $obj->maxdepth = $menu->depth;\n }\n }\n }\n $ret_array[] = $obj;\n } else {\n $obj->maxdepth = $obj->depth;\n $ret_array[] = $obj;\n }\n if (($i + 1) >= count($sections) || $sections[$i + 1]->depth <= $ret_depth) {\n return $ret_array;\n }\n }\n return array();\n }\n }",
" /**\n * @deprecated 2.3.4 moved to section model\n */\n public static function hasChildren($i) {\n global $sections;",
" if (($i + 1) >= count($sections)) return false;\n return ($sections[$i]->depth < $sections[$i + 1]->depth) ? true : false;\n }",
" /** exdoc\n * Creates a location object, based off of the three arguments passed, and returns it.\n *\n * @return array\n * @deprecated 2.3.4 moved to section model\n */\n public static function initializeNavigation() {\n $sections = section::levelTemplate(0, 0);\n return $sections;\n }",
" /**\n * returns all the section's children\n *\n * @static\n *\n * @param int $parent top level parent id\n * @param int $depth variable to hold level of recursion\n * @param array $parents\n *\n * @return array\n * @deprecated 2.3.4 moved to section model\n */\n public static function levelTemplate($parent, $depth = 0, $parents = array()) {\n global $user;",
" if ($parent != 0) $parents[] = $parent;\n $nodes = array();\n $cache = expSession::getCacheValue('navigation');\n $sect = new section();\n if (!isset($cache['kids'][$parent])) {\n $kids = $sect->find('all','parent=' . $parent);\n $cache['kids'][$parent] = $kids;\n expSession::setCacheValue('navigation', $cache);\n } else {\n $kids = $cache['kids'][$parent];\n }\n $kids = expSorter::sort(array('array' => $kids, 'sortby' => 'rank', 'order' => 'ASC'));\n for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) {\n $child = $kids[$i];\n //foreach ($kids as $child) {\n if ($child->public == 1 || expPermissions::check('view', expCore::makeLocation('navigation', '', $child->id))) {\n $child->numParents = count($parents);\n $child->depth = $depth;\n $child->first = ($i == 0 ? 1 : 0);\n $child->last = ($i == count($kids) - 1 ? 1 : 0);\n $child->parents = $parents;\n $child->canManage = (isset($user->is_acting_admin) && $user->is_acting_admin == 1 ? 1 : 0);\n $child->canManageRank = $child->canManage;\n if (!isset($child->sef_name)) {\n $child->sef_name = '';\n }\n // Generate the link attribute base on alias type.\n if ($child->alias_type == 1) {\n // External link. Set the link to the configured website URL.\n // This is guaranteed to be a full URL because of the\n // section::updateExternalAlias() method in models-1/section.php\n $child->link = $child->external_link;\n } else if ($child->alias_type == 2) {\n // Internal link.\n // Need to check and see if the internal_id is pointing at an external link.\n// $dest = $db->selectObject('section', 'id=' . $child->internal_id);\n $dest = $sect->find('first','id=' . $child->internal_id);\n if (!empty($dest->alias_type) && $dest->alias_type == 1) {\n // This internal alias is pointing at an external alias.\n // Use the external_link of the destination section for the link\n $child->link = $dest->external_link;\n } else {\n // Pointing at a regular section. This is guaranteed to be\n // a regular section because aliases cannot be turned into sections,\n // (and vice-versa) and because the section::updateInternalLink\n // does 'alias to alias' dereferencing before the section is saved\n // (see models-1/section.php)\n //added by Tyler to pull the descriptions through for the children view\n $child->description = !empty($dest->description) ? $dest->description : '';\n $child->link = expCore::makeLink(array('section' => $child->internal_id));\n }\n } else {\n // Normal link, alias_type == 0. Just create the URL from the section's id.\n $child->link = expCore::makeLink(array('section' => $child->id), '', $child->sef_name);\n }\n //$child->numChildren = $db->countObjects('section','parent='.$child->id);\n $nodes[] = $child;\n $nodes = array_merge($nodes, section::levelTemplate($child->id, $depth + 1, $parents));\n }\n }\n return $nodes;\n }",
" /**\n * Returns a flat representation of the full site hierarchy.\n *\n * @param int $parent top level parent id\n * @param int $depth variable to hold level of recursion\n * @param array $ignore_ids array of pages to ignore\n * @param bool $full include a 'top' level entry\n * @param string $perm permission level to build list\n * @param bool $addstandalones should we add the stand-alone pages also\n * @param bool $addinternalalias\n *\n * @return array\n * @deprecated 2.3.4 moved to section model, HOWEVER still used in theme config\n */\n public static function levelDropdownControlArray($parent, $depth = 0, $ignore_ids = array(), $full = false, $perm = 'view', $addstandalones = false, $addinternalalias = true) {\n global $db;",
" $ar = array();\n if ($parent == 0 && $full) {\n $ar[0] = '<' . gt('Top of Hierarchy') . '>';\n }\n if ($addinternalalias) {\n $intalias = '';\n } else {\n $intalias = ' AND alias_type != 2';\n }\n $nodes = $db->selectObjects('section', 'parent=' . $parent . $intalias, 'rank');\n foreach ($nodes as $node) {\n if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) {\n if ($node->active == 1) {\n $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . $node->name;\n } else {\n $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';\n }\n $ar[$node->id] = $text;\n foreach (self::levelDropdownControlArray($node->id, $depth + 1, $ignore_ids, $full, $perm, $addstandalones, $addinternalalias) as $id => $text) {\n $ar[$id] = $text;\n }\n }\n }\n if ($addstandalones && $parent == 0) {\n $sections = $db->selectObjects('section', 'parent=-1');\n foreach ($sections as $node) {\n if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) {\n if ($node->active == 1) {\n $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . $node->name;\n } else {\n $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';\n }\n $ar[$node->id] = '(' . gt('Standalone') . ') ' . $text;\n }\n }\n// $ar = array_merge($ar,$sections);\n }\n return $ar;\n }",
" /**\n * add all module items to search index\n *\n * @return int\n */\n function addContentToSearch() {\n global $db;",
" //global $sections;\n //\t\tglobal $router;\n// $db->delete('search', \"ref_module='navigation' AND ref_type='section'\");\n $db->delete('search', \"ref_module='\".$this->baseclassname.\"' AND ref_type='section'\");\n // this now ensures we get internal pages, instead of relying on the global $sections, which does not.\n $sections = $db->selectObjects('section', 'active=1');\n foreach ($sections as $section) {\n $search_record = new stdClass();\n// $search_record->category = 'Webpages';\n// $search_record->ref_module = 'navigationController';\n// $search_record->ref_type = 'section';\n// $search_record->ref_module = $this->classname;\n $search_record->ref_module = $this->baseclassname;\n $search_record->category = $this->searchName();\n $search_record->ref_type = $this->searchCategory();\n $search_record->original_id = $section->id;\n $search_record->title = $section->name;\n //$search_record->view_link = $router->buildUrlByPageId($section->id);\n $link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));\n if ($link . '/' == URL_FULL) $link = '';\n $search_record->view_link = $link;\n $search_record->body = $section->description;\n $search_record->keywords = $section->keywords;\n // now we're going to grab all the textmodules on this page and build the body for the page based off the content\n // of all the text module added together.\n $loc = expCore::makeLocation('text');\n $controllername = 'text';\n foreach ($db->selectObjects('sectionref', \"module='\" . $controllername . \"' AND section=\" . $section->id) as $module) {\n $loc->src = $module->source;\n// $controller = new $controllername();\n $controller = expModules::getController($controllername);\n $textitems = $db->selectObjects($controller->model_table, \"location_data='\" . serialize($loc) . \"'\");\n foreach ($textitems as $textitem) {\n if (!empty($textitem)) {\n $search_record->body .= ' ' . search::removeHTML($textitem->body) . ' ';\n $search_record->keywords .= \" \" . $textitem->title;\n }\n }\n }\n $db->insertObject($search_record, 'search');\n }\n return count($sections);\n }",
" /**\n * Retrieve either the entire hierarchy, or a subset of the hierarchy, as an array suitable for use\n * in a dropdowncontrol. This is used primarily by the section datatype for moving and adding\n * sections to specific parts of the site hierarchy.\n *\n * @param int $parent The id of the subtree parent. If passed as 0 (the default), the entire subtree is parsed.\n * @param int $depth\n * @param int $default\n * @param array $ignore_ids a value-array of IDs to be ignored when generating the list. This is used\n * when moving a section, since a section cannot be made a subsection of itself or any of its subsections.\n *\n * @return string\n */\n function levelShowDropdown($parent, $depth = 0, $default = 0, $ignore_ids = array()) {\n global $db;",
" $html = '';\n $nodes = $db->selectObjects('section', 'parent=' . $parent, 'rank');\n//\t\t$nodes = expSorter::sort(array('array'=>$nodes,'sortby'=>'rank', 'order'=>'ASC'));\n foreach ($nodes as $node) {\n if (($node->public == 1 || expPermissions::check('view', expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) {\n $html .= '<option value=\"' . $node->id . '\" ';\n if ($default == $node->id) $html .= 'selected';\n $html .= '>';\n if ($node->active == 1) {\n $html .= str_pad('', $depth * 3, '.', STR_PAD_LEFT) . $node->name;\n } else {\n $html .= str_pad('', $depth * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';\n }\n $html .= '</option>';\n $html .= self::levelShowDropdown($node->id, $depth + 1, $default, $ignore_ids);\n }\n }\n return $html;\n }",
" /**\n * recursively lists the template hierarchy\n *\n * @static\n *\n * @param int $parent top level parent id\n * @param int $depth variable to hold level of recursion\n *\n * @return array\n * @deprecated 2.0.0 this only for deprecated templates\n */\n public static function getTemplateHierarchyFlat($parent, $depth = 1) {\n global $db;",
" $arr = array();\n $kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank');\n//\t\t$kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC'));\n for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) {\n $page = $kids[$i];\n $page->depth = $depth;\n $page->first = ($i == 0 ? 1 : 0);\n $page->last = ($i == count($kids) - 1 ? 1 : 0);\n $arr[] = $page;\n $arr = array_merge($arr, self::getTemplateHierarchyFlat($page->id, $depth + 1));\n }\n return $arr;\n }",
" /**\n * @deprecated 2.0.0 this only for deprecated templates\n */\n public static function process_section($section, $template) {\n global $db;",
" if (!is_object($template)) {\n $template = $db->selectObject('section_template', 'id=' . $template);\n $section->subtheme = $template->subtheme;\n $db->updateObject($section, 'section');\n }\n $prefix = '@st' . $template->id;\n $refs = $db->selectObjects('sectionref', \"source LIKE '$prefix%'\");\n // Copy all modules and content for this section\n foreach ($refs as $ref) {\n $src = substr($ref->source, strlen($prefix)) . $section->id;\n if (call_user_func(array($ref->module, 'hasContent'))) {\n $oloc = expCore::makeLocation($ref->module, $ref->source);\n $nloc = expCore::makeLocation($ref->module, $src);\n if ($ref->module != \"container\") {\n call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc);\n } else {\n call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc, $section->id);\n }\n }\n }\n // Grab sub pages\n foreach ($db->selectObjects('section_template', 'parent=' . $template->id) as $t) {\n self::process_subsections($section, $t);\n }",
" }",
" /**\n * @deprecated 2.0.0 this only for deprecated templates\n */\n function process_subsections($parent_section, $subtpl) {\n global $db, $router;",
" $section = new stdClass();\n $section->parent = $parent_section->id;\n $section->name = $subtpl->name;\n $section->sef_name = $router->encode($section->name);\n $section->subtheme = $subtpl->subtheme;\n $section->active = $subtpl->active;\n $section->public = $subtpl->public;\n $section->rank = $subtpl->rank;\n $section->page_title = $subtpl->page_title;\n $section->keywords = $subtpl->keywords;\n $section->description = $subtpl->description;\n $section->id = $db->insertObject($section, 'section');\n self::process_section($section, $subtpl);\n }",
" /**\n * Delete page and send its contents to the recycle bin\n *\n * @param $parent\n * @deprecated 2.3.4 moved to section model\n */\n public static function deleteLevel($parent) {\n global $db;",
" $kids = $db->selectObjects('section', 'parent=' . $parent);\n foreach ($kids as $kid) {\n self::deleteLevel($kid->id);\n }\n $secrefs = $db->selectObjects('sectionref', 'section=' . $parent);\n foreach ($secrefs as $secref) {\n $loc = expCore::makeLocation($secref->module, $secref->source, $secref->internal);\n recyclebin::sendToRecycleBin($loc, $parent);\n //FIXME if we delete the module & sectionref the module completely disappears\n// if (class_exists($secref->module)) {\n// $modclass = $secref->module;\n// //FIXME: more module/controller glue code\n// if (expModules::controllerExists($modclass)) {\n// $modclass = expModules::getControllerClassName($modclass);\n// $mod = new $modclass($loc->src);\n// $mod->delete_instance();\n// } else {\n// $mod = new $modclass();\n// $mod->deleteIn($loc);\n// }\n// }\n }\n// $db->delete('sectionref', 'section=' . $parent);\n $db->delete('section', 'parent=' . $parent);\n }",
" /**\n * Move content page and its children to stand-alones\n *\n * @param $parent\n * @deprecated 2.3.4 moved to section model\n */\n public static function removeLevel($parent) {\n global $db;",
" $kids = $db->selectObjects('section', 'parent=' . $parent);\n foreach ($kids as $kid) {\n $kid->parent = -1;\n $db->updateObject($kid, 'section');\n self::removeLevel($kid->id);\n }\n }",
" /**\n * Check for cascading page view permission, esp. if not public\n * @deprecated 2.3.4 moved to section model\n */\n public static function canView($section) {\n global $db;",
" if ($section == null) {\n return false;\n }\n if ($section->public == 0) {\n // Not a public section. Check permissions.\n return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id));\n } else { // Is public. check parents.\n if ($section->parent <= 0) {\n // Out of parents, and since we are still checking, we haven't hit a private section.\n return true;\n } else {\n $s = $db->selectObject('section', 'id=' . $section->parent);\n return self::canView($s);\n }\n }\n }",
" /**\n * Check to see if page is public with cascading\n * @deprecated 2.3.4 moved to section model\n */\n public static function isPublic($s) {\n if ($s == null) {\n return false;\n }\n while ($s->public && $s->parent > 0) {\n $s = new section($s->parent);\n }\n $lineage = (($s->public) ? 1 : 0);\n return $lineage;\n }",
" public static function canManageStandalones() {\n global $user;",
" if ($user->isAdmin()) return true;\n $standalones = section::levelTemplate(-1, 0);\n //\t\t$canmanage = false;\n foreach ($standalones as $standalone) {\n $loc = expCore::makeLocation('navigation', '', $standalone->id);\n if (expPermissions::check('manage', $loc)) return true;\n }\n return false;\n }",
" /**\n * Reassign permissions based on a check/change in menu/page hierarchy\n *\n * @static\n *\n * @param $id\n */\n public static function checkForSectionalAdmins($id) {\n global $db;",
" $section = $db->selectObject('section', 'id=' . $id);\n $branch = section::levelTemplate($id, 0);\n array_unshift($branch, $section);\n $allusers = array();\n $allgroups = array();\n while ($section->parent > 0) {\n //\t\t\t$ploc = expCore::makeLocation('navigationController', null, $section);\n $allusers = array_merge($allusers, $db->selectColumn('userpermission', 'uid', \"permission='manage' AND module='navigation' AND internal=\" . $section->parent));\n $allgroups = array_merge($allgroups, $db->selectColumn('grouppermission', 'gid', \"permission='manage' AND module='navigation' AND internal=\" . $section->parent));\n $section = $db->selectObject('section', 'id=' . $section->parent);\n }\n foreach ($branch as $section) {\n $sloc = expCore::makeLocation('navigation', null, $section->id);\n // remove any manage permissions for this page and it's children\n // $db->delete('userpermission', \"module='navigationController' AND internal=\".$section->id);\n // $db->delete('grouppermission', \"module='navigationController' AND internal=\".$section->id);\n foreach ($allusers as $uid) {\n $u = user::getUserById($uid);\n expPermissions::grant($u, 'manage', $sloc);\n }\n foreach ($allgroups as $gid) {\n $g = group::getGroupById($gid);\n expPermissions::grantGroup($g, 'manage', $sloc);\n }\n }\n }",
" function manage() {\n global $db, $router, $user;",
" expHistory::set('manageable', $router->params);\n assign_to_template(array(\n 'canManageStandalones' => self::canManageStandalones(),\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\n 'user' => $user,\n// 'canManagePagesets' => $user->isAdmin(),\n// 'templates' => $db->selectObjects('section_template', 'parent=0'),\n ));\n }",
" public function manage_sitemap() {\n global $db, $user, $sectionObj, $sections;",
" expHistory::set('viewable', $this->params);\n $id = $sectionObj->id;\n $current = null;\n // all we need to do is determine the current section\n $navsections = $sections;\n if ($sectionObj->parent == -1) {\n $current = $sectionObj;\n } else {\n foreach ($navsections as $section) {\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n assign_to_template(array(\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\n 'sections' => $navsections,\n 'current' => $current,\n 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),\n ));\n }",
" /**\n * Ajax request for specific pages as json date to yui tree\n */\n public static function returnChildrenAsJSON() {\n global $db;",
" //$nav = section::levelTemplate(intval($_REQUEST['id'], 0));\n $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;\n $nav = $db->selectObjects('section', 'parent=' . $id, 'rank');\n //FIXME $manage_all is moot w/ cascading perms now?\n $manage_all = false;\n if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) {\n $manage_all = true;\n }\n //FIXME recode to use foreach $key=>$value\n $navcount = count($nav);\n for ($i = 0; $i < $navcount; $i++) {\n if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) {\n $nav[$i]->manage = 1;\n $view = true;\n } else {\n $nav[$i]->manage = 0;\n $view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id));\n }\n $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name);\n if (!$view) unset($nav[$i]);\n }\n $nav= array_values($nav);\n// $nav[$navcount - 1]->last = true;\n if (count($nav)) $nav[count($nav) - 1]->last = true;\n// echo expJavascript::ajaxReply(201, '', $nav);\n $ar = new expAjaxReply(201, '', $nav);\n $ar->send();\n }",
" /**\n * Ajax request for all pages as json date to jstree\n */\n public static function returnChildrenAsJSON2() {\n global $db;",
" $icons = array(\n 0 => 'addpage',\n 1 => 'addextpage',\n 2 => 'addintpage',\n 3 => 'addfreeform',\n );",
" $navs = $db->selectObjects('section', 'parent!=-1', 'rank');\n foreach ($navs as $i=>$nav) {\n $navs[$i]->parent = $nav->parent?$nav->parent:'#';\n $navs[$i]->text = $nav->name;\n $navs[$i]->icon = $icons[$nav->alias_type];\n if (!$nav->active) {\n $navs[$i]->icon .= ' inactive';\n $attr = new stdClass();\n $attr->class = 'inactive'; // class to obscure elements\n $navs[$i]->a_attr = $attr;\n }\n if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $navs[$i]->id))) {\n $navs[$i]->manage = 1;\n $view = true;\n } else {\n $navs[$i]->manage = 0;\n $navs[$i]->state->disabled = true;\n $view = $navs[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $navs[$i]->id));\n }\n $navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name);\n if (!$view) {\n// unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child\n $attr = new stdClass();\n $attr->class = 'hidden'; // bs3 class to hide elements\n $navs[$i]->li_attr = $attr;\n }\n }\n $navs= array_values($navs);\n// header('Content-Type: application/json; charset=utf8');\n\t\techo json_encode($navs);\n// echo expJavascript::ajaxReply(201, '', $navs);\n exit;\n }",
" /**\n * Ajax function to reorder page hierarchy from yui tree control\n */\n public static function DragnDropReRank() {\n global $db, $router;",
" $move = $router->params['move'];\n $target = $router->params['target'];\n $type = $router->params['type'];\n $targSec = $db->selectObject(\"section\",\"id=\".$target);\n// $targSec = new section($target);\n $check_id = $targSec->parent;\n $moveSec = $db->selectObject(\"section\",\"id=\".$move);\n// $moveSec = new section($move);",
" // dropped on top of page\n if ($type == \"append\") {\n //save the old parent in case we are changing the depth of the moving section\n $oldParent = $moveSec->parent;\n //assign the parent of the moving section to the ID of the target section\n $moveSec->parent = $targSec->id;\n //set the rank of the moving section to 0 since it will appear first in the new order\n $moveSec->rank = 1;\n //select all children currently of the parent we're about to append to\n $targSecChildren = $db->selectObjects(\"section\", \"parent=\" . $targSec->id . \" ORDER BY rank\");\n //update the ranks of the children to +1 higher to accommodate our new rank 0 section being moved in.\n $newrank = 1;\n foreach ($targSecChildren as $value) {\n if ($value->id != $moveSec->id) {\n $value->rank = $newrank;\n $db->updateObject($value, 'section');\n $newrank++;\n }\n }\n $db->updateObject($moveSec, 'section');\n if ($oldParent != $moveSec->parent) {\n //we need to re-rank the children of the parent that the miving section has just left\n $childOfLastMove = $db->selectObjects(\"section\", \"parent=\" . $oldParent . \" ORDER BY rank\");\n for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) {\n $childOfLastMove[$i]->rank = $i;\n $db->updateObject($childOfLastMove[$i], 'section');\n }",
" }\n// echo $moveSec->name . \" was appended to \" . $targSec->name;",
" } elseif ($type == \"after\") { // dropped between (after) pages\n if ($targSec->parent == $moveSec->parent) {\n //are we moving up...\n if ($targSec->rank < $moveSec->rank) {\n $moveSec->rank = $targSec->rank + 1;\n $moveNextSiblings = $db->selectObjects(\"section\", \"id!=\" . $moveSec->id . \" AND parent=\" . $targSec->parent . \" AND rank>\" . $targSec->rank . \" ORDER BY rank\");\n $rerank = $moveSec->rank + 1;\n foreach ($moveNextSiblings as $value) {\n if ($value->id != $moveSec->id) {\n $value->rank = $rerank;\n $db->updateObject($value, 'section');\n $rerank++;\n }\n }\n $db->updateObject($targSec, 'section');\n// $targSec->update();\n $db->updateObject($moveSec, 'section');\n// $moveSec->update();\n //or are we moving down...\n } else {\n $targSec->rank = $targSec->rank - 1;\n $moveSec->rank = $targSec->rank + 1;\n $movePreviousSiblings = $db->selectObjects(\"section\", \"id!=\" . $moveSec->id . \" AND parent=\" . $targSec->parent . \" AND rank<=\" . $targSec->rank . \" ORDER BY rank\");\n $rerank = 1;\n foreach ($movePreviousSiblings as $value) {\n if ($value->id != $moveSec->id) {\n $value->rank = $rerank;\n $db->updateObject($value, 'section');\n $rerank++;\n }\n }\n $db->updateObject($targSec, 'section');\n// $targSec->update();\n $db->updateObject($moveSec, 'section');\n// $moveSec->update();\n }\n } else { // 'before', is this used?\n //store ranks from the depth we're moving from. Used to re-rank the level depth the moving section is moving from.\n $oldRank = $moveSec->rank;\n $oldParent = $moveSec->parent;\n //select all children of the target sections parent with a rank higher than it's own\n $moveNextSiblings = $db->selectObjects(\"section\", \"parent=\" . $targSec->parent . \" AND rank>\" . $targSec->rank . \" ORDER BY rank\");\n //update moving sections rank and parent\n $moveSec->rank = $targSec->rank + 1;\n $moveSec->parent = $targSec->parent;\n //$rerank=$moveSec->rank+1;\n foreach ($moveNextSiblings as $value) {\n $value->rank = $value->rank + 1;\n $db->updateObject($value, 'section');\n }\n $db->updateObject($moveSec, 'section');\n //handle re-ranking of previous parent\n $oldSiblings = $db->selectObjects(\"section\", \"parent=\" . $oldParent . \" AND rank>\" . $oldRank . \" ORDER BY rank\");\n $rerank = 1;\n foreach ($oldSiblings as $value) {\n if ($value->id != $moveSec->id) {\n $value->rank = $rerank;\n $db->updateObject($value, 'section');\n $rerank++;\n }\n }\n if ($oldParent != $moveSec->parent) {\n //we need to re-rank the children of the parent that the moving section has just left\n $childOfLastMove = $db->selectObjects(\"section\", \"parent=\" . $oldParent . \" ORDER BY rank\");\n for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) {\n $childOfLastMove[$i]->rank = $i;\n $db->updateObject($childOfLastMove[$i], 'section');\n }\n }\n }\n }\n self::checkForSectionalAdmins($move);\n expSession::clearAllUsersSessionCache('navigation');\n }",
" /**\n * Ajax function to reorder page hierarchy from jstree control\n */\n public static function DragnDropReRank2() {\n global $router, $db;",
" $id = $router->params['id'];\n $page = new section($id);\n $old_rank = $page->rank;\n $old_parent = $page->parent;\n $new_rank = $router->params['position'] + 1; // rank\n $new_parent = intval($router->params['parent']);",
" $db->decrement($page->tablename, 'rank', 1, 'rank>' . $old_rank . ' AND parent=' . $old_parent); // close in hole\n $db->increment($page->tablename, 'rank', 1, 'rank>=' . $new_rank . ' AND parent=' . $new_parent); // make room",
" $params = array();\n $params['parent'] = $new_parent;\n $params['rank'] = $new_rank;\n $page->update($params);",
" self::checkForSectionalAdmins($id);\n expSession::clearAllUsersSessionCache('navigation');\n }",
" function edit_section() {\n global $db, $user;",
" $parent = new section($this->params['parent']);\n if (empty($parent->id)) $parent->id = 0;\n assign_to_template(array(\n 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0),\n 'parent' => $parent,\n 'isAdministrator' => $user->isAdmin(),\n ));\n }",
" function edit_contentpage() {\n //FIXME we come here for new/edit content/standalone pages\n // FIXME: Allow non-administrative users to manage certain parts of the section hierarchy.\n //if ($user->is_acting_admin == 1 /*TODO: section admin*/) {\n// $section = null;\n $section = new stdClass();\n if (isset($this->params['id'])) {\n // Check to see if an id was passed in get. If so, retrieve that section from\n // the database, and perform an edit on it.\n $section = $this->section->find($this->params['id']);\n } elseif (isset($this->params['parent'])) {\n // The isset check is merely a precaution. This action should\n // ALWAYS be invoked with a parent or id value.\n $section = new section($this->params);\n } else {\n notfoundController::handle_not_found();\n exit;\n }\n if (!empty($section->id)) {\n $check_id = $section->id;\n } else {\n $check_id = $section->parent;\n }\n if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) {\n if (empty($section->id)) {\n $section->active = 1;\n $section->public = 1;\n if (!isset($section->parent)) {\n // This is another precaution. The parent attribute\n // should ALWAYS be set by the caller.\n //FJD - if that's the case, then we should die.\n notfoundController::handle_not_authorized();\n exit;\n //$section->parent = 0;\n }\n }\n assign_to_template(array(\n 'section' => $section,\n 'glyphs' => self::get_glyphs(),\n ));\n } else { // User does not have permission to manage sections. Throw a 403\n notfoundController::handle_not_authorized();\n }\n }",
" private static function get_glyphs() {\n if (bs()) {\n require_once(BASE . 'external/font-awesome.class.php');\n $fa = new Smk_FontAwesome;\n if (bs3()) {\n $icons = $fa->getArray(BASE . 'external/font-awesome4/css/font-awesome.css');\n $icons = $fa->sortByName($icons);\n return $fa->nameGlyph($icons);\n } elseif (bs2()) {\n expCSS::auto_compile_less(\n 'external/font-awesome/less/font-awesome.less',\n 'external/font-awesome/css/font-awesome.css'\n ); // font-awesome is included within bootstrap2, but not as a separate .css file\n $icons = $fa->getArray(BASE . 'external/font-awesome/css/font-awesome.css', 'icon-');\n return $fa->nameGlyph($icons, 'icon-');\n }\n } else {\n return array();\n }\n }",
" function edit_internalalias() {\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\n if ($section->parent == -1) {\n notfoundController::handle_not_found();\n exit;\n } // doesn't work for standalone pages\n if (empty($section->id)) {\n $section->public = 1;\n if (!isset($section->parent)) {\n // This is another precaution. The parent attribute\n // should ALWAYS be set by the caller.\n //FJD - if that's the case, then we should die.\n notfoundController::handle_not_authorized();\n exit;\n //$section->parent = 0;\n }\n }\n assign_to_template(array(\n 'section' => $section,\n 'glyphs' => self::get_glyphs(),\n ));\n }",
" function edit_freeform() {\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\n if ($section->parent == -1) {\n notfoundController::handle_not_found();\n exit;\n } // doesn't work for standalone pages\n if (empty($section->id)) {\n $section->public = 1;\n if (!isset($section->parent)) {\n // This is another precaution. The parent attribute\n // should ALWAYS be set by the caller.\n //FJD - if that's the case, then we should die.\n notfoundController::handle_not_authorized();\n exit;\n //$section->parent = 0;\n }\n }\n assign_to_template(array(\n 'section' => $section,\n 'glyphs' => self::get_glyphs(),\n ));\n }",
" function edit_externalalias() {\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\n if ($section->parent == -1) {\n notfoundController::handle_not_found();\n exit;\n } // doesn't work for standalone pages\n if (empty($section->id)) {\n $section->public = 1;\n if (!isset($section->parent)) {\n // This is another precaution. The parent attribute\n // should ALWAYS be set by the caller.\n //FJD - if that's the case, then we should die.\n notfoundController::handle_not_authorized();\n exit;\n //$section->parent = 0;\n }\n }\n assign_to_template(array(\n 'section' => $section,\n 'glyphs' => self::get_glyphs(),\n ));\n }",
" function update() {\n parent::update();\n expSession::clearAllUsersSessionCache('navigation');\n }",
" function move_standalone() {\n expSession::clearAllUsersSessionCache('navigation');\n assign_to_template(array(\n 'parent' => $this->params['parent'],\n ));\n }",
" /**\n * Move standalone back to hierarchy\n *\n */\n function reparent_standalone() {\n $standalone = $this->section->find($this->params['page']);\n if ($standalone) {\n $standalone->parent = $this->params['parent'];\n $standalone->update();\n expSession::clearAllUsersSessionCache('navigation');\n expHistory::back();\n } else {\n notfoundController::handle_not_found();\n }\n }",
" /**\n * Move content page to standalones\n *\n */\n function remove() {\n global $db;",
" $section = $db->selectObject('section', 'id=' . $this->params['id']);\n if ($section) {\n section::removeLevel($section->id);\n $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent);\n $section->parent = -1;\n $db->updateObject($section, 'section');\n expSession::clearAllUsersSessionCache('navigation');\n expHistory::back();\n } else {\n notfoundController::handle_not_authorized();\n }\n }",
" function delete_standalones() {\n if (!empty($this->params['deleteit'])) {\n foreach ($this->params['deleteit'] as $page) {\n $section = new section(intval($page));\n if ($section) {\n// self::deleteLevel($section->id);\n $section->delete();\n }\n }\n }\n expSession::clearAllUsersSessionCache('navigation');\n expHistory::back();\n }",
" /**\n * permission functions to aggregate a module's visible permissions based on add/remove permissions\n *\n * @return array\n */\n public function permissions() {\n //set the permissions array\n return $this->add_permissions;\n }",
" // create a psuedo global manage pages permission\n public static function checkPermissions($permission,$location) {\n global $exponent_permissions_r, $router;",
" // only applies to the 'manage' method\n if (empty($location->src) && empty($location->int) && ((!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false)) {\n if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) {\n foreach ($page as $pageperm) {\n if (!empty($pageperm['manage'])) return true;\n }\n }\n }\n return false;\n }",
" /**\n * Rebuild the sectionref table as a list of modules on a page\n * @deprecated 2.3.4 moved to sectionref model\n */\n public static function rebuild_sectionrefs() {\n global $db;",
" // recursive run though all the nested containers\n function scan_container($container_id, $page_id) {\n global $db;",
" $containers = $db->selectObjects('container',\"external='\" . $container_id . \"'\");\n $ret = '';\n foreach ($containers as $container) {\n $iLoc = expUnserialize($container->internal);\n $newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id);\n if (!empty($newret)) $ret .= $newret . '<br>';\n if ($iLoc->mod == 'container') {\n $ret .= scan_container($container->internal, $page_id);\n }\n }\n return $ret;\n }",
" // recursive run through all the nested pages\n function scan_page($parent_id) {\n global $db;",
" $sections = $db->selectObjects('section','parent=' . $parent_id);\n $ret = '';\n foreach ($sections as $page) {\n $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));\n $ret .= scan_container($cLoc, $page->id);\n $ret .= scan_page($page->id);\n }\n return $ret;\n }",
" // first remove duplicate records\n $db->sql('DELETE FROM ' . $db->prefix . 'sectionref WHERE id NOT IN (SELECT * FROM (SELECT MIN(n.id) FROM ' . $db->prefix . 'sectionref n GROUP BY n.module, n.source) x)');\n $ret = scan_page(0); // the page hierarchy\n $ret .= scan_page(-1); // now the stand alone pages",
" // we need to get the non-main containers such as sidebars, footers, etc...\n $hardcodedmods = $db->selectObjects('sectionref',\"refcount=1000 AND source NOT LIKE '%@section%' AND source NOT LIKE '%@random%'\");\n foreach ($hardcodedmods as $hardcodedmod) {\n if ($hardcodedmod->module == 'container') {\n $page_id = intval(preg_replace('/\\D/', '', $hardcodedmod->source));\n if (empty($page_id)) {\n $page_id = SITE_DEFAULT_SECTION; // we'll default to the home page\n }\n $ret .= scan_container(serialize(expCore::makeLocation($hardcodedmod->module, $hardcodedmod->source)), $page_id);\n } else {\n $hardcodedmod->section = 0; // this is a hard-coded non-container module\n $db->updateObject($hardcodedmod, 'sectionref');\n }\n }",
" // mark modules in the recycle bin as section 0\n $db->columnUpdate('sectionref', 'section', 0, \"refcount=0\");\n// $recycledmods = $db->selectObjects('sectionref',\"refcount=0\");\n// foreach ($recycledmods as $recycledmod) {\n// $recycledmod->section = 0; // this is a module in the recycle bin\n// $db->updateObject($recycledmod, 'sectionref');\n// }\n return $ret;\n }",
"}\n",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class newsController extends expController {\n public $useractions = array(\n 'showall'=>'Show all News',\n 'tags'=>\"Tags\",\n );",
"",
" public $remove_configs = array(\n 'categories',\n 'comments',\n// 'ealerts',\n// 'facebook',\n// 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" protected $add_permissions = array(\n 'showUnpublished'=>'View Unpublished News',\n 'import'=>'Import News Items',\n 'export'=>'Export News Items'\n );",
"\n static function displayname() { return gt(\"News\"); }\n static function description() { return gt(\"Display & manage news type content on your site.\"); }\n static function isSearchable() { return true; }",
" static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" public function showall() {\n expHistory::set('viewable', $this->params);\n // figure out if should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $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\n $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.\n if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items);",
" ",
" // setup the pagination object to paginate the news stories.\n $page = new expPaginator(array(\n 'records'=>$items,\n 'limit'=>$limit,\n 'order'=>$order,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view']\n ));",
" ",
" assign_to_template(array(\n 'page'=>$page,\n 'items'=>$page->records,\n 'rank'=>($order==='rank')?1:0,\n 'params'=>$this->params,\n ));\n }",
" public function showall_by_date() {\n\t expHistory::set('viewable', $this->params);\n if (!empty($this->params['day'])) {\n $start_date = expDateTime::startOfDayTimestamp(mktime(0, 0, 0, $this->params['month'], $this->params['day'], $this->params['year']));\n $end_date = expDateTime::endOfDayTimestamp(mktime(23, 59, 59, $this->params['month'], $this->params['day'], $this->params['year']));\n $format_date = DISPLAY_DATE_FORMAT;\n } elseif (!empty($this->params['month'])) {\n $start_date = expDateTime::startOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));\n $end_date = expDateTime::endOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));\n $format_date = \"%B %Y\";\n } elseif (!empty($this->params['year'])) {\n $start_date = expDateTime::startOfYearTimestamp(mktime(0, 0, 0, 1, 1, $this->params['year']));\n $end_date = expDateTime::endOfYearTimestamp(mktime(23, 59, 59, 12, 31, $this->params['year']));\n $format_date = \"%Y\";\n } else {\n exit();\n }",
"\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n// 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"publish >= '\".$start_date.\"' AND publish <= '\".$end_date.\"'\",\n 'where'=>\"publish >= '\".$start_date.\"' AND publish <= '\".$end_date.\"'\",\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'dir'=>'desc',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('News for').' \"'.expDateTime::format_date($start_date,$format_date).'\"')\n );\n\t}",
" public function show() {\n expHistory::set('viewable', $this->params);\n // figure out if we're looking this up by id or title\n $id = null;\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {",
" $id = $this->params['title'];",
" }",
" $record = new news($id);\n if (empty($record->id))\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));",
" $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc->src = $r_loc->src;\n }",
" $order = !empty($config['order']) ? $config['order'] : 'publish DESC';\n if (strstr($order,\" \")) {\n $orderby = explode(\" \",$order);\n $order = $orderby[0];\n $order_direction = $orderby[1];\n } else {\n $order_direction = '';\n }\n if ($order_direction == 'DESC') {\n $order_direction_next = '';\n } else {\n $order_direction_next = 'DESC';\n }\n $nextwhere = $this->aggregateWhereClause().' AND '.$order.' > '.$record->$order.' ORDER BY '.$order.' '.$order_direction_next;\n $record->next = $record->find('first',$nextwhere);\n $prevwhere = $this->aggregateWhereClause().' AND '.$order.' < '.$record->$order.' ORDER BY '.$order.' '.$order_direction;\n $record->prev = $record->find('first',$prevwhere);",
" assign_to_template(array(\n 'record'=>$record,\n 'config'=>$config,\n 'params'=>$this->params\n ));\n }",
" public function showUnpublished() {\n expHistory::set('viewable', $this->params);",
" ",
" // setup the where clause for looking up records.\n $where = parent::aggregateWhereClause();\n $where = \"((unpublish != 0 AND unpublish < \".time().\") OR (publish > \".time().\")) AND \".$where;\n if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1';",
" $page = new expPaginator(array(\n 'model'=>'news',\n 'where'=>$where,\n 'limit'=>25,\n 'order'=>'unpublish',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title',\n gt('Published On')=>'publish',\n gt('Status')=>'unpublish'\n ),\n ));",
" ",
" assign_to_template(array(\n 'page'=>$page\n ));\n }",
" ",
" public function showExpired() {\n redirect_to(array('controller'=>'news', 'action'=>'showUnpublished','src'=>$this->params['src']));\n }",
" ",
"// public function configure() {\n// parent::configure();\n// assign_to_template(array('sortopts'=>$this->sortopts));\n// }",
" \n public function saveConfig() { ",
" if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) {\n if ($this->params['order'] == 'rank ASC') {\n expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params);\n }\n }",
" \n parent::saveConfig();\n }\n ",
" public function getRSSContent($limit = 0) {\n // pull the news posts from the database\n $items = $this->news->find('all', $this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'publish DESC', $limit);",
" //Convert the newsitems to rss items\n $rssitems = array();",
" foreach ($items as $key => $item) { ",
" $rss_item = new FeedItem();\n $rss_item->title = expString::convertSmartQuotes($item->title);\n $rss_item->link = $rss_item->guid = makeLink(array('controller'=>'news', 'action'=>'show', 'title'=>$item->sef_url));\n $rss_item->description = expString::convertSmartQuotes($item->body);\n $rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n $rss_item->authorEmail = user::getEmailById($item->poster);\n// $rss_item->date = date(DATE_RSS,$item->publish_date);\n $rss_item->date = $item->publish_date;\n $rssitems[$key] = $rss_item;",
" if ($limit && count($rssitems) >= $limit)\n break;\n }\n return $rssitems;\n }",
" /**\n * Pull RSS Feed and display as news items\n *\n * @param $items\n * @return array\n */\n private function mergeRssData($items) {",
" if (!empty($this->config['pull_rss'])) { ",
" $RSS = new SimplePie();\n\t $RSS->set_cache_location(BASE.'tmp/rsscache'); // default is ./cache\n//\t $RSS->set_cache_duration(3600); // default is 3600\n\t $RSS->set_timeout(20); // default is 10\n//\t $RSS->set_output_encoding('UTF-8'); // default is UTF-8\n $news = array();\n foreach($this->config['pull_rss'] as $url) {\n $RSS->set_feed_url($url);\n $feed = $RSS->init();\n if (!$feed) {\n // an error occurred in the rss.\n continue;\n }\n\t $RSS->handle_content_type();\n foreach ($RSS->get_items() as $rssItem) {\n $rssObject = new stdClass();\n $rssObject->title = $rssItem->get_title();\n $rssObject->body = $rssItem->get_description();\n $rssObject->rss_link = $rssItem->get_permalink();\n $rssObject->publish = $rssItem->get_date('U');\n $rssObject->publish_date = $rssItem->get_date('U');\n $rssObject->poster = $rssItem->get_author()->get_name();\n $rssObject->isRss = true;\n\t\t\t\t\t$t = explode(' • ',$rssObject->title);\n\t\t\t\t\t$rssObject->forum = $t[0];\n\t\t\t\t\tif (!empty($t[1])) {\n $rssObject->topic = $t[1];\n } else {\n $t = explode(' • ',$rssObject->title);\n $rssObject->forum = $t[0];\n if (!empty($t[1])) {\n $rssObject->topic = $t[1];\n }\n }\n $news[] = $rssObject;\n }\n }\n $items = array_merge($items, $news);\n }\n return $items;\n }",
" /**\n * additional check for display of search hit, only display published\n *\n * @param $record\n *\n * @return bool\n */\n public static function searchHit($record) {\n $news = new news($record->original_id);\n if (expPermissions::check('showUnpublished', expUnserialize($record->location_data)) || ($news->publish == 0 || $news->publish <= time()) && ($news->unpublish == 0 || $news->unpublish > time())) {\n return true;\n } else {\n return false;\n }\n }",
" private function sortDescending($a,$b) {\n return ($a->publish_date > $b->publish_date ? -1 : 1);\n }",
" private function sortAscending($a,$b) {\n return ($a->publish_date < $b->publish_date ? -1 : 1);\n }",
" /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n \tfunction aggregateWhereClause($type='') {\n $sql = parent::aggregateWhereClause();\n $sql = \"(publish = 0 or publish <= \" . time() . \") AND (unpublish=0 OR unpublish > \".time().\") AND \".$sql;\n if (isset($this->config['only_featured'])) $sql .= ' AND is_featured=1';",
" return $sql;\n }",
" /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_fb($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['type'] = 'article';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $metainfo['title'] = substr(empty($object->meta_fb['title']) ? $object->title : $object->meta_fb['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_fb['description']) ? $desc : $object->meta_fb['description'], 0, 199);\n $metainfo['url'] = empty($object->meta_fb['url']) ? $canonical : $object->meta_fb['url'];\n $metainfo['image'] = empty($object->meta_fb['fbimage'][0]) ? '' : $object->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n $config = expConfig::getConfig($object->location_data);\n if (!empty($config['expFile']['fbimage'][0]))\n $file = new expFile($config['expFile']['fbimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
" /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_tw($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['card'] = 'summary';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $config = expConfig::getConfig($object->location_data);\n if (!empty($object->meta_tw['twsite'])) {\n $metainfo['site'] = $object->meta_tw['twsite'];\n } elseif (!empty($config['twsite'])) {\n $metainfo['site'] = $config['twsite'];\n }\n $metainfo['title'] = substr(empty($object->meta_tw['title']) ? $object->title : $object->meta_tw['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_tw['description']) ? $desc : $object->meta_tw['description'], 0, 199);\n $metainfo['image'] = empty($object->meta_tw['twimage'][0]) ? '' : $object->meta_tw['twimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n if (!empty($config['expFile']['twimage'][0]))\n $file = new expFile($config['expFile']['twimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
"// function import() {\n// $pullable_modules = expModules::listInstalledControllers('news');\n// $modules = new expPaginator(array(\n// 'records' => $pullable_modules,\n// 'controller' => $this->loc->mod,\n// 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n// 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n// 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n// 'columns' => array(\n// gt('Title') => 'title',\n// gt('Page') => 'section'\n// ),\n// ));\n//\n// assign_to_template(array(\n// 'modules' => $modules,\n// ));\n// }\n//\n// function import_select() {\n// //Get the temp directory to put the uploaded file\n// $directory = \"tmp\";\n//\n// //Get the file save it to the temp directory\n// if ($_FILES[\"import_file\"][\"error\"] == UPLOAD_ERR_OK) {\n// $file = expFile::fileUpload(\"import_file\", false, false, time() . \"_\" . $_FILES['import_file']['name'], $directory.'/');\n// if ($file == null) {\n// switch ($_FILES[\"import_file\"][\"error\"]) {\n// case UPLOAD_ERR_INI_SIZE:\n// case UPLOAD_ERR_FORM_SIZE:\n// $this->params['_formError'] = gt('The file you attempted to upload is too large. Contact your system administrator if this is a problem.');\n// break;\n// case UPLOAD_ERR_PARTIAL:\n// $this->params['_formError'] = gt('The file was only partially uploaded.');\n// break;\n// case UPLOAD_ERR_NO_FILE:\n// $this->params['_formError'] = gt('No file was uploaded.');\n// break;\n// default:\n// $this->params['_formError'] = gt('A strange internal error has occurred. Please contact the Exponent Developers.');\n// break;\n// }\n// expSession::set(\"last_POST\", $this->params);\n// header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n// exit(\"\");\n// } else {\n// $errors = array();\n// $data = expFile::parseDatabase(BASE . $directory . \"/\" . $file->filename, $errors, 'news');\n// if (!empty($errors)) {\n// $message = gt('Importing encountered the following errors') . ':<br>';\n// foreach ($errors as $error) {\n// $message .= '* ' . $error . '<br>';\n// }\n// flash('error', $message);\n// }\n//\n// assign_to_template(array(\n// 'items' => $data['news']->records,\n// 'filename' => $directory . \"/\" . $file->filename,\n// 'source' => $this->params['aggregate'][0]\n// ));\n// }\n// }\n// }\n//\n// function import_process() {\n// $filename = $this->params['filename'];\n// $src = $this->params['source'];\n// $selected = $this->params['items'];\n// $errors = array();\n// $data = expFile::parseDatabase(BASE . $filename, $errors, 'news');\n// foreach ($selected as $select) {\n// $item = new news();\n// foreach ($data['news']->records[$select] as $key => $value) {\n// if ($key != 'id' && $key != 'location_data') {\n// $item->$key = $value;\n// }\n// }\n// $item->id = null;\n// $item->rank = null;\n// $item->location_data = serialize(expCore::makeLocation('news', $src));\n// $item->save();\n// }\n// flash('message', count($selected) . ' ' . gt('News items were imported.'));\n// expHistory::back();\n// }\n//\n// function export() {\n// $pullable_modules = expModules::listInstalledControllers('news');\n// $modules = new expPaginator(array(\n// 'records' => $pullable_modules,\n// 'controller' => $this->loc->mod,\n// 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n// 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n// 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n// 'columns' => array(\n// gt('Title') => 'title',\n// gt('Page') => 'section'\n// ),\n// ));\n// assign_to_template(array(\n// 'modules' => $modules,\n// ));\n// }\n//\n// function export_process() {\n// if (!empty($this->params['aggregate'])) {\n// $selected = $this->params['aggregate'];\n// $where = '(';\n// foreach ($selected as $key=>$src) {\n// if ($key) $where .= ' OR ';\n// $where .= \"location_data='\" . serialize(expCore::makeLocation('news', $src)) . \"'\";\n// }\n// $where .= ')';\n//\n// $filename = 'news.eql';\n//\n// ob_end_clean();\n// ob_start(\"ob_gzhandler\");\n//\n// // 'application/octet-stream' is the registered IANA type but\n// // MSIE and Opera seems to prefer 'application/octetstream'\n// $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';\n//\n// header('Content-Type: ' . $mime_type);\n// header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n// // IE need specific headers\n// if (EXPONENT_USER_BROWSER == 'IE') {\n// header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n// header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n// header('Pragma: public');\n// } else {\n// header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n// header('Pragma: no-cache');\n// }\n// echo expFile::dumpDatabase('news', 'export', $where);\n// exit; // Exit, since we are exporting\n// }\n// expHistory::back();\n// }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class newsController extends expController {\n public $useractions = array(\n 'showall'=>'Show all News',\n 'tags'=>\"Tags\",\n );",
" protected $add_permissions = array(\n 'showUnpublished'=>'View Unpublished News',\n 'showExpired'=>'View Unpublished News',\n );\n protected $manage_permissions = array(\n 'import'=>'Import News Items',\n 'export'=>'Export News Items'\n );",
" public $remove_configs = array(\n 'categories',\n 'comments',\n// 'ealerts',\n// 'facebook',\n// 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
"",
"\n static function displayname() { return gt(\"News\"); }\n static function description() { return gt(\"Display & manage news type content on your site.\"); }\n static function isSearchable() { return true; }",
" static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" public function showall() {\n expHistory::set('viewable', $this->params);\n // figure out if should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $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\n $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.\n if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items);",
"",
" // setup the pagination object to paginate the news stories.\n $page = new expPaginator(array(\n 'records'=>$items,\n 'limit'=>$limit,\n 'order'=>$order,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view']\n ));",
"",
" assign_to_template(array(\n 'page'=>$page,\n 'items'=>$page->records,\n 'rank'=>($order==='rank')?1:0,\n 'params'=>$this->params,\n ));\n }",
" public function showall_by_date() {\n\t expHistory::set('viewable', $this->params);\n if (!empty($this->params['day'])) {\n $start_date = expDateTime::startOfDayTimestamp(mktime(0, 0, 0, $this->params['month'], $this->params['day'], $this->params['year']));\n $end_date = expDateTime::endOfDayTimestamp(mktime(23, 59, 59, $this->params['month'], $this->params['day'], $this->params['year']));\n $format_date = DISPLAY_DATE_FORMAT;\n } elseif (!empty($this->params['month'])) {\n $start_date = expDateTime::startOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));\n $end_date = expDateTime::endOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));\n $format_date = \"%B %Y\";\n } elseif (!empty($this->params['year'])) {\n $start_date = expDateTime::startOfYearTimestamp(mktime(0, 0, 0, 1, 1, $this->params['year']));\n $end_date = expDateTime::endOfYearTimestamp(mktime(23, 59, 59, 12, 31, $this->params['year']));\n $format_date = \"%Y\";\n } else {\n exit();\n }",
"\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n// 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"publish >= '\".$start_date.\"' AND publish <= '\".$end_date.\"'\",\n 'where'=>\"publish >= '\".$start_date.\"' AND publish <= '\".$end_date.\"'\",\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'dir'=>'desc',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('News for').' \"'.expDateTime::format_date($start_date,$format_date).'\"')\n );\n\t}",
" public function show() {\n expHistory::set('viewable', $this->params);\n // figure out if we're looking this up by id or title\n $id = null;\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {",
" $id = expString::escape($this->params['title']);",
" }",
" $record = new news($id);\n if (empty($record->id))\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));",
" $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc->src = $r_loc->src;\n }",
" $order = !empty($config['order']) ? $config['order'] : 'publish DESC';\n if (strstr($order,\" \")) {\n $orderby = explode(\" \",$order);\n $order = $orderby[0];\n $order_direction = $orderby[1];\n } else {\n $order_direction = '';\n }\n if ($order_direction == 'DESC') {\n $order_direction_next = '';\n } else {\n $order_direction_next = 'DESC';\n }\n $nextwhere = $this->aggregateWhereClause().' AND '.$order.' > '.$record->$order.' ORDER BY '.$order.' '.$order_direction_next;\n $record->next = $record->find('first',$nextwhere);\n $prevwhere = $this->aggregateWhereClause().' AND '.$order.' < '.$record->$order.' ORDER BY '.$order.' '.$order_direction;\n $record->prev = $record->find('first',$prevwhere);",
" assign_to_template(array(\n 'record'=>$record,\n 'config'=>$config,\n 'params'=>$this->params\n ));\n }",
" public function showUnpublished() {\n expHistory::set('viewable', $this->params);",
"",
" // setup the where clause for looking up records.\n $where = parent::aggregateWhereClause();\n $where = \"((unpublish != 0 AND unpublish < \".time().\") OR (publish > \".time().\")) AND \".$where;\n if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1';",
" $page = new expPaginator(array(\n 'model'=>'news',\n 'where'=>$where,\n 'limit'=>25,\n 'order'=>'unpublish',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title',\n gt('Published On')=>'publish',\n gt('Status')=>'unpublish'\n ),\n ));",
"",
" assign_to_template(array(\n 'page'=>$page\n ));\n }",
"",
" public function showExpired() {\n redirect_to(array('controller'=>'news', 'action'=>'showUnpublished','src'=>$this->params['src']));\n }",
"",
"// public function configure() {\n// parent::configure();\n// assign_to_template(array('sortopts'=>$this->sortopts));\n// }",
"\n public function saveconfig() {",
" if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) {\n if ($this->params['order'] == 'rank ASC') {\n expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params);\n }\n }",
"\n parent::saveconfig();\n }\n",
" public function getRSSContent($limit = 0) {\n // pull the news posts from the database\n $items = $this->news->find('all', $this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'publish DESC', $limit);",
" //Convert the newsitems to rss items\n $rssitems = array();",
" foreach ($items as $key => $item) {",
" $rss_item = new FeedItem();\n $rss_item->title = expString::convertSmartQuotes($item->title);\n $rss_item->link = $rss_item->guid = makeLink(array('controller'=>'news', 'action'=>'show', 'title'=>$item->sef_url));\n $rss_item->description = expString::convertSmartQuotes($item->body);\n $rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n $rss_item->authorEmail = user::getEmailById($item->poster);\n// $rss_item->date = date(DATE_RSS,$item->publish_date);\n $rss_item->date = $item->publish_date;\n $rssitems[$key] = $rss_item;",
" if ($limit && count($rssitems) >= $limit)\n break;\n }\n return $rssitems;\n }",
" /**\n * Pull RSS Feed and display as news items\n *\n * @param $items\n * @return array\n */\n private function mergeRssData($items) {",
" if (!empty($this->config['pull_rss'])) {",
" $RSS = new SimplePie();\n\t $RSS->set_cache_location(BASE.'tmp/rsscache'); // default is ./cache\n//\t $RSS->set_cache_duration(3600); // default is 3600\n\t $RSS->set_timeout(20); // default is 10\n//\t $RSS->set_output_encoding('UTF-8'); // default is UTF-8\n $news = array();\n foreach($this->config['pull_rss'] as $url) {\n $RSS->set_feed_url($url);\n $feed = $RSS->init();\n if (!$feed) {\n // an error occurred in the rss.\n continue;\n }\n\t $RSS->handle_content_type();\n foreach ($RSS->get_items() as $rssItem) {\n $rssObject = new stdClass();\n $rssObject->title = $rssItem->get_title();\n $rssObject->body = $rssItem->get_description();\n $rssObject->rss_link = $rssItem->get_permalink();\n $rssObject->publish = $rssItem->get_date('U');\n $rssObject->publish_date = $rssItem->get_date('U');\n $rssObject->poster = $rssItem->get_author()->get_name();\n $rssObject->isRss = true;\n\t\t\t\t\t$t = explode(' • ',$rssObject->title);\n\t\t\t\t\t$rssObject->forum = $t[0];\n\t\t\t\t\tif (!empty($t[1])) {\n $rssObject->topic = $t[1];\n } else {\n $t = explode(' • ',$rssObject->title);\n $rssObject->forum = $t[0];\n if (!empty($t[1])) {\n $rssObject->topic = $t[1];\n }\n }\n $news[] = $rssObject;\n }\n }\n $items = array_merge($items, $news);\n }\n return $items;\n }",
" /**\n * additional check for display of search hit, only display published\n *\n * @param $record\n *\n * @return bool\n */\n public static function searchHit($record) {\n $news = new news($record->original_id);\n if (expPermissions::check('showUnpublished', expUnserialize($record->location_data)) || ($news->publish == 0 || $news->publish <= time()) && ($news->unpublish == 0 || $news->unpublish > time())) {\n return true;\n } else {\n return false;\n }\n }",
" private function sortDescending($a,$b) {\n return ($a->publish_date > $b->publish_date ? -1 : 1);\n }",
" private function sortAscending($a,$b) {\n return ($a->publish_date < $b->publish_date ? -1 : 1);\n }",
" /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n \tfunction aggregateWhereClause($type='') {\n $sql = parent::aggregateWhereClause();\n $sql = \"(publish = 0 or publish <= \" . time() . \") AND (unpublish=0 OR unpublish > \".time().\") AND \".$sql;\n if (isset($this->config['only_featured'])) $sql .= ' AND is_featured=1';",
" return $sql;\n }",
" /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_fb($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['type'] = 'article';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $metainfo['title'] = substr(empty($object->meta_fb['title']) ? $object->title : $object->meta_fb['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_fb['description']) ? $desc : $object->meta_fb['description'], 0, 199);\n $metainfo['url'] = empty($object->meta_fb['url']) ? $canonical : $object->meta_fb['url'];\n $metainfo['image'] = empty($object->meta_fb['fbimage'][0]) ? '' : $object->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n $config = expConfig::getConfig($object->location_data);\n if (!empty($config['expFile']['fbimage'][0]))\n $file = new expFile($config['expFile']['fbimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
" /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_tw($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['card'] = 'summary';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $config = expConfig::getConfig($object->location_data);\n if (!empty($object->meta_tw['twsite'])) {\n $metainfo['site'] = $object->meta_tw['twsite'];\n } elseif (!empty($config['twsite'])) {\n $metainfo['site'] = $config['twsite'];\n }\n $metainfo['title'] = substr(empty($object->meta_tw['title']) ? $object->title : $object->meta_tw['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_tw['description']) ? $desc : $object->meta_tw['description'], 0, 199);\n $metainfo['image'] = empty($object->meta_tw['twimage'][0]) ? '' : $object->meta_tw['twimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n if (!empty($config['expFile']['twimage'][0]))\n $file = new expFile($config['expFile']['twimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }",
"// function import() {\n// $pullable_modules = expModules::listInstalledControllers('news');\n// $modules = new expPaginator(array(\n// 'records' => $pullable_modules,\n// 'controller' => $this->loc->mod,\n// 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n// 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n// 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n// 'columns' => array(\n// gt('Title') => 'title',\n// gt('Page') => 'section'\n// ),\n// ));\n//\n// assign_to_template(array(\n// 'modules' => $modules,\n// ));\n// }\n//\n// function import_select() {\n// //Get the temp directory to put the uploaded file\n// $directory = \"tmp\";\n//\n// //Get the file save it to the temp directory\n// if ($_FILES[\"import_file\"][\"error\"] == UPLOAD_ERR_OK) {\n// $file = expFile::fileUpload(\"import_file\", false, false, time() . \"_\" . $_FILES['import_file']['name'], $directory.'/');\n// if ($file == null) {\n// switch ($_FILES[\"import_file\"][\"error\"]) {\n// case UPLOAD_ERR_INI_SIZE:\n// case UPLOAD_ERR_FORM_SIZE:\n// $this->params['_formError'] = gt('The file you attempted to upload is too large. Contact your system administrator if this is a problem.');\n// break;\n// case UPLOAD_ERR_PARTIAL:\n// $this->params['_formError'] = gt('The file was only partially uploaded.');\n// break;\n// case UPLOAD_ERR_NO_FILE:\n// $this->params['_formError'] = gt('No file was uploaded.');\n// break;\n// default:\n// $this->params['_formError'] = gt('A strange internal error has occurred. Please contact the Exponent Developers.');\n// break;\n// }\n// expSession::set(\"last_POST\", $this->params);\n// header(\"Location: \" . $_SERVER['HTTP_REFERER']);\n// exit(\"\");\n// } else {\n// $errors = array();\n// $data = expFile::parseDatabase(BASE . $directory . \"/\" . $file->filename, $errors, 'news');\n// if (!empty($errors)) {\n// $message = gt('Importing encountered the following errors') . ':<br>';\n// foreach ($errors as $error) {\n// $message .= '* ' . $error . '<br>';\n// }\n// flash('error', $message);\n// }\n//\n// assign_to_template(array(\n// 'items' => $data['news']->records,\n// 'filename' => $directory . \"/\" . $file->filename,\n// 'source' => $this->params['aggregate'][0]\n// ));\n// }\n// }\n// }\n//\n// function import_process() {\n// $filename = $this->params['filename'];\n// $src = $this->params['source'];\n// $selected = $this->params['items'];\n// $errors = array();\n// $data = expFile::parseDatabase(BASE . $filename, $errors, 'news');\n// foreach ($selected as $select) {\n// $item = new news();\n// foreach ($data['news']->records[$select] as $key => $value) {\n// if ($key != 'id' && $key != 'location_data') {\n// $item->$key = $value;\n// }\n// }\n// $item->id = null;\n// $item->rank = null;\n// $item->location_data = serialize(expCore::makeLocation('news', $src));\n// $item->save();\n// }\n// flash('message', count($selected) . ' ' . gt('News items were imported.'));\n// expHistory::back();\n// }\n//\n// function export() {\n// $pullable_modules = expModules::listInstalledControllers('news');\n// $modules = new expPaginator(array(\n// 'records' => $pullable_modules,\n// 'controller' => $this->loc->mod,\n// 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n// 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n// 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n// 'columns' => array(\n// gt('Title') => 'title',\n// gt('Page') => 'section'\n// ),\n// ));\n// assign_to_template(array(\n// 'modules' => $modules,\n// ));\n// }\n//\n// function export_process() {\n// if (!empty($this->params['aggregate'])) {\n// $selected = $this->params['aggregate'];\n// $where = '(';\n// foreach ($selected as $key=>$src) {\n// if ($key) $where .= ' OR ';\n// $where .= \"location_data='\" . serialize(expCore::makeLocation('news', $src)) . \"'\";\n// }\n// $where .= ')';\n//\n// $filename = 'news.eql';\n//\n// ob_end_clean();\n// ob_start(\"ob_gzhandler\");\n//\n// // 'application/octet-stream' is the registered IANA type but\n// // MSIE and Opera seems to prefer 'application/octetstream'\n// $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';\n//\n// header('Content-Type: ' . $mime_type);\n// header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n// // IE need specific headers\n// if (EXPONENT_USER_BROWSER == 'IE') {\n// header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n// header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n// header('Pragma: public');\n// } else {\n// header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n// header('Pragma: no-cache');\n// }\n// echo expFile::dumpDatabase('news', 'export', $where);\n// exit; // Exit, since we are exporting\n// }\n// expHistory::back();\n// }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class photosController extends expController {\n public $basemodel_name = 'photo';\n// public $useractions = array(\n// 'showall'=>'Gallery',\n// 'slideshow'=>'Slideshow',\n// //'showall_tags'=>\"Tag Categories\"\n// );",
"",
" public $remove_configs = array(\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination', // we need to customize it in this module?\n 'rss',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Photo Album\"); }\n static function description() { return gt(\"Displays and manages images.\"); }\n static function isSearchable() { return true; }",
" ",
" public function showall() {\n expHistory::set('viewable', $this->params);\n $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;\n if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {\n $limit = '0';\n }\n $order = isset($this->config['order']) ? $this->config['order'] : \"rank\";\n $page = new expPaginator(array(\n 'model'=>'photo',\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>$limit,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),\n 'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
" ",
" assign_to_template(array(\n 'page'=>$page,\n 'params'=>$this->params,\n ));\n }",
" ",
" function show() {\n expHistory::set('viewable', $this->params);",
" ",
" // figure out if we're looking this up by id or title\n $id = null;\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {",
" $id = $this->params['title'];",
" }\n $record = new photo($id);\n if (empty($record->id))\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));",
" $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc->src = $r_loc->src;\n }",
" $where = $this->aggregateWhereClause();\n// $maxrank = $db->max($this->model_table,'rank','',$where);\n//\n// $record->next = $db->selectValue($this->model_table,'sef_url',$where.\" AND rank=\".($record->rank+1));\n// $record->prev = $db->selectValue($this->model_table,'sef_url',$where.\" AND rank=\".($record->rank-1));\n//\n// if ($record->rank==$maxrank) {\n// $where = $where.\" AND rank=1\";\n// $record->next = $db->selectValue($this->model_table,'sef_url',$where);\n// }\n//\n// if ($record->rank==1) {\n// $where = $where.\" AND rank=\".$maxrank;\n// $record->prev = $db->selectValue($this->model_table,'sef_url',$where);\n// }\n $record->addNextPrev($where);",
" assign_to_template(array(\n 'record'=>$record,\n 'imgnum'=>$record->rank,\n 'imgtot'=>count($record->find('all',$this->aggregateWhereClause())),\n// \"next\"=>$next,\n// \"previous\"=>$prev,\n 'config'=>$config\n ));\n }",
" ",
" public function slideshow() {\n expHistory::set('viewable', $this->params);\n $order = isset($this->config['order']) ? $this->config['order'] : \"rank\";\n $page = new expPaginator(array(\n 'model'=>'photo',\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>empty($this->params['gallery']) ? array() : array($this->params['gallery']),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
" assign_to_template(array(\n// 'slides'=>$slides\n 'slides'=>$page->records,\n ));\n }",
" ",
" public function showall_tags() {\n $images = $this->image->find('all');\n $used_tags = array();\n foreach ($images as $image) {\n foreach($image->expTag as $tag) {\n if (isset($used_tags[$tag->id])) {\n $used_tags[$tag->id]->count++;\n } else {\n $exptag = new expTag($tag->id);\n $used_tags[$tag->id] = $exptag;\n $used_tags[$tag->id]->count = 1;\n }",
" \n }\n }\n ",
" assign_to_template(array(\n 'tags'=>$used_tags\n ));",
" } ",
"\n /**\n * Returns rich snippet PageMap meta data\n *\n * @param $request\n * @param $object\n *\n * @return string\n */\n function meta_rich($request, $object) {\n if (!empty($object->expFile[0]) && file_exists(BASE.$object->expFile[0]->directory.$object->expFile[0]->filename)) {\n return '<!--\n <PageMap>\n <DataObject type=\"thumbnail\">\n <Attribute name=\"src\" value=\"'.URL_FULL.$object->expFile[0]->directory.$object->expFile[0]->filename.'\"/>\n <Attribute name=\"width\" value=\"'.$object->expFile[0]->image_width.'\"/>\n <Attribute name=\"height\" value=\"'.$object->expFile[0]->image_width.'\"/>\n </DataObject>\n </PageMap>\n -->';\n } else return null;\n }",
" public function update() {",
" //populate the alt tag field if the user didn't\n if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title'];",
" ",
" // call expController update to save the image\n parent::update();\n }",
" public function multi_add() {\n// global $db;",
"// $tags = $db->selectObjects('expTags', '1', 'title ASC');\n// $taglist = '';\n// foreach ($tags as $tag) {\n// $taglist .= \"'\" . $tag->title . \"',\";\n// }\n// $taglist = expTag::getAllTags();\n// $modelname = $this->basemodel_name;\n// assign_to_template(array(\n// 'record' => $record,\n// 'table' => $this->$modelname->tablename,\n// 'controller' => $this->params['controller'],\n// 'taglist' => $taglist\n// ));\n }",
" public function multi_update() {\n// global $db;",
" if (!empty($this->params['expFile'])) {\n if (!empty($this->params['title'])) {\n $prefix = $this->params['title'] . ' - ';\n } else {\n $prefix = '';\n }\n $params = array();\n //check for and handle tags\n if (array_key_exists('expTag', $this->params)) {\n $tags = explode(\",\", trim($this->params['expTag']));",
" foreach ($tags as $tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag)) {\n $expTag = new expTag($tag);\n if (empty($expTag->id))\n $expTag->update(array('title' => $tag));\n $params['expTag'][] = $expTag->id;\n }\n }\n }\n }",
" //check for and handle cats\n if (array_key_exists('expCat', $this->params) && !empty($this->params['expCat'])) {\n $catid = $this->params['expCat'];\n $params['expCat'][] = $catid;\n }\n foreach ($this->params['expFile'] as $fileid) {\n $params['expFile'][0] = new expFile($fileid);\n if (!empty($params['expFile'][0]->id)) {\n $photo = new photo();\n $photo->expFile = $params['expFile'];\n $loc = expCore::makeLocation(\"photo\",$this->params['src']);\n $photo->location_data = serialize($loc);\n // $photo->body = $gi['description'];\n // $photo->alt = !empty($gi['alt']) ? $gi['alt'] : $photo->title;\n $filename = pathinfo($params['expFile'][0]->filename);\n $photo->title = $prefix . $filename['filename'];\n if (!empty($params['expTag'])) {\n $photo->expTag = $params['expTag'];\n }\n if (!empty($params['expCat'])) {\n $photo->expCat = $params['expCat'];\n }\n $photo->update($params); // save gallery name as category\n }\n }\n $this->addContentToSearch();\n }\n expHistory::back();\n }",
" function delete_multi() {\n expHistory::set('manageable', $this->params);\n $order = isset($this->config['order']) ? $this->config['order'] : \"rank\";\n $page = new expPaginator(array(\n 'model'=>'photo',\n 'where'=>$this->aggregateWhereClause(),\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
" assign_to_template(array(\n 'page'=>$page,\n ));\n }",
" function delete_multi_act() {\n foreach ($this->params['pic'] as $pic_id=>$value) {\n $obj = new photo($pic_id);\n $obj->delete();\n }\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class photosController extends expController {\n public $basemodel_name = 'photo';\n// public $useractions = array(\n// 'showall'=>'Gallery',\n// 'slideshow'=>'Slideshow',\n// //'showall_tags'=>\"Tag Categories\"\n// );",
" protected $manage_permissions = array(\n 'multi'=>'Bulk Actions',\n );",
" public $remove_configs = array(\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination', // we need to customize it in this module?\n 'rss',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Photo Album\"); }\n static function description() { return gt(\"Displays and manages images.\"); }\n static function isSearchable() { return true; }",
"",
" public function showall() {\n expHistory::set('viewable', $this->params);\n $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;\n if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {\n $limit = '0';\n }\n $order = isset($this->config['order']) ? $this->config['order'] : \"rank\";\n $page = new expPaginator(array(\n 'model'=>'photo',\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>$limit,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),\n 'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
"",
" assign_to_template(array(\n 'page'=>$page,\n 'params'=>$this->params,\n ));\n }",
"",
" function show() {\n expHistory::set('viewable', $this->params);",
"",
" // figure out if we're looking this up by id or title\n $id = null;\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {",
" $id = expString::escape($this->params['title']);",
" }\n $record = new photo($id);\n if (empty($record->id))\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));",
" $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc->src = $r_loc->src;\n }",
" $where = $this->aggregateWhereClause();\n// $maxrank = $db->max($this->model_table,'rank','',$where);\n//\n// $record->next = $db->selectValue($this->model_table,'sef_url',$where.\" AND rank=\".($record->rank+1));\n// $record->prev = $db->selectValue($this->model_table,'sef_url',$where.\" AND rank=\".($record->rank-1));\n//\n// if ($record->rank==$maxrank) {\n// $where = $where.\" AND rank=1\";\n// $record->next = $db->selectValue($this->model_table,'sef_url',$where);\n// }\n//\n// if ($record->rank==1) {\n// $where = $where.\" AND rank=\".$maxrank;\n// $record->prev = $db->selectValue($this->model_table,'sef_url',$where);\n// }\n $record->addNextPrev($where);",
" assign_to_template(array(\n 'record'=>$record,\n 'imgnum'=>$record->rank,\n 'imgtot'=>count($record->find('all',$this->aggregateWhereClause())),\n// \"next\"=>$next,\n// \"previous\"=>$prev,\n 'config'=>$config\n ));\n }",
"",
" public function slideshow() {\n expHistory::set('viewable', $this->params);\n $order = isset($this->config['order']) ? $this->config['order'] : \"rank\";\n $page = new expPaginator(array(\n 'model'=>'photo',\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>empty($this->params['gallery']) ? array() : array($this->params['gallery']),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
" assign_to_template(array(\n// 'slides'=>$slides\n 'slides'=>$page->records,\n ));\n }",
"",
" public function showall_tags() {\n $images = $this->image->find('all');\n $used_tags = array();\n foreach ($images as $image) {\n foreach($image->expTag as $tag) {\n if (isset($used_tags[$tag->id])) {\n $used_tags[$tag->id]->count++;\n } else {\n $exptag = new expTag($tag->id);\n $used_tags[$tag->id] = $exptag;\n $used_tags[$tag->id]->count = 1;\n }",
"\n }\n }\n",
" assign_to_template(array(\n 'tags'=>$used_tags\n ));",
" }",
"\n /**\n * Returns rich snippet PageMap meta data\n *\n * @param $request\n * @param $object\n *\n * @return string\n */\n function meta_rich($request, $object) {\n if (!empty($object->expFile[0]) && file_exists(BASE.$object->expFile[0]->directory.$object->expFile[0]->filename)) {\n return '<!--\n <PageMap>\n <DataObject type=\"thumbnail\">\n <Attribute name=\"src\" value=\"'.URL_FULL.$object->expFile[0]->directory.$object->expFile[0]->filename.'\"/>\n <Attribute name=\"width\" value=\"'.$object->expFile[0]->image_width.'\"/>\n <Attribute name=\"height\" value=\"'.$object->expFile[0]->image_width.'\"/>\n </DataObject>\n </PageMap>\n -->';\n } else return null;\n }",
" public function update() {",
" //populate the alt tag field if the user didn't\n if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title'];",
"",
" // call expController update to save the image\n parent::update();\n }",
" public function multi_add() {\n// global $db;",
"// $tags = $db->selectObjects('expTags', '1', 'title ASC');\n// $taglist = '';\n// foreach ($tags as $tag) {\n// $taglist .= \"'\" . $tag->title . \"',\";\n// }\n// $taglist = expTag::getAllTags();\n// $modelname = $this->basemodel_name;\n// assign_to_template(array(\n// 'record' => $record,\n// 'table' => $this->$modelname->tablename,\n// 'controller' => $this->params['controller'],\n// 'taglist' => $taglist\n// ));\n }",
" public function multi_update() {\n// global $db;",
" if (!empty($this->params['expFile'])) {\n if (!empty($this->params['title'])) {\n $prefix = $this->params['title'] . ' - ';\n } else {\n $prefix = '';\n }\n $params = array();\n //check for and handle tags\n if (array_key_exists('expTag', $this->params)) {\n $tags = explode(\",\", trim($this->params['expTag']));",
" foreach ($tags as $tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag)) {\n $expTag = new expTag($tag);\n if (empty($expTag->id))\n $expTag->update(array('title' => $tag));\n $params['expTag'][] = $expTag->id;\n }\n }\n }\n }",
" //check for and handle cats\n if (array_key_exists('expCat', $this->params) && !empty($this->params['expCat'])) {\n $catid = $this->params['expCat'];\n $params['expCat'][] = $catid;\n }\n foreach ($this->params['expFile'] as $fileid) {\n $params['expFile'][0] = new expFile($fileid);\n if (!empty($params['expFile'][0]->id)) {\n $photo = new photo();\n $photo->expFile = $params['expFile'];\n $loc = expCore::makeLocation(\"photo\",$this->params['src']);\n $photo->location_data = serialize($loc);\n // $photo->body = $gi['description'];\n // $photo->alt = !empty($gi['alt']) ? $gi['alt'] : $photo->title;\n $filename = pathinfo($params['expFile'][0]->filename);\n $photo->title = $prefix . $filename['filename'];\n if (!empty($params['expTag'])) {\n $photo->expTag = $params['expTag'];\n }\n if (!empty($params['expCat'])) {\n $photo->expCat = $params['expCat'];\n }\n $photo->update($params); // save gallery name as category\n }\n }\n $this->addContentToSearch();\n }\n expHistory::back();\n }",
" function delete_multi() {\n expHistory::set('manageable', $this->params);\n $order = isset($this->config['order']) ? $this->config['order'] : \"rank\";\n $page = new expPaginator(array(\n 'model'=>'photo',\n 'where'=>$this->aggregateWhereClause(),\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
" assign_to_template(array(\n 'page'=>$page,\n ));\n }",
" function delete_multi_act() {\n foreach ($this->params['pic'] as $pic_id=>$value) {\n $obj = new photo($pic_id);\n $obj->delete();\n }\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class pixidouController extends expController {",
"// public $cacheDir = \"framework/modules/pixidou/images/\";",
"\tpublic $cacheDir = \"tmp/pixidou/\";\n public $requires_login = array(",
" 'editor',\n 'exitEditor'",
" );",
" static function displayname() { return gt(\"Pixidou Image Editor\"); }\n static function description() { return gt(\"Add and manage Exponent Files\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }",
" static function hasSources()\n {\n return false;\n }",
" function editor() {\n global $user;",
" ",
" $file = new expFile($this->params['id']);",
" \n $canSaveOg = $user->id==$file->poster || $user->is_admin ? 1 : 0 ;\n\t if (file_exists(BASE.$file->directory.$file->filename)) {\n\t\t\t$file->copyToDirectory(BASE.$this->cacheDir);",
"\t\t\tassign_to_template(array(\n 'image'=>$file,\n 'update'=>$this->params['update'],\n 'saveog'=>$canSaveOg\n ));\n\t } else {",
"\t\t flash('error',gt('The file').' \"'.BASE.$file->directory.$file->filename.'\" '.gt('does not exist on the server.'));\n\t\t redirect_to(array(\"controller\"=>'file',\"action\"=>'picker',\"ajax_action\"=>1,\"update\"=>$this->params['update'],\"filter\"=>$this->params['filter']));",
"\t }\n }",
" ",
" public function exitEditor() {\n // clean up parameters\n $this->params['fid'] = intval($this->params['fid']);\n if (!empty($this->params['cpi']) && strpos($this->params['cpi'], '..') !== false) {\n $this->params['exitType'] = 'error';\n }\n switch ($this->params['exitType']) {\n case 'saveAsCopy':",
" $oldimage = new expFile($this->params['fid']); \n $copyname = expFile::resolveDuplicateFilename($oldimage->path); \n copy(BASE.$this->cacheDir.\"/\".$this->params['cpi'],$oldimage->directory.$copyname); //copy the edited file over to the files dir",
" $newFile = new expFile(array(\"filename\"=>$copyname)); //construct a new expFile\n $newFile->directory = $oldimage->directory;\n $newFile->title = $oldimage->title;\n $newFile->shared = $oldimage->shared;\n $newFile->mimetype = $oldimage->mimetype;\n $newFile->posted = time();",
" $newFile->filesize = filesize(BASE.$this->cacheDir.\"/\".$this->params['cpi']);\n $resized = getimagesize(BASE.$this->cacheDir.\"/\".$this->params['cpi']);",
" $newFile->image_width = $resized[0];\n $newFile->image_height = $resized[1];\n $newFile->alt = $oldimage->alt;\n $newFile->is_image = $oldimage->is_image;\n $newFile->save(); //Save it to the database",
" break;\n case 'saveAsIs':\n //eDebug($this->params,true);\n $oldimage = new expFile($this->params['fid']);",
" $resized = getimagesize(BASE.$this->cacheDir.\"/\".$this->params['cpi']);",
" $oldimage->image_width = $resized[0];\n $oldimage->image_height = $resized[1];\n $oldimage->save();",
" copy(BASE.$this->cacheDir.\"/\".$this->params['cpi'],$oldimage->directory.$oldimage->filename); //copy the edited file over to the files dir",
" break;",
" ",
" default:\n # code...\n break;\n }\n // proper file types to look for",
" $types = array(\".jpg\",\".gif\",\".png\");\n ",
" //Pixidou images directory, the editor's cache",
" $cachedir = BASE.$this->cacheDir;\n ",
" if (is_dir($cachedir) && is_readable($cachedir) ) {\n $dh = opendir($cachedir);\n while (($tmpfile = readdir($dh)) !== false) {",
" if (in_array(substr($tmpfile,-4,4),$types)) {\n $filename = $cachedir.$tmpfile;",
" unlink($filename);\n }\n }\n }",
" \n redirect_to(array(\"controller\"=>'file',\"action\"=>'picker',\"ajax_action\"=>1,\"update\"=>$this->params['update'],\"filter\"=>$this->params['filter']));",
" }",
" ",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class pixidouController extends expController {",
"",
"\tpublic $cacheDir = \"tmp/pixidou/\";\n public $requires_login = array(",
" 'editor'=>'You must be logged in to perform this action',\n 'exitEditor'=>'You must be logged in to perform this action',",
" );",
" static function displayname() { return gt(\"Pixidou Image Editor\"); }\n static function description() { return gt(\"Add and manage Exponent Files\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }",
" static function hasSources()\n {\n return false;\n }",
" function editor() {\n global $user;",
"",
" $file = new expFile($this->params['id']);",
"\n $canSaveOg = $user->id==$file->poster || $user->isSuperAdmin() ? 1 : 0 ;\n\t if (file_exists(BASE . $file->directory . $file->filename)) {\n\t\t\t$file->copyToDirectory(BASE . $this->cacheDir);",
"\t\t\tassign_to_template(array(\n 'image'=>$file,\n 'update'=>$this->params['update'],\n 'saveog'=>$canSaveOg\n ));\n\t } else {",
"\t\t flash('error', gt('The file') . ' \"' . BASE . $file->directory . $file->filename . '\" ' . gt('does not exist on the server.'));\n\t\t redirect_to(array(\"controller\"=>'file', \"action\"=>'picker', \"ajax_action\"=>1, \"update\"=>$this->params['update'], \"filter\"=>$this->params['filter']));",
"\t }\n }",
"",
" public function exitEditor() {\n // clean up parameters\n $this->params['fid'] = intval($this->params['fid']);\n if (!empty($this->params['cpi']) && strpos($this->params['cpi'], '..') !== false) {\n $this->params['exitType'] = 'error';\n }\n switch ($this->params['exitType']) {\n case 'saveAsCopy':",
" $oldimage = new expFile($this->params['fid']);\n $copyname = expFile::resolveDuplicateFilename($oldimage->path);\n copy(BASE . $this->cacheDir . \"/\" . $this->params['cpi'], $oldimage->directory . $copyname); //copy the edited file over to the files dir",
" $newFile = new expFile(array(\"filename\"=>$copyname)); //construct a new expFile\n $newFile->directory = $oldimage->directory;\n $newFile->title = $oldimage->title;\n $newFile->shared = $oldimage->shared;\n $newFile->mimetype = $oldimage->mimetype;\n $newFile->posted = time();",
" $newFile->filesize = filesize(BASE . $this->cacheDir . \"/\" . $this->params['cpi']);\n $resized = getimagesize(BASE . $this->cacheDir . \"/\" . $this->params['cpi']);",
" $newFile->image_width = $resized[0];\n $newFile->image_height = $resized[1];\n $newFile->alt = $oldimage->alt;\n $newFile->is_image = $oldimage->is_image;\n $newFile->save(); //Save it to the database",
" break;\n case 'saveAsIs':\n //eDebug($this->params,true);\n $oldimage = new expFile($this->params['fid']);",
" $resized = getimagesize(BASE . $this->cacheDir . \"/\" . $this->params['cpi']);",
" $oldimage->image_width = $resized[0];\n $oldimage->image_height = $resized[1];\n $oldimage->save();",
" copy(BASE . $this->cacheDir . \"/\" . $this->params['cpi'], $oldimage->directory . $oldimage->filename); //copy the edited file over to the files dir",
" break;",
"",
" default:\n # code...\n break;\n }\n // proper file types to look for",
" $types = array(\".jpg\", \".gif\", \".png\");\n",
" //Pixidou images directory, the editor's cache",
" $cachedir = BASE . $this->cacheDir;\n",
" if (is_dir($cachedir) && is_readable($cachedir) ) {\n $dh = opendir($cachedir);\n while (($tmpfile = readdir($dh)) !== false) {",
" if (in_array(substr($tmpfile, -4, 4), $types)) {\n $filename = $cachedir . $tmpfile;",
" unlink($filename);\n }\n }\n }",
"\n redirect_to(array(\"controller\"=>'file', \"action\"=>'picker', \"ajax_action\"=>1, \"update\"=>$this->params['update'], \"filter\"=>$this->params['filter']));",
" }",
"",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class portfolioController extends expController {\n public $useractions = array(\n 'showall'=>'Show all', \n 'tags'=>\"Tags\",\n 'slideshow'=>\"Slideshow\"\n );",
"",
" public $remove_configs = array(\n 'comments',\n 'ealerts',\n 'facebook',\n 'rss',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" protected $add_permissions = array(\n 'import'=>'Import Portfolio Items',\n 'export'=>'Export Portfolio Items'\n );",
"\n static function displayname() { return gt(\"Portfolio\"); }\n static function description() { return gt(\"Display a portfolio or listing.\"); }\n static function isSearchable() { return true; }",
" static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" public function showall() {\n expHistory::set('viewable', $this->params);\n $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;\n if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {\n $limit = '0';\n }\n $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n $page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>$limit,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>!isset($this->params['group']) ? array() : array($this->params['group']),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
" assign_to_template(array(\n 'page'=>$page,\n 'rank'=>($order==='rank')?1:0,\n 'params'=>$this->params,\n ));\n }\n \n public function slideshow() {\n expHistory::set('viewable', $this->params);",
" $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n //FIXME we need to change this to expPaginator to get category grouping\n $s = new portfolio();\n $slides = $s->find('all',$this->aggregateWhereClause(),$order);",
" assign_to_template(array(\n 'slides'=>$slides,\n 'rank'=>($order==='rank')?1:0\n ));\n }",
" /**\n * Returns rich snippet PageMap meta data\n *\n * @param $request\n * @param $object\n *\n * @return string\n */\n function meta_rich($request, $object) {\n if (!empty($object->expFile[0]) && file_exists(BASE.$object->expFile[0]->directory.$object->expFile[0]->filename)) {\n $rich_meta = '<!--\n <PageMap>\n <DataObject type=\"thumbnail\">\n <Attribute name=\"src\" value=\"' . URL_FULL . $object->expFile[0]->directory . $object->expFile[0]->filename . '\"/>\n <Attribute name=\"width\" value=\"' . $object->expFile[0]->image_width . '\"/>\n <Attribute name=\"height\" value=\"' . $object->expFile[0]->image_height . '\"/>\n </DataObject>\n </PageMap>\n -->';\n return $rich_meta;\n }\n }",
" /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n \tfunction aggregateWhereClause($type='') {\n $sql = parent::aggregateWhereClause();\n $sql .= (!empty($this->config['only_featured']))?\"AND featured=1\":\"\";",
" return $sql;\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class portfolioController extends expController {\n public $useractions = array(\n 'showall'=>'Show all', \n 'tags'=>\"Tags\",\n 'slideshow'=>\"Slideshow\"\n );",
" protected $manage_permissions = array(\n 'import'=>'Import Portfolio Items',\n 'export'=>'Export Portfolio Items'\n );",
" public $remove_configs = array(\n 'comments',\n 'ealerts',\n 'facebook',\n 'rss',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
"",
"\n static function displayname() { return gt(\"Portfolio\"); }\n static function description() { return gt(\"Display a portfolio or listing.\"); }\n static function isSearchable() { return true; }",
" static function canImportData() {\n return true;\n }",
" static function canExportData() {\n return true;\n }",
" public function showall() {\n expHistory::set('viewable', $this->params);\n $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;\n if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {\n $limit = '0';\n }\n $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n $page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>$limit,\n 'order'=>$order,\n 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'groups'=>!isset($this->params['group']) ? array() : array($this->params['group']),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));",
" assign_to_template(array(\n 'page'=>$page,\n 'rank'=>($order==='rank')?1:0,\n 'params'=>$this->params,\n ));\n }\n \n public function slideshow() {\n expHistory::set('viewable', $this->params);",
" $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n //FIXME we need to change this to expPaginator to get category grouping\n $s = new portfolio();\n $slides = $s->find('all',$this->aggregateWhereClause(),$order);",
" assign_to_template(array(\n 'slides'=>$slides,\n 'rank'=>($order==='rank')?1:0\n ));\n }",
" /**\n * Returns rich snippet PageMap meta data\n *\n * @param $request\n * @param $object\n *\n * @return string\n */\n function meta_rich($request, $object) {\n if (!empty($object->expFile[0]) && file_exists(BASE.$object->expFile[0]->directory.$object->expFile[0]->filename)) {\n $rich_meta = '<!--\n <PageMap>\n <DataObject type=\"thumbnail\">\n <Attribute name=\"src\" value=\"' . URL_FULL . $object->expFile[0]->directory . $object->expFile[0]->filename . '\"/>\n <Attribute name=\"width\" value=\"' . $object->expFile[0]->image_width . '\"/>\n <Attribute name=\"height\" value=\"' . $object->expFile[0]->image_height . '\"/>\n </DataObject>\n </PageMap>\n -->';\n return $rich_meta;\n }\n }",
" /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n \tfunction aggregateWhereClause($type='') {\n $sql = parent::aggregateWhereClause();\n $sql .= (!empty($this->config['only_featured']))?\"AND featured=1\":\"\";",
" return $sql;\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\nclass recyclebinController extends expController\n{",
" protected $add_permissions = array(",
" 'showall' => 'View Recycle Bin',\n 'show' => 'View Recycle Bin',\n 'remove' => 'Remove Recycle Bin Item'\n );",
" //protected $remove_permissions = array('edit');",
" static function displayname()\n {\n return gt(\"Recycle Bin Manager\");\n }",
" static function description()\n {\n return gt(\"Manage modules that have been deleted from your web pages\");\n }",
" static function author()\n {\n return \"Phillip Ball - OIC Group, Inc\";\n }",
" static function hasSources()\n {\n return false;\n }",
" static function hasContent()\n {\n return false;\n }",
" function showall()\n {\n expHistory::set('manageable', $this->params);",
" //initialize a new recycle bin and grab the previously trashed items\n $bin = new recyclebin();\n $orphans = $bin->moduleOrphans();",
" assign_to_template(\n array(\n 'items' => $orphans\n )\n );\n }",
" public function show()\n {\n //instantiate an expRecord for the module in question\n //$mod = new $this->params['recymod']();\n define('SOURCE_SELECTOR', 1);\n define('PREVIEW_READONLY', 1); // for mods",
" //initialize a new recycle bin and grab the previously trashed items\n $bin = new recyclebin();\n $orphans = $bin->moduleOrphans($this->params['recymod']);",
" assign_to_template(\n array(\n 'items' => $orphans,\n 'module' => $this->params['recymod']\n )\n );\n }",
" /**\n * Permanently remove a module from the recycle bin and all it's items from the system\n *\n */\n public function remove()\n {\n global $db;\n",
"",
" $mod = expModules::getController($this->params['mod'], $this->params['src']);\n if ($mod != null) {\n $mod->delete_instance(); // delete all assoc items\n $db->delete(\n 'sectionref',\n \"source='\" . $this->params['src'] . \"' and module='\" . $this->params['mod'] . \"'\"\n ); // delete recycle bin holder\n flash('notice', gt('Item removed from Recycle Bin'));\n }\n expHistory::back();\n }",
" /**\n * Permanently remove all modules from the recycle bin and all their items from the system\n *\n */\n public function remove_all()\n {\n global $db;",
" $bin = new recyclebin();\n $orphans = $bin->moduleOrphans();\n foreach ($orphans as $orphan) {\n $mod = expModules::getController($orphan->module, $orphan->source);\n if ($mod != null) {\n $mod->delete_instance(); // delete all assoc items\n $db->delete(\n 'sectionref',\n \"source='\" . $orphan->source . \"' and module='\" . $orphan->module . \"'\"\n ); // delete recycle bin holder\n }\n }\n flash('notice', gt('Recycle Bin has been Emptied'));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\nclass recyclebinController extends expController\n{",
" protected $manage_permissions = array(",
" 'showall' => 'View Recycle Bin',\n 'show' => 'View Recycle Bin',\n 'remove' => 'Remove Recycle Bin Item'\n );",
" //protected $remove_permissions = array('edit');",
" static function displayname()\n {\n return gt(\"Recycle Bin Manager\");\n }",
" static function description()\n {\n return gt(\"Manage modules that have been deleted from your web pages\");\n }",
" static function author()\n {\n return \"Phillip Ball - OIC Group, Inc\";\n }",
" static function hasSources()\n {\n return false;\n }",
" static function hasContent()\n {\n return false;\n }",
" function showall()\n {\n expHistory::set('manageable', $this->params);",
" //initialize a new recycle bin and grab the previously trashed items\n $bin = new recyclebin();\n $orphans = $bin->moduleOrphans();",
" assign_to_template(\n array(\n 'items' => $orphans\n )\n );\n }",
" public function show()\n {\n //instantiate an expRecord for the module in question\n //$mod = new $this->params['recymod']();\n define('SOURCE_SELECTOR', 1);\n define('PREVIEW_READONLY', 1); // for mods",
" //initialize a new recycle bin and grab the previously trashed items\n $bin = new recyclebin();\n $orphans = $bin->moduleOrphans($this->params['recymod']);",
" assign_to_template(\n array(\n 'items' => $orphans,\n 'module' => $this->params['recymod']\n )\n );\n }",
" /**\n * Permanently remove a module from the recycle bin and all it's items from the system\n *\n */\n public function remove()\n {\n global $db;\n",
" $this->params['mod'] = expString::escape($this->params['mod']);\n $this->params['src'] = expString::escape($this->params['src']);",
" $mod = expModules::getController($this->params['mod'], $this->params['src']);\n if ($mod != null) {\n $mod->delete_instance(); // delete all assoc items\n $db->delete(\n 'sectionref',\n \"source='\" . $this->params['src'] . \"' and module='\" . $this->params['mod'] . \"'\"\n ); // delete recycle bin holder\n flash('notice', gt('Item removed from Recycle Bin'));\n }\n expHistory::back();\n }",
" /**\n * Permanently remove all modules from the recycle bin and all their items from the system\n *\n */\n public function remove_all()\n {\n global $db;",
" $bin = new recyclebin();\n $orphans = $bin->moduleOrphans();\n foreach ($orphans as $orphan) {\n $mod = expModules::getController($orphan->module, $orphan->source);\n if ($mod != null) {\n $mod->delete_instance(); // delete all assoc items\n $db->delete(\n 'sectionref',\n \"source='\" . $orphan->source . \"' and module='\" . $orphan->module . \"'\"\n ); // delete recycle bin holder\n }\n }\n flash('notice', gt('Recycle Bin has been Emptied'));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class reportController extends expController {",
" protected $add_permissions = array(\n 'build_report' => 'Manage',",
" 'cart_summary' => 'View Cart Summary Report',",
"",
" 'dashboard' => 'View the e-Commerce Dashboard',",
" 'order_report' => 'Generate Order Report',\n 'product_report' => 'Generate Product Report',",
" 'generateOrderReport' => 'View Order Report',\n 'generateProductReport' => 'View Product Report',",
"",
" 'print_orders' => 'Print Orders',",
" 'batch_export' => 'Export Products',",
" 'show_payment_summary' => 'Show Payment Summary',",
" 'export_order_items' => 'Export Order Items File');",
"\n static function displayname() {\n return gt(\"Ecom Report Builder\");\n }",
" static function description() {\n return gt(\"Build reports based on store activity\");\n }",
" static function author() {\n return \"Phillip Ball - OIC Group, Inc\";\n }",
" static function hasSources() {\n return false;\n }",
" protected $o;\n protected $oneday = 86400;\n protected $tstart;\n protected $tend;\n protected $prev_month;\n protected $prev_hour = '12';\n protected $prev_min = '00';\n protected $prev_ampm = 'AM';\n protected $now_date;\n protected $now_hour;\n protected $now_min;\n protected $now_ampm;",
" function __construct($src = null, $params = array()) {\n parent::__construct($src, $params);\n $this->o = new order();\n $this->tstart = time() - $this->oneday;\n $this->tend = time();\n// $this->prev_month = strftime(\"%A, %d %B %Y\", mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));\n// $this->now_date = strftime(\"%A, %d %B %Y\");\n $this->prev_month = strftime(DISPLAY_DATE_FORMAT, mktime(0, 0, 0, (strftime(\"%m\") - 1), 1, strftime(\"%Y\")));\n $this->now_date = strftime(DISPLAY_DATE_FORMAT);\n $this->now_hour = strftime(\"%I\");\n $this->now_min = strftime(\"%M\");\n $this->now_ampm = strftime(\"%p\");\n }",
" private function setDateParams($params) {\n //eDebug($params,true);\n if (!empty($params['quickrange'])) {\n if ($params['quickrange'] == 1) {\n $this->tstart = time() - $this->oneday * 7;\n } else if ($params['quickrange'] == 2) {\n $this->tstart = time() - $this->oneday * 30;\n } else if ($params['quickrange'] == 0) {\n $this->tstart = time() - $this->oneday;\n }\n $this->prev_month = strftime(DISPLAY_DATE_FORMAT,$this->tstart);\n } else if (isset($params['date-starttime'])) { //FIXME OLD calendar control format\n $formatedStart = $params['date-starttime'] . ' ' . $params['time-h-starttime'] . \":\" . $params['time-m-starttime'] . ' ' . $params['ampm-starttime'];\n $this->tstart = strtotime($formatedStart);\n $this->tend = strtotime($params['date-endtime'] . ' ' . $params['time-h-endtime'] . \":\" . $params['time-m-endtime'] . ' ' . $params['ampm-endtime']);",
" // parse out date into calendarcontrol fields\n $this->prev_month = $formatedStart;\n $this->prev_hour = $params['time-h-starttime'];\n $this->prev_min = $params['time-m-starttime'];\n $this->prev_ampm = $params['ampm-starttime'];",
" // parse out date into calendarcontrol fields\n $this->now_date = $params['date-endtime'];\n $this->now_hour = $params['time-h-endtime'];\n $this->now_min = $params['time-m-endtime'];\n $this->now_ampm = $params['ampm-endtime'];\n } elseif (isset($params['starttime'])) {\n $this->tstart = strtotime($params['starttime']);\n $this->tend = strtotime($params['endtime']);",
" // parse out date into calendarcontrol fields\n $this->prev_month = date('m/d/Y', $this->tstart);\n $this->prev_hour = date('h', $this->tstart);\n $this->prev_min = date('i', $this->tstart);\n $this->prev_ampm = date('a', $this->tstart);",
" // parse out date into calendarcontrol fields\n $this->now_date = date('m/d/Y', $this->tend);\n $this->now_hour = date('h', $this->tend);\n $this->now_min = date('i', $this->tend);\n $this->now_ampm = date('a', $this->tend);\n } else {\n $this->tstart = time() - $this->oneday;\n }\n return;\n }",
" function dashboard() {\n global $db;",
" $quickrange = array(0 => gt('Last 24 Hours'), 1 => gt('Last 7 Days'), 2 => gt('Last 30 Days'));\n $this->setDateParams($this->params);\n if (!isset($this->params['quickrange'])) {\n $this->params['quickrange'] = 0;\n }",
" $except = array('order_discounts', 'billingmethod', 'order_status_changes', 'billingmethod', 'order_discounts');\n $orders = $this->o->find('all', 'purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend, null, null, 0, true, false, $except, true);\n $oar = array();\n foreach ($orders as $order) {\n //eDebug($order,true);\n if (empty($oar[$order->order_type->title])) {\n $oar[$order->order_type->title] = array();\n $oar[$order->order_type->title]['grand_total'] = null;\n $oar[$order->order_type->title]['num_orders'] = null;\n $oar[$order->order_type->title]['num_items'] = null;\n }\n $oar[$order->order_type->title]['grand_total'] += $order->grand_total;\n $oar[$order->order_type->title]['num_orders']++;\n $oar[$order->order_type->title]['num_items'] += count($order->orderitem);",
" if (empty($oar[$order->order_type->title][$order->order_status->title])) {\n $oar[$order->order_type->title][$order->order_status->title] = array();\n $oar[$order->order_type->title][$order->order_status->title]['grand_total'] = null;\n $oar[$order->order_type->title][$order->order_status->title]['num_orders'] = null;\n $oar[$order->order_type->title][$order->order_status->title]['num_items'] = null;\n }\n $oar[$order->order_type->title][$order->order_status->title]['grand_total'] += $order->grand_total;\n $oar[$order->order_type->title][$order->order_status->title]['num_orders']++;\n $oar[$order->order_type->title][$order->order_status->title]['num_items'] += count($order->orderitem);\n }",
" $sql = \"SELECT COUNT(*) as c FROM \" . $db->prefix . \"orders, \" . $db->prefix . \"sessionticket WHERE ticket = sessionticket_ticket\";\n $allCarts = $db->countObjectsBySql($sql);",
" assign_to_template(array(\n 'orders' => $oar,\n 'quickrange' => $quickrange,\n 'quickrange_default' => $this->params['quickrange'],\n 'prev_month' => $this->prev_month,\n 'now_date' => $this->now_date,\n 'now_hour' => $this->now_hour,\n 'now_min' => $this->now_min,\n 'now_ampm' => $this->now_ampm,\n 'prev_hour' => $this->prev_hour,\n 'prev_min' => $this->prev_min,\n 'prev_ampm' => $this->prev_ampm,\n 'active_carts' => $allCarts\n ));\n }",
" function cart_summary() {\n global $db;",
" $p = $this->params;\n $sql = \"SELECT DISTINCT(o.id), o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title from \";\n $sql .= $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"product as p ON oi.product_id = p.id \";\n if (!empty($p['order_status'][0]) && $p['order_status'][0] != -1) $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON o.order_type_id = ot.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"geo_region as gr ON (gr.id = b.state OR gr.id = s.state) \";\n if (!empty($p['discounts'][0]) && $p['discounts'][0] != -1) $sql .= \"LEFT JOIN \" . $db->prefix . \"order_discounts as od ON od.orders_id = o.id \";",
" $sqlwhere = \"WHERE o.purchased != 0\";",
" if (!empty($p['date-startdate'])) $sqlwhere .= \" AND o.purchased >= \" . strtotime($p['date-startdate'] . \" \" . $p['time-h-startdate'] . \":\" . $p['time-m-startdate'] . \" \" . $p['ampm-startdate']);\n /*if ($p->['time-h-startdate'] == )\n if ($p->['time-m-startdate'] == )\n if ($p->['ampm-startdate'] == )*/",
" if (!empty($p['date-enddate'])) $sqlwhere .= \" AND o.purchased <= \" . strtotime($p['date-enddate'] . \" \" . $p['time-h-enddate'] . \":\" . $p['time-m-enddate'] . \" \" . $p['ampm-enddate']);\n /*if ($p->['date-enddate'] == )\n if ($p->['time-h-enddate'] == )\n if ($p->['time-m-enddate'] == )\n if ($p->['ampm-enddate'] == )*/",
" $inc = 0;\n $sqltmp = '';\n if (!empty($p['order_status'])) foreach ($p['order_status'] as $os) {\n if ($os == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_status_id = \" . $os;\n } else {\n $sqltmp .= \" OR o.order_status_id = \" . $os;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" $inc = 0;\n $sqltmp = '';\n if (!empty($p['order_type'])) foreach ($p['order_type'] as $ot) {\n if ($ot == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_type_id = \" . $ot;\n } else {\n $sqltmp .= \" OR o.order_type_id = \" . $ot;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['order-range-num'])) {\n $operator = '';\n switch ($p['order-range-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND o.invoice_id\" . $operator . $p['order-range-num'];\n }",
" if (!empty($p['order-price-num'])) {\n $operator = '';\n switch ($p['order-price-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND o.grand_total\" . $operator . $p['order-price-num'];\n }",
" if (!empty($p['pnam'])) {\n $sqlwhere .= \" AND p.title LIKE '%\" . $p['pnam'] . \"%'\";\n }",
" if (!empty($p['sku'])) {\n $sqlwhere .= \" AND p.model LIKE '%\" . $p['sku'] . \"%'\";\n }",
" $inc = 0;\n $sqltmp = '';\n if (!empty($p['discounts'])) foreach ($p['discounts'] as $d) {\n if ($d == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (od.discounts_id = \" . $d;\n } else {\n $sqltmp .= \" OR od.discounts_id = \" . $d;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['blshpname'])) {\n $sqlwhere .= \" AND (b.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $p['blshpname'] . \"%')\";\n }",
" if (!empty($p['email'])) {\n $sqlwhere .= \" AND (b.email LIKE '%\" . $p['email'] . \"%'\";\n $sqlwhere .= \" OR s.email LIKE '%\" . $p['email'] . \"%')\";\n }",
" if (!empty($p['zip'])) {\n if ($p['bl-sp-zip'] == 'b') $sqlwhere .= \" AND b.zip LIKE '%\" . $p['zip'] . \"%'\";\n else if ($p['bl-sp-zip'] == 's') $sqlwhere .= \" AND s.zip LIKE '%\" . $p['zip'] . \"%'\";\n }",
" if (isset($p['state'])) {\n $inc = 0;\n $sqltmp = '';\n foreach ($p['state'] as $s) {\n if ($s == -1) continue;\n else if ($inc == 0) {\n $inc++;\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" AND (b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" AND (s.state = \" . $s;\n } else {\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" OR b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" OR s.state = \" . $s;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" if (isset($p['payment_method'])) {\n $inc = 0;\n $sqltmp = '';\n foreach ($p['payment_method'] as $s) {\n if ($s == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_status_id = \" . $s;\n } else {\n $sqltmp .= \" OR o.order_status_id = \" . $s;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" //echo $sql . $sqlwhere . \"<br>\";\n /*\n Need: order, orderitems, order status, ordertype, billingmethods, geo region, shipping methods, products",
" [date-startdate] => \n [time-h-startdate] => \n [time-m-startdate] => ",
" [ampm-startdate] => am",
" [date-enddate] => \n [time-h-enddate] => \n [time-m-enddate] => ",
" [ampm-enddate] => am\n [order_status] => Array\n (\n [0] => 0\n [1] => 1\n [2] => 2\n )",
" [order_type] => Array\n (\n [0] => 0\n [1] => 2\n )",
" [order-range-op] => e",
" [order-range-num] => ",
" [order-price-op] => l",
" [order-price-num] => \n [pnam] => \n [sku] => ",
" [discounts] => Array\n (\n [0] => -1\n )\n",
" [blshpname] => \n [email] => ",
" [bl-sp-zip] => s",
" [zip] => ",
" [bl-sp-state] => s\n [state] => Array\n (\n [0] => -1\n )",
" [status] => Array\n (\n [0] => -1\n )",
" )\n */\n expSession::set('order_print_query', $sql . $sqlwhere);\n //$where = 1;//$this->aggregateWhereClause();\n //$order = 'id';\n //$prod = new product();\n // $order = new order();",
" //$items = $prod->find('all', 1, 'id DESC',25); \n //$items = $order->find('all', 1, 'id DESC',25); ",
" //$res = $mod->find('all',$sql,'id',25);",
" //eDebug($items);",
" $page = new expPaginator(array(\n //'model'=>'order',\n //'records'=>$items,\n // 'where'=>$where,\n 'sql' => $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 25 : $this->config['limit'],\n 'order' => 'invoice_id',\n 'order_direction' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Date') => 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Status') => 'status_title'\n ),\n ));",
" $action_items = array(\n 'print_orders' => 'Print Orders',\n 'export_odbc' => 'Export Shipping Data to CSV'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));\n }",
" function order_report() {\n // stub function. I'm sure eventually we can pull up exising reports to pre-populate our form.\n $os = new order_status();\n $oss = $os->find('all');\n $order_status = array();\n $order_status[-1] = gt('--Any--');\n foreach ($oss as $status) {\n $order_status[$status->id] = $status->title;\n }",
" $ot = new order_type();\n $ots = $ot->find('all');\n $order_type = array();\n $order_type[-1] = gt('--Any--');\n foreach ($ots as $orderType) {\n $order_type[$orderType->id] = $orderType->title;\n }",
" $dis = new discounts();\n $diss = $dis->find('all');\n $discounts = array();\n $discounts[-1] = gt('--Any--');\n foreach ($diss as $discount) {\n $discounts[$discount->id] = $discount->coupon_code;\n }",
" /*$geo = new geoRegion();",
" $geos = $geo->find('all'); ",
" $states = array();\n $states[-1] = gt('--Any--');\n foreach ($geos as $skey=>$state)\n {\n $states[$skey] = $state->name;\n } */",
" $payment_methods = billingmethod::$payment_types;\n $payment_methods[-1] = gt('--Any--');\n ksort($payment_methods);\n //array('-1'=>'', 'V'=>'Visa','MC'=>'Mastercard','D'=>'Discover','AMEX'=>'American Express','PP'=>'PayPal','GC'=>'Google Checkout','Other'=>'Other');",
" //eDebug(mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));\n// $prev_month = strftime(\"%A, %d %B %Y\", mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));",
" //eDebug(strftime(\"%A, %d %B %Y\", mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")))); ",
"// $now_date = strftime(\"%A, %d %B %Y\");\n $prev_month = strftime(DISPLAY_DATE_FORMAT, mktime(0, 0, 0, (strftime(\"%m\") - 1), 1, strftime(\"%Y\")));\n $now_date = strftime(DISPLAY_DATE_FORMAT);\n $now_hour = strftime(\"%I\");\n $now_min = strftime(\"%M\");\n $now_ampm = strftime(\"%p\");",
" assign_to_template(array(\n 'prev_month' => $prev_month,\n 'now_date' => $now_date,\n 'now_hour' => $now_hour,\n 'now_min' => $now_min,\n 'now_ampm' => $now_ampm,\n 'order_status' => $order_status,\n 'discounts' => $discounts,\n// 'states'=>$states,\n 'order_type' => $order_type,\n 'payment_methods' => $payment_methods\n ));\n }",
" function generateOrderReport() {\n global $db;\n //eDebug($this->params);\n $p = $this->params;",
" //eDebug();",
" //build ",
" $start_sql = \"SELECT DISTINCT(o.id), \";\n $count_sql = \"SELECT COUNT(DISTINCT(o.id)) as c, \";\n $sql = \"o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title, ot.title as order_type\";\n if ((count($p['order_status_changed']) == 1 && $p['order_status_changed'][0] != -1) || count($p['order_status_changed']) > 1 || (!empty($p['include_status_date']) && (!empty($p['date-sstartdate']) || !empty($p['date-senddate'])))) $sql .= \", FROM_UNIXTIME(osc.created_at,'%c/%e/%y %h:%i:%s %p') as status_changed_date\";\n $sql .= \" from \" . $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON ot.id = o.order_type_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"product as p ON oi.product_id = p.id \";\n //if ($p['order_type'][0] != -1) $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON o.order_type_id = ot.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n if ((count($p['order_status_changed']) == 1 && $p['order_status_changed'][0] != -1) || count($p['order_status_changed']) > 1 || (!empty($p['include_status_date']) && (!empty($p['date-sstartdate']) || !empty($p['date-senddate'])))) $sql .= \"INNER JOIN \" . $db->prefix . \"order_status_changes as osc ON osc.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";\n $sql .= \"LEFT JOIN \" . $db->prefix . \"geo_region as gr ON (gr.id = b.state OR gr.id = s.state) \";\n if ($p['discounts'][0] != -1) $sql .= \"LEFT JOIN \" . $db->prefix . \"order_discounts as od ON od.orders_id = o.id \";",
" $sqlwhere = \"WHERE o.purchased != 0\";",
" if (!empty($p['include_purchased_date']) && !empty($p['date-pstartdate'])) $sqlwhere .= \" AND o.purchased >= \" . strtotime($p['date-pstartdate'] . \" \" . $p['time-h-pstartdate'] . \":\" . $p['time-m-pstartdate'] . \" \" . $p['ampm-pstartdate']);\n /*if ($p->['time-h-startdate'] == )\n if ($p->['time-m-startdate'] == )\n if ($p->['ampm-startdate'] == )*/\n if (!empty($p['include_purchased_date']) && !empty($p['date-penddate'])) $sqlwhere .= \" AND o.purchased <= \" . strtotime($p['date-penddate'] . \" \" . $p['time-h-penddate'] . \":\" . $p['time-m-penddate'] . \" \" . $p['ampm-penddate']);\n /*if ($p->['date-enddate'] == )\n if ($p->['time-h-enddate'] == )\n if ($p->['time-m-enddate'] == )\n if ($p->['ampm-enddate'] == )*/\n if (!empty($p['include_status_date']) && !empty($p['date-sstartdate'])) $sqlwhere .= \" AND osc.created_at >= \" . strtotime($p['date-sstartdate'] . \" \" . $p['time-h-sstartdate'] . \":\" . $p['time-m-sstartdate'] . \" \" . $p['ampm-sstartdate']);",
" if (!empty($p['include_status_date']) && !empty($p['date-senddate'])) $sqlwhere .= \" AND osc.created_at <= \" . strtotime($p['date-senddate'] . \" \" . $p['time-h-senddate'] . \":\" . $p['time-m-senddate'] . \" \" . $p['ampm-senddate']);",
" $inc = 0;\n $sqltmp = '';\n foreach ($p['order_status'] as $os) {\n if ($os == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_status_id = \" . $os;\n } else {\n $sqltmp .= \" OR o.order_status_id = \" . $os;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" $inc = 0;\n $sqltmp = '';\n foreach ($p['order_status_changed'] as $osc) {\n if ($osc == -1) continue;\n else if ($inc == 0) {\n $inc++;\n //$sqltmp .= \" AND ((osc.to_status_id = \" . $osc . \" AND (osc.from_status_id != \" . $osc . \")\";\n $sqltmp .= \" AND (osc.to_status_id = \" . $osc;\n } else {\n //$sqltmp .= \" OR (osc.to_status_id = \" . $osc . \" AND (osc.from_status_id != \" . $osc . \")\";\n $sqltmp .= \" OR osc.to_status_id = \" . $osc;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" $inc = 0;\n $sqltmp = '';\n foreach ($p['order_type'] as $ot) {\n if ($ot == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_type_id = \" . $ot;\n } else {\n $sqltmp .= \" OR o.order_type_id = \" . $ot;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['order-range-num'])) {\n $operator = '';\n switch ($p['order-range-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND o.invoice_id\" . $operator . $p['order-range-num'];\n }",
" if (!empty($p['order-price-num'])) {\n $operator = '';\n switch ($p['order-price-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND o.grand_total\" . $operator . $p['order-price-num'];\n }",
" if (!empty($p['pnam'])) {\n $sqlwhere .= \" AND p.title LIKE '%\" . $p['pnam'] . \"%'\";\n }",
" if (!empty($p['sku'])) {\n $sqlwhere .= \" AND p.model LIKE '%\" . $p['sku'] . \"%'\";\n }",
" $inc = 0;\n $sqltmp = '';\n if (isset($p['product_status'])) {\n foreach ($p['product_status'] as $pstat) {\n if ($pstat == -1 || empty($pstat)) continue;",
" $product_status = new product_status($pstat);\n if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (oi.products_status = '\" . $product_status->title . \"'\";\n } else {\n $sqltmp .= \" OR oi.products_status = '\" . $product_status->title . \"'\";\n }\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['uidata'])) {\n $sqlwhere .= \" AND oi.user_input_fields != '' AND oi.user_input_fields != 'a:0:{}'\";\n }",
" $inc = 0;\n $sqltmp = '';\n foreach ($p['discounts'] as $d) {\n if ($d == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (od.discounts_id = \" . $d;\n } else {\n $sqltmp .= \" OR od.discounts_id = \" . $d;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['blshpname'])) {\n $sqlwhere .= \" AND (b.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $p['blshpname'] . \"%')\";\n }",
" if (!empty($p['email'])) {\n $sqlwhere .= \" AND (b.email LIKE '%\" . $p['email'] . \"%'\";\n $sqlwhere .= \" OR s.email LIKE '%\" . $p['email'] . \"%')\";\n }",
" if (!empty($p['zip'])) {\n if ($p['bl-sp-zip'] == 'b') $sqlwhere .= \" AND b.zip LIKE '%\" . $p['zip'] . \"%'\";\n else if ($p['bl-sp-zip'] == 's') $sqlwhere .= \" AND s.zip LIKE '%\" . $p['zip'] . \"%'\";\n }",
" if (isset($p['state'])) {\n $inc = 0;\n $sqltmp = '';\n foreach ($p['state'] as $s) {\n if ($s == -1) continue;\n else if ($inc == 0) {\n $inc++;\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" AND (b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" AND (s.state = \" . $s;\n } else {\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" OR b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" OR s.state = \" . $s;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" if (isset($p['payment_method'])) {\n $inc = 0;\n $sqltmp = '';",
" //get each calculator's id ",
"\n foreach ($p['payment_method'] as $s) {\n if ($s == -1) continue;\n if ($s == 'VisaCard' || $s == 'AmExCard' || $s == 'MasterCard' || $s == 'DiscoverCard') {\n $paymentQuery = 'b.billing_options LIKE \"%' . $s . '%\"';\n } else {\n $bc = new billingcalculator();\n $calc = $bc->findBy('calculator_name', $s);\n $paymentQuery = 'billingcalculator_id = ' . $calc->id;\n }",
" if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND ( \" . $paymentQuery;\n } else {\n $sqltmp .= \" OR \" . $paymentQuery;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" //echo $sql . $sqlwhere . \"<br>\";\n /*\n Need: order, orderitems, order status, ordertype, billingmethods, geo region, shipping methods, products",
" [date-startdate] => \n [time-h-startdate] => \n [time-m-startdate] => ",
" [ampm-startdate] => am",
" [date-enddate] => \n [time-h-enddate] => \n [time-m-enddate] => ",
" [ampm-enddate] => am\n [order_status] => Array\n (\n [0] => 0\n [1] => 1\n [2] => 2\n )",
" [order_type] => Array\n (\n [0] => 0\n [1] => 2\n )",
" [order-range-op] => e",
" [order-range-num] => ",
" [order-price-op] => l",
" [order-price-num] => \n [pnam] => \n [sku] => ",
" [discounts] => Array\n (\n [0] => -1\n )\n",
" [blshpname] => \n [email] => ",
" [bl-sp-zip] => s",
" [zip] => ",
" [bl-sp-state] => s\n [state] => Array\n (\n [0] => -1\n )",
" [status] => Array\n (\n [0] => -1\n )",
" )\n */",
" //$sqlwhere .= \" ORDER BY purchased_date DESC\";\n $count_sql .= $sql . $sqlwhere;\n $sql = $start_sql . $sql;\n expSession::set('order_print_query', $sql . $sqlwhere);\n $reportRecords = $db->selectObjectsBySql($sql . $sqlwhere);\n expSession::set('order_export_values', $reportRecords);",
" //eDebug(expSession::get('order_export_values'));\n //$where = 1;//$this->aggregateWhereClause();\n //$order = 'id';\n //$prod = new product();\n // $order = new order();",
" //$items = $prod->find('all', 1, 'id DESC',25); \n //$items = $order->find('all', 1, 'id DESC',25); ",
" //$res = $mod->find('all',$sql,'id',25);\n //eDebug($items);",
" //eDebug($sql . $sqlwhere); ",
"\n $page = new expPaginator(array(\n //'model'=>'order',\n //'records'=>$items,\n // 'where'=>$where,\n 'count_sql' => $count_sql,\n 'sql' => $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 350 : $this->config['limit'],\n 'order' => 'invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date') => 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Status Changed Date') => 'status_changed_date',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n",
" //strftime(\"%a %d-%m-%Y\", get_first_day(3, 1, 2007)); Thursday, 1 April 2010 ",
" //$d_month_previous = date('n', mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));",
" $action_items = array(\n 'print_orders' => 'Print Orders',\n 'export_odbc' => 'Export Shipping Data to CSV',\n 'export_status_report' => 'Export Order Status Data to CSV',\n 'export_inventory' => 'Export Inventory Data to CSV',\n 'export_user_input_report' => 'Export User Input Data to CSV',\n 'export_order_items' => 'Export Order Items Data to CSV',\n 'show_payment_summary' => 'Show Payment & Tax Summary'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));\n }",
" function show_payment_summary() {\n global $db;",
" $payments = billingmethod::$payment_types;",
" $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n if (!empty($this->params['act-upon'])) foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);",
" $payment_summary = array();\n // $Credit Cards\n// $sql = \"SELECT orders_id, billing_cost, billing_options, calculator_name, user_title FROM \" . $db->prefix . \"billingmethods, \" . $db->prefix . \"billingcalculator WHERE \" . $db->prefix . \"billingcalculator.id = billingcalculator_id and orders_id IN (\" . $orders_string . \")\";\n $sql = \"SELECT orders_id, billing_cost, billing_options, calculator_name, title FROM \" . $db->prefix . \"billingmethods, \" . $db->prefix . \"billingcalculator WHERE \" . $db->prefix . \"billingcalculator.id = billingcalculator_id and orders_id IN (\" . $orders_string . \")\";\n $res = $db->selectObjectsBySql($sql);\n if (!empty($res)) {\n foreach ($res as $item) {\n $options = expUnserialize($item->billing_options);\n if (!empty($item->billing_cost)) {\n// if ($item->user_title == 'Credit Card') {\n if ($item->title == 'Credit Card') { //FIXME there is no billingmethod->title ...this is translated??\n if (!empty($options->cc_type)) {\n //@$payment_summary[$payments[$options->cc_type]] += $item->billing_cost;\n @$payment_summary[$payments[$options->cc_type]] += $options->result->amount_captured;\n }\n } else {\n @$payment_summary[$payments[$item->calculator_name]] += $item->billing_cost;\n }\n }\n }\n }",
" $payments_key_arr = array();\n $payment_values_arr = array();\n foreach ($payment_summary as $key => $item) {\n $payments_key_arr[] = '\"' . $key . '\"';\n $payment_values_arr[] = round($item, 2);\n }\n $payments_key = implode(\",\", $payments_key_arr);\n $payment_values = implode(\",\", $payment_values_arr);",
" //tax\n// $tax_sql = \"SELECT SUM(tax) as tax_total FROM \" . $db->prefix . \"orders WHERE id IN (\" . $orders_string . \")\";\n// $tax_res = $db->selectObjectBySql($tax_sql);\n $tax_types = taxController::getTaxRates();\n// $tax_type_formatted = $tax_types[0]->zonename . ' - ' . $tax_types[0]->classname . ' - ' . $tax_types[0]->rate . '%';",
" $ord = new order();\n $tax_res2 = $ord->find('all',\"id IN (\" . $orders_string . \")\");",
" $taxes = array();\n foreach ($tax_res2 as $tt) {\n $key = key($tt->taxzones);\n if (!empty($key)) {\n $tname = $tt->taxzones[$key]->name;\n if (!isset($taxes[$key]['format'])) {\n $taxes[$key] = array();\n $taxes[$key]['total'] =0;\n }\n $taxes[$key]['format'] = $tname . ' - ' . $tt->taxzones[$key]->rate . '%';\n $taxes[$key]['total'] += $tt->tax;\n }\n }",
" assign_to_template(array(\n 'payment_summary' => $payment_summary,\n 'payments_key' => $payments_key,\n 'payment_values' => $payment_values,\n// 'tax_total' => !empty($tax_res->tax_total) ? $tax_res->tax_total : 0,\n// 'tax_type' => $tax_type_formatted,\n 'taxes' => $taxes\n ));\n }",
" function export_user_input_report() {\n $order = new order();\n $out = '\"ITEM_NAME\",\"QUANTITY\",\"PERSONALIZATION\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')');\n //eDebug($orders,true);\n $pattern = '/\\(.*\\)/i';\n $items = array();\n $top = array();\n foreach ($orders as $order) { //eDebug($order,true);\n foreach ($order->orderitem as $oi) {\n // eDebug($oi,true);\n $item = array();\n if ($oi->user_input_fields == '' || $oi->user_input_fields == 'a:0:{}') continue;\n else $item['user_input_data'] = expUnserialize($oi->user_input_fields);;",
" $model = preg_replace($pattern, '', preg_replace('/\\s/', '', $oi->products_model));\n $item['model'] = $model;\n //$item['name'] = strip_tags($oi->products_name);\n $item['qty'] = $oi->quantity;",
" $items[] = $item;\n }\n }\n unset($item);\n foreach ($items as $item) {\n $line = '';",
" //$line = expString::outputField(\"SMC Inventory - Laurie\"); ",
" $line .= expString::outputField($item['model']);\n //$line.= expString::outputField($item['name']);\n $line .= expString::outputField($item['qty']);\n $ui = array();\n $uiInfo = '';\n foreach ($item['user_input_data'] as $tlArray) {\n foreach ($tlArray as $ifKey => $if) {\n $uiInfo .= $ifKey . '=' . $if . \" | \";\n }\n }\n $line .= expString::outputField(strtoupper(substr_replace($uiInfo, '', strrpos($uiInfo, ' |'), strlen(' |'))), chr(13) . chr(10));\n $out .= $line;\n }\n //eDebug($out,true);\n self::download($out, 'User_Input_Export_' . time() . '.csv', 'application/csv');\n // [firstname] => Fred [middlename] => J [lastname] => Dirkse [organization] => OIC Group, Inc. [address1] => PO Box 1111 [address2] => [city] => Peoria [state] => 23 [zip] => 61653 [country] => [phone] => 309-555-1212 begin_of_the_skype_highlighting 309-555-1212 end_of_the_skype_highlighting [email] => fred@oicgroup.net [shippingcalculator_id] => 4 [option] => 01 [option_title] => 8-10 Day [shipping_cost] => 5.95\n }",
" function export_inventory() {\n $order = new order();\n $out = '\"BADDR_LAST_NM\",\"ITEM_NAME\",\"ITEM_DESC\",\"ITEM_QUANTITY\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')');\n //eDebug($orders,true);\n $pattern = '/\\(.*\\)/i';\n $items = array();\n $top = array();\n foreach ($orders as $order) { //eDebug($order,true);\n foreach ($order->orderitem as $oi) {\n $model = preg_replace($pattern, '', preg_replace('/\\s/', '', $oi->products_model));\n if (stripos($model, 'DUI') === 0) {\n $top[$model]['name'] = strip_tags($oi->products_name);\n if (isset($top[$model]['qty'])) $top[$model]['qty'] += $oi->quantity;\n else $top[$model]['qty'] = $oi->quantity;\n } else {\n $items[$model]['name'] = strip_tags($oi->products_name);\n if (isset($items[$model]['qty'])) $items[$model]['qty'] += $oi->quantity;\n else $items[$model]['qty'] = $oi->quantity;\n }\n }\n }\n ksort($top, SORT_STRING);\n ksort($items, SORT_STRING);\n foreach ($top as $model => $item) {\n $line = '';\n $line = expString::outputField(\"SMC Inventory - Laurie\");\n $line .= expString::outputField($model);\n $line .= expString::outputField($item['name']);\n $line .= expString::outputField($item['qty'], chr(13) . chr(10));\n $out .= $line;\n }\n foreach ($items as $model => $item) {\n $line = '';\n $line = expString::outputField(\"SMC Inventory - Laurie\");\n $line .= expString::outputField($model);\n $line .= expString::outputField($item['name']);\n $line .= expString::outputField($item['qty'], chr(13) . chr(10));\n $out .= $line;\n }\n //eDebug($out,true);\n self::download($out, 'Inventory_Export_' . time() . '.csv', 'application/csv');\n // [firstname] => Fred [middlename] => J [lastname] => Dirkse [organization] => OIC Group, Inc. [address1] => PO Box 1111 [address2] => [city] => Peoria [state] => 23 [zip] => 61653 [country] => [phone] => 309-555-1212 begin_of_the_skype_highlighting 309-555-1212 end_of_the_skype_highlighting [email] => fred@oicgroup.net [shippingcalculator_id] => 4 [option] => 01 [option_title] => 8-10 Day [shipping_cost] => 5.95",
" }",
" function generateProductReport() {\n global $db;\n // eDebug($this->params);\n $p = $this->params;\n $sqlids = \"SELECT DISTINCT(p.id) from \";\n $count_sql = \"SELECT COUNT(DISTINCT(p.id)) as c FROM \";\n $sqlstart = \"SELECT DISTINCT(p.id), p.title, p.model, concat('\".expCore::getCurrencySymbol().\"',format(p.base_price,2)) as base_price\";//, ps.title as status from \";\n $sql = $db->prefix . \"product as p \";\n if (!isset($p['allproducts'])){\n $sql .= \"INNER JOIN \" . $db->prefix . \"product_status as ps ON p.product_status_id = ps.id \";\n $sqlstart .= \", ps.title as status from \";\n if (!isset($p['uncategorized'])){\n $sql .= \"INNER JOIN \" . $db->prefix . \"product_storeCategories as psc ON p.id = psc.product_id \";\n }\n } else {\n $sqlstart .= \" from \";\n }\n //$sqlidsjoin = \"INNER JOIN \" . $db->prefix . \"product as childp ON p.id = childp.parent_id \";\n $sqlwhere = 'WHERE (1=1 ';",
" $inc = 0;\n $sqltmp = '';\n if (isset($p['product_status'])) {\n foreach ($p['product_status'] as $os) {\n if ($os == '') continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (p.product_status_id = \" . $os;\n } else {\n $sqltmp .= \" OR p.product_status_id = \" . $os;\n }",
" }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" $inc = 0;\n $sqltmp = '';\n if (!empty($p['product_type'])) foreach ($p['product_type'] as $ot) {\n if ($ot == '') continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (p.product_type = '\" . $ot . \"'\";\n } else {\n $sqltmp .= \" OR p.product_type = '\" . $ot . \"'\";\n }",
" }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!isset($p['allproducts'])) {\n if (!isset($p['uncategorized'])) {\n $inc = 0;\n $sqltmp = '';\n if (!empty($p['storeCategory'])) foreach ($p['storeCategory'] as $ot) {\n if ($ot == '') continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (psc.storecategories_id = \" . $ot;\n } else {\n $sqltmp .= \" OR psc.storecategories_id = \" . $ot;\n }",
" }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n } else {\n $sqlwhere .= \" AND psc.storecategories_id = 0 AND p.parent_id = 0\";\n }\n }",
" if (!empty($p['product-range-num'])) {\n $operator = '';\n switch ($p['product-range-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND p.id\" . $operator . $p['product-range-num'];\n }",
" $inc = 0;\n $sqltmp = '';\n if (isset($p['company'])) {\n foreach ($p['company'] as $os) {\n if ($os == '') continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (p.companies_id = \" . $os;\n } else {\n $sqltmp .= \" OR p.companies_id = \" . $os;\n }",
" }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" if (!empty($p['product-price-num'])) {\n $operator = '';\n switch ($p['product-price-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND p.base_price\" . $operator . $p['product-price-num'];\n }",
" if (!empty($p['pnam'])) {\n $sqlwhere .= \" AND p.title LIKE '%\" . $p['pnam'] . \"%'\";\n }",
" if (!empty($p['sku'])) {\n $sqlwhere .= \" AND p.model LIKE '%\" . $p['sku'] . \"%'\";\n }",
" $sqlwhere .= \")\";",
" $exportSQL = $sqlids . $sql . $sqlwhere; // . \")\"; // \" OR p.parent_id IN (\".$sqlids . $sql . $sqlwhere . \")\";\n //$sqlidswhere = \" OR p.id IN (SELECT id FROM\".$db->prefix.\"_product WHERE parent_id=)\";\n// eDebug($sqlstart . $sql . $sqlwhere);\n// eDebug($count_sql . $sql . $sqlwhere);\n// eDebug(\"Stored:\" . $exportSQL);\n expSession::set('product_export_query', $exportSQL);\n //expSession::set('product_export_query', \"SELECT DISTINCT(p.id) FROM `exponent_product` p WHERE (title like '%Velcro%' OR feed_title like '%Velcro%' OR title like '%Multicam%' OR feed_title like '%Multicam%') AND parent_id = 0\");",
" $product = new product();",
" //$items = $product->find('all', '', 'id', 25); \n //$page = new expPaginator(); \n //eDebug($page,true); ",
" $page = new expPaginator(array(\n// 'model' => 'product',\n //'records'=>$items,\n // 'where'=>$where,\n 'sql' => $sqlstart . $sql . $sqlwhere,\n //'sql'=>\"SELECT DISTINCT(p.id), p.title, p.model, p.base_price FROM `exponent_product` p WHERE (title like '%Velcro%' OR feed_title like '%Velcro%' OR title like '%Multicam%' OR feed_title like '%Multicam%') AND parent_id = 0\",\n //'count_sql'=>\"SELECT COUNT(DISTINCT(p.id)) FROM `exponent_product` p WHERE (title like '%Velcro%' OR feed_title like '%Velcro%' OR title like '%Multicam%' OR feed_title like '%Multicam%') AND parent_id = 0\",\n 'count_sql' => $count_sql . $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 350 : $this->config['limit'],\n 'order' => 'id',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => 'store',\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n 'ID' => 'id',\n gt('Product') => 'title|controller=store,action=show,showby=id',\n 'SKU' => 'model',\n gt('Price') => 'base_price',\n gt('Status') => 'status'\n ),\n //'columns'=>array('Product'=>'title','SKU'=>'model'),\n ));\n //eDebug($page,true);\n /*$page = new expPaginator(array(\n 'model'=>'order',\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'sql'=>$sql,\n 'order'=>'purchased',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns'=>array(\n 'Customer'=>'lastname',",
" 'Invoice #'=>'invoice_id', ",
" 'Total'=>'total',\n 'Date Purchased'=>'purchased',\n 'Status'=>'order_status_id',\n )\n )); */\n $action_items = array(\n 'batch_export' => 'Export Product List to CSV',\n 'status_export' => 'Export Product Status Report to CSV'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));",
" // \n // \n // assign_to_template(array('page'=>$page)); ",
" }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �",
" //echo \"1<br>\"; eDebug($str); ",
"\n $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\t\", \" \", $str);\n $str = str_replace(\",\", \"\\,\", $str);\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);",
" if (!$isHTML) {\n $str = str_replace('\\\"', \""\", $str);\n $str = str_replace('\"', \""\", $str);\n } else {\n $str = str_replace('\"', '\"\"', $str);\n }",
" //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n $str = trim(str_replace(\"�\", \"™\", $str));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);\n// global $db;",
" $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\,\", \",\", $str);\n $str = str_replace('\"\"', '\"', $str); //do this no matter what...in case someone added a quote in a non HTML field\n if (!$isHTML) {",
" //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char ",
" $str = str_replace('\"', \""\", $str);\n }\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);\n //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n// if (DB_ENGINE=='mysqli') {\n//\t $str = @mysqli_real_escape_string($db->connection,trim(str_replace(\"�\", \"™\", $str)));\n// } elseif(DB_ENGINE=='mysql') {\n// $str = @mysql_real_escape_string(trim(str_replace(\"�\", \"™\", $str)),$db->connection);\n// } else {\n//\t $str = trim(str_replace(\"�\", \"™\", $str));\n// }\n $str = @expString::escape(trim(str_replace(\"�\", \"™\", $str)));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n public static function parseAndTrim($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);\n// global $db;",
" $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);",
" //$str = str_replace(\",\",\"\\,\",$str); ",
"\n $str = str_replace('\\\"', \""\", $str);\n $str = str_replace('\"', \""\", $str);\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);\n //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n// if (DB_ENGINE=='mysqli') {\n//\t $str = @mysqli_real_escape_string($db->connection,trim(str_replace(\"�\", \"™\", $str)));\n// } elseif(DB_ENGINE=='mysql') {\n// $str = @mysql_real_escape_string(trim(str_replace(\"�\", \"™\", $str)),$db->connection);\n// } else {\n//\t $str = trim(str_replace(\"�\", \"™\", $str));\n// }\n $str = @expString::escape(trim(str_replace(\"�\", \"™\", $str)));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n function outputField($val, $eof = ',', $isHTML = false) {\n $newVal = expString::parseAndTrimExport($val, $isHTML);\n if ($newVal != '') return '\"' . $newVal . '\"' . $eof;\n else return $eof;\n }",
" function print_orders() {\n// global $db, $timer;\n //eDebug($this->params,true);\n //eDebug($timer->mark());\n //eDebug( expSession::get('order_print_query'));\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n //$sql = expSession::get('order_print_query');\n //eDebug($sql);\n //expSession::set('product_export_query','');\n //$orders = $db->selectArraysBySql($sql);\n $obs = expSession::get('order_export_values');\n usort($obs, array(\"reportController\", \"sortPrintOrders\"));\n foreach ($obs as $ob) {\n $orders[] = array('id' => $ob->id);\n }\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $order) {\n $orders[] = array('id' => $order);\n }\n }",
" //eDebug(\"Done with print_orders: \" . $timer->mark());\n //eDebug($orders,true);\n $oc = new orderController();\n $oc->getPDF($orders);\n }",
" //sort print orders by id, newest to oldest\n static function sortPrintOrders($a, $b) {\n if ($a->invoice_id > $b->invoice_id) return -1;\n else if ($a->invoice_id < $b->invoice_id) return 1;\n else if ($a->invoice_id == $b->invoice_id) return 0;\n }",
" function export_odbc() {\n $order = new order();\n $out = '\"order_id\",\"shipping_method_id\",\"shipping_option\",\"shipping_cost\",\"firstname\",\"middlename\",\"lastname\",\"organization\",\"address1\",\"address2\",\"city\",\"state\",\"zip\",\"country\",\"phone\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')');\n //eDebug($orders);\n foreach ($orders as $order) {\n $line = expString::outputField($order->invoice_id);\n foreach ($order->shippingmethods as $m) {\n $line .= expString::outputField($m->id);\n $line .= expString::outputField($m->option_title);\n $line .= expString::outputField($order->shipping_total + $order->surcharge_total);\n $line .= expString::outputField($m->firstname);\n $line .= expString::outputField($m->middlename);\n $line .= expString::outputField($m->lastname);\n $line .= expString::outputField($m->organization);\n $line .= expString::outputField($m->address1);\n $line .= expString::outputField($m->address2);\n $line .= expString::outputField($m->city);\n// $state = new geoRegion($m->state);\n //eDebug($state);\n// $line .= expString::outputField($state->code);\n $line .= expString::outputField(geoRegion::getAbbrev($m->state));\n $line .= expString::outputField($m->zip);\n// $line .= expString::outputField('US');\n $line .= expString::outputField(geoRegion::getCountryCode($m->country));\n $line .= expString::outputField($m->phone, chr(13) . chr(10));\n break;\n }\n $out .= $line;\n }\n //eDebug($out,true);\n self::download($out, 'Shipping_Export.csv', 'application/csv');\n // [firstname] => Fred [middlename] => J [lastname] => Dirkse [organization] => OIC Group, Inc. [address1] => PO Box 1111 [address2] => [city] => Peoria [state] => 23 [zip] => 61653 [country] => [phone] => 309-555-1212 begin_of_the_skype_highlighting 309-555-1212 end_of_the_skype_highlighting [email] => fred@oicgroup.net [shippingcalculator_id] => 4 [option] => 01 [option_title] => 8-10 Day [shipping_cost] => 5.95",
" }",
" function export_order_items() {\n $order = new order();\n $out = '\"order_id\",\"quantity\",\"SKU\",\"product_title\",\"firstname\",\"middlename\",\"lastname\",\"organization\",\"address1\",\"address2\",\"city\",\"state\",\"zip\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')');\n //eDebug($orders);\n foreach ($orders as $order) {\n $m = array_shift($order->shippingmethods);\n foreach ($order->orderitem as $orderitem) {\n $line = expString::outputField($order->invoice_id);\n $line .= expString::outputField($orderitem->quantity);\n $line .= expString::outputField($orderitem->products_model);\n $line .= expString::outputField($orderitem->products_name);",
" $line .= expString::outputField($m->firstname);\n $line .= expString::outputField($m->middlename);\n $line .= expString::outputField($m->lastname);\n $line .= expString::outputField($m->organization);\n $line .= expString::outputField($m->address1);\n $line .= expString::outputField($m->address2);\n $line .= expString::outputField($m->city);\n $state = new geoRegion($m->state);\n $line .= expString::outputField($state->code);\n $line .= expString::outputField($m->zip, chr(13) . chr(10));\n $out .= $line;\n }\n }\n //eDebug($out,true);\n self::download($out, 'Order_Item_Export.csv', 'application/csv');\n // [firstname] => Fred [middlename] => J [lastname] => Dirkse [organization] => OIC Group, Inc. [address1] => PO Box 1111 [address2] => [city] => Peoria [state] => 23 [zip] => 61653 [country] => [phone] => 309-555-1212 begin_of_the_skype_highlighting 309-555-1212 end_of_the_skype_highlighting [email] => fred@oicgroup.net [shippingcalculator_id] => 4 [option] => 01 [option_title] => 8-10 Day [shipping_cost] => 5.95",
" }",
" function export_status_report() {\n $order = new order();\n $out = '\"ITEM_NAME\",\"ITEM_DESC\",\"ITEM_QUANTITY\",\"ITEM_STATUS\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')', null, null, null, true, true, array('order_discounts', 'billingmethod', 'order_status_changes', 'order_status', 'order_type'), true);\n $pattern = '/\\(.*\\)/i';\n foreach ($orders as $order) {\n foreach ($order->orderitem as $oi) {\n $model = preg_replace($pattern, '', preg_replace('/\\s/', '', $oi->products_model));\n $line = '';\n $line .= expString::outputField($model);\n $line .= expString::outputField($oi->products_name);\n $line .= expString::outputField($oi->quantity);\n $line .= expString::outputField($oi->products_status, chr(13) . chr(10));\n $out .= $line;\n }\n }\n self::download($out, 'Status_Export_' . time() . '.csv', 'application/csv');\n }",
" static function download($file, $name, $type) {\n if (!headers_sent()) {\n //echo $file;\n //exit();\n ob_clean();\n header('Content-Description: File Transfer');\n header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1\n header('Pragma: public');\n// header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // force download dialog\n header('Content-Type: application/force-download');\n //header('Content-Type: application/octet-stream', false);\n header('Content-Type: application/download', false);\n header('Content-Type: ' . $type, false);\n //header('Content-Type: application/pdf', false);\n // use the Content-Disposition header to supply a recommended filename\n header('Content-Disposition: attachment; filename=\"' . $name . '\";');\n header('Content-Transfer-Encoding: ascii');\n header('Content-Length: ' . strlen($file));\n //header('Content-Length: '.filesize($this->tmp_rendered));\n echo $file;\n //echo readfile($this->tmp_rendered);\n } else {\n echo \"Oops, headers already sent. Check DEVELOPMENT variable?\";\n }\n die();\n }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n function stripLineEndings($val) {\n return preg_replace('/\\r\\n/', ' ', trim($val));\n }",
" function productFeed() {\n// global $db;\n //check query password to avoid DDOS\n /*\n * condition = new",
" * description \n * id - SKU \n * link \n * price \n * title \n * brand - manufacturer \n * image link - fullsized image, up to 10, comma seperated \n * product type - category - \"Electronics > Audio > Audio Accessories MP3 Player Accessories\",\"Health & Beauty > Healthcare > Biometric Monitors > Pedometers\" ",
" */\n $out = '\"id\",\"condition\",\"description\",\"like\",\"price\",\"title\",\"brand\",\"image link\",\"product type\"' . chr(13) . chr(10);",
" $p = new product();\n $prods = $p->find('all', 'parent_id=0 AND ');\n //$prods = $db->selectObjects('product','parent_id=0 AND');\n }",
" function abandoned_carts() {\n global $db;",
" $allCarts = array();\n $carts = array();\n $cartsWithoutItems = array();\n $cartsWithItems = array();\n $cartsWithItemsAndInfo = array();\n $summary = array();\n $valueproducts = '';",
" $quickrange = array(0 => gt('Last 24 Hours'), 1 => gt('Last 7 Days'), 2 => gt('Last 30 Days'));\n $this->setDateParams($this->params);\n if (!isset($this->params['quickrange'])) {\n $this->params['quickrange'] = 0;\n }",
" // purchased == 0 or invoice_id == 0 on unsubmitted orders\n $sql = \"SELECT * FROM \" . $db->prefix . \"orders WHERE purchased = 0 AND edited_at >= \" . $this->tstart . \" AND edited_at <= \" . $this->tend . \" AND sessionticket_ticket NOT IN \";\n $sql .= \"(SELECT ticket FROM \" . $db->prefix . \"sessionticket) ORDER BY edited_at DESC\";\n // echo $sql;\n $allCarts = $db->selectObjectsBySql($sql);\n foreach ($allCarts as $item) {",
" $sql = \"SELECT * FROM \" . $db->prefix . \"orderitems WHERE orders_id =\" . $item->id;",
" $carts = $db->selectObjectsBySql($sql);\n foreach ($carts as $item2) {\n $valueproducts += $item2->products_price_adjusted * $item2->quantity;\n }",
" $carts['last_visit'] = date('Y-m-d, g:i:s A', $item->edited_at);\n $carts['referrer'] = $item->orig_referrer;",
" if (count($carts) > 2) {\n if (!empty($item->user_id)) {\n $u = $db->selectObject('user', 'id=' . $item->user_id);\n $carts['name'] = $u->firstname . ' ' . $u->lastname;\n $carts['email'] = $u->email;\n $cartsWithItemsAndInfo[] = $carts;\n // $cartsWithItemsAndInfo['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60,2).\" minutes\";\n // $cartsWithItemsAndInfo['ip_address'] = $item->ip_address;\n // $cartsWithItemsAndInfo['referrer'] = $item->referrer;\n } else {\n $cartsWithItems[] = $carts;\n // $cartsWithItems['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60,2).\" minutes\";\n // $cartsWithItems['ip_address'] = $item->ip_address;\n // $cartsWithItems['referrer'] = $item->referrer;\n }",
" } else {\n $item->last_visit = date('Y-m-d, g:i:s A', $item->edited_at);\n $cartsWithoutItems[] = $item;\n }\n }\n //Added the count\n $allCarts['count'] = count($allCarts);\n $cartsWithoutItems['count'] = count($cartsWithoutItems);\n $cartsWithItems['count'] = count($cartsWithItems); //for the added values at the top\n $cartsWithItemsAndInfo['count'] = count($cartsWithItemsAndInfo); //for the added values at the top",
" // eDebug($allCarts);\n // eDebug($cartsWithoutItems);\n // eDebug($cartsWithItems);\n // eDebug($cartsWithItemsAndInfo);\n // exit();\n $summary['totalcarts'] = $allCarts['count'];\n $summary['valueproducts'] = $valueproducts;\n $summary['cartsWithoutItems'] = round(($allCarts['count'] ? $cartsWithoutItems['count'] / $allCarts['count'] : 0) * 100, 2) . '%';\n $summary['cartsWithItems'] = round(($allCarts['count'] ? $cartsWithItems['count'] / $allCarts['count'] : 0) * 100, 2) . '%';\n $summary['cartsWithItemsAndInfo'] = round(($allCarts['count'] ? $cartsWithItemsAndInfo['count'] / $allCarts['count'] : 0) * 100, 2) . '%';",
" assign_to_template(array(\n 'quickrange' => $quickrange,\n 'quickrange_default' => $this->params['quickrange'],\n 'summary' => $summary,\n 'cartsWithoutItems' => $cartsWithoutItems,\n 'cartsWithItems' => $cartsWithItems,\n 'cartsWithItemsAndInfo' => $cartsWithItemsAndInfo\n ));\n }",
" function pruge_abandoned_carts()\n {\n global $db;",
" $db->delete(\"orders\",\"`invoice_id` = '0' AND `edited_at` < UNIX_TIMESTAMP(now())-5184000 AND `sessionticket_ticket` NOT IN (SELECT `ticket` FROM `\".$db->prefix.\"sessionticket`)\");\n $db->delete(\"orderitems\",\"`orders_id` NOT IN (SELECT `id` FROM `\".$db->prefix.\"orders`)\");\n $db->delete(\"shippingmethods\",\"`id` NOT IN (SELECT `shippingmethods_id` FROM `\".$db->prefix.\"orders`)\");\n }",
" function current_carts() {\n global $db;",
" $allCarts = array();\n $carts = array();\n $cartsWithoutItems = array();\n $cartsWithItems = array();\n $cartsWithItemsAndInfo = array();\n $summary = array();\n $valueproducts = '';\n // $sql = \"SELECT * FROM \" . $db->prefix . \"orders WHERE DATEDIFF(FROM_UNIXTIME(edited_at, '%Y-%m-%d'), '\" . date('Y-m-d') . \"') = 0\";",
" $sql = \"SELECT * FROM \" . $db->prefix . \"orders, \" . $db->prefix . \"sessionticket WHERE ticket = sessionticket_ticket\";",
" $allCarts = $db->selectObjectsBySql($sql);",
" // eDebug($allCarts, true);\n foreach ($allCarts as $item) {",
" $sql = \"SELECT * FROM \" . $db->prefix . \"orderitems WHERE orders_id =\" . $item->id;",
" $carts = $db->selectObjectsBySql($sql);",
" foreach ($carts as $item2) {\n $valueproducts += $item2->products_price_adjusted * $item2->quantity;\n }",
" $carts['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60, 2) . \" minutes\";\n $carts['ip_address'] = $item->ip_address;\n $carts['referrer'] = $item->referrer;",
" if (count($carts) > 3) {\n if (!empty($item->user_id)) {\n $u = $db->selectObject('user', 'id=' . $item->user_id);\n $carts['name'] = $u->firstname . ' ' . $u->lastname;\n $carts['email'] = $u->email;\n $cartsWithItemsAndInfo[] = $carts;\n // $cartsWithItemsAndInfo['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60,2).\" minutes\";\n // $cartsWithItemsAndInfo['ip_address'] = $item->ip_address;\n // $cartsWithItemsAndInfo['referrer'] = $item->referrer;\n } else {\n $cartsWithItems[] = $carts;\n // $cartsWithItems['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60,2).\" minutes\";\n // $cartsWithItems['ip_address'] = $item->ip_address;\n // $cartsWithItems['referrer'] = $item->referrer;\n }",
" } else {\n $item->length_of_time = round(abs($item->last_active - $item->start_time) / 60, 2) . \" minutes\";\n $cartsWithoutItems[] = $item;\n }\n }\n //Added the count\n $allCarts['count'] = count($allCarts);\n $cartsWithoutItems['count'] = count($cartsWithoutItems);\n $cartsWithItems['count'] = count($cartsWithItems); //for the added values at the top\n $cartsWithItemsAndInfo['count'] = count($cartsWithItemsAndInfo); //for the added values at the top",
" // eDebug($allCarts);\n // eDebug($cartsWithoutItems);\n // eDebug($cartsWithItems);\n // eDebug($cartsWithItemsAndInfo);",
" $summary['totalcarts'] = $allCarts['count'];\n $summary['valueproducts'] = intval($valueproducts);\n $summary['cartsWithoutItems'] = round(($allCarts['count'] ? $cartsWithoutItems['count'] / $allCarts['count'] : 0) * 100, 2) . '%';\n $summary['cartsWithItems'] = round(($allCarts['count'] ? $cartsWithItems['count'] / $allCarts['count'] : 0) * 100, 2) . '%';\n $summary['cartsWithItemsAndInfo'] = round(($allCarts['count'] ? $cartsWithItemsAndInfo['count'] / $allCarts['count'] : 0) * 100, 2) . '%';",
" // eDebug($summary, true);\n assign_to_template(array(\n 'summary' => $summary,\n 'cartsWithoutItems' => $cartsWithoutItems,\n 'cartsWithItems' => $cartsWithItems,\n 'cartsWithItemsAndInfo' => $cartsWithItemsAndInfo\n ));\n /*\n $this->setDateParams($this->params);\n $except = array('order_discounts', 'billingmethod', 'order_status_changes', 'billingmethod','order_discounts');\n //$orders = $this->o->find('all','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend,null,null,null,true,false,$except,true);\n // $sql = \"SELECT DATE_FORMAT(created_at, '%Y-%m-%d') as formattedDate FROM orders WHERE created_at\n eDebug(date('Y-m-d'), true);\n // eDebug($this->tend);\n eDebug(date('Y-m-d, g:i:s A', $this->tend));",
" $allOrderCount = $this->o->find('count','created_at >= ' . $this->tstart . ' AND created_at <= ' . $this->tend,null,null,null,true,false,$except,true); ",
" $sql = \"SELECT COUNT(DISTINCT(`orders_id`)) as c FROM \" . $db->prefix . \"orderitems oi \";\n $sql .= \"JOIN \" . $db->prefix . \"orders o ON oi.orders_id = o.id \";\n $sql .= \"WHERE o.created_at >= \" . $this->tstart . \" AND o.created_at <= \" . $this->tend;\n //$sql .= \" AND o.user_id != 0 AND o.order_type_id = 1\";",
" ",
" eDebug($sql);\n $allCartsWithItems = $db->countObjectsBySql($sql);",
" ",
" $sql = \"SELECT COUNT(DISTINCT(`orders_id`)) as c FROM \" . $db->prefix . \"orderitems oi \";\n $sql .= \"JOIN \" . $db->prefix . \"orders o ON oi.orders_id = o.id \";\n $sql .= \"WHERE o.created_at >= \" . $this->tstart . \" AND o.created_at <= \" . $this->tend;\n eDebug($sql);\n $realUserCartsWithItems = $db->countObjectsBySql($sql);",
" \n $ordersInCheckout = $this->o->find('count','created_at >= ' . $this->tstart . ' AND created_at <= ' . $this->tend . \" AND user_id != 0\",null,null,null,true,false,$except,true); \n \n //$ordersPurchased = $this->o->find('count','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend . \" AND user_id != 0 AND order_type_id = 1\",null,null,null,true,false,$except,true); \n //$ordersPurchased = $this->o->find('count','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend . \" AND user_id != 0\",null,null,null,true,false,$except,true); \n $ordersPurchased = $this->o->find('count','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend,null,null,null,true,false,$except,true); \n $orders = $this->o->find('all','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend,null,null,null,true,false,$except,true); \n \n eDebug(\"All:\" . $allOrderCount); \n eDebug(\"Carts w/ Items:\" . $allCartsWithItems); \n eDebug(\"Carts w/ Items in Checkout:\" . $ordersInCheckout); \n eDebug(\"Purchased:\" . $ordersPurchased); \n ",
" $totalAbandoned = ($allCartsWithItems - $ordersPurchased) / $allCartsWithItems;\n $checkoutAbandoned = ($ordersInCheckout - $ordersPurchased) / $ordersInCheckout;\n eDebug(\"Total Abandoned: \" . $totalAbandoned);\n eDebug(\"Checkout Abandoned: \" . $checkoutAbandoned);",
" \n \n \n ",
" $quickrange = array(0=>'Last 24 Hours',1=>'Last 7 Days',2=>'Last 30 Days');\n $quickrange_default = isset($this->params['quickrange']) ? $this->params['quickrange'] : 0;\n assign_to_template(array('orders'=>$oar,'quickrange'=>$quickrange,'quickrange_default'=>$quickrange_default));",
" assign_to_template(array('prev_month'=>$this->prev_month, 'now_date'=>$this->now_date, 'now_hour'=>$this->now_hour, 'now_min'=>$this->now_min, 'now_ampm'=>$this->now_ampm, 'prev_hour'=>$this->prev_hour, 'prev_min'=>$this->prev_min, 'prev_ampm'=>$this->prev_ampm)); ",
" */\n }",
" function batch_export() {\n global $db;\n //eDebug($this->params);\n //$sql = \"SELECT * INTO OUTFILE '\" . BASE . \"tmp/export.csv' FIELDS TERMINATED BY ',' FROM exponent_product WHERE 1 LIMIT 10\";\n// $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"canonical\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\"' . chr(13) . chr(10);\n $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\",\"weight\",\"width\",\"height\",\"length\",\"companies_id\"' . chr(13) . chr(10);\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $sql = expSession::get('product_export_query');\n if (empty($sql)) $sql = 'SELECT DISTINCT(p.id) from ' . $db->prefix . 'product as p WHERE (1=1 )';\n //eDebug($sql);\n //expSession::set('product_export_query','');\n $prods = $db->selectArraysBySql($sql);\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $prod) {\n $prods[] = array('id' => $prod);\n }\n }\n set_time_limit(0);\n $baseProd = new product();",
" //$p = new product($pid['id'], false, false);\n foreach ($prods as $pid) {\n $except = array('company', 'crosssellItem', 'optiongroup');\n $p = $baseProd->find('first', 'id=' . $pid['id'], null, null, 0, true, false, $except, true);",
" //eDebug($p,true);\n $out .= expString::outputField($p->id);\n $out .= expString::outputField($p->parent_id);\n $out .= expString::outputField($p->child_rank);\n $out .= expString::outputField($p->title);\n $out .= expString::outputField(expString::stripLineEndings($p->body), \",\", true);\n $out .= expString::outputField($p->model);\n $out .= expString::outputField($p->warehouse_location);\n $out .= expString::outputField($p->sef_url);\n// $out .= expString::outputField($p->canonical); //FIXME this is NOT in import\n $out .= expString::outputField($p->meta_title);\n $out .= expString::outputField($p->meta_keywords);\n $out .= expString::outputField($p->meta_description);\n $out .= expString::outputField($p->tax_class_id);\n $out .= expString::outputField($p->quantity);\n $out .= expString::outputField($p->availability_type);\n $out .= expString::outputField($p->base_price);\n $out .= expString::outputField($p->special_price);\n $out .= expString::outputField($p->use_special_price);\n $out .= expString::outputField($p->active_type);\n $out .= expString::outputField($p->product_status_id);",
" $rank = 0;\n //eDebug($p);\n for ($x = 0; $x < 12; $x++) {\n $this->catstring = '';\n if (isset($p->storeCategory[$x])) {\n $out .= expString::outputField(storeCategory::buildCategoryString($p->storeCategory[$x]->id, true));\n $rank = $db->selectValue('product_storeCategories', 'rank', 'product_id=' . $p->id . ' AND storecategories_id=' . $p->storeCategory[$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->surcharge);\n $out .= expString::outputField($rank);\n $out .= expString::outputField($p->feed_title);\n $out .= expString::outputField($p->feed_body);\n $out .= expString::outputField($p->weight);\n $out .= expString::outputField($p->height);\n $out .= expString::outputField($p->width);\n $out .= expString::outputField($p->length);\n $out .= expString::outputField($p->companies_id, chr(13) . chr(10)); //Removed the extra \",\" in the last element",
" foreach ($p->childProduct as $cp) {\n //$p = new product($pid['id'], true, false);\n //eDebug($p,true);\n $out .= expString::outputField($cp->id);\n $out .= expString::outputField($cp->parent_id);\n $out .= expString::outputField($cp->child_rank);\n $out .= expString::outputField($cp->title);\n $out .= expString::outputField(expString::stripLineEndings($cp->body));\n $out .= expString::outputField($cp->model);\n $out .= expString::outputField($cp->warehouse_location);\n $out .= expString::outputField($cp->sef_url);\n// $out .= expString::outputField($cp->canonical); //FIXME this is NOT in import\n $out .= expString::outputField($cp->meta_title);\n $out .= expString::outputField($cp->meta_keywords);\n $out .= expString::outputField($cp->meta_description);\n $out .= expString::outputField($cp->tax_class_id);\n $out .= expString::outputField($cp->quantity);\n $out .= expString::outputField($cp->availability_type);\n $out .= expString::outputField($cp->base_price);\n $out .= expString::outputField($cp->special_price);\n $out .= expString::outputField($cp->use_special_price);\n $out .= expString::outputField($cp->active_type);\n $out .= expString::outputField($cp->product_status_id);\n $out .= ',,,,,,,,,,,,'; // for store categories\n $out .= expString::outputField($cp->surcharge);\n $out .= ',,,'; // for rank, feed title, feed body\n $out .= expString::outputField($cp->weight);\n $out .= expString::outputField($cp->height);\n $out .= expString::outputField($cp->width);\n $out .= expString::outputField($cp->length);\n $out .= expString::outputField($cp->companies_id, chr(13) . chr(10)); //Removed the extra \",\" in the last element\n //echo($out);\n }",
" }",
" $outFile = 'tmp/product_export_' . time() . '.csv';\n $outHandle = fopen(BASE . $outFile, 'w');\n fwrite($outHandle, $out);\n fclose($outHandle);",
" echo \"<br/><br/>\".gt('Download the file here').\": <a href='\" . PATH_RELATIVE . $outFile . \"'>\".gt('Product Export').\"</a>\";",
" /*eDebug(BASE . \"tmp/export.csv\");\n $db->sql($sql);\n eDebug($db->error());*/",
" /*OPTIONALLY ENCLOSED BY '\" . '\"' . ",
" \"' ESCAPED BY '\\\\'\n LINES TERMINATED BY '\" . '\\\\n' .\n \"' */\n }",
" function payment_report() {\n// global $db;\n $payment_methods = array('-1' => '', 'V' => 'Visa', 'MC' => 'Mastercard', 'D' => 'Discover', 'AMEX' => 'American Express', 'PP' => 'PayPal', 'GC' => 'Google Checkout', 'Other' => 'Other');\n //5 paypal\n //4 credit card - VisaCard, MasterCard, AmExCard, DiscoverCard",
" $oids = \"(\";",
" eDebug(expSession::get('order_print_query'));\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n //$sql = expSession::get('order_print_query');\n //eDebug($sql);\n //expSession::set('product_export_query','');\n //$orders = $db->selectArraysBySql($sql);\n $obs = expSession::get('order_export_values');\n usort($obs, array(\"reportController\", \"sortPrintOrders\"));\n foreach ($obs as $ob) {\n $oids .= $ob->id . \",\";\n }\n //eDebug($prods);\n } else {\n if (!empty($this->params['act-upon'])) foreach ($this->params['act-upon'] as $order) {\n $oids .= $order->id . \",\";\n }\n }\n $oids = strrev(expUtil::right(strrev($oids), strlen($oids) - 1));\n $oids .= \")\";\n eDebug($oids);\n //eDebug($orders,true);",
" }",
" function status_export() {\n global $db;\n //eDebug($this->params);\n //$sql = \"SELECT * INTO OUTFILE '\" . BASE . \"tmp/export.csv' FIELDS TERMINATED BY ',' FROM exponent_product WHERE 1 LIMIT 10\";",
" //is | parent_id | SKU |WAREHOUSE LOCATION | Title | Vendor/Manufacturer | Product Status | Notes",
" $out = '\"id\",\"parent_id\",\"model\",\"warehouse_location\",\"title\",\"vendor\",\"product_status\",\"notes\"' . chr(13) . chr(10);\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $sql = expSession::get('product_export_query');\n if (empty($sql)) $sql = 'SELECT DISTINCT(p.id) from ' . $db->prefix . 'product as p WHERE (1=1 )';\n //eDebug($sql);\n //expSession::set('product_export_query','');\n $prods = $db->selectArraysBySql($sql);\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $prod) {\n $prods[] = array('id' => $prod);\n }\n }",
" $stats = new product_status();\n $stats = $stats->find('all');",
"// $statuses = array();\n $statuses = array(0=>'');\n foreach ($stats as $stat) {\n $statuses[$stat->id] = $stat->title;\n }",
"// eDebug($statuses);",
" set_time_limit(0);\n $baseProd = new product();",
" //$p = new product($pid['id'], false, false);\n //id | parent_id | SKU |WAREHOUSE LOCATION | Title | Vendor/Manufacturer | Product Status | Notes\n foreach ($prods as $pid) {\n $except = array('crosssellItem', 'optiongroup', 'childProduct');\n $p = $baseProd->find('first', 'id=' . $pid['id'], null, null, 0, true, true, $except, true);",
" /*if(count($p->expSimpleNote))\n {\n eDebug($p,true);\n }\n else\n {\n continue;\n }*/",
" $out .= expString::outputField($p->id);\n $out .= expString::outputField($p->parent_id);\n $out .= expString::outputField($p->model);\n $out .= expString::outputField($p->warehouse_location);\n $out .= expString::outputField($p->title);\n $out .= expString::outputField($p->company->title);\n $out .= expString::outputField($statuses[$p->product_status_id]);",
" $noteString = '';\n foreach ($p->expSimpleNote as $note) {\n $noteString .= \"(\" . $note->name . \" - \" . date('M d Y H:i A', $note->created_at) . \") \" . $note->body . \"||\";\n }\n $out .= expString::outputField($noteString, chr(13) . chr(10));",
" $cps = $baseProd->find('all', 'parent_id=' . $p->id, null, null, 0, true, true, $except, true);\n foreach ($cps as $cp) {\n $out .= expString::outputField($cp->id);\n $out .= expString::outputField($cp->parent_id);\n $out .= expString::outputField($cp->model);\n $out .= expString::outputField($cp->warehouse_location);\n $out .= expString::outputField($cp->title);\n $out .= expString::outputField($cp->company->title);\n $out .= expString::outputField($statuses[$cp->product_status_id]);",
" $noteString = '';\n foreach ($cp->expSimpleNote as $note) {\n $noteString .= \"(\" . $note->name . \" - \" . date('M d Y H:i A', $note->created_at) . \") \" . $note->body . \"||\";\n }\n $out .= expString::outputField($noteString, chr(13) . chr(10));\n }\n }",
" //eDebug($out,true);\n $outFile = 'tmp/product_status_' . time() . '.csv';\n $outHandle = fopen(BASE . $outFile, 'w');\n fwrite($outHandle, $out);\n fclose($outHandle);",
" echo \"<br/><br/>\".gt('Download the file here').\": <a href='\" . PATH_RELATIVE . $outFile . \"'>\".gt('Product Export').\"</a>\";",
" /*eDebug(BASE . \"tmp/export.csv\");\n $db->sql($sql);\n eDebug($db->error());*/",
" /*OPTIONALLY ENCLOSED BY '\" . '\"' . ",
" \"' ESCAPED BY '\\\\'\n LINES TERMINATED BY '\" . '\\\\n' .\n \"' */\n }",
" //public $catstring = '';",
" /**\n * @deprecated 2.3.4 moved to storeCategory\n */\n public static function buildCategoryString($catID, $reset = false) {\n static $cstr = '';\n if ($reset) $cstr = '';\n if (strlen($cstr) > 0) $cstr .= \"::\";\n $cat = new storeCategory($catID);\n //eDebug($cat);\n if (!empty($cat->parent_id)) self::buildCategoryString($cat->parent_id);\n $cstr .= $cat->title . \"::\";\n return substr($cstr, 0, -2);\n }",
" function product_report() {\n $pts = storeController::getProductTypes();\n $newPts = array();\n foreach ($pts as $pt) {\n $newPts[$pt] = $pt;\n }\n assign_to_template(array(\n 'product_types' => $newPts\n ));\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class reportController extends expController {",
" protected $manage_permissions = array(\n 'abandoned_carts' => 'Abandoned Carts Report',\n 'batch_export' => 'Export Products',",
" 'cart_summary' => 'View Cart Summary Report',",
" 'current_carts' => 'Current Carts Report',",
" 'dashboard' => 'View the e-Commerce Dashboard',",
" 'download' => 'Download Report',",
" 'generateOrderReport' => 'View Order Report',\n 'generateProductReport' => 'View Product Report',",
" 'order_report' => 'Generate Order Report',\n 'payment_report' => 'Generate Payment Report',",
" 'print_orders' => 'Print Orders',",
" 'product_report' => 'Generate Product Report',\n 'purge_abandoned_carts' => 'Purge Abandoned Carts',",
" 'show_payment_summary' => 'Show Payment Summary',",
" 'status_export' => 'Export Status',\n );",
"\n static function displayname() {\n return gt(\"Ecom Report Builder\");\n }",
" static function description() {\n return gt(\"Build reports based on store activity\");\n }",
" static function author() {\n return \"Phillip Ball - OIC Group, Inc\";\n }",
" static function hasSources() {\n return false;\n }",
" protected $o;\n protected $oneday = 86400;\n protected $tstart;\n protected $tend;\n protected $prev_month;\n protected $prev_hour = '12';\n protected $prev_min = '00';\n protected $prev_ampm = 'AM';\n protected $now_date;\n protected $now_hour;\n protected $now_min;\n protected $now_ampm;",
" function __construct($src = null, $params = array()) {\n parent::__construct($src, $params);\n $this->o = new order();\n $this->tstart = time() - $this->oneday;\n $this->tend = time();\n// $this->prev_month = strftime(\"%A, %d %B %Y\", mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));\n// $this->now_date = strftime(\"%A, %d %B %Y\");\n $this->prev_month = strftime(DISPLAY_DATE_FORMAT, mktime(0, 0, 0, (strftime(\"%m\") - 1), 1, strftime(\"%Y\")));\n $this->now_date = strftime(DISPLAY_DATE_FORMAT);\n $this->now_hour = strftime(\"%I\");\n $this->now_min = strftime(\"%M\");\n $this->now_ampm = strftime(\"%p\");\n }",
" private function setDateParams($params) {\n //eDebug($params,true);\n if (!empty($params['quickrange'])) {\n if ($params['quickrange'] == 1) {\n $this->tstart = time() - $this->oneday * 7;\n } else if ($params['quickrange'] == 2) {\n $this->tstart = time() - $this->oneday * 30;\n } else if ($params['quickrange'] == 0) {\n $this->tstart = time() - $this->oneday;\n }\n $this->prev_month = strftime(DISPLAY_DATE_FORMAT,$this->tstart);\n } else if (isset($params['date-starttime'])) { //FIXME OLD calendar control format\n $formatedStart = $params['date-starttime'] . ' ' . $params['time-h-starttime'] . \":\" . $params['time-m-starttime'] . ' ' . $params['ampm-starttime'];\n $this->tstart = strtotime($formatedStart);\n $this->tend = strtotime($params['date-endtime'] . ' ' . $params['time-h-endtime'] . \":\" . $params['time-m-endtime'] . ' ' . $params['ampm-endtime']);",
" // parse out date into calendarcontrol fields\n $this->prev_month = $formatedStart;\n $this->prev_hour = $params['time-h-starttime'];\n $this->prev_min = $params['time-m-starttime'];\n $this->prev_ampm = $params['ampm-starttime'];",
" // parse out date into calendarcontrol fields\n $this->now_date = $params['date-endtime'];\n $this->now_hour = $params['time-h-endtime'];\n $this->now_min = $params['time-m-endtime'];\n $this->now_ampm = $params['ampm-endtime'];\n } elseif (isset($params['starttime'])) {\n $this->tstart = strtotime($params['starttime']);\n $this->tend = strtotime($params['endtime']);",
" // parse out date into calendarcontrol fields\n $this->prev_month = date('m/d/Y', $this->tstart);\n $this->prev_hour = date('h', $this->tstart);\n $this->prev_min = date('i', $this->tstart);\n $this->prev_ampm = date('a', $this->tstart);",
" // parse out date into calendarcontrol fields\n $this->now_date = date('m/d/Y', $this->tend);\n $this->now_hour = date('h', $this->tend);\n $this->now_min = date('i', $this->tend);\n $this->now_ampm = date('a', $this->tend);\n } else {\n $this->tstart = time() - $this->oneday;\n }\n return;\n }",
" function dashboard() {\n global $db;",
" $quickrange = array(0 => gt('Last 24 Hours'), 1 => gt('Last 7 Days'), 2 => gt('Last 30 Days'));\n $this->setDateParams($this->params);\n if (!isset($this->params['quickrange'])) {\n $this->params['quickrange'] = 0;\n }",
" $except = array('order_discounts', 'billingmethod', 'order_status_changes', 'billingmethod', 'order_discounts');\n $orders = $this->o->find('all', 'purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend, null, null, 0, true, false, $except, true);\n $oar = array();\n foreach ($orders as $order) {\n //eDebug($order,true);\n if (empty($oar[$order->order_type->title])) {\n $oar[$order->order_type->title] = array();\n $oar[$order->order_type->title]['grand_total'] = null;\n $oar[$order->order_type->title]['num_orders'] = null;\n $oar[$order->order_type->title]['num_items'] = null;\n }\n $oar[$order->order_type->title]['grand_total'] += $order->grand_total;\n $oar[$order->order_type->title]['num_orders']++;\n $oar[$order->order_type->title]['num_items'] += count($order->orderitem);",
" if (empty($oar[$order->order_type->title][$order->order_status->title])) {\n $oar[$order->order_type->title][$order->order_status->title] = array();\n $oar[$order->order_type->title][$order->order_status->title]['grand_total'] = null;\n $oar[$order->order_type->title][$order->order_status->title]['num_orders'] = null;\n $oar[$order->order_type->title][$order->order_status->title]['num_items'] = null;\n }\n $oar[$order->order_type->title][$order->order_status->title]['grand_total'] += $order->grand_total;\n $oar[$order->order_type->title][$order->order_status->title]['num_orders']++;\n $oar[$order->order_type->title][$order->order_status->title]['num_items'] += count($order->orderitem);\n }",
" $sql = \"SELECT COUNT(*) as c FROM \" . $db->prefix . \"orders, \" . $db->prefix . \"sessionticket WHERE ticket = sessionticket_ticket\";\n $allCarts = $db->countObjectsBySql($sql);",
" assign_to_template(array(\n 'orders' => $oar,\n 'quickrange' => $quickrange,\n 'quickrange_default' => $this->params['quickrange'],\n 'prev_month' => $this->prev_month,\n 'now_date' => $this->now_date,\n 'now_hour' => $this->now_hour,\n 'now_min' => $this->now_min,\n 'now_ampm' => $this->now_ampm,\n 'prev_hour' => $this->prev_hour,\n 'prev_min' => $this->prev_min,\n 'prev_ampm' => $this->prev_ampm,\n 'active_carts' => $allCarts\n ));\n }",
" function cart_summary() {\n global $db;",
" $p = $this->params;\n $sql = \"SELECT DISTINCT(o.id), o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title from \";\n $sql .= $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"product as p ON oi.product_id = p.id \";\n if (!empty($p['order_status'][0]) && $p['order_status'][0] != -1) $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON o.order_type_id = ot.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"geo_region as gr ON (gr.id = b.state OR gr.id = s.state) \";\n if (!empty($p['discounts'][0]) && $p['discounts'][0] != -1) $sql .= \"LEFT JOIN \" . $db->prefix . \"order_discounts as od ON od.orders_id = o.id \";",
" $sqlwhere = \"WHERE o.purchased != 0\";",
" if (!empty($p['date-startdate'])) $sqlwhere .= \" AND o.purchased >= \" . strtotime($p['date-startdate'] . \" \" . $p['time-h-startdate'] . \":\" . $p['time-m-startdate'] . \" \" . $p['ampm-startdate']);\n /*if ($p->['time-h-startdate'] == )\n if ($p->['time-m-startdate'] == )\n if ($p->['ampm-startdate'] == )*/",
" if (!empty($p['date-enddate'])) $sqlwhere .= \" AND o.purchased <= \" . strtotime($p['date-enddate'] . \" \" . $p['time-h-enddate'] . \":\" . $p['time-m-enddate'] . \" \" . $p['ampm-enddate']);\n /*if ($p->['date-enddate'] == )\n if ($p->['time-h-enddate'] == )\n if ($p->['time-m-enddate'] == )\n if ($p->['ampm-enddate'] == )*/",
" $inc = 0;\n $sqltmp = '';\n if (!empty($p['order_status'])) foreach ($p['order_status'] as $os) {\n if ($os == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_status_id = \" . $os;\n } else {\n $sqltmp .= \" OR o.order_status_id = \" . $os;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" $inc = 0;\n $sqltmp = '';\n if (!empty($p['order_type'])) foreach ($p['order_type'] as $ot) {\n if ($ot == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_type_id = \" . $ot;\n } else {\n $sqltmp .= \" OR o.order_type_id = \" . $ot;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['order-range-num'])) {\n $operator = '';\n switch ($p['order-range-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND o.invoice_id\" . $operator . $p['order-range-num'];\n }",
" if (!empty($p['order-price-num'])) {\n $operator = '';\n switch ($p['order-price-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND o.grand_total\" . $operator . $p['order-price-num'];\n }",
" if (!empty($p['pnam'])) {\n $sqlwhere .= \" AND p.title LIKE '%\" . $p['pnam'] . \"%'\";\n }",
" if (!empty($p['sku'])) {\n $sqlwhere .= \" AND p.model LIKE '%\" . $p['sku'] . \"%'\";\n }",
" $inc = 0;\n $sqltmp = '';\n if (!empty($p['discounts'])) foreach ($p['discounts'] as $d) {\n if ($d == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (od.discounts_id = \" . $d;\n } else {\n $sqltmp .= \" OR od.discounts_id = \" . $d;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['blshpname'])) {\n $sqlwhere .= \" AND (b.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $p['blshpname'] . \"%')\";\n }",
" if (!empty($p['email'])) {\n $sqlwhere .= \" AND (b.email LIKE '%\" . $p['email'] . \"%'\";\n $sqlwhere .= \" OR s.email LIKE '%\" . $p['email'] . \"%')\";\n }",
" if (!empty($p['zip'])) {\n if ($p['bl-sp-zip'] == 'b') $sqlwhere .= \" AND b.zip LIKE '%\" . $p['zip'] . \"%'\";\n else if ($p['bl-sp-zip'] == 's') $sqlwhere .= \" AND s.zip LIKE '%\" . $p['zip'] . \"%'\";\n }",
" if (isset($p['state'])) {\n $inc = 0;\n $sqltmp = '';\n foreach ($p['state'] as $s) {\n if ($s == -1) continue;\n else if ($inc == 0) {\n $inc++;\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" AND (b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" AND (s.state = \" . $s;\n } else {\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" OR b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" OR s.state = \" . $s;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" if (isset($p['payment_method'])) {\n $inc = 0;\n $sqltmp = '';\n foreach ($p['payment_method'] as $s) {\n if ($s == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_status_id = \" . $s;\n } else {\n $sqltmp .= \" OR o.order_status_id = \" . $s;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" //echo $sql . $sqlwhere . \"<br>\";\n /*\n Need: order, orderitems, order status, ordertype, billingmethods, geo region, shipping methods, products",
" [date-startdate] =>\n [time-h-startdate] =>\n [time-m-startdate] =>",
" [ampm-startdate] => am",
" [date-enddate] =>\n [time-h-enddate] =>\n [time-m-enddate] =>",
" [ampm-enddate] => am\n [order_status] => Array\n (\n [0] => 0\n [1] => 1\n [2] => 2\n )",
" [order_type] => Array\n (\n [0] => 0\n [1] => 2\n )",
" [order-range-op] => e",
" [order-range-num] =>",
" [order-price-op] => l",
" [order-price-num] =>\n [pnam] =>\n [sku] =>",
" [discounts] => Array\n (\n [0] => -1\n )\n",
" [blshpname] =>\n [email] =>",
" [bl-sp-zip] => s",
" [zip] =>",
" [bl-sp-state] => s\n [state] => Array\n (\n [0] => -1\n )",
" [status] => Array\n (\n [0] => -1\n )",
" )\n */\n expSession::set('order_print_query', $sql . $sqlwhere);\n //$where = 1;//$this->aggregateWhereClause();\n //$order = 'id';\n //$prod = new product();\n // $order = new order();",
" //$items = $prod->find('all', 1, 'id DESC',25);\n //$items = $order->find('all', 1, 'id DESC',25);",
" //$res = $mod->find('all',$sql,'id',25);",
" //eDebug($items);",
" $page = new expPaginator(array(\n //'model'=>'order',\n //'records'=>$items,\n // 'where'=>$where,\n 'sql' => $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 25 : $this->config['limit'],\n 'order' => 'invoice_id',\n 'order_direction' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Date') => 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Status') => 'status_title'\n ),\n ));",
" $action_items = array(\n 'print_orders' => 'Print Orders',\n 'export_odbc' => 'Export Shipping Data to CSV'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));\n }",
" function order_report() {\n // stub function. I'm sure eventually we can pull up exising reports to pre-populate our form.\n $os = new order_status();\n $oss = $os->find('all');\n $order_status = array();\n $order_status[-1] = gt('--Any--');\n foreach ($oss as $status) {\n $order_status[$status->id] = $status->title;\n }",
" $ot = new order_type();\n $ots = $ot->find('all');\n $order_type = array();\n $order_type[-1] = gt('--Any--');\n foreach ($ots as $orderType) {\n $order_type[$orderType->id] = $orderType->title;\n }",
" $dis = new discounts();\n $diss = $dis->find('all');\n $discounts = array();\n $discounts[-1] = gt('--Any--');\n foreach ($diss as $discount) {\n $discounts[$discount->id] = $discount->coupon_code;\n }",
" /*$geo = new geoRegion();",
" $geos = $geo->find('all');",
" $states = array();\n $states[-1] = gt('--Any--');\n foreach ($geos as $skey=>$state)\n {\n $states[$skey] = $state->name;\n } */",
" $payment_methods = billingmethod::$payment_types;\n $payment_methods[-1] = gt('--Any--');\n ksort($payment_methods);\n //array('-1'=>'', 'V'=>'Visa','MC'=>'Mastercard','D'=>'Discover','AMEX'=>'American Express','PP'=>'PayPal','GC'=>'Google Checkout','Other'=>'Other');",
" //eDebug(mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));\n// $prev_month = strftime(\"%A, %d %B %Y\", mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));",
" //eDebug(strftime(\"%A, %d %B %Y\", mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\"))));",
"// $now_date = strftime(\"%A, %d %B %Y\");\n $prev_month = strftime(DISPLAY_DATE_FORMAT, mktime(0, 0, 0, (strftime(\"%m\") - 1), 1, strftime(\"%Y\")));\n $now_date = strftime(DISPLAY_DATE_FORMAT);\n $now_hour = strftime(\"%I\");\n $now_min = strftime(\"%M\");\n $now_ampm = strftime(\"%p\");",
" assign_to_template(array(\n 'prev_month' => $prev_month,\n 'now_date' => $now_date,\n 'now_hour' => $now_hour,\n 'now_min' => $now_min,\n 'now_ampm' => $now_ampm,\n 'order_status' => $order_status,\n 'discounts' => $discounts,\n// 'states'=>$states,\n 'order_type' => $order_type,\n 'payment_methods' => $payment_methods\n ));\n }",
" function generateOrderReport() {\n global $db;\n //eDebug($this->params);\n $p = $this->params;",
" //eDebug();",
" //build",
" $start_sql = \"SELECT DISTINCT(o.id), \";\n $count_sql = \"SELECT COUNT(DISTINCT(o.id)) as c, \";\n $sql = \"o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title, ot.title as order_type\";\n if ((count($p['order_status_changed']) == 1 && $p['order_status_changed'][0] != -1) || count($p['order_status_changed']) > 1 || (!empty($p['include_status_date']) && (!empty($p['date-sstartdate']) || !empty($p['date-senddate'])))) $sql .= \", FROM_UNIXTIME(osc.created_at,'%c/%e/%y %h:%i:%s %p') as status_changed_date\";\n $sql .= \" from \" . $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON ot.id = o.order_type_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"product as p ON oi.product_id = p.id \";\n //if ($p['order_type'][0] != -1) $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON o.order_type_id = ot.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n if ((count($p['order_status_changed']) == 1 && $p['order_status_changed'][0] != -1) || count($p['order_status_changed']) > 1 || (!empty($p['include_status_date']) && (!empty($p['date-sstartdate']) || !empty($p['date-senddate'])))) $sql .= \"INNER JOIN \" . $db->prefix . \"order_status_changes as osc ON osc.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";\n $sql .= \"LEFT JOIN \" . $db->prefix . \"geo_region as gr ON (gr.id = b.state OR gr.id = s.state) \";\n if ($p['discounts'][0] != -1) $sql .= \"LEFT JOIN \" . $db->prefix . \"order_discounts as od ON od.orders_id = o.id \";",
" $sqlwhere = \"WHERE o.purchased != 0\";",
" if (!empty($p['include_purchased_date']) && !empty($p['date-pstartdate'])) $sqlwhere .= \" AND o.purchased >= \" . strtotime($p['date-pstartdate'] . \" \" . $p['time-h-pstartdate'] . \":\" . $p['time-m-pstartdate'] . \" \" . $p['ampm-pstartdate']);\n /*if ($p->['time-h-startdate'] == )\n if ($p->['time-m-startdate'] == )\n if ($p->['ampm-startdate'] == )*/\n if (!empty($p['include_purchased_date']) && !empty($p['date-penddate'])) $sqlwhere .= \" AND o.purchased <= \" . strtotime($p['date-penddate'] . \" \" . $p['time-h-penddate'] . \":\" . $p['time-m-penddate'] . \" \" . $p['ampm-penddate']);\n /*if ($p->['date-enddate'] == )\n if ($p->['time-h-enddate'] == )\n if ($p->['time-m-enddate'] == )\n if ($p->['ampm-enddate'] == )*/\n if (!empty($p['include_status_date']) && !empty($p['date-sstartdate'])) $sqlwhere .= \" AND osc.created_at >= \" . strtotime($p['date-sstartdate'] . \" \" . $p['time-h-sstartdate'] . \":\" . $p['time-m-sstartdate'] . \" \" . $p['ampm-sstartdate']);",
" if (!empty($p['include_status_date']) && !empty($p['date-senddate'])) $sqlwhere .= \" AND osc.created_at <= \" . strtotime($p['date-senddate'] . \" \" . $p['time-h-senddate'] . \":\" . $p['time-m-senddate'] . \" \" . $p['ampm-senddate']);",
" $inc = 0;\n $sqltmp = '';\n foreach ($p['order_status'] as $os) {\n if ($os == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_status_id = \" . $os;\n } else {\n $sqltmp .= \" OR o.order_status_id = \" . $os;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" $inc = 0;\n $sqltmp = '';\n foreach ($p['order_status_changed'] as $osc) {\n if ($osc == -1) continue;\n else if ($inc == 0) {\n $inc++;\n //$sqltmp .= \" AND ((osc.to_status_id = \" . $osc . \" AND (osc.from_status_id != \" . $osc . \")\";\n $sqltmp .= \" AND (osc.to_status_id = \" . $osc;\n } else {\n //$sqltmp .= \" OR (osc.to_status_id = \" . $osc . \" AND (osc.from_status_id != \" . $osc . \")\";\n $sqltmp .= \" OR osc.to_status_id = \" . $osc;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" $inc = 0;\n $sqltmp = '';\n foreach ($p['order_type'] as $ot) {\n if ($ot == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (o.order_type_id = \" . $ot;\n } else {\n $sqltmp .= \" OR o.order_type_id = \" . $ot;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['order-range-num'])) {\n $operator = '';\n switch ($p['order-range-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND o.invoice_id\" . $operator . $p['order-range-num'];\n }",
" if (!empty($p['order-price-num'])) {\n $operator = '';\n switch ($p['order-price-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND o.grand_total\" . $operator . $p['order-price-num'];\n }",
" if (!empty($p['pnam'])) {\n $sqlwhere .= \" AND p.title LIKE '%\" . $p['pnam'] . \"%'\";\n }",
" if (!empty($p['sku'])) {\n $sqlwhere .= \" AND p.model LIKE '%\" . $p['sku'] . \"%'\";\n }",
" $inc = 0;\n $sqltmp = '';\n if (isset($p['product_status'])) {\n foreach ($p['product_status'] as $pstat) {\n if ($pstat == -1 || empty($pstat)) continue;",
" $product_status = new product_status($pstat);\n if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (oi.products_status = '\" . $product_status->title . \"'\";\n } else {\n $sqltmp .= \" OR oi.products_status = '\" . $product_status->title . \"'\";\n }\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['uidata'])) {\n $sqlwhere .= \" AND oi.user_input_fields != '' AND oi.user_input_fields != 'a:0:{}'\";\n }",
" $inc = 0;\n $sqltmp = '';\n foreach ($p['discounts'] as $d) {\n if ($d == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (od.discounts_id = \" . $d;\n } else {\n $sqltmp .= \" OR od.discounts_id = \" . $d;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!empty($p['blshpname'])) {\n $sqlwhere .= \" AND (b.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $p['blshpname'] . \"%')\";\n }",
" if (!empty($p['email'])) {\n $sqlwhere .= \" AND (b.email LIKE '%\" . $p['email'] . \"%'\";\n $sqlwhere .= \" OR s.email LIKE '%\" . $p['email'] . \"%')\";\n }",
" if (!empty($p['zip'])) {\n if ($p['bl-sp-zip'] == 'b') $sqlwhere .= \" AND b.zip LIKE '%\" . $p['zip'] . \"%'\";\n else if ($p['bl-sp-zip'] == 's') $sqlwhere .= \" AND s.zip LIKE '%\" . $p['zip'] . \"%'\";\n }",
" if (isset($p['state'])) {\n $inc = 0;\n $sqltmp = '';\n foreach ($p['state'] as $s) {\n if ($s == -1) continue;\n else if ($inc == 0) {\n $inc++;\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" AND (b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" AND (s.state = \" . $s;\n } else {\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" OR b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" OR s.state = \" . $s;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" if (isset($p['payment_method'])) {\n $inc = 0;\n $sqltmp = '';",
" //get each calculator's id",
"\n foreach ($p['payment_method'] as $s) {\n if ($s == -1) continue;\n if ($s == 'VisaCard' || $s == 'AmExCard' || $s == 'MasterCard' || $s == 'DiscoverCard') {\n $paymentQuery = 'b.billing_options LIKE \"%' . $s . '%\"';\n } else {\n $bc = new billingcalculator();\n $calc = $bc->findBy('calculator_name', $s);\n $paymentQuery = 'billingcalculator_id = ' . $calc->id;\n }",
" if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND ( \" . $paymentQuery;\n } else {\n $sqltmp .= \" OR \" . $paymentQuery;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" //echo $sql . $sqlwhere . \"<br>\";\n /*\n Need: order, orderitems, order status, ordertype, billingmethods, geo region, shipping methods, products",
" [date-startdate] =>\n [time-h-startdate] =>\n [time-m-startdate] =>",
" [ampm-startdate] => am",
" [date-enddate] =>\n [time-h-enddate] =>\n [time-m-enddate] =>",
" [ampm-enddate] => am\n [order_status] => Array\n (\n [0] => 0\n [1] => 1\n [2] => 2\n )",
" [order_type] => Array\n (\n [0] => 0\n [1] => 2\n )",
" [order-range-op] => e",
" [order-range-num] =>",
" [order-price-op] => l",
" [order-price-num] =>\n [pnam] =>\n [sku] =>",
" [discounts] => Array\n (\n [0] => -1\n )\n",
" [blshpname] =>\n [email] =>",
" [bl-sp-zip] => s",
" [zip] =>",
" [bl-sp-state] => s\n [state] => Array\n (\n [0] => -1\n )",
" [status] => Array\n (\n [0] => -1\n )",
" )\n */",
" //$sqlwhere .= \" ORDER BY purchased_date DESC\";\n $count_sql .= $sql . $sqlwhere;\n $sql = $start_sql . $sql;\n expSession::set('order_print_query', $sql . $sqlwhere);\n $reportRecords = $db->selectObjectsBySql($sql . $sqlwhere);\n expSession::set('order_export_values', $reportRecords);",
" //eDebug(expSession::get('order_export_values'));\n //$where = 1;//$this->aggregateWhereClause();\n //$order = 'id';\n //$prod = new product();\n // $order = new order();",
" //$items = $prod->find('all', 1, 'id DESC',25);\n //$items = $order->find('all', 1, 'id DESC',25);",
" //$res = $mod->find('all',$sql,'id',25);\n //eDebug($items);",
" //eDebug($sql . $sqlwhere);",
"\n $page = new expPaginator(array(\n //'model'=>'order',\n //'records'=>$items,\n // 'where'=>$where,\n 'count_sql' => $count_sql,\n 'sql' => $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 350 : $this->config['limit'],\n 'order' => 'invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date') => 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Status Changed Date') => 'status_changed_date',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n",
" //strftime(\"%a %d-%m-%Y\", get_first_day(3, 1, 2007)); Thursday, 1 April 2010",
" //$d_month_previous = date('n', mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));",
" $action_items = array(\n 'print_orders' => 'Print Orders',\n 'export_odbc' => 'Export Shipping Data to CSV',\n 'export_status_report' => 'Export Order Status Data to CSV',\n 'export_inventory' => 'Export Inventory Data to CSV',\n 'export_user_input_report' => 'Export User Input Data to CSV',\n 'export_order_items' => 'Export Order Items Data to CSV',\n 'show_payment_summary' => 'Show Payment & Tax Summary'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));\n }",
" function show_payment_summary() {\n global $db;",
" $payments = billingmethod::$payment_types;",
" $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n if (!empty($this->params['act-upon'])) foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);",
" $payment_summary = array();\n // $Credit Cards\n// $sql = \"SELECT orders_id, billing_cost, billing_options, calculator_name, user_title FROM \" . $db->prefix . \"billingmethods, \" . $db->prefix . \"billingcalculator WHERE \" . $db->prefix . \"billingcalculator.id = billingcalculator_id and orders_id IN (\" . $orders_string . \")\";\n $sql = \"SELECT orders_id, billing_cost, billing_options, calculator_name, title FROM \" . $db->prefix . \"billingmethods, \" . $db->prefix . \"billingcalculator WHERE \" . $db->prefix . \"billingcalculator.id = billingcalculator_id and orders_id IN (\" . $orders_string . \")\";\n $res = $db->selectObjectsBySql($sql);\n if (!empty($res)) {\n foreach ($res as $item) {\n $options = expUnserialize($item->billing_options);\n if (!empty($item->billing_cost)) {\n// if ($item->user_title == 'Credit Card') {\n if ($item->title == 'Credit Card') { //FIXME there is no billingmethod->title ...this is translated??\n if (!empty($options->cc_type)) {\n //@$payment_summary[$payments[$options->cc_type]] += $item->billing_cost;\n @$payment_summary[$payments[$options->cc_type]] += $options->result->amount_captured;\n }\n } else {\n @$payment_summary[$payments[$item->calculator_name]] += $item->billing_cost;\n }\n }\n }\n }",
" $payments_key_arr = array();\n $payment_values_arr = array();\n foreach ($payment_summary as $key => $item) {\n $payments_key_arr[] = '\"' . $key . '\"';\n $payment_values_arr[] = round($item, 2);\n }\n $payments_key = implode(\",\", $payments_key_arr);\n $payment_values = implode(\",\", $payment_values_arr);",
" //tax\n// $tax_sql = \"SELECT SUM(tax) as tax_total FROM \" . $db->prefix . \"orders WHERE id IN (\" . $orders_string . \")\";\n// $tax_res = $db->selectObjectBySql($tax_sql);\n $tax_types = taxController::getTaxRates();\n// $tax_type_formatted = $tax_types[0]->zonename . ' - ' . $tax_types[0]->classname . ' - ' . $tax_types[0]->rate . '%';",
" $ord = new order();\n $tax_res2 = $ord->find('all',\"id IN (\" . $orders_string . \")\");",
" $taxes = array();\n foreach ($tax_res2 as $tt) {\n $key = key($tt->taxzones);\n if (!empty($key)) {\n $tname = $tt->taxzones[$key]->name;\n if (!isset($taxes[$key]['format'])) {\n $taxes[$key] = array();\n $taxes[$key]['total'] =0;\n }\n $taxes[$key]['format'] = $tname . ' - ' . $tt->taxzones[$key]->rate . '%';\n $taxes[$key]['total'] += $tt->tax;\n }\n }",
" assign_to_template(array(\n 'payment_summary' => $payment_summary,\n 'payments_key' => $payments_key,\n 'payment_values' => $payment_values,\n// 'tax_total' => !empty($tax_res->tax_total) ? $tax_res->tax_total : 0,\n// 'tax_type' => $tax_type_formatted,\n 'taxes' => $taxes\n ));\n }",
" function export_user_input_report() {\n $order = new order();\n $out = '\"ITEM_NAME\",\"QUANTITY\",\"PERSONALIZATION\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')');\n //eDebug($orders,true);\n $pattern = '/\\(.*\\)/i';\n $items = array();\n $top = array();\n foreach ($orders as $order) { //eDebug($order,true);\n foreach ($order->orderitem as $oi) {\n // eDebug($oi,true);\n $item = array();\n if ($oi->user_input_fields == '' || $oi->user_input_fields == 'a:0:{}') continue;\n else $item['user_input_data'] = expUnserialize($oi->user_input_fields);;",
" $model = preg_replace($pattern, '', preg_replace('/\\s/', '', $oi->products_model));\n $item['model'] = $model;\n //$item['name'] = strip_tags($oi->products_name);\n $item['qty'] = $oi->quantity;",
" $items[] = $item;\n }\n }\n unset($item);\n foreach ($items as $item) {\n $line = '';",
" //$line = expString::outputField(\"SMC Inventory - Laurie\");",
" $line .= expString::outputField($item['model']);\n //$line.= expString::outputField($item['name']);\n $line .= expString::outputField($item['qty']);\n $ui = array();\n $uiInfo = '';\n foreach ($item['user_input_data'] as $tlArray) {\n foreach ($tlArray as $ifKey => $if) {\n $uiInfo .= $ifKey . '=' . $if . \" | \";\n }\n }\n $line .= expString::outputField(strtoupper(substr_replace($uiInfo, '', strrpos($uiInfo, ' |'), strlen(' |'))), chr(13) . chr(10));\n $out .= $line;\n }\n //eDebug($out,true);\n self::download($out, 'User_Input_Export_' . time() . '.csv', 'application/csv');\n // [firstname] => Fred [middlename] => J [lastname] => Dirkse [organization] => OIC Group, Inc. [address1] => PO Box 1111 [address2] => [city] => Peoria [state] => 23 [zip] => 61653 [country] => [phone] => 309-555-1212 begin_of_the_skype_highlighting 309-555-1212 end_of_the_skype_highlighting [email] => fred@oicgroup.net [shippingcalculator_id] => 4 [option] => 01 [option_title] => 8-10 Day [shipping_cost] => 5.95\n }",
" function export_inventory() {\n $order = new order();\n $out = '\"BADDR_LAST_NM\",\"ITEM_NAME\",\"ITEM_DESC\",\"ITEM_QUANTITY\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')');\n //eDebug($orders,true);\n $pattern = '/\\(.*\\)/i';\n $items = array();\n $top = array();\n foreach ($orders as $order) { //eDebug($order,true);\n foreach ($order->orderitem as $oi) {\n $model = preg_replace($pattern, '', preg_replace('/\\s/', '', $oi->products_model));\n if (stripos($model, 'DUI') === 0) {\n $top[$model]['name'] = strip_tags($oi->products_name);\n if (isset($top[$model]['qty'])) $top[$model]['qty'] += $oi->quantity;\n else $top[$model]['qty'] = $oi->quantity;\n } else {\n $items[$model]['name'] = strip_tags($oi->products_name);\n if (isset($items[$model]['qty'])) $items[$model]['qty'] += $oi->quantity;\n else $items[$model]['qty'] = $oi->quantity;\n }\n }\n }\n ksort($top, SORT_STRING);\n ksort($items, SORT_STRING);\n foreach ($top as $model => $item) {\n $line = '';\n $line = expString::outputField(\"SMC Inventory - Laurie\");\n $line .= expString::outputField($model);\n $line .= expString::outputField($item['name']);\n $line .= expString::outputField($item['qty'], chr(13) . chr(10));\n $out .= $line;\n }\n foreach ($items as $model => $item) {\n $line = '';\n $line = expString::outputField(\"SMC Inventory - Laurie\");\n $line .= expString::outputField($model);\n $line .= expString::outputField($item['name']);\n $line .= expString::outputField($item['qty'], chr(13) . chr(10));\n $out .= $line;\n }\n //eDebug($out,true);\n self::download($out, 'Inventory_Export_' . time() . '.csv', 'application/csv');\n // [firstname] => Fred [middlename] => J [lastname] => Dirkse [organization] => OIC Group, Inc. [address1] => PO Box 1111 [address2] => [city] => Peoria [state] => 23 [zip] => 61653 [country] => [phone] => 309-555-1212 begin_of_the_skype_highlighting 309-555-1212 end_of_the_skype_highlighting [email] => fred@oicgroup.net [shippingcalculator_id] => 4 [option] => 01 [option_title] => 8-10 Day [shipping_cost] => 5.95",
" }",
" function generateProductReport() {\n global $db;\n // eDebug($this->params);\n $p = $this->params;\n $sqlids = \"SELECT DISTINCT(p.id) from \";\n $count_sql = \"SELECT COUNT(DISTINCT(p.id)) as c FROM \";\n $sqlstart = \"SELECT DISTINCT(p.id), p.title, p.model, concat('\".expCore::getCurrencySymbol().\"',format(p.base_price,2)) as base_price\";//, ps.title as status from \";\n $sql = $db->prefix . \"product as p \";\n if (!isset($p['allproducts'])){\n $sql .= \"INNER JOIN \" . $db->prefix . \"product_status as ps ON p.product_status_id = ps.id \";\n $sqlstart .= \", ps.title as status from \";\n if (!isset($p['uncategorized'])){\n $sql .= \"INNER JOIN \" . $db->prefix . \"product_storeCategories as psc ON p.id = psc.product_id \";\n }\n } else {\n $sqlstart .= \" from \";\n }\n //$sqlidsjoin = \"INNER JOIN \" . $db->prefix . \"product as childp ON p.id = childp.parent_id \";\n $sqlwhere = 'WHERE (1=1 ';",
" $inc = 0;\n $sqltmp = '';\n if (isset($p['product_status'])) {\n foreach ($p['product_status'] as $os) {\n if ($os == '') continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (p.product_status_id = \" . $os;\n } else {\n $sqltmp .= \" OR p.product_status_id = \" . $os;\n }",
" }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" $inc = 0;\n $sqltmp = '';\n if (!empty($p['product_type'])) foreach ($p['product_type'] as $ot) {\n if ($ot == '') continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (p.product_type = '\" . $ot . \"'\";\n } else {\n $sqltmp .= \" OR p.product_type = '\" . $ot . \"'\";\n }",
" }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";",
" if (!isset($p['allproducts'])) {\n if (!isset($p['uncategorized'])) {\n $inc = 0;\n $sqltmp = '';\n if (!empty($p['storeCategory'])) foreach ($p['storeCategory'] as $ot) {\n if ($ot == '') continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (psc.storecategories_id = \" . $ot;\n } else {\n $sqltmp .= \" OR psc.storecategories_id = \" . $ot;\n }",
" }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n } else {\n $sqlwhere .= \" AND psc.storecategories_id = 0 AND p.parent_id = 0\";\n }\n }",
" if (!empty($p['product-range-num'])) {\n $operator = '';\n switch ($p['product-range-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND p.id\" . $operator . $p['product-range-num'];\n }",
" $inc = 0;\n $sqltmp = '';\n if (isset($p['company'])) {\n foreach ($p['company'] as $os) {\n if ($os == '') continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (p.companies_id = \" . $os;\n } else {\n $sqltmp .= \" OR p.companies_id = \" . $os;\n }",
" }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }",
" if (!empty($p['product-price-num'])) {\n $operator = '';\n switch ($p['product-price-op']) {\n case 'g':\n $operator = '>';\n break;\n case 'l':\n $operator = '<';\n break;\n case 'e':\n $operator = '=';\n break;\n }\n $sqlwhere .= \" AND p.base_price\" . $operator . $p['product-price-num'];\n }",
" if (!empty($p['pnam'])) {\n $sqlwhere .= \" AND p.title LIKE '%\" . $p['pnam'] . \"%'\";\n }",
" if (!empty($p['sku'])) {\n $sqlwhere .= \" AND p.model LIKE '%\" . $p['sku'] . \"%'\";\n }",
" $sqlwhere .= \")\";",
" $exportSQL = $sqlids . $sql . $sqlwhere; // . \")\"; // \" OR p.parent_id IN (\".$sqlids . $sql . $sqlwhere . \")\";\n //$sqlidswhere = \" OR p.id IN (SELECT id FROM\".$db->prefix.\"_product WHERE parent_id=)\";\n// eDebug($sqlstart . $sql . $sqlwhere);\n// eDebug($count_sql . $sql . $sqlwhere);\n// eDebug(\"Stored:\" . $exportSQL);\n expSession::set('product_export_query', $exportSQL);\n //expSession::set('product_export_query', \"SELECT DISTINCT(p.id) FROM `exponent_product` p WHERE (title like '%Velcro%' OR feed_title like '%Velcro%' OR title like '%Multicam%' OR feed_title like '%Multicam%') AND parent_id = 0\");",
" $product = new product();",
" //$items = $product->find('all', '', 'id', 25);\n //$page = new expPaginator();\n //eDebug($page,true);",
" $page = new expPaginator(array(\n// 'model' => 'product',\n //'records'=>$items,\n // 'where'=>$where,\n 'sql' => $sqlstart . $sql . $sqlwhere,\n //'sql'=>\"SELECT DISTINCT(p.id), p.title, p.model, p.base_price FROM `exponent_product` p WHERE (title like '%Velcro%' OR feed_title like '%Velcro%' OR title like '%Multicam%' OR feed_title like '%Multicam%') AND parent_id = 0\",\n //'count_sql'=>\"SELECT COUNT(DISTINCT(p.id)) FROM `exponent_product` p WHERE (title like '%Velcro%' OR feed_title like '%Velcro%' OR title like '%Multicam%' OR feed_title like '%Multicam%') AND parent_id = 0\",\n 'count_sql' => $count_sql . $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 350 : $this->config['limit'],\n 'order' => 'id',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => 'store',\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n 'ID' => 'id',\n gt('Product') => 'title|controller=store,action=show,showby=id',\n 'SKU' => 'model',\n gt('Price') => 'base_price',\n gt('Status') => 'status'\n ),\n //'columns'=>array('Product'=>'title','SKU'=>'model'),\n ));\n //eDebug($page,true);\n /*$page = new expPaginator(array(\n 'model'=>'order',\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'sql'=>$sql,\n 'order'=>'purchased',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns'=>array(\n 'Customer'=>'lastname',",
" 'Invoice #'=>'invoice_id',",
" 'Total'=>'total',\n 'Date Purchased'=>'purchased',\n 'Status'=>'order_status_id',\n )\n )); */\n $action_items = array(\n 'batch_export' => 'Export Product List to CSV',\n 'status_export' => 'Export Product Status Report to CSV'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));",
" //\n //\n // assign_to_template(array('page'=>$page));",
" }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �",
" //echo \"1<br>\"; eDebug($str);",
"\n $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\t\", \" \", $str);\n $str = str_replace(\",\", \"\\,\", $str);\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);",
" if (!$isHTML) {\n $str = str_replace('\\\"', \""\", $str);\n $str = str_replace('\"', \""\", $str);\n } else {\n $str = str_replace('\"', '\"\"', $str);\n }",
" //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n $str = trim(str_replace(\"�\", \"™\", $str));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);\n// global $db;",
" $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\,\", \",\", $str);\n $str = str_replace('\"\"', '\"', $str); //do this no matter what...in case someone added a quote in a non HTML field\n if (!$isHTML) {",
" //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char",
" $str = str_replace('\"', \""\", $str);\n }\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);\n //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n// if (DB_ENGINE=='mysqli') {\n//\t $str = @mysqli_real_escape_string($db->connection,trim(str_replace(\"�\", \"™\", $str)));\n// } elseif(DB_ENGINE=='mysql') {\n// $str = @mysql_real_escape_string(trim(str_replace(\"�\", \"™\", $str)),$db->connection);\n// } else {\n//\t $str = trim(str_replace(\"�\", \"™\", $str));\n// }\n $str = @expString::escape(trim(str_replace(\"�\", \"™\", $str)));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n public static function parseAndTrim($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);\n// global $db;",
" $str = str_replace(\"�\", \"’\", $str);\n $str = str_replace(\"�\", \"‘\", $str);\n $str = str_replace(\"�\", \"®\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"—\", $str);\n $str = str_replace(\"�\", \"”\", $str);\n $str = str_replace(\"�\", \"“\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);",
" //$str = str_replace(\",\",\"\\,\",$str);",
"\n $str = str_replace('\\\"', \""\", $str);\n $str = str_replace('\"', \""\", $str);\n $str = str_replace(\"�\", \"¼\", $str);\n $str = str_replace(\"�\", \"½\", $str);\n $str = str_replace(\"�\", \"¾\", $str);\n //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n// if (DB_ENGINE=='mysqli') {\n//\t $str = @mysqli_real_escape_string($db->connection,trim(str_replace(\"�\", \"™\", $str)));\n// } elseif(DB_ENGINE=='mysql') {\n// $str = @mysql_real_escape_string(trim(str_replace(\"�\", \"™\", $str)),$db->connection);\n// } else {\n//\t $str = trim(str_replace(\"�\", \"™\", $str));\n// }\n $str = @expString::escape(trim(str_replace(\"�\", \"™\", $str)));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n function outputField($val, $eof = ',', $isHTML = false) {\n $newVal = expString::parseAndTrimExport($val, $isHTML);\n if ($newVal != '') return '\"' . $newVal . '\"' . $eof;\n else return $eof;\n }",
" function print_orders() {\n// global $db, $timer;\n //eDebug($this->params,true);\n //eDebug($timer->mark());\n //eDebug( expSession::get('order_print_query'));\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n //$sql = expSession::get('order_print_query');\n //eDebug($sql);\n //expSession::set('product_export_query','');\n //$orders = $db->selectArraysBySql($sql);\n $obs = expSession::get('order_export_values');\n usort($obs, array(\"reportController\", \"sortPrintOrders\"));\n foreach ($obs as $ob) {\n $orders[] = array('id' => $ob->id);\n }\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $order) {\n $orders[] = array('id' => $order);\n }\n }",
" //eDebug(\"Done with print_orders: \" . $timer->mark());\n //eDebug($orders,true);\n $oc = new orderController();\n $oc->getPDF($orders);\n }",
" //sort print orders by id, newest to oldest\n static function sortPrintOrders($a, $b) {\n if ($a->invoice_id > $b->invoice_id) return -1;\n else if ($a->invoice_id < $b->invoice_id) return 1;\n else if ($a->invoice_id == $b->invoice_id) return 0;\n }",
" function export_odbc() {\n $order = new order();\n $out = '\"order_id\",\"shipping_method_id\",\"shipping_option\",\"shipping_cost\",\"firstname\",\"middlename\",\"lastname\",\"organization\",\"address1\",\"address2\",\"city\",\"state\",\"zip\",\"country\",\"phone\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')');\n //eDebug($orders);\n foreach ($orders as $order) {\n $line = expString::outputField($order->invoice_id);\n foreach ($order->shippingmethods as $m) {\n $line .= expString::outputField($m->id);\n $line .= expString::outputField($m->option_title);\n $line .= expString::outputField($order->shipping_total + $order->surcharge_total);\n $line .= expString::outputField($m->firstname);\n $line .= expString::outputField($m->middlename);\n $line .= expString::outputField($m->lastname);\n $line .= expString::outputField($m->organization);\n $line .= expString::outputField($m->address1);\n $line .= expString::outputField($m->address2);\n $line .= expString::outputField($m->city);\n// $state = new geoRegion($m->state);\n //eDebug($state);\n// $line .= expString::outputField($state->code);\n $line .= expString::outputField(geoRegion::getAbbrev($m->state));\n $line .= expString::outputField($m->zip);\n// $line .= expString::outputField('US');\n $line .= expString::outputField(geoRegion::getCountryCode($m->country));\n $line .= expString::outputField($m->phone, chr(13) . chr(10));\n break;\n }\n $out .= $line;\n }\n //eDebug($out,true);\n self::download($out, 'Shipping_Export.csv', 'application/csv');\n // [firstname] => Fred [middlename] => J [lastname] => Dirkse [organization] => OIC Group, Inc. [address1] => PO Box 1111 [address2] => [city] => Peoria [state] => 23 [zip] => 61653 [country] => [phone] => 309-555-1212 begin_of_the_skype_highlighting 309-555-1212 end_of_the_skype_highlighting [email] => fred@oicgroup.net [shippingcalculator_id] => 4 [option] => 01 [option_title] => 8-10 Day [shipping_cost] => 5.95",
" }",
" function export_order_items() {\n $order = new order();\n $out = '\"order_id\",\"quantity\",\"SKU\",\"product_title\",\"firstname\",\"middlename\",\"lastname\",\"organization\",\"address1\",\"address2\",\"city\",\"state\",\"zip\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')');\n //eDebug($orders);\n foreach ($orders as $order) {\n $m = array_shift($order->shippingmethods);\n foreach ($order->orderitem as $orderitem) {\n $line = expString::outputField($order->invoice_id);\n $line .= expString::outputField($orderitem->quantity);\n $line .= expString::outputField($orderitem->products_model);\n $line .= expString::outputField($orderitem->products_name);",
" $line .= expString::outputField($m->firstname);\n $line .= expString::outputField($m->middlename);\n $line .= expString::outputField($m->lastname);\n $line .= expString::outputField($m->organization);\n $line .= expString::outputField($m->address1);\n $line .= expString::outputField($m->address2);\n $line .= expString::outputField($m->city);\n $state = new geoRegion($m->state);\n $line .= expString::outputField($state->code);\n $line .= expString::outputField($m->zip, chr(13) . chr(10));\n $out .= $line;\n }\n }\n //eDebug($out,true);\n self::download($out, 'Order_Item_Export.csv', 'application/csv');\n // [firstname] => Fred [middlename] => J [lastname] => Dirkse [organization] => OIC Group, Inc. [address1] => PO Box 1111 [address2] => [city] => Peoria [state] => 23 [zip] => 61653 [country] => [phone] => 309-555-1212 begin_of_the_skype_highlighting 309-555-1212 end_of_the_skype_highlighting [email] => fred@oicgroup.net [shippingcalculator_id] => 4 [option] => 01 [option_title] => 8-10 Day [shipping_cost] => 5.95",
" }",
" function export_status_report() {\n $order = new order();\n $out = '\"ITEM_NAME\",\"ITEM_DESC\",\"ITEM_QUANTITY\",\"ITEM_STATUS\"' . chr(13) . chr(10);\n //eDebug($this->params,true);\n $order_ids = array();\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $obs = expSession::get('order_export_values');\n foreach ($obs as $ob) {\n $order_ids[] = $ob->id;\n }\n } else {\n foreach ($this->params['act-upon'] as $order_id) {\n $order_ids[] = $order_id;\n }\n }\n $order_ids = array_unique($order_ids);\n $orders_string = implode(',', $order_ids);\n $orders = $order->find('all', 'id IN (' . $orders_string . ')', null, null, null, true, true, array('order_discounts', 'billingmethod', 'order_status_changes', 'order_status', 'order_type'), true);\n $pattern = '/\\(.*\\)/i';\n foreach ($orders as $order) {\n foreach ($order->orderitem as $oi) {\n $model = preg_replace($pattern, '', preg_replace('/\\s/', '', $oi->products_model));\n $line = '';\n $line .= expString::outputField($model);\n $line .= expString::outputField($oi->products_name);\n $line .= expString::outputField($oi->quantity);\n $line .= expString::outputField($oi->products_status, chr(13) . chr(10));\n $out .= $line;\n }\n }\n self::download($out, 'Status_Export_' . time() . '.csv', 'application/csv');\n }",
" static function download($file, $name, $type) {\n if (!headers_sent()) {\n //echo $file;\n //exit();\n ob_clean();\n header('Content-Description: File Transfer');\n header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1\n header('Pragma: public');\n// header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // force download dialog\n header('Content-Type: application/force-download');\n //header('Content-Type: application/octet-stream', false);\n header('Content-Type: application/download', false);\n header('Content-Type: ' . $type, false);\n //header('Content-Type: application/pdf', false);\n // use the Content-Disposition header to supply a recommended filename\n header('Content-Disposition: attachment; filename=\"' . $name . '\";');\n header('Content-Transfer-Encoding: ascii');\n header('Content-Length: ' . strlen($file));\n //header('Content-Length: '.filesize($this->tmp_rendered));\n echo $file;\n //echo readfile($this->tmp_rendered);\n } else {\n echo \"Oops, headers already sent. Check DEVELOPMENT variable?\";\n }\n die();\n }",
" /**\n * @deprecated 2.3.3 moved to expString\n */\n function stripLineEndings($val) {\n return preg_replace('/\\r\\n/', ' ', trim($val));\n }",
" function productFeed() {\n// global $db;\n //check query password to avoid DDOS\n /*\n * condition = new",
" * description\n * id - SKU\n * link\n * price\n * title\n * brand - manufacturer\n * image link - fullsized image, up to 10, comma seperated\n * product type - category - \"Electronics > Audio > Audio Accessories MP3 Player Accessories\",\"Health & Beauty > Healthcare > Biometric Monitors > Pedometers\"",
" */\n $out = '\"id\",\"condition\",\"description\",\"like\",\"price\",\"title\",\"brand\",\"image link\",\"product type\"' . chr(13) . chr(10);",
" $p = new product();\n $prods = $p->find('all', 'parent_id=0 AND ');\n //$prods = $db->selectObjects('product','parent_id=0 AND');\n }",
" function abandoned_carts() {\n global $db;",
" $allCarts = array();\n $carts = array();\n $cartsWithoutItems = array();\n $cartsWithItems = array();\n $cartsWithItemsAndInfo = array();\n $summary = array();\n $valueproducts = '';",
" $quickrange = array(0 => gt('Last 24 Hours'), 1 => gt('Last 7 Days'), 2 => gt('Last 30 Days'));\n $this->setDateParams($this->params);\n if (!isset($this->params['quickrange'])) {\n $this->params['quickrange'] = 0;\n }",
" // purchased == 0 or invoice_id == 0 on unsubmitted orders\n $sql = \"SELECT * FROM \" . $db->prefix . \"orders WHERE purchased = 0 AND edited_at >= \" . $this->tstart . \" AND edited_at <= \" . $this->tend . \" AND sessionticket_ticket NOT IN \";\n $sql .= \"(SELECT ticket FROM \" . $db->prefix . \"sessionticket) ORDER BY edited_at DESC\";\n // echo $sql;\n $allCarts = $db->selectObjectsBySql($sql);\n foreach ($allCarts as $item) {",
" $sql = \"SELECT * FROM \" . $db->prefix . \"orderitems WHERE orders_id =\" . $item->id;",
" $carts = $db->selectObjectsBySql($sql);\n foreach ($carts as $item2) {\n $valueproducts += $item2->products_price_adjusted * $item2->quantity;\n }",
" $carts['last_visit'] = date('Y-m-d, g:i:s A', $item->edited_at);\n $carts['referrer'] = $item->orig_referrer;",
" if (count($carts) > 2) {\n if (!empty($item->user_id)) {\n $u = $db->selectObject('user', 'id=' . $item->user_id);\n $carts['name'] = $u->firstname . ' ' . $u->lastname;\n $carts['email'] = $u->email;\n $cartsWithItemsAndInfo[] = $carts;\n // $cartsWithItemsAndInfo['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60,2).\" minutes\";\n // $cartsWithItemsAndInfo['ip_address'] = $item->ip_address;\n // $cartsWithItemsAndInfo['referrer'] = $item->referrer;\n } else {\n $cartsWithItems[] = $carts;\n // $cartsWithItems['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60,2).\" minutes\";\n // $cartsWithItems['ip_address'] = $item->ip_address;\n // $cartsWithItems['referrer'] = $item->referrer;\n }",
" } else {\n $item->last_visit = date('Y-m-d, g:i:s A', $item->edited_at);\n $cartsWithoutItems[] = $item;\n }\n }\n //Added the count\n $allCarts['count'] = count($allCarts);\n $cartsWithoutItems['count'] = count($cartsWithoutItems);\n $cartsWithItems['count'] = count($cartsWithItems); //for the added values at the top\n $cartsWithItemsAndInfo['count'] = count($cartsWithItemsAndInfo); //for the added values at the top",
" // eDebug($allCarts);\n // eDebug($cartsWithoutItems);\n // eDebug($cartsWithItems);\n // eDebug($cartsWithItemsAndInfo);\n // exit();\n $summary['totalcarts'] = $allCarts['count'];\n $summary['valueproducts'] = $valueproducts;\n $summary['cartsWithoutItems'] = round(($allCarts['count'] ? $cartsWithoutItems['count'] / $allCarts['count'] : 0) * 100, 2) . '%';\n $summary['cartsWithItems'] = round(($allCarts['count'] ? $cartsWithItems['count'] / $allCarts['count'] : 0) * 100, 2) . '%';\n $summary['cartsWithItemsAndInfo'] = round(($allCarts['count'] ? $cartsWithItemsAndInfo['count'] / $allCarts['count'] : 0) * 100, 2) . '%';",
" assign_to_template(array(\n 'quickrange' => $quickrange,\n 'quickrange_default' => $this->params['quickrange'],\n 'summary' => $summary,\n 'cartsWithoutItems' => $cartsWithoutItems,\n 'cartsWithItems' => $cartsWithItems,\n 'cartsWithItemsAndInfo' => $cartsWithItemsAndInfo\n ));\n }",
" function pruge_abandoned_carts()\n {\n global $db;",
" $db->delete(\"orders\",\"`invoice_id` = '0' AND `edited_at` < UNIX_TIMESTAMP(now())-5184000 AND `sessionticket_ticket` NOT IN (SELECT `ticket` FROM `\".$db->prefix.\"sessionticket`)\");\n $db->delete(\"orderitems\",\"`orders_id` NOT IN (SELECT `id` FROM `\".$db->prefix.\"orders`)\");\n $db->delete(\"shippingmethods\",\"`id` NOT IN (SELECT `shippingmethods_id` FROM `\".$db->prefix.\"orders`)\");\n }",
" function current_carts() {\n global $db;",
" $allCarts = array();\n $carts = array();\n $cartsWithoutItems = array();\n $cartsWithItems = array();\n $cartsWithItemsAndInfo = array();\n $summary = array();\n $valueproducts = '';\n // $sql = \"SELECT * FROM \" . $db->prefix . \"orders WHERE DATEDIFF(FROM_UNIXTIME(edited_at, '%Y-%m-%d'), '\" . date('Y-m-d') . \"') = 0\";",
" $sql = \"SELECT * FROM \" . $db->prefix . \"orders, \" . $db->prefix . \"sessionticket WHERE ticket = sessionticket_ticket\";",
" $allCarts = $db->selectObjectsBySql($sql);",
" // eDebug($allCarts, true);\n foreach ($allCarts as $item) {",
" $sql = \"SELECT * FROM \" . $db->prefix . \"orderitems WHERE orders_id =\" . $item->id;",
" $carts = $db->selectObjectsBySql($sql);",
" foreach ($carts as $item2) {\n $valueproducts += $item2->products_price_adjusted * $item2->quantity;\n }",
" $carts['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60, 2) . \" minutes\";\n $carts['ip_address'] = $item->ip_address;\n $carts['referrer'] = $item->referrer;",
" if (count($carts) > 3) {\n if (!empty($item->user_id)) {\n $u = $db->selectObject('user', 'id=' . $item->user_id);\n $carts['name'] = $u->firstname . ' ' . $u->lastname;\n $carts['email'] = $u->email;\n $cartsWithItemsAndInfo[] = $carts;\n // $cartsWithItemsAndInfo['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60,2).\" minutes\";\n // $cartsWithItemsAndInfo['ip_address'] = $item->ip_address;\n // $cartsWithItemsAndInfo['referrer'] = $item->referrer;\n } else {\n $cartsWithItems[] = $carts;\n // $cartsWithItems['length_of_time'] = round(abs($item->last_active - $item->start_time) / 60,2).\" minutes\";\n // $cartsWithItems['ip_address'] = $item->ip_address;\n // $cartsWithItems['referrer'] = $item->referrer;\n }",
" } else {\n $item->length_of_time = round(abs($item->last_active - $item->start_time) / 60, 2) . \" minutes\";\n $cartsWithoutItems[] = $item;\n }\n }\n //Added the count\n $allCarts['count'] = count($allCarts);\n $cartsWithoutItems['count'] = count($cartsWithoutItems);\n $cartsWithItems['count'] = count($cartsWithItems); //for the added values at the top\n $cartsWithItemsAndInfo['count'] = count($cartsWithItemsAndInfo); //for the added values at the top",
" // eDebug($allCarts);\n // eDebug($cartsWithoutItems);\n // eDebug($cartsWithItems);\n // eDebug($cartsWithItemsAndInfo);",
" $summary['totalcarts'] = $allCarts['count'];\n $summary['valueproducts'] = intval($valueproducts);\n $summary['cartsWithoutItems'] = round(($allCarts['count'] ? $cartsWithoutItems['count'] / $allCarts['count'] : 0) * 100, 2) . '%';\n $summary['cartsWithItems'] = round(($allCarts['count'] ? $cartsWithItems['count'] / $allCarts['count'] : 0) * 100, 2) . '%';\n $summary['cartsWithItemsAndInfo'] = round(($allCarts['count'] ? $cartsWithItemsAndInfo['count'] / $allCarts['count'] : 0) * 100, 2) . '%';",
" // eDebug($summary, true);\n assign_to_template(array(\n 'summary' => $summary,\n 'cartsWithoutItems' => $cartsWithoutItems,\n 'cartsWithItems' => $cartsWithItems,\n 'cartsWithItemsAndInfo' => $cartsWithItemsAndInfo\n ));\n /*\n $this->setDateParams($this->params);\n $except = array('order_discounts', 'billingmethod', 'order_status_changes', 'billingmethod','order_discounts');\n //$orders = $this->o->find('all','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend,null,null,null,true,false,$except,true);\n // $sql = \"SELECT DATE_FORMAT(created_at, '%Y-%m-%d') as formattedDate FROM orders WHERE created_at\n eDebug(date('Y-m-d'), true);\n // eDebug($this->tend);\n eDebug(date('Y-m-d, g:i:s A', $this->tend));",
" $allOrderCount = $this->o->find('count','created_at >= ' . $this->tstart . ' AND created_at <= ' . $this->tend,null,null,null,true,false,$except,true);",
" $sql = \"SELECT COUNT(DISTINCT(`orders_id`)) as c FROM \" . $db->prefix . \"orderitems oi \";\n $sql .= \"JOIN \" . $db->prefix . \"orders o ON oi.orders_id = o.id \";\n $sql .= \"WHERE o.created_at >= \" . $this->tstart . \" AND o.created_at <= \" . $this->tend;\n //$sql .= \" AND o.user_id != 0 AND o.order_type_id = 1\";",
"",
" eDebug($sql);\n $allCartsWithItems = $db->countObjectsBySql($sql);",
"",
" $sql = \"SELECT COUNT(DISTINCT(`orders_id`)) as c FROM \" . $db->prefix . \"orderitems oi \";\n $sql .= \"JOIN \" . $db->prefix . \"orders o ON oi.orders_id = o.id \";\n $sql .= \"WHERE o.created_at >= \" . $this->tstart . \" AND o.created_at <= \" . $this->tend;\n eDebug($sql);\n $realUserCartsWithItems = $db->countObjectsBySql($sql);",
"\n $ordersInCheckout = $this->o->find('count','created_at >= ' . $this->tstart . ' AND created_at <= ' . $this->tend . \" AND user_id != 0\",null,null,null,true,false,$except,true);",
" //$ordersPurchased = $this->o->find('count','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend . \" AND user_id != 0 AND order_type_id = 1\",null,null,null,true,false,$except,true);\n //$ordersPurchased = $this->o->find('count','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend . \" AND user_id != 0\",null,null,null,true,false,$except,true);\n $ordersPurchased = $this->o->find('count','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend,null,null,null,true,false,$except,true);\n $orders = $this->o->find('all','purchased >= ' . $this->tstart . ' AND purchased <= ' . $this->tend,null,null,null,true,false,$except,true);",
" eDebug(\"All:\" . $allOrderCount);\n eDebug(\"Carts w/ Items:\" . $allCartsWithItems);\n eDebug(\"Carts w/ Items in Checkout:\" . $ordersInCheckout);\n eDebug(\"Purchased:\" . $ordersPurchased);\n",
" $totalAbandoned = ($allCartsWithItems - $ordersPurchased) / $allCartsWithItems;\n $checkoutAbandoned = ($ordersInCheckout - $ordersPurchased) / $ordersInCheckout;\n eDebug(\"Total Abandoned: \" . $totalAbandoned);\n eDebug(\"Checkout Abandoned: \" . $checkoutAbandoned);",
"",
"\n",
" $quickrange = array(0=>'Last 24 Hours',1=>'Last 7 Days',2=>'Last 30 Days');\n $quickrange_default = isset($this->params['quickrange']) ? $this->params['quickrange'] : 0;\n assign_to_template(array('orders'=>$oar,'quickrange'=>$quickrange,'quickrange_default'=>$quickrange_default));",
" assign_to_template(array('prev_month'=>$this->prev_month, 'now_date'=>$this->now_date, 'now_hour'=>$this->now_hour, 'now_min'=>$this->now_min, 'now_ampm'=>$this->now_ampm, 'prev_hour'=>$this->prev_hour, 'prev_min'=>$this->prev_min, 'prev_ampm'=>$this->prev_ampm));",
" */\n }",
" function batch_export() {\n global $db;\n //eDebug($this->params);\n //$sql = \"SELECT * INTO OUTFILE '\" . BASE . \"tmp/export.csv' FIELDS TERMINATED BY ',' FROM exponent_product WHERE 1 LIMIT 10\";\n// $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"canonical\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\"' . chr(13) . chr(10);\n $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\",\"weight\",\"width\",\"height\",\"length\",\"companies_id\"' . chr(13) . chr(10);\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $sql = expSession::get('product_export_query');\n if (empty($sql)) $sql = 'SELECT DISTINCT(p.id) from ' . $db->prefix . 'product as p WHERE (1=1 )';\n //eDebug($sql);\n //expSession::set('product_export_query','');\n $prods = $db->selectArraysBySql($sql);\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $prod) {\n $prods[] = array('id' => $prod);\n }\n }\n set_time_limit(0);\n $baseProd = new product();",
" //$p = new product($pid['id'], false, false);\n foreach ($prods as $pid) {\n $except = array('company', 'crosssellItem', 'optiongroup');\n $p = $baseProd->find('first', 'id=' . $pid['id'], null, null, 0, true, false, $except, true);",
" //eDebug($p,true);\n $out .= expString::outputField($p->id);\n $out .= expString::outputField($p->parent_id);\n $out .= expString::outputField($p->child_rank);\n $out .= expString::outputField($p->title);\n $out .= expString::outputField(expString::stripLineEndings($p->body), \",\", true);\n $out .= expString::outputField($p->model);\n $out .= expString::outputField($p->warehouse_location);\n $out .= expString::outputField($p->sef_url);\n// $out .= expString::outputField($p->canonical); //FIXME this is NOT in import\n $out .= expString::outputField($p->meta_title);\n $out .= expString::outputField($p->meta_keywords);\n $out .= expString::outputField($p->meta_description);\n $out .= expString::outputField($p->tax_class_id);\n $out .= expString::outputField($p->quantity);\n $out .= expString::outputField($p->availability_type);\n $out .= expString::outputField($p->base_price);\n $out .= expString::outputField($p->special_price);\n $out .= expString::outputField($p->use_special_price);\n $out .= expString::outputField($p->active_type);\n $out .= expString::outputField($p->product_status_id);",
" $rank = 0;\n //eDebug($p);\n for ($x = 0; $x < 12; $x++) {\n $this->catstring = '';\n if (isset($p->storeCategory[$x])) {\n $out .= expString::outputField(storeCategory::buildCategoryString($p->storeCategory[$x]->id, true));\n $rank = $db->selectValue('product_storeCategories', 'rank', 'product_id=' . $p->id . ' AND storecategories_id=' . $p->storeCategory[$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->surcharge);\n $out .= expString::outputField($rank);\n $out .= expString::outputField($p->feed_title);\n $out .= expString::outputField($p->feed_body);\n $out .= expString::outputField($p->weight);\n $out .= expString::outputField($p->height);\n $out .= expString::outputField($p->width);\n $out .= expString::outputField($p->length);\n $out .= expString::outputField($p->companies_id, chr(13) . chr(10)); //Removed the extra \",\" in the last element",
" foreach ($p->childProduct as $cp) {\n //$p = new product($pid['id'], true, false);\n //eDebug($p,true);\n $out .= expString::outputField($cp->id);\n $out .= expString::outputField($cp->parent_id);\n $out .= expString::outputField($cp->child_rank);\n $out .= expString::outputField($cp->title);\n $out .= expString::outputField(expString::stripLineEndings($cp->body));\n $out .= expString::outputField($cp->model);\n $out .= expString::outputField($cp->warehouse_location);\n $out .= expString::outputField($cp->sef_url);\n// $out .= expString::outputField($cp->canonical); //FIXME this is NOT in import\n $out .= expString::outputField($cp->meta_title);\n $out .= expString::outputField($cp->meta_keywords);\n $out .= expString::outputField($cp->meta_description);\n $out .= expString::outputField($cp->tax_class_id);\n $out .= expString::outputField($cp->quantity);\n $out .= expString::outputField($cp->availability_type);\n $out .= expString::outputField($cp->base_price);\n $out .= expString::outputField($cp->special_price);\n $out .= expString::outputField($cp->use_special_price);\n $out .= expString::outputField($cp->active_type);\n $out .= expString::outputField($cp->product_status_id);\n $out .= ',,,,,,,,,,,,'; // for store categories\n $out .= expString::outputField($cp->surcharge);\n $out .= ',,,'; // for rank, feed title, feed body\n $out .= expString::outputField($cp->weight);\n $out .= expString::outputField($cp->height);\n $out .= expString::outputField($cp->width);\n $out .= expString::outputField($cp->length);\n $out .= expString::outputField($cp->companies_id, chr(13) . chr(10)); //Removed the extra \",\" in the last element\n //echo($out);\n }",
" }",
" $outFile = 'tmp/product_export_' . time() . '.csv';\n $outHandle = fopen(BASE . $outFile, 'w');\n fwrite($outHandle, $out);\n fclose($outHandle);",
" echo \"<br/><br/>\".gt('Download the file here').\": <a href='\" . PATH_RELATIVE . $outFile . \"'>\".gt('Product Export').\"</a>\";",
" /*eDebug(BASE . \"tmp/export.csv\");\n $db->sql($sql);\n eDebug($db->error());*/",
" /*OPTIONALLY ENCLOSED BY '\" . '\"' .",
" \"' ESCAPED BY '\\\\'\n LINES TERMINATED BY '\" . '\\\\n' .\n \"' */\n }",
" function payment_report() {\n// global $db;\n $payment_methods = array('-1' => '', 'V' => 'Visa', 'MC' => 'Mastercard', 'D' => 'Discover', 'AMEX' => 'American Express', 'PP' => 'PayPal', 'GC' => 'Google Checkout', 'Other' => 'Other');\n //5 paypal\n //4 credit card - VisaCard, MasterCard, AmExCard, DiscoverCard",
" $oids = \"(\";",
" eDebug(expSession::get('order_print_query'));\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n //$sql = expSession::get('order_print_query');\n //eDebug($sql);\n //expSession::set('product_export_query','');\n //$orders = $db->selectArraysBySql($sql);\n $obs = expSession::get('order_export_values');\n usort($obs, array(\"reportController\", \"sortPrintOrders\"));\n foreach ($obs as $ob) {\n $oids .= $ob->id . \",\";\n }\n //eDebug($prods);\n } else {\n if (!empty($this->params['act-upon'])) foreach ($this->params['act-upon'] as $order) {\n $oids .= $order->id . \",\";\n }\n }\n $oids = strrev(expUtil::right(strrev($oids), strlen($oids) - 1));\n $oids .= \")\";\n eDebug($oids);\n //eDebug($orders,true);",
" }",
" function status_export() {\n global $db;\n //eDebug($this->params);\n //$sql = \"SELECT * INTO OUTFILE '\" . BASE . \"tmp/export.csv' FIELDS TERMINATED BY ',' FROM exponent_product WHERE 1 LIMIT 10\";",
" //is | parent_id | SKU |WAREHOUSE LOCATION | Title | Vendor/Manufacturer | Product Status | Notes",
" $out = '\"id\",\"parent_id\",\"model\",\"warehouse_location\",\"title\",\"vendor\",\"product_status\",\"notes\"' . chr(13) . chr(10);\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $sql = expSession::get('product_export_query');\n if (empty($sql)) $sql = 'SELECT DISTINCT(p.id) from ' . $db->prefix . 'product as p WHERE (1=1 )';\n //eDebug($sql);\n //expSession::set('product_export_query','');\n $prods = $db->selectArraysBySql($sql);\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $prod) {\n $prods[] = array('id' => $prod);\n }\n }",
" $stats = new product_status();\n $stats = $stats->find('all');",
"// $statuses = array();\n $statuses = array(0=>'');\n foreach ($stats as $stat) {\n $statuses[$stat->id] = $stat->title;\n }",
"// eDebug($statuses);",
" set_time_limit(0);\n $baseProd = new product();",
" //$p = new product($pid['id'], false, false);\n //id | parent_id | SKU |WAREHOUSE LOCATION | Title | Vendor/Manufacturer | Product Status | Notes\n foreach ($prods as $pid) {\n $except = array('crosssellItem', 'optiongroup', 'childProduct');\n $p = $baseProd->find('first', 'id=' . $pid['id'], null, null, 0, true, true, $except, true);",
" /*if(count($p->expSimpleNote))\n {\n eDebug($p,true);\n }\n else\n {\n continue;\n }*/",
" $out .= expString::outputField($p->id);\n $out .= expString::outputField($p->parent_id);\n $out .= expString::outputField($p->model);\n $out .= expString::outputField($p->warehouse_location);\n $out .= expString::outputField($p->title);\n $out .= expString::outputField($p->company->title);\n $out .= expString::outputField($statuses[$p->product_status_id]);",
" $noteString = '';\n foreach ($p->expSimpleNote as $note) {\n $noteString .= \"(\" . $note->name . \" - \" . date('M d Y H:i A', $note->created_at) . \") \" . $note->body . \"||\";\n }\n $out .= expString::outputField($noteString, chr(13) . chr(10));",
" $cps = $baseProd->find('all', 'parent_id=' . $p->id, null, null, 0, true, true, $except, true);\n foreach ($cps as $cp) {\n $out .= expString::outputField($cp->id);\n $out .= expString::outputField($cp->parent_id);\n $out .= expString::outputField($cp->model);\n $out .= expString::outputField($cp->warehouse_location);\n $out .= expString::outputField($cp->title);\n $out .= expString::outputField($cp->company->title);\n $out .= expString::outputField($statuses[$cp->product_status_id]);",
" $noteString = '';\n foreach ($cp->expSimpleNote as $note) {\n $noteString .= \"(\" . $note->name . \" - \" . date('M d Y H:i A', $note->created_at) . \") \" . $note->body . \"||\";\n }\n $out .= expString::outputField($noteString, chr(13) . chr(10));\n }\n }",
" //eDebug($out,true);\n $outFile = 'tmp/product_status_' . time() . '.csv';\n $outHandle = fopen(BASE . $outFile, 'w');\n fwrite($outHandle, $out);\n fclose($outHandle);",
" echo \"<br/><br/>\".gt('Download the file here').\": <a href='\" . PATH_RELATIVE . $outFile . \"'>\".gt('Product Export').\"</a>\";",
" /*eDebug(BASE . \"tmp/export.csv\");\n $db->sql($sql);\n eDebug($db->error());*/",
" /*OPTIONALLY ENCLOSED BY '\" . '\"' .",
" \"' ESCAPED BY '\\\\'\n LINES TERMINATED BY '\" . '\\\\n' .\n \"' */\n }",
" //public $catstring = '';",
" /**\n * @deprecated 2.3.4 moved to storeCategory\n */\n public static function buildCategoryString($catID, $reset = false) {\n static $cstr = '';\n if ($reset) $cstr = '';\n if (strlen($cstr) > 0) $cstr .= \"::\";\n $cat = new storeCategory($catID);\n //eDebug($cat);\n if (!empty($cat->parent_id)) self::buildCategoryString($cat->parent_id);\n $cstr .= $cat->title . \"::\";\n return substr($cstr, 0, -2);\n }",
" function product_report() {\n $pts = storeController::getProductTypes();\n $newPts = array();\n foreach ($pts as $pt) {\n $newPts[$pt] = $pt;\n }\n assign_to_template(array(\n 'product_types' => $newPts\n ));\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class searchController extends expController {\n public $useractions = array(\n 'show'=>'Show Search Form',\n 'cloud'=>'Show Tag Cloud'\n );",
" protected $add_permissions = array(\n 'spider'=>'Spider Site'",
" );",
"",
" public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Search Form\"); }\n static function description() { return gt(\"Add a form to allow users to search for content on your website.\"); }\n static function hasSources() { return false; }\n static function hasContent() { return false; }",
" public function search()\n {\n global $router;",
" $terms = $this->params['search_string'];",
" // If magic quotes is on and the user uses modifiers like \" (quotes) they get escaped. We don't want that in this case.\n if (get_magic_quotes_gpc()) {\n $terms = stripslashes($terms);\n }\n $terms = htmlspecialchars($terms);",
" if ($router->current_url == substr(URL_FULL, 0, -1)) { // give us a user friendly url\n unset($router->params['int']);\n// unset($router->params['src']);\n// $router->params['src'] = '1';\n redirect_to($router->params);\n }",
" $search = new search();",
" $page = new expPaginator(array(\n// 'model'=>'search',\n 'records'=>$search->getSearchResults($terms, !empty($this->config['only_best']), 0, !empty($this->config['eventlimit']) ? $this->config['eventlimit'] : null),\n //'sql'=>$sql,\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10,\n 'order'=>'score',\n 'dir'=>'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'dontsortwithincat'=>true,\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'src' => $this->loc->src,\n ));",
" if (!empty($this->config['is_categorized'])) {\n $results = array();\n foreach ($page->records as $hit) {\n if (!isset($results[$hit->category])) {\n $results[$hit->category] = array();\n }\n $results[$hit->category][] = $hit;\n }\n assign_to_template(array(\n 'results'=>$results,\n ));\n }",
" // include CSS for results\n // auto-include the CSS for pagination links\n\t expCSS::pushToHead(array(\n//\t\t \"unique\"=>\"search-results\",\n\t\t \"link\"=>$this->asset_path.\"css/results.css\",\n\t\t )\n\t\t);",
" assign_to_template(array(\n 'page'=>$page,\n 'terms'=>$terms,\n 'params'=>$this->params,\n ));\n }",
" ",
" public static function spider() {\n global $db;",
" // reinitialize search index\n\t $db->delete('search');",
" $mods = array();\n // old school modules\n//\t foreach (expModules::modules_list() as $mod) {\n////\t\t $name = @call_user_func(array($mod,'name'));\n// $name = @call_user_func(array($mod,'searchName'));\n//\t\t if (class_exists($mod) && is_callable(array($mod,'spiderContent'))) {\n// $mods[$name] = call_user_func(array($mod,'spiderContent'));\n//\t\t }\n//\t }",
" // 2.0 modules\n//\t foreach (expModules::listControllers() as $ctlname=>$ctl) {\n foreach (expModules::getActiveControllersList() as $ctl) {\n $ctlname = expModules::getModuleClassName($ctl);\n\t\t $controller = new $ctlname();\n\t\t if (method_exists($controller,'isSearchable') && $controller->isSearchable()) {\n//\t\t\t $mods[$controller->name()] = $controller->addContentToSearch();\n $mods[$controller->searchName()] = $controller->addContentToSearch();\n\t\t }\n\t }",
"\t",
"\t uksort($mods,'strnatcasecmp');\n\t assign_to_template(array(\n 'mods'=>$mods\n ));\n }",
" ",
" public function show() {\n //no need to do anything..we're just showing the form... so far! MUAHAHAHAHAHAAA! what?\n// redirect_to(array(\"controller\"=>'search',\"action\"=>'showall'));\n }",
" ",
" public function showall() {\n// redirect_to(array(\"controller\"=>'search',\"action\"=>'show'));\n// $this->show();\n }",
" /**\n * tag cloud\n */\n function cloud() {\n global $db;",
" expHistory::set('manageable', $this->params);\n $page = new expPaginator(array(\n 'model'=>'expTag',\n 'where'=>null,\n// 'limit'=>999,\n 'order'=>\"title\",\n 'dontsortwithincat'=>true,\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));",
"// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n// foreach ($page->records as $key => $value) {\n// $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n// if (!empty($attatchedat)) {\n// $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n// $page->records[$key]->attached[$contenttype] = $attatchedat;\n// }\n// }\n// }\n $tags_list = array();\n foreach ($page->records as $key=>$record) {\n $count = $db->countObjects('content_expTags','exptags_id=' . $record->id);\n if ($count) {\n $page->records[$key]->attachedcount = $count;\n $tags_list[$record->title] = new stdClass();\n $tags_list[$record->title]->count = $count;\n $tags_list[$record->title]->sef_url = $record->sef_url;\n $tags_list[$record->title]->title = $record->title;\n } else {\n unset($page->records[$key]);\n }\n }\n // trim the tag cloud to our limit.\n $page->records = expSorter::sort(array('array'=>$page->records, 'order'=>'attachedcount DESC', 'type'=>'a'));\n if (!empty($this->config['limit'])) $page->records = array_slice($page->records,0,$this->config['limit']);\n if (!empty($this->config['order']) && $this->config['order'] != 'hits') {\n $page->records = expSorter::sort(array('array'=>$page->records, 'order'=>'title ASC', 'ignore_case'=>true, 'sort_type'=>'a'));\n }\n assign_to_template(array(\n 'page'=>$page,\n 'tags_list'=>$tags_list\n ));\n }",
" // some general search stuff\n public function autocomplete() {\n return;\n global $db;",
" $model = $this->params['model'];\n $mod = new $model();\n $srchcol = explode(\",\",$this->params['searchoncol']);\n /*for ($i=0; $i<count($srchcol); $i++) {\n if ($i>=1) $sql .= \" OR \";\n $sql .= $srchcol[$i].' LIKE \\'%'.$this->params['query'].'%\\'';\n }*/\n // $sql .= ' AND parent_id=0';\n //eDebug($sql);",
" ",
" //$res = $mod->find('all',$sql,'id',25);\n $sql = \"select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from \".$db->prefix.\"product as p INNER JOIN \".$db->prefix.\"content_expfiles as cef ON p.id=cef.content_id INNER JOIN \".$db->prefix.\"expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"') desc LIMIT 25\";\n //$res = $db->selectObjectsBySql($sql);\n //$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`');",
" ",
" $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
"\t",
"\tpublic function searchQueryReport() {\n\t\tglobal $db;",
"\t\t",
"\t\t//Instantiate the search model\n\t\t$search = new search();",
"\t\t",
"\t\t//Store the keywords that returns nothing\n $badSearch = array();\n\t\t$badSearchArr = array();",
"\t\t",
"\t\t//User Records Initialization\n\t\t$all_user = -1;\n\t\t$anonymous = -2;\n\t\t$uname = array('id'=>array($all_user, $anonymous), 'name'=>array('All Users', 'Anonymous'));",
"\t\t$user_default = '';\n\t\t$where = '';",
"\t\t",
"\t\tif(isset($this->params['user_id']) && $this->params['user_id'] != -1) {\n\t\t\t$user_default = $this->params['user_id'];\n\t\t}",
"\t\t",
"\t\texpHistory::set('manageable', $this->params);",
"\t\t$ctr = 2;\n\t\t$ctr2 = 0;",
"\t\t",
"\t\t//Getting the search users\n\t\t$records = $db->selectObjects('search_queries');",
"\t\t\n\t\t",
"\t\tforeach($records as $item) {\n\t\t\t$u = user::getUserById($item->user_id);",
"\t\t\tif($item->user_id == 0) {\n\t\t\t\t$item->user_id = $anonymous;\n\t\t\t}",
"\t\t\t",
"\t\t\tif(!in_array($item->user_id, $uname['id'])) {\n\t\t\t\t$uname['name'][$ctr] = $u->firstname . ' ' . $u->lastname;\n\t\t\t\t$uname['id'][$ctr] = $item->user_id;\n\t\t\t\t$ctr++;\n\t\t\t}",
"\t\t\t",
"\t\t\t$result = $search->getSearchResults($item->query, false, true);\n\t\t\tif(empty($result) && !in_array($item->query, $badSearchArr)) {\n\t\t\t\t$badSearchArr[] = $item->query;\n\t\t\t\t$badSearch[$ctr2]['query'] = $item->query;\n\t\t\t\t$badSearch[$ctr2]['count'] = $db->countObjects(\"search_queries\", \"query='{$item->query}'\");\n\t\t\t\t$ctr2++;\n\t\t\t}",
"\t\t\t\n\t\t}\n\t",
"\t\t//Check if the user choose from the dropdown\n\t\tif(!empty($user_default)) {\n\t\t\tif($user_default == $anonymous) {\n\t\t\t\t$u_id = 0;\n\t\t\t} else {\n\t\t\t\t$u_id = $user_default;\n\t\t\t}\n\t\t\t$where .= \"user_id = {$u_id}\";\n\t\t}",
"\t",
"\t\t//Get all the search query records\n\t\t$records = $db->selectObjects('search_queries', $where);\n for ($i = 0, $iMax = count($records); $i < $iMax; $i++) {\n\t\t\tif(!empty($records[$i]->user_id)) {\n\t\t\t\t$u = user::getUserById($records[$i]->user_id);\n\t\t\t\t$records[$i]->user = $u->firstname . ' ' . $u->lastname;\n\t\t\t}\n\t\t}",
"\t\t",
" $page = new expPaginator(array(\n 'records' => $records,\n 'where'=>1,\n 'model'=>'search_queries',\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? 10 : $this->config['limit'],\n 'order'=>empty($this->config['order']) ? 'timestamp' : $this->config['order'],\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n 'ID'=>'id',\n gt('Query')=>'query',\n gt('Timestamp')=>'timestamp',\n gt('User')=>'user_id',\n ),\n ));",
" $uname['id'] = implode($uname['id'],',');\n $uname['name'] = implode($uname['name'],',');\n assign_to_template(array(\n 'page'=>$page,\n 'users'=>$uname,\n 'user_default' => $user_default,\n 'badSearch' => $badSearch\n ));",
"\t\t",
"\t}",
"\t",
"\tpublic function topSearchReport() {\n\t\tglobal $db;\n\t\t$limit = intval(TOP_SEARCH);",
"\t\t",
"\t\tif(empty($limit)) {\n\t\t\t$limit = 10;\n\t\t}",
"\t\t$count = $db->countObjects('search_queries');",
"\t",
"\t\t$records = $db->selectObjectsBySql(\"SELECT COUNT(query) cnt, query FROM \" .$db->prefix . \"search_queries GROUP BY query ORDER BY cnt DESC LIMIT 0, {$limit}\");",
" $records_key_arr = array();\n $records_values_arr = array();\n\t\tforeach($records as $item) {\n\t\t\t$records_key_arr[] = '\"' . addslashes($item->query) . '\"';\n\t\t\t$records_values_arr[] = number_format((($item->cnt / $count)*100), 2);\n\t\t}\n\t\t$records_key = implode(\",\", $records_key_arr);\n\t\t$records_values = implode(\",\", $records_values_arr);",
"\t\t",
"\t\tassign_to_template(array(\n 'records'=>$records,\n 'total'=>$count,\n 'limit' => $limit,\n 'records_key' => $records_key,\n 'records_values' => $records_values\n ));\n\t}",
" function delete_search_queries() {\n $sq = new search_queries();\n $sqall = $sq->find('all');\n if (!empty($sqall)) foreach ($sqall as $sqd) {\n $sqd->delete();\n }\n flash('message', gt(\"Search Queries successfully deleted.\"));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class searchController extends expController {\n public $useractions = array(\n 'show'=>'Show Search Form',\n 'cloud'=>'Show Tag Cloud'\n );",
" protected $manage_permissions = array(\n 'spider'=>'Spider Site',\n 'searchQueryReport'=>'Search Query Report',\n 'topSearchReport'=>'Top Search Report',",
" );",
"",
" public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)",
" static function displayname() { return gt(\"Search Form\"); }\n static function description() { return gt(\"Add a form to allow users to search for content on your website.\"); }\n static function hasSources() { return false; }\n static function hasContent() { return false; }",
" public function search()\n {\n global $router;",
" $terms = $this->params['search_string'];",
" // If magic quotes is on and the user uses modifiers like \" (quotes) they get escaped. We don't want that in this case.\n if (get_magic_quotes_gpc()) {\n $terms = stripslashes($terms);\n }\n $terms = htmlspecialchars($terms);",
" if ($router->current_url == substr(URL_FULL, 0, -1)) { // give us a user friendly url\n unset($router->params['int']);\n// unset($router->params['src']);\n// $router->params['src'] = '1';\n redirect_to($router->params);\n }",
" $search = new search();",
" $page = new expPaginator(array(\n// 'model'=>'search',\n 'records'=>$search->getSearchResults($terms, !empty($this->config['only_best']), 0, !empty($this->config['eventlimit']) ? $this->config['eventlimit'] : null),\n //'sql'=>$sql,\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10,\n 'order'=>'score',\n 'dir'=>'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'dontsortwithincat'=>true,\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'src' => $this->loc->src,\n ));",
" if (!empty($this->config['is_categorized'])) {\n $results = array();\n foreach ($page->records as $hit) {\n if (!isset($results[$hit->category])) {\n $results[$hit->category] = array();\n }\n $results[$hit->category][] = $hit;\n }\n assign_to_template(array(\n 'results'=>$results,\n ));\n }",
" // include CSS for results\n // auto-include the CSS for pagination links\n\t expCSS::pushToHead(array(\n//\t\t \"unique\"=>\"search-results\",\n\t\t \"link\"=>$this->asset_path.\"css/results.css\",\n\t\t )\n\t\t);",
" assign_to_template(array(\n 'page'=>$page,\n 'terms'=>$terms,\n 'params'=>$this->params,\n ));\n }",
"",
" public static function spider() {\n global $db;",
" // reinitialize search index\n\t $db->delete('search');",
" $mods = array();\n // old school modules\n//\t foreach (expModules::modules_list() as $mod) {\n////\t\t $name = @call_user_func(array($mod,'name'));\n// $name = @call_user_func(array($mod,'searchName'));\n//\t\t if (class_exists($mod) && is_callable(array($mod,'spiderContent'))) {\n// $mods[$name] = call_user_func(array($mod,'spiderContent'));\n//\t\t }\n//\t }",
" // 2.0 modules\n//\t foreach (expModules::listControllers() as $ctlname=>$ctl) {\n foreach (expModules::getActiveControllersList() as $ctl) {\n $ctlname = expModules::getModuleClassName($ctl);\n\t\t $controller = new $ctlname();\n\t\t if (method_exists($controller,'isSearchable') && $controller->isSearchable()) {\n//\t\t\t $mods[$controller->name()] = $controller->addContentToSearch();\n $mods[$controller->searchName()] = $controller->addContentToSearch();\n\t\t }\n\t }",
"",
"\t uksort($mods,'strnatcasecmp');\n\t assign_to_template(array(\n 'mods'=>$mods\n ));\n }",
"",
" public function show() {\n //no need to do anything..we're just showing the form... so far! MUAHAHAHAHAHAAA! what?\n// redirect_to(array(\"controller\"=>'search',\"action\"=>'showall'));\n }",
"",
" public function showall() {\n// redirect_to(array(\"controller\"=>'search',\"action\"=>'show'));\n// $this->show();\n }",
" /**\n * tag cloud\n */\n function cloud() {\n global $db;",
" expHistory::set('manageable', $this->params);\n $page = new expPaginator(array(\n 'model'=>'expTag',\n 'where'=>null,\n// 'limit'=>999,\n 'order'=>\"title\",\n 'dontsortwithincat'=>true,\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));",
"// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n// foreach ($page->records as $key => $value) {\n// $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n// if (!empty($attatchedat)) {\n// $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n// $page->records[$key]->attached[$contenttype] = $attatchedat;\n// }\n// }\n// }\n $tags_list = array();\n foreach ($page->records as $key=>$record) {\n $count = $db->countObjects('content_expTags','exptags_id=' . $record->id);\n if ($count) {\n $page->records[$key]->attachedcount = $count;\n $tags_list[$record->title] = new stdClass();\n $tags_list[$record->title]->count = $count;\n $tags_list[$record->title]->sef_url = $record->sef_url;\n $tags_list[$record->title]->title = $record->title;\n } else {\n unset($page->records[$key]);\n }\n }\n // trim the tag cloud to our limit.\n $page->records = expSorter::sort(array('array'=>$page->records, 'order'=>'attachedcount DESC', 'type'=>'a'));\n if (!empty($this->config['limit'])) $page->records = array_slice($page->records,0,$this->config['limit']);\n if (!empty($this->config['order']) && $this->config['order'] != 'hits') {\n $page->records = expSorter::sort(array('array'=>$page->records, 'order'=>'title ASC', 'ignore_case'=>true, 'sort_type'=>'a'));\n }\n assign_to_template(array(\n 'page'=>$page,\n 'tags_list'=>$tags_list\n ));\n }",
" // some general search stuff\n public function autocomplete() {\n return;\n global $db;",
" $model = $this->params['model'];\n $mod = new $model();\n $srchcol = explode(\",\",$this->params['searchoncol']);\n /*for ($i=0; $i<count($srchcol); $i++) {\n if ($i>=1) $sql .= \" OR \";\n $sql .= $srchcol[$i].' LIKE \\'%'.$this->params['query'].'%\\'';\n }*/\n // $sql .= ' AND parent_id=0';\n //eDebug($sql);",
"",
" //$res = $mod->find('all',$sql,'id',25);\n $sql = \"select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from \".$db->prefix.\"product as p INNER JOIN \".$db->prefix.\"content_expfiles as cef ON p.id=cef.content_id INNER JOIN \".$db->prefix.\"expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"') desc LIMIT 25\";\n //$res = $db->selectObjectsBySql($sql);\n //$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`');",
"",
" $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }",
"",
"\tpublic function searchQueryReport() {\n\t\tglobal $db;",
"",
"\t\t//Instantiate the search model\n\t\t$search = new search();",
"",
"\t\t//Store the keywords that returns nothing\n $badSearch = array();\n\t\t$badSearchArr = array();",
"",
"\t\t//User Records Initialization\n\t\t$all_user = -1;\n\t\t$anonymous = -2;\n\t\t$uname = array('id'=>array($all_user, $anonymous), 'name'=>array('All Users', 'Anonymous'));",
"\t\t$user_default = '';\n\t\t$where = '';",
"",
"\t\tif(isset($this->params['user_id']) && $this->params['user_id'] != -1) {\n\t\t\t$user_default = $this->params['user_id'];\n\t\t}",
"",
"\t\texpHistory::set('manageable', $this->params);",
"\t\t$ctr = 2;\n\t\t$ctr2 = 0;",
"",
"\t\t//Getting the search users\n\t\t$records = $db->selectObjects('search_queries');",
"\n",
"\t\tforeach($records as $item) {\n\t\t\t$u = user::getUserById($item->user_id);",
"\t\t\tif($item->user_id == 0) {\n\t\t\t\t$item->user_id = $anonymous;\n\t\t\t}",
"",
"\t\t\tif(!in_array($item->user_id, $uname['id'])) {\n\t\t\t\t$uname['name'][$ctr] = $u->firstname . ' ' . $u->lastname;\n\t\t\t\t$uname['id'][$ctr] = $item->user_id;\n\t\t\t\t$ctr++;\n\t\t\t}",
"",
"\t\t\t$result = $search->getSearchResults($item->query, false, true);\n\t\t\tif(empty($result) && !in_array($item->query, $badSearchArr)) {\n\t\t\t\t$badSearchArr[] = $item->query;\n\t\t\t\t$badSearch[$ctr2]['query'] = $item->query;\n\t\t\t\t$badSearch[$ctr2]['count'] = $db->countObjects(\"search_queries\", \"query='{$item->query}'\");\n\t\t\t\t$ctr2++;\n\t\t\t}",
"\n\t\t}\n",
"\t\t//Check if the user choose from the dropdown\n\t\tif(!empty($user_default)) {\n\t\t\tif($user_default == $anonymous) {\n\t\t\t\t$u_id = 0;\n\t\t\t} else {\n\t\t\t\t$u_id = $user_default;\n\t\t\t}\n\t\t\t$where .= \"user_id = {$u_id}\";\n\t\t}",
"",
"\t\t//Get all the search query records\n\t\t$records = $db->selectObjects('search_queries', $where);\n for ($i = 0, $iMax = count($records); $i < $iMax; $i++) {\n\t\t\tif(!empty($records[$i]->user_id)) {\n\t\t\t\t$u = user::getUserById($records[$i]->user_id);\n\t\t\t\t$records[$i]->user = $u->firstname . ' ' . $u->lastname;\n\t\t\t}\n\t\t}",
"",
" $page = new expPaginator(array(\n 'records' => $records,\n 'where'=>1,\n 'model'=>'search_queries',\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? 10 : $this->config['limit'],\n 'order'=>empty($this->config['order']) ? 'timestamp' : $this->config['order'],\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n 'ID'=>'id',\n gt('Query')=>'query',\n gt('Timestamp')=>'timestamp',\n gt('User')=>'user_id',\n ),\n ));",
" $uname['id'] = implode($uname['id'],',');\n $uname['name'] = implode($uname['name'],',');\n assign_to_template(array(\n 'page'=>$page,\n 'users'=>$uname,\n 'user_default' => $user_default,\n 'badSearch' => $badSearch\n ));",
"",
"\t}",
"",
"\tpublic function topSearchReport() {\n\t\tglobal $db;\n\t\t$limit = intval(TOP_SEARCH);",
"",
"\t\tif(empty($limit)) {\n\t\t\t$limit = 10;\n\t\t}",
"\t\t$count = $db->countObjects('search_queries');",
"",
"\t\t$records = $db->selectObjectsBySql(\"SELECT COUNT(query) cnt, query FROM \" .$db->prefix . \"search_queries GROUP BY query ORDER BY cnt DESC LIMIT 0, {$limit}\");",
" $records_key_arr = array();\n $records_values_arr = array();\n\t\tforeach($records as $item) {\n\t\t\t$records_key_arr[] = '\"' . addslashes($item->query) . '\"';\n\t\t\t$records_values_arr[] = number_format((($item->cnt / $count)*100), 2);\n\t\t}\n\t\t$records_key = implode(\",\", $records_key_arr);\n\t\t$records_values = implode(\",\", $records_values_arr);",
"",
"\t\tassign_to_template(array(\n 'records'=>$records,\n 'total'=>$count,\n 'limit' => $limit,\n 'records_key' => $records_key,\n 'records_values' => $records_values\n ));\n\t}",
" function delete_search_queries() {\n $sq = new search_queries();\n $sqall = $sq->find('all');\n if (!empty($sqall)) foreach ($sqall as $sqd) {\n $sqd->delete();\n }\n flash('message', gt(\"Search Queries successfully deleted.\"));\n expHistory::back();\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class simplePollController extends expController {\n\tpublic $basemodel_name = 'simplepoll_question';\n\tpublic $useractions = array(\n 'showall'=>'Show Poll Question',\n 'showRandom'=>'Show Random Question',\n\t);\n\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n\t\t'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n\t\t'rss',\n\t\t'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)\n// public $codequality = 'beta';",
" static function displayname() { return gt(\"Simple Poll\"); }\n static function description() { return gt(\"A simple poll that asks a visitor one question with multiple answers. Can manage multiple questions, though it only displays one.\"); }\n//\tfunction isSearchable() { return true; }",
" public function __construct($src=null, $params=array()) {\n parent::__construct($src, $params);\n $this->simplepoll_timeblock = new simplepoll_timeblock();\n }",
"\tpublic function showall() {\n expHistory::set('viewable', $this->params);\n $where = $this->aggregateWhereClause();\n $where .= \" AND active = 1\";\n $question = $this->simplepoll_question->find('first', $where);\n if (empty($question)) $question = $this->simplepoll_question->find('first', $this->aggregateWhereClause());\n assign_to_template(array(\n 'question'=>$question,\n ));\n\t}",
" public function showRandom() {\n \t expHistory::set('viewable', $this->params);\n $question = $this->simplepoll_question->find('first', $this->aggregateWhereClause(), 'RAND()');\n \t\tassign_to_template(array(\n 'question'=>$question,\n ));\n \t}",
" public function manage_questions() {\n global $router;",
" expHistory::set('manageable', $router->params);\n $where = $this->aggregateWhereClause();\n $questions = $this->simplepoll_question->find('all', $where);\n assign_to_template(array(\n 'questions'=>$questions,\n ));\n }",
" public function manage_question() {\n global $router;",
" $question = null;\n if (isset($this->params['id'])) {\n $question = $this->simplepoll_question->find('first','id='.$this->params['id']);\n }",
" if ($question) {\n expHistory::set('manageable', $router->params);\n assign_to_template(array(\n 'question'=>$question,\n ));\n }\n }",
" public function delete() {\n // if no active question, set first question as active\n $question = $this->simplepoll_question->find('first', 'id='.$this->params['id']);\n parent::delete();\n $question = $this->simplepoll_question->find('first', \"location_data='\".$question->location_data.\"' AND active = 1\");\n if (empty($question)) {\n $question = $this->simplepoll_question->find('first', \"location_data='\".$question->location_data.\"'\");\n $question->update(array('active'=>1));\n }\n }",
" public function edit_answer() {\n $id = !empty($this->params['id']) ? $this->params['id'] : null;\n $answer = new simplepoll_answer($id);\n if (empty($answer->simplepoll_question->id) && !empty($this->params['question_id'])) {\n $answer->simplepoll_question = $this->simplepoll_question->find('first', 'id='.$this->params['question_id']);\n }\n assign_to_template(array(\n 'answer'=>$answer,\n ));\n }",
" public function update_answer() {\n $answer = new simplepoll_answer($this->params);\n $answer->update();\n\t expHistory::returnTo('manageable');\n }",
" public function delete_answer() {\n if (isset($this->params['id'])) {\n $answer = new simplepoll_answer($this->params['id']);\n $answer->delete();\n }\n expHistory::back();\n }",
" public function activate() {\n $this->simplepoll_question->toggle();\n $active = $this->simplepoll_question->find('first',\"id=\".$this->params['id']);\n $active->update(array('active'=>1));\n\t expHistory::returnTo('manageable');\n }",
" public function vote() {\n global $user;",
" if (isset($this->params['choice'])) {",
" $answer = new simplepoll_answer($this->params['choice']);",
" if (empty($this->config)) {\n $this->config['anonymous_timeout'] = 5*3600;\n $this->config['thank_you_message'] = 'Thank you for voting.';\n $this->config['already_voted_message'] = 'You have already voted in this poll.';\n $this->config['voting_closed_message'] = 'Voting has been closed for this poll.';\n }",
" // Check to see if voting is even allowed:\n if ($answer->simplepoll_question->open_voting) {\n // Time blocking\n// $timeblock = null;\n if (is_object($user) && $user->id > 0) {\n $timeblock = $this->simplepoll_timeblock->find('first','user_id='.$user->id.' AND simplepoll_question_id='.$answer->simplepoll_question_id);\n// $timeblock = $db->selectObject('simplepoll_timeblock','user_id='.$user->id.' AND simplepoll_question_id='.$answer->simplepoll_question_id);\n } else {\n $timeblock = $this->simplepoll_timeblock->find('first',\"ip_hash='\".md5($_SERVER['REMOTE_ADDR']).\"' AND simplepoll_question_id=\".$answer->simplepoll_question_id);\n// $timeblock = $db->selectObject('simplepoll_timeblock',\"ip_hash='\".md5($_SERVER['REMOTE_ADDR']).\"' AND simplepoll_question_id=\".$answer->simplepoll_question_id);\n }",
" if ($timeblock == null || ($timeblock->lock_expires < time() && $timeblock->lock_expires != 0)) {\n if ($timeblock == null)\n $timeblock = new simplepoll_timeblock();\n $answer->vote_count++;\n $answer->update();",
" // Update the timeblock\n $timeblock->simplepoll_question_id = $answer->simplepoll_question_id;\n if (is_object($user) && $user->id > 0) {\n $timeblock->lock_expires = 0;\n $timeblock->user_id = $user->id;\n $timeblock->ip_hash = '';\n } else {\n $timeblock->lock_expires = time()+($this->config['anonymous_timeout']*3600);\n $timeblock->user_id = 0;\n $timeblock->ip_hash = md5($_SERVER['REMOTE_ADDR']);\n }",
"// if (isset($timeblock->id)) {\n// $db->updateObject($timeblock,'simplepoll_timeblock');\n// } else {\n// $db->insertObject($timeblock,'simplepoll_timeblock');\n// }\n $timeblock->update();",
" flash('message', $this->config['thank_you_message']);\n if ($answer->simplepoll_question->open_results) {\n redirect_to(array('controller'=>'simplePoll', 'action'=>'results','id'=>$answer->simplepoll_question_id));\n } else {\n expHistory::back();\n }\n } else {\n flash('error', $this->config['already_voted_message']);\n expHistory::back();\n }\n } else {\n flash('error', $this->config['voting_closed_message']);\n expHistory::back();\n }\n } else {\n flash('error', gt('You must select an answer to vote'));\n \t expHistory::back();\n }\n }",
" public function results() {\n if (isset($this->params['id'])) {\n $question = $this->simplepoll_question->find('first', 'id='.$this->params['id']);\n }\n if (!empty($question) && $question->open_results) {\n $total = 0;\n foreach ($question->simplepoll_answer as $answer) {\n $total += $answer->vote_count;\n }\n assign_to_template(array(\n 'question'=>$question,\n 'vote_total'=>$total,\n ));\n }\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */",
"class simplePollController extends expController {\n\tpublic $basemodel_name = 'simplepoll_question';\n\tpublic $useractions = array(\n 'showall'=>'Show Poll Question',\n 'showRandom'=>'Show Random Question',\n\t);\n\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n\t\t'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n\t\t'rss',\n\t\t'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)\n// public $codequality = 'beta';",
" static function displayname() { return gt(\"Simple Poll\"); }\n static function description() { return gt(\"A simple poll that asks a visitor one question with multiple answers. Can manage multiple questions, though it only displays one.\"); }\n//\tfunction isSearchable() { return true; }",
" public function __construct($src=null, $params=array()) {\n parent::__construct($src, $params);\n $this->simplepoll_timeblock = new simplepoll_timeblock();\n }",
"\tpublic function showall() {\n expHistory::set('viewable', $this->params);\n $where = $this->aggregateWhereClause();\n $where .= \" AND active = 1\";\n $question = $this->simplepoll_question->find('first', $where);\n if (empty($question)) $question = $this->simplepoll_question->find('first', $this->aggregateWhereClause());\n assign_to_template(array(\n 'question'=>$question,\n ));\n\t}",
" public function showRandom() {\n \t expHistory::set('viewable', $this->params);\n $question = $this->simplepoll_question->find('first', $this->aggregateWhereClause(), 'RAND()');\n \t\tassign_to_template(array(\n 'question'=>$question,\n ));\n \t}",
" public function manage_questions() {\n global $router;",
" expHistory::set('manageable', $router->params);\n $where = $this->aggregateWhereClause();\n $questions = $this->simplepoll_question->find('all', $where);\n assign_to_template(array(\n 'questions'=>$questions,\n ));\n }",
" public function manage_question() {\n global $router;",
" $question = null;\n if (isset($this->params['id'])) {\n $question = $this->simplepoll_question->find('first','id='.$this->params['id']);\n }",
" if ($question) {\n expHistory::set('manageable', $router->params);\n assign_to_template(array(\n 'question'=>$question,\n ));\n }\n }",
" public function delete() {\n // if no active question, set first question as active\n $question = $this->simplepoll_question->find('first', 'id='.$this->params['id']);\n parent::delete();\n $question = $this->simplepoll_question->find('first', \"location_data='\".$question->location_data.\"' AND active = 1\");\n if (empty($question)) {\n $question = $this->simplepoll_question->find('first', \"location_data='\".$question->location_data.\"'\");\n $question->update(array('active'=>1));\n }\n }",
" public function edit_answer() {\n $id = !empty($this->params['id']) ? $this->params['id'] : null;\n $answer = new simplepoll_answer($id);\n if (empty($answer->simplepoll_question->id) && !empty($this->params['question_id'])) {\n $answer->simplepoll_question = $this->simplepoll_question->find('first', 'id='.$this->params['question_id']);\n }\n assign_to_template(array(\n 'answer'=>$answer,\n ));\n }",
" public function update_answer() {\n $answer = new simplepoll_answer($this->params);\n $answer->update();\n\t expHistory::returnTo('manageable');\n }",
" public function delete_answer() {\n if (isset($this->params['id'])) {\n $answer = new simplepoll_answer($this->params['id']);\n $answer->delete();\n }\n expHistory::back();\n }",
" public function activate() {\n $this->simplepoll_question->toggle();\n $active = $this->simplepoll_question->find('first',\"id=\".$this->params['id']);\n $active->update(array('active'=>1));\n\t expHistory::returnTo('manageable');\n }",
" public function vote() {\n global $user;",
" if (isset($this->params['choice'])) {",
" $answer = new simplepoll_answer(intval($this->params['choice']));",
" if (empty($this->config)) {\n $this->config['anonymous_timeout'] = 5*3600;\n $this->config['thank_you_message'] = 'Thank you for voting.';\n $this->config['already_voted_message'] = 'You have already voted in this poll.';\n $this->config['voting_closed_message'] = 'Voting has been closed for this poll.';\n }",
" // Check to see if voting is even allowed:\n if ($answer->simplepoll_question->open_voting) {\n // Time blocking\n// $timeblock = null;\n if (is_object($user) && $user->id > 0) {\n $timeblock = $this->simplepoll_timeblock->find('first','user_id='.$user->id.' AND simplepoll_question_id='.$answer->simplepoll_question_id);\n// $timeblock = $db->selectObject('simplepoll_timeblock','user_id='.$user->id.' AND simplepoll_question_id='.$answer->simplepoll_question_id);\n } else {\n $timeblock = $this->simplepoll_timeblock->find('first',\"ip_hash='\".md5($_SERVER['REMOTE_ADDR']).\"' AND simplepoll_question_id=\".$answer->simplepoll_question_id);\n// $timeblock = $db->selectObject('simplepoll_timeblock',\"ip_hash='\".md5($_SERVER['REMOTE_ADDR']).\"' AND simplepoll_question_id=\".$answer->simplepoll_question_id);\n }",
" if ($timeblock == null || ($timeblock->lock_expires < time() && $timeblock->lock_expires != 0)) {\n if ($timeblock == null)\n $timeblock = new simplepoll_timeblock();\n $answer->vote_count++;\n $answer->update();",
" // Update the timeblock\n $timeblock->simplepoll_question_id = $answer->simplepoll_question_id;\n if (is_object($user) && $user->id > 0) {\n $timeblock->lock_expires = 0;\n $timeblock->user_id = $user->id;\n $timeblock->ip_hash = '';\n } else {\n $timeblock->lock_expires = time()+($this->config['anonymous_timeout']*3600);\n $timeblock->user_id = 0;\n $timeblock->ip_hash = md5($_SERVER['REMOTE_ADDR']);\n }",
"// if (isset($timeblock->id)) {\n// $db->updateObject($timeblock,'simplepoll_timeblock');\n// } else {\n// $db->insertObject($timeblock,'simplepoll_timeblock');\n// }\n $timeblock->update();",
" flash('message', $this->config['thank_you_message']);\n if ($answer->simplepoll_question->open_results) {\n redirect_to(array('controller'=>'simplePoll', 'action'=>'results','id'=>$answer->simplepoll_question_id));\n } else {\n expHistory::back();\n }\n } else {\n flash('error', $this->config['already_voted_message']);\n expHistory::back();\n }\n } else {\n flash('error', $this->config['voting_closed_message']);\n expHistory::back();\n }\n } else {\n flash('error', gt('You must select an answer to vote'));\n \t expHistory::back();\n }\n }",
" public function results() {\n if (isset($this->params['id'])) {\n $question = $this->simplepoll_question->find('first', 'id='.$this->params['id']);\n }\n if (!empty($question) && $question->open_results) {\n $total = 0;\n foreach ($question->simplepoll_answer as $answer) {\n $total += $answer->vote_count;\n }\n assign_to_template(array(\n 'question'=>$question,\n 'vote_total'=>$total,\n ));\n }\n }",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */",
"class loginController extends expController {\n\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n\t\t'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)\n public $useractions = array(\n\t 'showlogin'=>'Login',\n );",
" static function displayname() { return gt(\"Login Manager\"); }\n static function description() { return gt(\"This is the login management module. It allows for logging in, logging out, etc.\"); }",
" static function hasSources() {\n return false;\n }",
"\t/**\n\t * Display a login view\n\t */\n\tpublic static function showlogin() {\n\t\tglobal $db, $user, $order, $router;",
"\t\t$oicount = !empty($order->item_count) ? $order->item_count : 0;\n\t\t// FIGURE OUT IF WE\"RE IN PREVIEW MODE OR NOT\n\t\t$level = 99;\n\t\tif (expSession::is_set('uilevel')) {\n\t\t\t$level = expSession::get('uilevel');\n\t\t}\n\t\t$previewtext = $level == UILEVEL_PREVIEW ? gt('Turn Preview Mode off') : gt('Turn Preview Mode on');\n\t\t$previewclass = $level == UILEVEL_PREVIEW ? 'preview_on' : 'preview_off';",
" if (!expSession::is_set('redirecturl')) expSession::set('redirecturl', expHistory::getLast());\n if (!expSession::is_set('redirecturl_error')) {\n expSession::set('redirecturl_error', makeLink(array('controller'=>'login', 'action'=>'showlogin')));\n expHistory::set('viewable', $router->params);\n }",
"\t\t//eDebug($order);\n\t\tif (expSession::loggedIn() && $user->username != \"anonymous\") {\n\t\t\t$loggedin = 1;\n\t\t\t// Generate display name as username if the first and last name fields are blank.\n\t\t\t$display_name = $user->firstname . ' ' .$user->lastname;\n\t\t\tif (trim($display_name) == '') {\n\t\t\t\t$display_name = $user->username;\n\t\t\t}\n\t\t\t// Need to check for groups and whatnot\n\t\t\tif ($db->countObjects('groupmembership','member_id='.$user->id.' AND is_admin=1')) {\n\t\t\t\t$is_group_admin = 1;\n\t\t\t} else {\n\t\t\t\t$is_group_admin = 0;\n\t\t\t}",
"\t\t\tassign_to_template(array(\n 'oicount'=>$oicount,\n 'previewtext'=>$previewtext,\n 'previewclass'=>$previewclass,\n 'loggedin'=>$loggedin,\n 'user'=>$user,\n 'displayname'=>$display_name,\n 'is_group_admin'=>$is_group_admin\n ));\n\t\t} else {\n\t\t\t//$template->assign('isecom',in_array('storeController',listActiveControllers()));\n\t\t\t$loggedin = 0;\n\t\t\tassign_to_template(array(\n 'oicount'=>$oicount,\n 'previewtext'=>$previewtext,\n 'previewclass'=>$previewclass,\n 'loggedin'=>$loggedin,\n 'user'=>$user\n ));\n if (expSession::get('customer-login')) {\n assign_to_template(array(\n 'checkout'=>true\n ));\n }\n\t\t}\n\t}",
"\t/**\n\t * main logout method\n\t */\n\tpublic static function logout() {\n\t\texpSession::logout();\n\t\texpSession::un_set(\"permissions\");\n\t\texpSession::un_set('uilevel');\n\t\texpSession::clearCurrentUserSessionCache();\n\t\tflash('message', gt('You have been logged out'));\n\t\tredirect_to(array(\"section\"=>SITE_DEFAULT_SECTION));\n\t}",
"\t/**\n\t * main login method\n\t */\n\tpublic static function login() {",
"\t\tuser::login(expString::sanitize($_POST['username']),expString::sanitize($_POST['password']));",
"\t\tif (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in\n\t\t\tflash('error', gt('Invalid Username / Password'));\n\t\t\tif (expSession::is_set('redirecturl_error')) {\n\t\t\t\t$url = expSession::get('redirecturl_error');\n\t\t\t\texpSession::un_set('redirecturl_error');\n\t\t\t\theader(\"Location: \".$url);\n\t\t\t} else {\n\t\t\t\texpHistory::back();\n\t\t\t}\n\t\t} else { // we're logged in\n\t\t\tglobal $user;",
" if (expSession::get('customer-login')) expSession::un_set('customer-login');\n\t\t\tif (!empty($_POST['username'])) flash('message', gt('Welcome back').' '.expString::sanitize($_POST['username']));\n if ($user->isAdmin()) {\n expHistory::back();\n } else {\n foreach ($user->groups as $g) {\n if (!empty($g->redirect)) {\n $url = URL_FULL.$g->redirect;\n break;\n }\n }\n if (isset($url)) {\n header(\"Location: \".$url);\n } else {\n expHistory::back();\n }\n }\n\t\t}\n\t}",
"\t/**\n\t * method to redirect to a login if needed\n\t */\n\tpublic static function loginredirect() {\n\t\tglobal $user, $router;",
"\t\tob_start();\n\t\tif ($user->isLoggedIn()) {\n\t\t\theader('Location: ' . expSession::get('redirecturl'));\n\t\t} else {\n\t\t\t//expSession::set('redirecturl', expHistory::getLastNotEditable());\n\t\t\texpSession::set('redirecturl', expHistory::getLast());\n\t\t\texpSession::set('redirecturl_error', makeLink(array('controller'=>'login', 'action'=>'loginredirect')));\n//\t\t\texpHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);\n\t\t\texpHistory::set('viewable', $router->params);\n\t\t}\n//\t\tredirect_to(array('controller'=>'login', 'action'=>'showlogin'));\n renderAction(array('controller'=>'login','action'=>'showlogin','no_output'=>true));\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################",
"/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */",
"class loginController extends expController {\n\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n\t\t'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)\n public $useractions = array(\n\t 'showlogin'=>'Login',\n );",
" static function displayname() { return gt(\"Login Manager\"); }\n static function description() { return gt(\"This is the login management module. It allows for logging in, logging out, etc.\"); }",
" static function hasSources() {\n return false;\n }",
"\t/**\n\t * Display a login view\n\t */\n\tpublic static function showlogin() {\n\t\tglobal $db, $user, $order, $router;",
"\t\t$oicount = !empty($order->item_count) ? $order->item_count : 0;\n\t\t// FIGURE OUT IF WE\"RE IN PREVIEW MODE OR NOT\n\t\t$level = 99;\n\t\tif (expSession::is_set('uilevel')) {\n\t\t\t$level = expSession::get('uilevel');\n\t\t}\n\t\t$previewtext = $level == UILEVEL_PREVIEW ? gt('Turn Preview Mode off') : gt('Turn Preview Mode on');\n\t\t$previewclass = $level == UILEVEL_PREVIEW ? 'preview_on' : 'preview_off';",
" if (!expSession::is_set('redirecturl')) expSession::set('redirecturl', expHistory::getLast());\n if (!expSession::is_set('redirecturl_error')) {\n expSession::set('redirecturl_error', makeLink(array('controller'=>'login', 'action'=>'showlogin')));\n expHistory::set('viewable', $router->params);\n }",
"\t\t//eDebug($order);\n\t\tif (expSession::loggedIn() && $user->username != \"anonymous\") {\n\t\t\t$loggedin = 1;\n\t\t\t// Generate display name as username if the first and last name fields are blank.\n\t\t\t$display_name = $user->firstname . ' ' .$user->lastname;\n\t\t\tif (trim($display_name) == '') {\n\t\t\t\t$display_name = $user->username;\n\t\t\t}\n\t\t\t// Need to check for groups and whatnot\n\t\t\tif ($db->countObjects('groupmembership','member_id='.$user->id.' AND is_admin=1')) {\n\t\t\t\t$is_group_admin = 1;\n\t\t\t} else {\n\t\t\t\t$is_group_admin = 0;\n\t\t\t}",
"\t\t\tassign_to_template(array(\n 'oicount'=>$oicount,\n 'previewtext'=>$previewtext,\n 'previewclass'=>$previewclass,\n 'loggedin'=>$loggedin,\n 'user'=>$user,\n 'displayname'=>$display_name,\n 'is_group_admin'=>$is_group_admin\n ));\n\t\t} else {\n\t\t\t//$template->assign('isecom',in_array('storeController',listActiveControllers()));\n\t\t\t$loggedin = 0;\n\t\t\tassign_to_template(array(\n 'oicount'=>$oicount,\n 'previewtext'=>$previewtext,\n 'previewclass'=>$previewclass,\n 'loggedin'=>$loggedin,\n 'user'=>$user\n ));\n if (expSession::get('customer-login')) {\n assign_to_template(array(\n 'checkout'=>true\n ));\n }\n\t\t}\n\t}",
"\t/**\n\t * main logout method\n\t */\n\tpublic static function logout() {\n\t\texpSession::logout();\n\t\texpSession::un_set(\"permissions\");\n\t\texpSession::un_set('uilevel');\n\t\texpSession::clearCurrentUserSessionCache();\n\t\tflash('message', gt('You have been logged out'));\n\t\tredirect_to(array(\"section\"=>SITE_DEFAULT_SECTION));\n\t}",
"\t/**\n\t * main login method\n\t */\n\tpublic static function login() {",
"\t\tuser::login(expString::escape(expString::sanitize($_POST['username'])),expString::escape(expString::sanitize($_POST['password'])));",
"\t\tif (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in\n\t\t\tflash('error', gt('Invalid Username / Password'));\n\t\t\tif (expSession::is_set('redirecturl_error')) {\n\t\t\t\t$url = expSession::get('redirecturl_error');\n\t\t\t\texpSession::un_set('redirecturl_error');\n\t\t\t\theader(\"Location: \".$url);\n\t\t\t} else {\n\t\t\t\texpHistory::back();\n\t\t\t}\n\t\t} else { // we're logged in\n\t\t\tglobal $user;",
" if (expSession::get('customer-login')) expSession::un_set('customer-login');\n\t\t\tif (!empty($_POST['username'])) flash('message', gt('Welcome back').' '.expString::sanitize($_POST['username']));\n if ($user->isAdmin()) {\n expHistory::back();\n } else {\n foreach ($user->groups as $g) {\n if (!empty($g->redirect)) {\n $url = URL_FULL.$g->redirect;\n break;\n }\n }\n if (isset($url)) {\n header(\"Location: \".$url);\n } else {\n expHistory::back();\n }\n }\n\t\t}\n\t}",
"\t/**\n\t * method to redirect to a login if needed\n\t */\n\tpublic static function loginredirect() {\n\t\tglobal $user, $router;",
"\t\tob_start();\n\t\tif ($user->isLoggedIn()) {\n\t\t\theader('Location: ' . expSession::get('redirecturl'));\n\t\t} else {\n\t\t\t//expSession::set('redirecturl', expHistory::getLastNotEditable());\n\t\t\texpSession::set('redirecturl', expHistory::getLast());\n\t\t\texpSession::set('redirecturl_error', makeLink(array('controller'=>'login', 'action'=>'loginredirect')));\n//\t\t\texpHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);\n\t\t\texpHistory::set('viewable', $router->params);\n\t\t}\n//\t\tredirect_to(array('controller'=>'login', 'action'=>'showlogin'));\n renderAction(array('controller'=>'login','action'=>'showlogin','no_output'=>true));\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "12FDDF33-2B21-4F8A-AB9A-01857197E810", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Exponent CMS version 2.3.9 suffers from a Object Injection vulnerability in framework/modules/core/controllers/expTagController.php related to change_tags."}, {"lang": "es", "value": "Existe una vulnerabilidad en Exponent CMS versi\u00f3n 2.3.9, sufre de una vulnerabilidad de Inyecci\u00f3n de Objeto en el archivo framework/modules/core/controllers/expTagController.php asociado con el par\u00e1metro change_tags."}], "evaluatorComment": null, "id": "CVE-2016-8900", "lastModified": "2019-05-28T16:01:48.990", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-05-24T17:29:00.913", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Exploit", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2016/09/30/5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-74"}
| 197
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.