public function getLanguage() { $this->db = Zend_Db_Table::getDefaultAdapter(); $sql = "SELECT code from ourbank_language where active = 1"; $result = $this->db->fetchOne($sql); return $result; }
public function fillgridAction() { self::createModel(); $request = $this->getRequest(); $valid = $request->getParam('nd'); if ($request->isXmlHttpRequest() and $valid) { $this->grid = $this->_helper->grid(); $this->grid->setGridparam($request); $this->grid->sql = Zend_Db_Table::getDefaultAdapter()->select()->from($this->model->info('name'), array('subject_faculty.subject_code', 'subject_mode_id', 'staff_id', 'subject_department.degree_id', 'department_id', 'department_id', 'subject_department.semester_id'))->joinLeft('subject_department', '(subject_department.subject_code = subject_faculty.subject_code AND subject_department.department_id = subject_faculty.department_id)', array())->where('subject_faculty.department_id = ?', $this->department_id); $searchOn = $request->getParam('_search'); if ($searchOn != 'false') { $sarr = $request->getParams(); foreach ($sarr as $key => $value) { switch ($key) { case 'staff_id': $this->grid->sql->where("{$key} LIKE ?", '%' . $value . '%'); break; case 'subject_code': $this->grid->sql->where("subject_faculty.subject_code LIKE ?", $value . '%'); break; case 'subject_mode': $this->grid->sql->where("subject_faculty.subject_mode_id LIKE ?", $value . '%'); break; case 'semester_id': $this->grid->sql->where("subject_department.semester_id = ?", $value); break; } } } self::fillgridfinal(); } else { echo '<b>Oops!! </b><br/>No use of peeping like that... :)'; } }
public function getTableFields($tableName) { $db = Zend_Db_Table::getDefaultAdapter(); $columns = $db->query("SELECT menufields FROM main_menu WHERE url = '" . $tableName . "'"); $columnData = $columns->fetch(); return $columnData; }
/** * Helper para pegar as imagens do webservice * */ public function GetDadosUsuario() { $auth = Zend_Auth::getInstance(); $db = Zend_Db_Table::getDefaultAdapter(); $chAction = strtolower(Zend_Controller_Front::getInstance()->getRequest()->getActionName()); $chController = Zend_Controller_Front::getInstance()->getRequest()->getControllerName(); $sql = 'select '; $sql .= ' u.*, '; $sql .= ' a.nm_avatar, '; $sql .= ' a.tp_avatar, '; $sql .= ' a.sz_avatar, '; $sql .= ' a.arquivo '; $sql .= 'from '; $sql .= ' sca_usuario u '; $sql .= ' left join sgg_avatar a on a.id_avatar = u.id_avatar '; $sql .= 'where u.st_usuario = 1 '; $sql .= 'and u.id_usuario = ' . $auth->getIdentity()->id_usuario; $result = $db->fetchRow($sql); if ($result) { if ($result['arquivo']) { $result['arquivo'] = "data:" . $result['tp_avatar'] . ";base64," . base64_encode($result['arquivo']); } } return $result; }
/** * Get trip paginator adapter * @param string $filtingField * @param string $filtingCriteria * @param string $sortingField * @return Zend_Paginator_Adapter_DbSelect|Zend_Paginator_Adapter_DbTableSelect */ public function getTripPaginatorAdapter($filtingField, $filtingCriteria, $sortingField) { $db = Zend_Db_Table::getDefaultAdapter(); $select = $db->select()->from(array('t' => 'trip'), array('t.trip_id', 't.departure_time', 't.arrival_time', 'fare'))->joinInner(array('r' => 'route'), 't.route_id = r.route_id', array('r.from_city', 'r.to_city')); if (!empty($filtingField)) { // switch filting field switch ($filtingField) { case 'departure_time': case 'arrival_time': if (!empty($filtingCriteria)) { $dateFormat = new Zend_Date($filtingCriteria, 'dd-MM-y HH:mm:ss'); $filtingCriteria = $dateFormat->toString('y-MM-dd HH:mm:ss'); } break; case 'from_city': case 'to_city': $db = Zend_Db_Table::getDefaultAdapter(); $select = $db->select()->from(array('t' => 'trip'), array('t.trip_id', 't.departure_time', 't.arrival_time', 'fare'))->joinInner(array('r' => 'route'), 't.route_id = r.route_id', array('r.from_city', 'r.to_city')); break; default: break; } // add filting criteria $select->where($filtingField . ' = ?', $filtingCriteria); } // add sorting criteria if (!empty($sortingField)) { $select->order($sortingField); } $adapter = new Zend_Paginator_Adapter_DbSelect($select); return $adapter; }
public function checkduplicaterequestname($servicedeskid, $requestname) { $db = Zend_Db_Table::getDefaultAdapter(); $qry = "select count(*) as count from main_sd_reqtypes sd where sd.service_request_name ='" . $requestname . "' AND sd.service_desk_id='" . $servicedeskid . "' AND sd.isactive=1 "; $res = $db->query($qry)->fetchAll(); return $res; }
protected function _getAuthAdapter() { $dbAdapter = Zend_Db_Table::getDefaultAdapter(); $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter); $authAdapter->setTableName('users')->setIdentityColumn('username')->setCredentialColumn('password')->setCredentialTreatment('SHA1(CONCAT(?,salt))'); return $authAdapter; }
public function loginAction() { $this->_helper->layout->disablelayout(); $authorization = Zend_Auth::getInstance(); $identity = $authorization->getIdentity(); if ($authorization->hasIdentity()) { $this->redirect("categories/list"); } if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getParams(); $db = Zend_Db_Table::getDefaultAdapter(); $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'username', 'password'); $authAdapter->setIdentity($data['username']); $authAdapter->setCredential(md5($data['password'])); $result = $authAdapter->authenticate(); if ($result->isValid()) { $active = (new Application_Model_Users())->getUserByUsername($data['username'])[0]['active']; if ($active) { $auth = Zend_Auth::getInstance(); $storage = $auth->getStorage(); $storage->write($authAdapter->getResultRowObject(array('f_name', 'username', 'id', 'user_type'))); $authorization = Zend_Auth::getInstance(); $identity = $authorization->getIdentity(); $this->view->identity = $identity; $this->redirect('categories/list'); } else { $this->view->user_msg = "The page not allowed for normal user."; $this->redirect("users/login"); } } } $form = new Application_Form_Login(); $this->view->form = $form; }
/** * Gets the adapter for authentication against a database table * * @return object */ protected function getAuthAdapter() { $dbAdapter = Zend_Db_Table::getDefaultAdapter(); $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter); $authAdapter->setTableName('login')->setIdentityColumn('username')->setCredentialColumn('password')->setCredentialTreatment('MD5(?)'); return $authAdapter; }
public function findForSelect() { $adapter = Zend_Db_Table::getDefaultAdapter(); $statement = "SELECT DISTINCT p.* FROM province p INNER JOIN city c ON (p.province_id = c.province_id) WHERE c.status = 'A' ORDER BY name"; $results = $adapter->fetchAll($statement); return $results; }
/** * Get all possible classroom * * @param int $userId * @return array */ public static function getAllByUser($userId) { $session = new Zend_Session_Namespace('data'); $db = Zend_Db_Table::getDefaultAdapter(); $cols = array('cr.*', 'c.*', 'c.id as id', 'cr.id as classroom_id', 'cr.name as classroom_name'); $course = array('c' => 'course'); $classroom = array('cr' => 'classroom'); $classUser = array('cu' => 'classroom_user'); $data = array(); //by course or classroom responsible $select = $db->select()->from($classroom, $cols)->join($course, 'c.id = cr.course_id', array())->where('c.responsible = ? OR cr.responsible = ?', $userId)->where("cr.status = 'active' OR cr.status = 'open'"); $responsibles = $db->fetchAll($select); //by registration $select = $db->select()->from($classroom, $cols)->join($course, 'c.id = cr.course_id', array())->join($classUser, 'cr.id = cu.classroom_id', array())->where('cu.user_id = ?', $userId)->where('cu.status = ?', 'registered')->where('cr.begin <= ?', date('Y-m-d'))->where('cr.end >= ? OR end IS NULL', date('Y-m-d'))->where("cr.status = 'active' OR cr.status = 'open'"); $registries = $db->fetchAll($select); foreach ($responsibles as $responsible) { $data[] = $responsible; $session->classrooms[] = $responsible['classroom_id']; } foreach ($registries as $registry) { if (in_array($registry, $data)) { continue; } $data[] = $registry; $session->classrooms[] = $registry['classroom_id']; } return $data; }
public function loadAppData() { $loggedInUserId = $this->getIdentityId(); $addData = array(); if ($loggedInUserId != null) { $db = Zend_Db_Table::getDefaultAdapter(); $tagGroupsTable = new Default_Dao_TagGroup(); $tagGroupsRows = $tagGroupsTable->fetchAll('valid is true'); foreach ($tagGroupsRows as $tagGroupsRow) { $tagGroup = new Default_Dto_TagGroup(); $tagGroup->id = $tagGroupsRow['id']; $tagGroup->name = $tagGroupsRow['name']; $tagGroup->tags = new Zend_Amf_Value_Messaging_ArrayCollection(); $tagGroup->tags->source = array(); $tagsTable = new Default_Dao_Tag(); $tagsRows = $tagsTable->fetchAll($db->quoteInto('group_id = ?', $tagGroupsRow['id'])); foreach ($tagsRows as $tagsRow) { $tag = new Default_Dto_Tag(); $tag->id = $tagsRow['id']; $tag->name = $tagsRow['name']; array_push($tagGroup->tags->source, $tag); } array_push($addData, $tagGroup); } } $result = new Zend_Amf_Value_Messaging_ArrayCollection(); $result->source = $addData; return $result; }
public function indexAction() { $db = Zend_Db_Table::getDefaultAdapter(); if (isset($_POST['editForm'])) { $first_name = $_POST['editForm']['first_name']; $last_name = $_POST['editForm']['last_name']; $current_city = $_POST['editForm']['current_city']; $person_id = $_POST['editForm']['person_id']; $form = false; } else { $person_id = $this->_request->get('id'); $select = $db->select(); $select->from('contacts')->where('person_id = ?', $person_id); $contacts = $db->fetchAll($select); $first_name = $contacts[0]['first_name']; $last_name = $contacts[0]['last_name']; $current_city = $contacts[0]['current_city']; $form = true; } $this->view->first_name = $first_name; $this->view->last_name = $last_name; $this->view->current_city = $current_city; $this->view->person_id = $person_id; $this->view->form = $form; if (isset($_POST['editForm']) && $first_name && $last_name && $current_city) { $data = array('first_name' => $first_name, 'last_name' => $last_name, 'current_city' => $current_city); $db->update('contacts', $data, array('person_id=?' => $person_id)); $this->renderScript('index/partials/tableRow.phtml'); } if ($this->_request->isXmlHttpRequest()) { $this->view->layout()->setLayout('ajax'); } }
public function populate() { $db = Zend_Db_Table::getDefaultAdapter(); $dbSelect = $db->select()->from(array('arp' => 'aclRolePrivileges'), array('aclRoleId'))->join(array('ap' => 'aclPrivileges'), 'arp.aclPrivilegeId = ap.aclPrivilegeId', array('aclPrivilegeName'))->join(array('ar' => 'aclResources'), 'ap.aclResourceId = ar.aclResourceId', array('aclResourceName'))->join(array('am' => 'aclModules'), 'ar.aclModuleId = am.aclModuleId', array('aclModuleName')); $roles = $db->fetchAll($dbSelect); foreach ($roles as $role) { if (!$this->has($role['aclModuleName'] . '_' . $role['aclResourceName'])) { $this->add(new Zend_Acl_Resource($role['aclModuleName'] . '_' . $role['aclResourceName'])); } if (!$this->hasRole($role['aclRoleId'])) { $this->addRole(new Zend_Acl_Role($role['aclRoleId'])); } } $defaultResources = array('default_error', 'default_login'); // check default resource if exists; add otherwise foreach ($defaultResources as $def) { if (!$this->has($def)) { $this->add(new Zend_Acl_Resource($def)); } } $this->deny(); $this->allow(null, $defaultResources); foreach ($roles as $role) { $this->allow($role['aclRoleId'], $role['aclModuleName'] . '_' . $role['aclResourceName'], $role['aclPrivilegeName']); } }
public function collectionsafterinsert() { $db = Zend_Db_Table::getDefaultAdapter(); $pageId = !empty($_GET['pages_id']) ? $_GET['pages_id'] : 0; if ($_POST) { $id = 0; $files = $_FILES['preview']; // var_dump($files);exit; if (!empty($files)) { // $lastId = $db->lastInsertId('collections'); // if(strpos($_SERVER['REQUEST_URI'], 'edit') !== FALSE){ // $id = $pageId; // } // if(strpos($_SERVER['REQUEST_URI'], 'add') !== FALSE){ // $id = $lastId; // } if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/public/uploadimg')) { mkdir($_SERVER['DOCUMENT_ROOT'] . '/public/uploadimg'); } // var_dump($img);exit; if ($_FILES['preview']['name'] != '') { $db->update('collections', array('img' => $files['name']), 'id=' . $pageId); move_uploaded_file($files['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/public/uploadimg/' . $files['name']); } } } if ($pageId != 0) { $sql = $db->select()->from(array('fc' => 'film_collection'))->join(array('f' => 'films'), 'f.id = fc.film_id', array('f.name'))->where('fc.collection_id =?', $pageId); $films = $db->query($sql)->fetchAll(); $this->view->films = $films; return $films; } }
public function empcompetencylevels($userId) { $db = Zend_Db_Table::getDefaultAdapter(); $Data = $db->query("select c.id,c.competencylevel\n\t\t\t\t\t\t\t\tfrom main_competencylevel as c\n\t\t\t\t\t\t\t\twhere c.isactive=1 "); $data = $Data->fetchAll(); return $data; }
public function __construct($invoice) { // ToDo: Pass configuration options $this->_db = Zend_Db_Table::getDefaultAdapter(); $this->_id = $invoice; $this->_initData(); }
public function init() { $this->setAttrib('class', 'form-horizontal'); $login = new Zend_Form_Element_Text('login'); $login->setRequired()->addValidator('StringLength', false, array('max' => 32))->setLabel('Nom d\'utilisateur'); $db = Zend_Db_Table::getDefaultAdapter(); $validator = new Zend_Validate_Db_NoRecordExists(array('adapter' => $db, 'schema' => 'twitter', 'table' => 'membre', 'field' => 'login')); $validator->setMessage("Le login '%value%' est déjà utilisé"); $login->addValidator($validator); $pass = new Zend_Form_Element_Password('pass'); $pass->setLabel('Mot de passe')->setRequired(); $passConfirm = new Zend_Form_Element_Password('confirm'); $passConfirm->setLabel('Confirmer le mot de passe'); $validator = new Zend_Validate_Identical('pass'); $validator->setMessage('La confirmation ne correspond pas au mot de passe'); $passConfirm->addValidator($validator); //$passConfirm->addValidator('Identical', false, array('token')); $hash = new Zend_Form_Element_Hash('hash'); $submit = new Zend_Form_Element_Submit('Inscription'); $cancel = new Zend_Form_Element_Button('Annuler'); $this->addElements(array($login, $pass, $passConfirm, $hash, $submit, $cancel)); // add display group $this->addDisplayGroup(array('login', 'pass', 'confirm', 'Inscription', 'Annuler'), 'users'); $this->getDisplayGroup('users')->setLegend('S\'inscrire'); // set decorators EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP, 'Inscription', 'Annuler'); }
public static function login($login, $senha) { $dbAdapter = Zend_Db_Table::getDefaultAdapter(); //Inicia o adaptador Zend_Auth para banco de dados $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter); $authAdapter->setTableName('users')->setIdentityColumn('login')->setCredentialColumn('password')->setCredentialTreatment('SHA1(?)'); //Define os dados para processar o login $authAdapter->setIdentity($login)->setCredential($senha); //Faz inner join dos dados do perfil no SELECT do Auth_Adapter $select = $authAdapter->getDbSelect(); $select->join('roles', 'roles.id_role = users.id_role', array('role_roles' => 'role', 'id_role')); //Efetua o login $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($authAdapter); //Verifica se o login foi efetuado com sucesso if ($result->isValid()) { //Recupera o objeto do usuário, sem a senha $info = $authAdapter->getResultRowObject(null, 'password'); $usuario = new Application_Model_Users(); $usuario->setFullName($info->nome); $usuario->setUserName($info->login); $usuario->setRoleId($info->role_roles); $usuario->setRoleCod($info->id_role); $storage = $auth->getStorage(); $storage->write($usuario); return true; } throw new Exception('Nome de usuário ou senha inválida'); }
protected function _getAuthAdapter() { $dbAdapter = Zend_Db_Table::getDefaultAdapter(); $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter); $authAdapter->setTableName('school_staff')->setIdentityColumn('email')->setCredentialColumn('password')->setCredentialTreatment('md5(?)'); return $authAdapter; }
public function indexAction() { $form = new Application_Form_Login(); $request = $this->getRequest(); if ($request->isPost()) { // if ($form->isValid($this->_getAllParams())) if ($form->isValid($request->getPost())) { $dbAdapter = Zend_Db_Table::getDefaultAdapter(); $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter); $authAdapter->setTableName('smo_usuario')->setIdentityColumn('usu_rut')->setCredentialColumn('usu_passwd')->setCredentialTreatment('md5(CONCAT(?,usu_passwd_salt))'); $authAdapter->setIdentity($form->getValue('rut'))->setCredential($form->getValue('pass')); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($authAdapter); if ($result->isValid()) { // get all info about this user from the login table // ommit only the password, we don't need that $userInfo = $authAdapter->getResultRowObject(null, 'password'); // the default storage is a session with namespace Zend_Auth $authStorage = $auth->getStorage(); $authStorage->write($userInfo); return $this->_helper->redirector->gotoSimple('index', 'index'); //$this->_redirect('view/index/index'); } else { $errorMessage = "Datos Incorrectos, intente de nuevo."; } } } $this->view->form = $form; $this->view->errorMessage = $errorMessage; }
public function __construct($node) { $time_start = microtime(true); $this->view = new Zend_View(); $this->view->setScriptPath(dirname(__FILE__)); $folderGuid = $node ? $node : 'root'; $this->view->addHelperPath(KUTU_ROOT_DIR . '/mix_lib/Kutu/View/Helper', 'Kutu_View_Helper'); if ($folderGuid == 'root') { $a = array(); $a['totalCount'] = 0; $a['folderGuid'] = $folderGuid; $limit = 10; $a['limit'] = $limit; } else { $a = array(); $a['folderGuid'] = $folderGuid; $db = Zend_Db_Table::getDefaultAdapter()->query("SELECT guid from KutuUser"); //("SELECT guid from KutuCatalog, KutuCatalogFolder where guid=catalogGuid AND folderGuid='$folderGuid'"); $rowset = $db->fetchAll(Zend_Db::FETCH_OBJ); $a['totalCount'] = count($rowset); $limit = 10; $a['limit'] = $limit; } $this->view->aData = $a; $time_end = microtime(true); $time = $time_end - $time_start; //echo'<br>WAKTU EKSEKUSI: '. $time; }
public function getQuatre($last) { //retourne la suite des photos en appel ajax $db = Zend_Db_Table::getDefaultAdapter(); $requete = 'SELECT * FROM photo WHERE idPhoto < ' . $last . ' ORDER BY idPhoto DESC LIMIT 0,4'; return $db->query($requete)->fetchAll(); }
/** * @param mixed $value * @return booleans */ public function isValid($value) { $db = Zend_Db_Table::getDefaultAdapter(); $sql = 'SELECT m.id FROM meeting m LEFT JOIN event e ON (m.id_event = e.id) WHERE m.ghost = false AND (e.latest = true OR (e.latest IS NULL AND m.id_meeting_type = 6)) AND m.id_meeting_type IN (3,4,6) AND ( (' . $db->quoteInto('m.meeting_at >= ?', $this->_objectEventAt->getValue()) . ' AND ' . $db->quoteInto('m.meeting_at + (m.length * interval \'1 minute\') <= timestamp ? + interval \'' . $this->_objectLength->getValue() . ' minutes\'', $this->_objectEventAt->getValue()) . ') OR (' . $db->quoteInto('m.meeting_at <= ?', $this->_objectEventAt->getValue()) . ' AND ' . $db->quoteInto('m.meeting_at >= timestamp ?', $this->_objectEventAt->getValue()) . ') OR (' . $db->quoteInto('m.meeting_at <= ?', $this->_objectEventAt->getValue()) . ' AND ' . $db->quoteInto('m.meeting_at + (m.length * interval \'1 minute\') >= timestamp ? + interval \'' . $this->_objectLength->getValue() . ' minutes\'', $this->_objectEventAt->getValue()) . ') OR (' . $db->quoteInto('m.meeting_at < timestamp ? + interval \'' . $this->_objectLength->getValue() . ' minutes\'', $this->_objectEventAt->getValue()) . ' AND ' . $db->quoteInto('m.meeting_at + (m.length * interval \'1 minute\') >= timestamp ? + interval \'' . $this->_objectLength->getValue() . ' minutes\'', $this->_objectEventAt->getValue()) . ') ) AND ' . $db->quoteInto('m.id_user = ?', Zend_Auth::getInstance()->getIdentity()->id) . ' AND ' . $db->quoteInto('m.id_branch = ?', Zend_Auth::getInstance()->getIdentity()->id_branch); if ($this->_nextEvent !== false) { $sql .= ' AND ' . $db->quoteInto('m.id_event <> ?', $this->_nextEvent); } $rows = $db->query($sql); if ($rows->rowCount() > 0) { $this->_error(self::VISIT_EXISTS); return false; } else { return true; } }
public function checkDuplicateQuestionName($categoryId, $question) { $db = Zend_Db_Table::getDefaultAdapter(); $qry = "select count(*) as count from main_pa_questions aq where aq.pa_category_id =" . $categoryId . " AND aq.question='" . $question . "' AND aq.isactive=1 "; $res = $db->query($qry)->fetchAll(); return $res; }
public function insertGroup($param) { $dbAdapter = Zend_Db_Table::getDefaultAdapter(); $dbAdapter->insert('AGroup', array('name' => $param)); $insertid = $dbAdapter->lastInsertId(); return $insertid; }
public function fillgridAction() { $request = $this->getRequest(); $valid = $request->getParam('nd'); if ($valid) { $this->grid = $this->_helper->grid(); $this->grid->sql = Zend_Db_Table::getDefaultAdapter()->select()->from('opac_issue_return', array('acc_no', 'member_id', 'title', 'author', 'edition', 'issue_date', 'return_date', 'isbn_id', 'status', 'issued_by', 'accepted_by')); $searchOn = $request->getParam('_search'); if ($searchOn != 'false') { $sarr = $request->getParams(); foreach ($sarr as $key => $value) { switch ($key) { case 'isbn_id': case 'acc_no': case 'edition': case 'status': case 'member_id': case 'issued_by': case 'accepted_by': $this->grid->sql->where("{$key} = ?", $value); break; case 'title': case 'author': case 'issue_date': case 'return_date': $this->grid->sql->where("{$key} LIKE ?", '%' . $value . '%'); break; } } } self::fillgridfinal(); } else { echo '<b>Oops!! </b><br/>No use of peeping like that.. :)'; } }
public function getempmedicalclaimtypes($userId) { $db = Zend_Db_Table::getDefaultAdapter(); $Data = $db->query('select if(injury_type = 1, "paternity",if(injury_type = 2 , "maternity",if (injury_type = 3,"disability","injury"))) as injuryType from main_empmedicalclaims where isactive =1 and user_id =' . $userId); $data = $Data->fetchAll(); return $data; }
protected function initLog() { $db = Zend_Db_Table::getDefaultAdapter(); $columns = $this->parseColumns(); $writer = new Zend_Log_Writer_Db($db, 'historico', $columns); $this->setLogger(new Zend_Log($writer)); }
/** * Executes a SQL query * * @param string $sqlString SQL query * @return bool */ public static function executeSQLCode($sqlString) { $result = true; $lines = explode(chr(10), $sqlString); foreach ($lines as $key => $line) { if (substr(ltrim($line), 0, 2) == '--' || ltrim($line) == '') { unset($lines[$key]); } } //$sqlString = implode(chr(10), $lines); if (strpos($sqlString, chr(13)) > 0) { $sqlQueries = explode(";" . chr(13), $sqlString); } else { $sqlQueries = explode(";" . chr(10), $sqlString); } if (count($sqlQueries) > 0) { $db = Zend_Db_Table::getDefaultAdapter(); foreach ($sqlQueries as $sql) { $sql = trim($sql); if ($sql !== "") { $sqlResult = $db->query($sql); $result = $result && $sqlResult; } } } return $result; }