function delLikes($rID) { $dao = new DAO(); $dao->delLikes($rID); echo 'sorry for your dislike!  '; returnToMovieDetail(); }
public function view() { $dao = DAO::getDAO('UserDAO'); if (isset($this->params[0]) && trim($this->params[0]) == 'remove') { // ex: requesting: /user-list/delete/2 $id = trim(sanitizeString($this->params[1])); $dao->removeById($id); } else { if (isset($this->params[0]) && trim($this->params[0]) == 'add') { $randNum = mt_rand(0, 99999); $newUser = new User(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'createTime' => dbDateTime())); // #TODO: implement UserDao.create($newUser) instead. if ($dao->countAll() > 30) { // Demo mode: clean up if too many users $dao->execute("DELETE FROM user"); $dao->execute("vacuum"); } $dao->insertInto("firstName, lastName, username, email, createTime", $newUser->getFields()); } } $users = $dao->getAll(); $v = $this->smarty; $v->assign('title', 'User List'); $v->assign('inc_content', v('user_list.html')); $v->assign('users', $users); $v->assign('totalUsers', $dao->countAll()); $this->display($v, v('index.html')); }
function importVersion($filename) { import('lib.pkp.classes.rt.RTXMLParser'); $parser = new RTXMLParser(); $version =& $parser->parse($filename); $this->dao->insertVersion($this->journalId, $version); }
function bookAsMember() { $userName = $_SESSION['LoginName']; $dao = new DAO(); $orderNumber = $dao->makeOrder($_GET['sID'], $dao->fetchUserIDByUserName($userName)); echo 'Thanks for your booking ! . Your order number is ' . $orderNumber; }
public function createSections(DAO $dao) { if ($dao->queryOK()) { $sections = array(); $row = $dao->next(); $count = $row['cnt']; $letter = $row[$this->_subcat_field][0]; $first_section = $last_section = $row[$this->_subcat_field]; while ($row = $dao->next()) { if ($row[$this->_subcat_field][0] == $letter) { // aggregating mode $count += $row['cnt']; $last_section = $row[$this->_subcat_field]; } else { // section assignment mode $section = $first_section == $last_section ? $first_section : "{$first_section}-{$last_section}"; $sections[] = array('section' => $section, 'section_slug' => LWS::slugify($section), 'count' => $count); // update loop values for next section $count = $row['cnt']; $letter = $row[$this->_subcat_field][0]; $first_section = $last_section = $row[$this->_subcat_field]; } } // end while() // add last section aggregated $section = $first_section == $last_section ? $first_section : "{$first_section}-{$last_section}"; $sections[] = array('section' => $section, 'section_slug' => LWS::slugify($section), 'count' => $count); } else { $sections = NULL; } return $sections; }
function update() { require_once 'Nouvelle.class.php'; require_once 'DAO.class.php'; // Cree un objet pour accueillir le contenu du RSS : un document XML $doc = new DOMDocument(); //Telecharge le fichier XML dans $rss $doc->load($this->url); // Recupère la liste (DOMNodeList) de tous les elements de l'arbre 'title' $nodeList = $doc->getElementsByTagName('title'); // Met à jour le titre dans l'objet $this->titre = $nodeList->item(0)->textContent; // Recupère la liste (DOMNodeList) de tous les elements de l'arbre 'title' $nodeList = $doc->getElementsByTagName('pubDate'); // Met à jour la date dans l'objet $this->date = $nodeList->item(0)->textContent; $docNodeList = $doc->getElementsByTagName('item'); $dao = new DAO(); $dao->createRSS($this->url); $id = $dao->returnIdFromURL($this->url); $table = array(); $nomLocalImage = 1; foreach ($docNodeList as $nouvelle) { $tempNouvelle = new Nouvelle(); $tempNouvelle->update($nouvelle); $tempNouvelle->downloadImage($nouvelle, $nomLocalImage); $dao->createNouvelle($tempNouvelle, $id); $nomLocalImage++; $table[] = $tempNouvelle; } $this->nouvelles = $table; }
/** * Dumps the Founder data into a table * * @param int $CompanyID */ function dumpFounderData($CompanyID) { // include the data access class include_once "DAO.php"; try { // create a new data access object $db = new DAO(); $sql = "EXEC dbo.GetFounderByCompanyID @CompanyID = " . $CompanyID; // set the select statement $db->setSQL($sql); // execute the SQL if ($db->execute()) { // did we get some rows if (sqlsrv_has_rows($db->getResultSet())) { // output the table and the first row (column headers) echo '<br>'; echo '<table class="sorted table-autosort:0 table-stripeclass:alternate">'; echo "<thead><tr>"; echo "<th class='table-sortable:default' width='100'>Name</th>"; echo "</tr></thead><tbody>"; // output the table rows while ($row = sqlsrv_fetch_array($db->getResultSet(), SQLSRV_FETCH_ASSOC)) { echo '<tr><td class="left" width="70"><a href="../Participant/History.php?wfID=' . $row['ID'] . '" target="_blank">' . $row['FounderName'] . '</a></td></tr>'; } // finish the table echo "</tbody></table>"; } else { echo "<div class='err'>No data found.</div>"; } } } catch (Exception $e) { echo $e->getMessage(), "\n"; } echo "</br>"; }
function generatePartWiseReport() { $type = $_REQUEST['type']; $typeID = $_REQUEST['typeID']; $dao = new DAO(); $debtorDetails = $dao->getReportDebtorDetails($type, $typeID); include "../view/partyWiseGenReport.php"; }
/** * Cette méthode permet de créer l'objet de connexion à une base de données * * @param string $pool Nom du pool de connection * @param string $dbname Nom de la base de données * @return DatabaseInterface */ static function createConnexion($pool, $dbname){ global $_CONST; if (isset($dbname) && isset($_CONST["POOL"][$pool]["ABSTRACTION"])){ $driverOptions = array(); // Connexion if($_CONST["POOL"][$pool]["ABSTRACTION"] == "PDO"){ // Classe d'abstraction DAO utilisant PDO require_once("drivers/DAO.class.php"); // Gestion des options du driver PDO if(isset($_CONST["POOL"][$pool]["FORCE_ENCODING"]) && $_CONST["POOL"][$pool]["FORCE_ENCODING"]!='') { if(defined('PDO::MYSQL_ATTR_INIT_COMMAND')) { $driverOptions[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES ".$_CONST["POOL"][$pool]["FORCE_ENCODING"]; $fix_force_encoding_bug = false; } else { $fix_force_encoding_bug = true; } } if(isset($_CONST["POOL"][$pool]["PERSISTENT"]) && $_CONST["POOL"][$pool]["PERSISTENT"]===true) { $driverOptions[PDO::ATTR_PERSISTENT] = true; } // Ouverture d'une connexion avec PDO $connexion = new DAO($_CONST["POOL"][$pool]["TYPE"], $dbname, $_CONST["POOL"][$pool]["USER"], $_CONST["POOL"][$pool]["PASS"], $_CONST["POOL"][$pool]["HOST"], $_CONST["POOL"][$pool]["PORT"], $driverOptions); if(isset($fix_force_encoding_bug) && $fix_force_encoding_bug) { $connexion->query("SET NAMES ".$_CONST["POOL"][$pool]["FORCE_ENCODING"]); } }elseif($_CONST["POOL"][$pool]["ABSTRACTION"] == "MYSQL"){ /** Classe d'abstraction MYSQL */ require_once("drivers/Mysqlux.class.php"); // Ouverture d'une connexion avec MYSQL $connexion = new Mysqlux($_CONST["POOL"][$pool]["TYPE"],$dbname, $_CONST["POOL"][$pool]["USER"], $_CONST["POOL"][$pool]["PASS"], $_CONST["POOL"][$pool]["HOST"], $_CONST["POOL"][$pool]["PORT"], $driverOptions); if(isset($_CONST["POOL"][$pool]["FORCE_ENCODING"]) && $_CONST["POOL"][$pool]["FORCE_ENCODING"]!='') { $connexion->query("SET NAMES ".$_CONST["POOL"][$pool]["FORCE_ENCODING"]); } }else{ // Génération d'une DataBaseException throw new DataBaseException("Erreur de connection '".$dbname."'","La couche d'abastraction '".$_CONST["POOL"][$pool]["ABSTRACTION"]."' n'est pas impléméntée !",""); } $connexion->logType = isset($_CONST["POOL"][$pool]["LOG"]) ? $_CONST["POOL"][$pool]["LOG"] : null; }else{ // Génération d'une DataBaseException throw new DataBaseException("Erreur de connection '".$dbname."'","La base de données '".$dbname."' n'est pas configurée !",""); } return $connexion; }
function tryLogin($un, $up) { $dao = new DAO(); $pass = $dao->fetchPassWord($un); if ($pass != $up) { return false; } else { return true; } }
function getTareasAbiertasYUsuarios($request_id) { $daoHandler = new DAO(); $sql = "SELECT \ts.step_name, u.user_name\r\n\t\t\t\tFROM \tef_task t\r\n\t\t\t\tleft join ef_step s ON s.step_id = t.task_step AND s.step_flow = t.task_flow\r\n\t\t\t\tleft join ef_user u ON u.user_id = t.task_assignedto\r\n\t\t\t\tWHERE \t?\r\n\t\t\t\tAND \tt.task_request = '.{$request_id}.' \r\n\t\t\t\tAND \t(t.task_status is null or t.task_status = 'new' or t.task_status = '')\r\n\t\t\t\tAND \tt.task_flow = '" . $_SESSION["user_flow"] . "' "; $daoHandler->resetDAO(); $daoHandler->setQuery($sql); $daoHandler->setParameter('i', 1); $reportData = $daoHandler->executeQuery(); return $reportData; }
/** * Performs the logic for logging into the LWS backend CMS. * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { $this->setLayout('login'); if ($request->isMethod('POST')) { $dao = new DAO(); $pw = md5($dao->getEscapedSQLString(trim($request->getPostParameter('pw')))); $email = $dao->getEscapedSQLString(trim(strtolower($request->getPostParameter('email')))); $dao->query("\n \t\t\tSELECT be_user.*, role \n \t\t\tFROM be_user INNER JOIN be_role USING(role_id) \n \t\t\tWHERE email='{$email}' AND password='******' LIMIT 1\n \t\t"); if ($dao->queryOK()) { $user = $dao->next(); $dao->query("SELECT last_login_ts FROM be_user WHERE email='{$user['email']}'"); // I know that there is a record in the DB with this email, so no need to check $ts_row = $dao->next(); $last_login = is_null($ts_row['last_login_ts']) ? 'N/A' : date('M jS Y @ g:i A', $ts_row['last_login_ts']); $dao->query("UPDATE be_user SET last_login_ts=UNIX_TIMESTAMP() WHERE email='{$user['email']}'"); $this->getUser()->setAttribute('be_user', array('first_name' => $user['first_name'], 'last_name' => $user['last_name'], 'full_name' => "{$user['first_name']} {$user['last_name']}", 'email' => $user['email'], 'role' => $user['role'], 'phone' => $user['phone'], 'phone_ext' => $user['phone_ext'], 'last_login' => $last_login, 'password' => $user['password'])); $this->getUser()->setAuthenticated(true); $this->getUser()->addCredential($user['role']); } else { if ($this->getUser()->hasAttribute('be_user')) { $this->getUser()->getAttributeHolder()->remove('be_user'); } $this->getUser()->setAuthenticated(false); $this->getUser()->setFlash('login_error', 'Invalid email and/or password!'); } // allows users to go directly to requested page after login $uri = $this->getContext()->getRouting()->getCurrentInternalUri(true); $this->redirect($uri); } return sfView::SUCCESS; }
function getDuracionCerradosPorCliente($cliente, $filtros) { $daoHandler = new DAO(); $flow = $_SESSION["user_flow"]; $sql = "SELECT AVG(a.delay) delay\r\n\t\t\t\tFROM(\tSELECT SUM(IF (d.date_end is not null, \r\n\t\t\t\t\t\t\t\t\t\t(-1*TIME_TO_SEC(TIMEDIFF(d.date_start, d.date_end))), \r\n\t\t\t\t\t\t\t\t\t\t(-1*TIME_TO_SEC(TIMEDIFF(d.date_start, NOW())))\r\n\t\t\t\t\t\t\t\t\t\t)) delay\r\n\t\t\t\t\t\tFROM ef_date d\r\n\t\t\t\t\t\tLEFT JOIN ef_step s ON d.date_flow = s.step_flow AND d.date_step = s.step_id\r\n\t\t\t\t\t\tLEFT JOIN \tef_request r2 ON d.date_request = r2.request_id\r\n\t\t\t\t\t\tLEFT JOIN \trc_reclamo r1 ON r1.ef_id = r2.request_id\r\n\t\t\t\t\t\tLEFT JOIN \trc_clase c ON r1.reclamo_clase = c.id\t\r\n\t\t\t\t\t\tWHERE \t\t(r2.request_status = 'closed' OR r2.request_status = 'cancelled')\r\n\t\t\t\t\t\tAND \t\tr1.cliente_nombre = '" . $cliente . "'\r\n\t\t\t\t\t\tAND \t\tr2.request_flow = " . $flow . "\r\n\t\t\t\t\t\t" . $filtros . "\r\n\t\t\t\t\t\tGROUP BY \td.date_request\r\n\t\t\t\t\t) a\r\n\t\t\t\tWHERE ? "; $daoHandler->resetDAO(); $daoHandler->setQuery($sql); $daoHandler->setParameter('i', 1); $reportData = $daoHandler->executeQuery(); return $reportData[0]["delay"]; }
/** * Created by PhpStorm. * User: arthurveys * Date: 09/01/16 * Time: 18:12 */ function getAllGroupes() { $request = 'select * from groupe'; $db = new DAO(); $listgroupe = array(); $result = $db->executeRequest($request); foreach ($result as $value) { $listgroupe[] = new groupe($value["groupeId"], $value["nom"], $value["description"], $value["imageHeader"]); } return $listgroupe; }
function validateStaff() { $dao = new DAO(); $id = $dao->fetchStaffIDbySSN($_POST['ssn']); if ($id != null) { $_SESSION['STAFFID'] = $id; echo 'WelCome, redirecting to management page...'; header("refresh:2; url=staff.php"); } else { echo 'you are not a staff of our company.'; } }
/** * Restore the given tables. * @param $tables array * @param $test PHPUnit_Framework_Assert */ public static function restoreTables($tables, $test) { $dao = new DAO(); foreach ($tables as $table) { $sqls = array("TRUNCATE TABLE {$table}", "INSERT INTO {$table} SELECT * FROM backup_{$table}", "DROP TABLE backup_{$table}"); foreach ($sqls as $sql) { if (!$dao->update($sql, false, true, false)) { $test->fail("Error while restoring {$table}: offending SQL is '{$sql}'"); } } } }
/** * */ function __construct() { parent::__construct(); $this->setTableName('t_widget'); $this->setPrimaryKey('pk_i_id'); $this->setFields(array('pk_i_id', 's_description', 's_location', 'e_kind', 's_content')); }
public function __construct($expired = false) { $this->city_areas = array(); $this->cities = array(); $this->regions = array(); $this->countries = array(); $this->categories = array(); $this->conditions = array(); $this->fields = array(); $this->tables[] = sprintf('%st_item_description as d, %st_category_description as cd', DB_TABLE_PREFIX, DB_TABLE_PREFIX); $this->order(); $this->limit(); $this->results_per_page = 10; if (!$expired) { $this->addTable(sprintf('%st_category', DB_TABLE_PREFIX)); $this->addConditions(sprintf("%st_item.b_active = 1 ", DB_TABLE_PREFIX)); $this->addConditions(sprintf("%st_item.b_enabled = 1 ", DB_TABLE_PREFIX)); $this->addConditions(sprintf("%st_item.b_spam = 0", DB_TABLE_PREFIX)); $this->addConditions(sprintf(" (%st_item.b_premium = 1 || %st_category.i_expiration_days = 0 ||TIMESTAMPDIFF(DAY,%st_item.dt_pub_date,'%s') < %st_category.i_expiration_days) ", DB_TABLE_PREFIX, DB_TABLE_PREFIX, DB_TABLE_PREFIX, date('Y-m-d H:i:s'), DB_TABLE_PREFIX)); $this->addConditions(sprintf("%st_category.b_enabled = 1", DB_TABLE_PREFIX)); $this->addConditions(sprintf("%st_category.pk_i_id = %st_item.fk_i_category_id", DB_TABLE_PREFIX, DB_TABLE_PREFIX)); } $this->total_results = null; parent::__construct(); }
/** * Set data related to t_currency table */ function __construct() { parent::__construct(); $this->setTableName('t_currency'); $this->setPrimaryKey('pk_c_code'); $this->setFields(array('pk_c_code', 's_name', 's_description', 'b_enabled')); }
/** * Constructor. */ function OAIDAO() { parent::DAO(); $this->archiveDao =& DAORegistry::getDAO('ArchiveDAO'); $this->recordDao =& DAORegistry::getDAO('RecordDAO'); PluginRegistry::loadCategory('schemas'); }
function __construct() { parent::__construct(); $this->setTableName('t_nc_mark_as_sold'); $this->setPrimaryKey('pk_sold_id'); $this->setFields(array('pk_sold_id')); }
/** * */ function __construct() { parent::__construct(); $this->setTableName('t_user_email_tmp'); $this->setPrimaryKey('fk_i_user_id'); $this->setFields(array('fk_i_user_id', 's_new_email', 'dt_date')); }
/** * Set data related to t_item_stats table */ public function __construct() { parent::__construct(); $this->setTableName('t_item_stats'); $this->setPrimaryKey('fk_i_item_id'); $this->setFields(array('fk_i_item_id', 'i_num_views', 'i_num_spam', 'i_num_repeated', 'i_num_bad_classified', 'i_num_offensive', 'i_num_expired', 'i_num_premium_views', 'dt_date')); }
function __construct() { parent::__construct(); $this->setTableName('t_nc_seller_ratings'); $this->setPrimaryKey('pk_i_seller_id'); $this->setFields(array('pk_i_seller_id', 'pk_i_user_id', 'vote_given')); }
/** * Set data related to t_city_area table */ function __construct() { parent::__construct(); $this->setTableName('t_city_area'); $this->setPrimaryKey('pk_i_id'); $this->setFields(array('pk_i_id', 'fk_i_city_id', 's_name')); }
/** * Set data related to t_city_stats table * * @access public * @since 2.4 */ function __construct() { parent::__construct(); $this->setTableName('t_city_stats'); $this->setPrimaryKey('fk_i_city_id'); $this->setFields(array('fk_i_city_id', 'i_num_items')); }
/** * */ function __construct() { parent::__construct(); $this->setTableName('t_region'); $this->setPrimaryKey('pk_i_id'); $this->setFields( array('pk_i_id', 'fk_c_country_code', 's_name', 'b_active', 's_slug') ); }
function __construct() { parent::__construct(); $this->setTableName('t_nc_facebook_user'); $this->setPrimaryKey('fk_i_user_id'); $this->setFields(array('fk_i_user_id', 'facebook_user_id')); }
/** * Set data related to t_country_stats table * * @access public * @since 2.4 */ function __construct() { parent::__construct(); $this->setTableName('t_country_stats'); $this->setPrimaryKey('fk_c_country_code'); $this->setFields(array('fk_c_country_code', 'i_num_items')); }
public function __construct() { parent::__construct(); $this->MAP_ARR = array('id' => 'id', 'name' => 'name', 'group_id' => 'group_id', 'upid' => 'upid', 'describe' => 'describe', 'price' => 'price', 'month_flag' => 'month_flag', 'pause_flag' => 'pause_flag', 'show_price' => 'show_price'); $this->MAP_TYPE = array('id' => FIELD_TYPE_INT | FIELD_TYPE_AUTO, 'group_id' => FIELD_TYPE_INT, 'upid' => FIELD_TYPE_INT, 'price' => FIELD_TYPE_INT, 'month_flag' => FIELD_TYPE_INT, 'pause_flag' => FIELD_TYPE_INT, 'show_price' => FIELD_TYPE_INT); $this->_TABLE = 'mproduct'; }