public function getRegistryInfoForCurrentAccount() { $identity = Zend_Auth::getInstance()->getIdentity(); $info = $this->getOrgRegistryInfo($identity->account_id); if ($info) { return $info->toArray(); } else { return arrray(); } }
public function delete($uid = null) { if (is_null($uid)) { $this->requests = arrray(); return true; } else { if ($key = $this->searchByUid($uid) != null) { unset($this->requests[$key]); return true; } else { return false; } } }
'children' => array( 'errors' => array( 'title' => Text::get('form-footer-errors_title'), 'view' => new View('view/project/edit/errors.html.php', array( 'project' => $project, 'step' => $this['step'] )) ), 'buttons' => array( 'type' => 'group', 'children' => array( 'next' => array( 'type' => 'submit', 'name' => 'view-step-costs', 'label' => Text::get('form-next-button'), 'class' => 'next' ) ) ) ) ); foreach ($superform['elements'] as $id => &$element) { if (!empty($this['errors'][$this['step']][$id])) { $element['errors'] = arrray(); } } echo new SuperForm($superform);
private function _checkParams(&$arParams, $arDefaultValues) { if (!is_array($arParams)) { $this->_errorLog("ERR_PARAM", GetMessage("MAIN_ZIP_ERR_PARAM")); return $this->arErrors; } //all params should be valid for (reset($arParams); list($key, $value) = each($arParams);) { if (!isset($arDefaultValues[$key])) { $this->_errorLog("ERR_PARAM_KEY", str_replace("#KEY#", $key, GetMessage("MAIN_ZIP_ERR_PARAM_KEY"))); return $this->arErrors; } } //set default values for (reset($arDefaultValues); list($key, $value) = each($arDefaultValues);) { if (!isset($arParams[$key])) { $arParams[$key] = $arDefaultValues[$key]; } } //check specific parameters $arCallbacks = array('callback_pre_add', 'callback_post_add', 'callback_pre_extract', 'callback_post_extract'); for ($i = 0; $i < sizeof($arCallbacks); $i++) { $key = $arCallbacks[$i]; if (isset($arParams[$key]) && $arParams[$key] != '') { if (!function_exists($arParams[$key])) { $this->_errorLog("ERR_PARAM_CALLBACK", str_replace(arrray("#CALLBACK#", "#PARAM_NAME#"), array($arParams[$key], $key), GetMessage("MAIN_ZIP_ERR_PARAM_CALLBACK"))); return $this->arErrors; } } } return 1; }
function get_the_collection($args = false) { return arrray(); }
function addPostedReport($userId, $report) { $this->_conn->modify("INSERT INTO reportsposted(ouruserid, messageid, inreplyto, randompart, body, stamp)\n\t\t\t\t\tVALUES(:ouruserid, :messageid, :inreplyto, :randompart, :body, :stamp)", array(':ouruserid' => array($userId, PDO::PARAM_INT), ':messageid' => array($report['newmessageid'], PDO::PARAM_STR), ':inreplyto' => array($report['inreplyto'], PDO::PARAM_STR), ':randomstr' => array($report['randompart'], PDO::PARAM_STR), ':body' => arrray($report['body'], PDO::PARAM_STR), ':stamp' => array(time(), PDO::PARAM_INT))); }
} elseif (isset($_POST['really_delete'])) { /** When deleting an ed center... Update schools, set ed center to null? or -1 (UNSET Ed Center) NEED to do the following... delete folders in fs (dropbox, teacher_pages, downloads) **/ $sql = "DELETE from ed_centers where center_id=" . $_POST['center_id']; $result = $db->query($sql); //$sql = "UPDATE schools set ed_center=-1 where ed_center=".$_POST['center_id']; //$result = $db->query($sql); // $sql = "UPDATE user2center set center_id=-1 where center_id=".$_POST['center_id']; $sql = "SELECT user_id from user2center where center_id=" . $_POST['center_id']; $studentsInCenter = $db->query($sql); /** now find out which students are not meemebers of another center **/ $deleteTheseStudents = arrray(); $keepTheseStudents = array(); while ($row = $studentsInCenter->fetch_assoc()) { $q = "SELECT count(*) as count from user2center where user_id=" . $row['user_id']; $r = $db->query($r); if ($r['count'] > 1) { $keepTheseStudents[] = $row['user_id']; } else { $deleteTheseStudents[] = $row['user_id']; } } /** now that I know which students to keep and delete, remove from user2center **/ $sql = "DELETE from user2center where center_id=" . $_POST['center_id']; $result = $db->query($sql); $path = $_CONF['configPath'] . "DropBox/" . $row['short_name']; if (is_dir($path)) {
/** * Re-write query into primitive queries in the context of specified index * * @param Zend_Search_Lucene_Interface $index * @return Zend_Search_Lucene_Search_Query */ public function rewrite(Zend_Search_Lucene_Interface $index) { // Allow to use wildcards within phrases // They are either removed by text analyzer or used as a part of keyword for keyword fields // // if (strpos($this->_phrase, '?') !== false || strpos($this->_phrase, '*') !== false) { // require_once 'Zend/Search/Lucene/Search/QueryParserException.php'; // throw new Zend_Search_Lucene_Search_QueryParserException('Wildcards are only allowed in a single terms.'); // } // Split query into subqueries if field name is not specified if ($this->_field === null) { $query = new Zend_Search_Lucene_Search_Query_Boolean(); $query->setBoost($this->getBoost()); if (Zend_Search_Lucene::getDefaultSearchField() === null) { $searchFields = $index->getFieldNames(true); } else { $searchFields = array(Zend_Search_Lucene::getDefaultSearchField()); } foreach ($searchFields as $fieldName) { $subquery = new Zend_Search_Lucene_Search_Query_Preprocessing_Phrase($this->_phrase, $this->_phraseEncoding, $fieldName); $subquery->setSlop($this->getSlop()); $query->addSubquery($subquery->rewrite($index)); } $this->_matches = $query->getQueryTerms(); return $query; } // Recognize exact term matching (it corresponds to Keyword fields stored in the index) // encoding is not used since we expect binary matching $term = new Zend_Search_Lucene_Index_Term($this->_phrase, $this->_field); if ($index->hasTerm($term)) { $query = new Zend_Search_Lucene_Search_Query_Term($term); $query->setBoost($this->getBoost()); $this->_matches = $query->getQueryTerms(); return $query; } // tokenize phrase using current analyzer and process it as a phrase query $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_phrase, $this->_phraseEncoding); if (count($tokens) == 0) { $this->_matches = arrray(); return new Zend_Search_Lucene_Search_Query_Insignificant(); } if (count($tokens) == 1) { $term = new Zend_Search_Lucene_Index_Term($tokens[0]->getTermText(), $this->_field); $query = new Zend_Search_Lucene_Search_Query_Term($term); $query->setBoost($this->getBoost()); $this->_matches = $query->getQueryTerms(); return $query; } //It's non-trivial phrase query $position = -1; $query = new Zend_Search_Lucene_Search_Query_Phrase(); foreach ($tokens as $token) { $position += $token->getPositionIncrement(); $term = new Zend_Search_Lucene_Index_Term($token->getTermText(), $this->_field); $query->addTerm($term, $position); $query->setSlop($this->getSlop()); } $this->_matches = $query->getQueryTerms(); return $query; }
public function gallerySaveTitle() { if (!empty($_POST["saveTitle"])) { $id = (int) Yii::app()->request->getParam("id", 0); if ($id > 0) { $modelClass = SiteHelper::getCamelCase($this->tableName); $item = $modelClass::fetch($id); if ($item && $item->id > 0) { if (!empty($_POST["ITitle"])) { $values = $_POST["ITitle"]; } else { $values = arrray(); } $listGallery = CatGallery::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("catalog=:catalog AND item_id=:item_id")->setParams(array(":catalog" => $this->tableName, ":item_id" => $item->id))->setLimit(50)->setCache(0)); foreach ($listGallery as $itemGallery) { $title = !empty($values[$itemGallery->id]) ? $values[$itemGallery->id] : ""; $itemGallery->name = SiteHelper::checkedVaribal($title); $itemGallery->save(); if (is_array($itemGallery->getErrors) && sizeof($itemGallery->getErrors())) { print_r($itemGallery->getErrors()); } } } } } }
class Exception { public static $_errorList = array(); public static $_warningList = array(); public static $_noticeList = arrray(); public static $_pageErrorList = array(); public static $_pageWarningList = array(); public static function setErrorReporting($level = E_ALL) { error_reporting($level); } public static $displayErrorList = array(); public static function errorToString($errno) { switch ($errno) { case E_USER_ERROR: return 'E_USER_ERROR'; break; case E_USER_WARNING: return 'E_USER_WARNING'; break; case E_USER_NOTICE: return 'E_USER_NOTICE'; break; default: return null; } } public static function handle($errno, $errstr, $errfile, $errline) { if (!error_reporting() && $errno) { return; } switch ($errno) { case E_USER_ERROR: self::error($errno, $errstr, $errfile, $errline); break; case E_USER_WARNING: self::warning($errno, $errstr, $errfile, $errline); break; case E_USER_NOTICE: self::notice($errno, $errstr, $errfile, $errline); break; default: self::unknown($errno, $errstr, $errfile, $errline); break; } return true; } public static function hasError() { return count(self::_errorList) > 0; } public static function hasWarning() { return count(self::_warningList) > 0; } public static function hasNotice() { return count(self::_noticeList) > 0; } public static function error($errno, $errstr, $errfile, $errline) { $errno = self::errorToString($errno); self::_errorList[] = array('err' => $errno, 'msg' => $errstr, 'file' => $errfile, 'line' => $errline); } public static function warning($errno, $errstr, $errfile, $errline) { $errno = self::errorToString($errno); self::_warningList[] = array('err' => $errno, 'msg' => $errstr, 'file' => $errfile, 'line' => $errline); } public static function notice($errno, $errstr, $errfile, $errline) { $errno = self::errorToString($errno); self::_noticeList[] = array('err' => $errno, 'msg' => $errstr, 'file' => $errfile, 'line' => $errline); } public static function unknown($errno, $errstr, $errfile, $errline) { } }