/** * Function to connect to Exact, this creates the client and automatically retrieves oAuth tokens if needed * * @return \Picqer\Financials\Exact\Connection * @throws Exception */ function connect() { $connection = new \Picqer\Financials\Exact\Connection(); $connection->setRedirectUrl('__REDIRECT_URL__'); $connection->setExactClientId('__CLIENT_ID__'); $connection->setExactClientSecret('__CLIENT_SECRET__'); // Retrieves authorizationcode from database if (getValue('authorizationcode')) { $connection->setAuthorizationCode(getValue('authorizationcode')); } // Retrieves accesstoken from database if (getValue('accesstoken')) { $connection->setAccessToken(getValue('accesstoken')); } // Retrieves refreshtoken from database if (getValue('refreshtoken')) { $connection->setRefreshToken(getValue('refreshtoken')); } // Retrieves expires timestamp from database if (getValue('expires_in')) { $connection->setTokenExpires(getValue('expires_in')); } // Set callback to save newly generated tokens $connection->setTokenUpdateCallback('tokenUpdateCallback'); // Make the client connect and exchange tokens try { $connection->connect(); } catch (\Exception $e) { throw new Exception('Could not connect to Exact: ' . $e->getMessage()); } return $connection; }
public function doMoveThis() { $plateau = $this; $from = getValue('case_from', null); $to = getValue('case_to', null); $tours = Tours::createFrom(partie()->getData()->tours); $regles = $this->regles; return self::doMove($plateau, $from, $to, $tours, $regles); }
public function Schalten($value) { $proto = $this->ReadPropertyString("protokoll"); $idValue = IPS_GetVariableIDByName("Status", $this->InstanceID); $value = getValue($idValue); $cmd = "/usr/local/bin/pilight-send -p {$proto}"; // $idID=IPS_GetCategoryIDByName("ID",$inst); // $idsId=IPS_GetChildrenIDs($idID); // foreach($idsId as $ix=>$id) { // $name=IPS_GetName($id); // $parm=getValue($id); // $cmd.=" --$name=$parm"; // } $val = $this->ReadPropertyInteger("programcode"); $cmd .= " --programcode={$val}"; $val = $this->ReadPropertyInteger("systemcode"); $cmd .= " --systemcode={$val}"; if ($value) { $value = "-t"; } else { $value = "-f"; } $cmd .= " {$value}"; // pilight-send -p kaku_switch -i 1 -u 1 -t print_r("befehl=" . $cmd . "\n"); //$rc = trim(@shell_exec("/usr/local/bin/pilight-send -p $proto -i $id -u $unit $value")); $retries = $this->ReadPropertyInteger("retries"); for ($i = 1; $i <= $retries; $i++) { $rc = trim(@shell_exec($cmd)); } }
function changePassword() { $array_return = array(); $admin_id = getValue('adm_id', 'int', 'POST', 0); $pass_old = getValue('pass_old', 'str', 'POST', ''); $pass_new = getValue('pass_new', 'str', 'POST', ''); $repass_new = getValue('repass_new', 'str', 'POST', ''); if (!$pass_old) { $array_return = array('error' => 'Bạn chưa điền mật khẩu cũ'); die(json_encode($array_return)); } if (!$pass_new || !$repass_new || $repass_new != $pass_new) { $array_return = array('error' => 'Mật khẩu mới không hợp lệ'); die(json_encode($array_return)); } $db_admin_pas = new db_query('SELECT adm_password FROM admin_users WHERE adm_id = ' . $admin_id . ''); $row_admin_pas = mysqli_fetch_assoc($db_admin_pas->result); unset($db_admin_pas); if ($row_admin_pas['adm_password'] != md5($pass_old)) { $array_return = array('error' => 'Mật khẩu cũ không đúng'); die(json_encode($array_return)); } else { $db_update_pass = new db_execute('UPDATE admin_users SET adm_password = "******" WHERE adm_id = ' . $admin_id . ''); if ($db_update_pass->total) { $array_return = array('success' => 1, 'msg' => 'Đổi mật khẩu thành công'); die(json_encode($array_return)); } else { $array_return = array('error' => 'Đổi mật khẩu thành công'); die(json_encode($array_return)); } } }
function update_component() { $comp = GetAllSelect('payroll_component', 'id')->result(); foreach ($comp as $c) { $data = array('session_id' => $this->new_session, 'payroll_component_id' => $c->id); $filter = array('session_id' => 'where/' . $this->new_session, 'payroll_component_id' => 'where/' . $c->id); $num_rows = GetAllSelect('payroll_component_session', 'id', $filter)->num_rows(); if ($num_rows > 0) { $this->db->where('session_id', $this->new_session)->where('payroll_component_id', $c->id)->update('payroll_component_session', $data); } else { $this->db->insert('payroll_component_session', $data); } $filter2 = array('session_id' => 'where/' . $this->old_session, 'payroll_component_id' => 'where/' . $c->id); $comp_sess_before = getValue('id', 'payroll_component_session', $filter2); print_ag($comp_sess_before); $comp_value = getAll('payroll_component_value', array('payroll_component_session_id' => 'where/' . $comp_sess_before))->row(); print_ag($comp_value); $comp_sess_new = getValue('id', 'payroll_component_session', $filter); $num_rows_new = GetAllSelect('payroll_component_value', 'id', array('payroll_component_session_id' => 'where/' . $comp_sess_new))->num_rows(); if (!empty($comp_value)) { $data2 = array('payroll_component_session_id' => $comp_sess_new, 'from' => $comp_value->from, 'to' => $comp_value->to, 'formula' => $comp_value->formula, 'is_condition' => $comp_value->is_condition, 'min' => $comp_value->min, 'max' => $comp_value->max, 'created_by' => sessId(), 'created_on' => dateNow()); if ($num_rows_new > 0) { $this->db->where('payroll_component_session_id', $comp_sess_new)->update('payroll_component_value', $data2); } else { $this->db->insert('payroll_component_value', $data2); } } print_ag($this->db->last_query()); } }
function sortValues() { // handle command... $response = getValue("value"); sort($response); return $response; }
function GetOptDoc($group_id, $tabel = 'report', $judul = '-Laporan-', $filter = NULL, $field = NULL, $id = NULL, $field2 = NULL, $filter_where_in = NULL) { $CI =& get_instance(); $user_id = $CI->session->userdata('user_id'); if ($filter == NULL) { $filter = array(); } if ($filter_where_in == NULL) { $filter_where_in = array(); } if ($field == NULL) { $field = 'title'; } if ($id == NULL) { $id = 'id'; } $q = $CI->db->query("SELECT a.id id, a.title_document title_document FROM report a LEFT JOIN report_permission b ON b.menu_id=a.id AND b.user_id = '{$user_id}' WHERE b.view='1' AND a.statusisasi='1' ORDER BY a.title_document ASC"); if ($judul) { $opt[''] = $judul; } foreach ($q->result_array() as $r) { $in_group_id = getValue('group_id', 'report', array('id' => 'where/1')); // die($r['id']); $in_group_id = explode(',', $in_group_id); if (in_array($group_id, $in_group_id)) { die($group_id); } $opt[$r[$id]] = $r['title_document']; } return $opt; }
public function GetNextID($serviceName) { $returnArray = array(); $responseArray = array(); $nextID = 0; $selectQuery = "select id from idinfo where servicename = :servicename;"; $parameters = array(':servicename' => trim($serviceName)); $stmt = runQuery(DB_SERVER, DB_PORT, DB_USERNAME, DB_USERPASSWORD, DB_NAME, $selectQuery, $parameters); if ($stmt == QUERY_FAILED) { return FAILED; } $row = fetchNextRow($stmt['statement']); if ($row != null) { try { $nextID = getValue($row, "id"); $nextID = $nextID + 1; } catch (Exception $e) { error_log('Database Error: ' . $e->getMessage()); return FAILED; } } $updateQuery = "UPDATE idinfo SET id = :id WHERE servicename = :servicename;"; $parameters = array(':id' => $nextID, ':servicename' => trim($serviceName)); $stmt = runQuery(DB_SERVER, DB_PORT, DB_USERNAME, DB_USERPASSWORD, DB_NAME, $updateQuery, $parameters); if ($stmt == QUERY_FAILED) { error_log('Database Error: ' . $e->getMessage()); return FAILED; } return $nextID; }
public function ajax_kik() { $this->loadData(); list($nb_red, $nb_blue) = self::compterSignes($this->grille); $x = intval(getValue('x')); $y = intval(getValue('y')); $charat = $y * 3 + $x; if ($this->grille[$charat] == 0 && $nb_red - $nb_blue + 1 == intval(slot()->position)) { $this->grille[$charat] = intval(slot()->position); $this->saveData(); } $winner = self::checkTicTacToe($this->grille); switch ($winner['etat']) { case 0: return $this->ajax_update(); case 1: case 2: $slots = partie()->getSlots(); $slots[$winner['etat'] - 1]->addScore(1, true); $r = $this->terminer(); $r->highlight = $winner['highlight']; $r->grid = $this->grille; return $r; case 3: $slots = partie()->getSlots(); $r = $this->terminer(); $r->highlight = $winner['highlight']; $r->grid = $this->grille; return $r; default: throw new Exception('grille de Tic Tac Toe impossible : ' . $winner); } }
function printOrder() { $desk_id = getValue('desk_id', 'int', 'POST', 0); check_desk_exist($desk_id); $list_menu = getValue('list_menu', 'arr', 'POST', array()); //cập nhật số lượng thực đơn đã in bếp vào trường cdm_printed_number $array_menu_success = array(); foreach ($list_menu as $menu) { $sql = 'UPDATE current_desk_menu SET cdm_printed_number = cdm_printed_number + ' . $menu['print_number'] . ' WHERE cdm_menu_id = ' . $menu['men_id'] . ' AND cdm_desk_id = ' . $desk_id; $db_update = new db_execute($sql); if ($db_update->total) { $array_menu_success[] = $menu; } } if (!$array_menu_success) { return; } else { $array_return = array('success' => 1, 'list_menu' => $array_menu_success); } //log action log_action(ACTION_LOG_PRINT_ORDER, 'In chế biến xuống bếp - bàn ID ' . $desk_id); die(json_encode($array_return)); }
function parse($xml) { $this->name = getValue($xml, 'name'); $this->category = getValue($xml, 'category'); $this->subcategory = getValue($xml, 'subcategory'); $this->usage = getValue($xml, 'usage'); $this->returns = getValue($xml, 'returns'); $this->related = getValue($xml, 'related'); $this->related = preg_split("/\n/", $this->related, -1, PREG_SPLIT_NO_EMPTY); $this->availability = getValue($xml, 'availability'); $this->partof = getValue($xml, 'partof'); $this->level = getValue($xml, 'level'); $this->type = getValue($xml, 'type'); $this->hasParameter = getValue($xml, 'label'); // Added for 149 $this->hasCode = getValue($xml, 'code'); // Added for 149 $this->description = innerHTML($xml, 'description'); $this->syntax = innerHTML($xml, 'syntax'); $this->constructor = innerHTML($xml, 'constructor'); $this->examples = getFragmentsAsArray($xml, 'example', array('image', 'code')); $this->fields = getFragmentsAsArray($xml, 'field', array('fname', 'fdescription')); $this->methods = getFragmentsAsArray($xml, 'method', array('mname', 'mdescription')); $this->parameters = getFragmentsAsArray($xml, 'parameter', array('label', 'description')); $this->cparameters = getFragmentsAsArray($xml, 'cparameter', array('clabel', 'cdescription')); }
function DisplayComments($input) { global $wgUser, $wgTitle, $wgOut, $wgVoteDirectory; $wgOut->addScript("<script type=\"text/javascript\" src=\"extensions/Comments/Comment.js\"></script>\n"); require_once 'CommentClass.php'; require_once "{$wgVoteDirectory}/VoteClass.php"; getValue($scorecard, $input, "Scorecard"); getValue($allow, $input, "Allow"); getValue($voting, $input, "Voting"); getValue($title, $input, "title"); getValue($userRating, $input, "userrating"); $Comment = new Comment($wgTitle->mArticleID); $Comment->setUser($wgUser->mName, $wgUser->mId); $Comment->setAllow($allow); $Comment->setVoting($voting); $Comment->setTitle($title); $Comment->setBool("ShowScorecard", $scorecard); $Comment->setBool("ShowUserRating", $userRating); if ($_POST['commentid']) { $Comment->setCommentID($_POST['commentid']); $Comment->delete(); } $output = $Comment->displayOrderForm(); if ($Comment->ShowScoreCard == 1) { $output .= "<div id=\"scorecard\"></div>"; } $output .= "<div id=\"allcomments\">" . $Comment->display() . "</div>"; $output .= $Comment->diplayForm(); if ($Comment->ShowScoreCard == 1) { $output .= $Comment->displayCommentScorecard($scorecard); } return $output; }
function getBlockingList($sId, $bBlocking) { $sSelectField = $bBlocking ? "ID" : "Profile"; $sWhereField = $bBlocking ? "Profile" : "ID"; $sType = getValue("SELECT `Type` FROM `" . MODULE_DB_PREFIX . "Profiles` WHERE `ID`='" . $sId . "' LIMIT 1"); if (empty($sType)) { $sType = CHAT_TYPE_FULL; } $aAllTypes = array(CHAT_TYPE_FULL, CHAT_TYPE_MODER, CHAT_TYPE_ADMIN); $iTypeIndex = array_search($sType, $aAllTypes); if ($bBlocking) { array_splice($aAllTypes, 0, $iTypeIndex); } else { array_splice($aAllTypes, $iTypeIndex + 1, count($aAllTypes) - $iTypeIndex - 1); } $sTypes = count($aAllTypes) > 0 ? " AND `profiles`.`Type` IN ('" . implode("','", $aAllTypes) . "')" : ""; $rResult = getResult("SELECT `blocked`.`" . $sSelectField . "` AS `Member` FROM `sys_block_list` AS `blocked` LEFT JOIN `" . MODULE_DB_PREFIX . "Profiles` AS `profiles` ON `blocked`.`" . $sSelectField . "`=`profiles`.`ID` WHERE `blocked`.`" . $sWhereField . "`='" . $sId . "'" . $sTypes); $aUsers = array(); $iCount = $rResult->rowCount(); for ($i = 0; $i < $iCount; $i++) { $aBlocked = $rResult->fetch(); $aUsers[] = $aBlocked["Member"]; } return $aUsers; }
public function getGpsByIP($ip = null, $type = 'CITY', $cacheMinutes = null) { if ($type == 'COUNTRY') { throw new InvalidArgumentException("Ilegal use of \$type variable. If you want to get country gps use getCountryGpsByIP method."); } $gpsToReturn = null; $location = $this->geoIP->getLocation($ip); if (empty($location)) { return false; } $type_id = $this->gps->getTypeId($type); $myGpses = $this->gps->getNodesByName(mysql_real_escape_string($location->city), $type_id, false, $cacheMinutes); if (count($myGpses) > 1) { // More than one node with same name // Check country foreach ($myGpses as $myGps) { $country = $this->gps->getParentByType($myGps['id'], $this->gps->getTypeId('COUNTRY')); if ($country['id'] == getValue($this->gps->getCountryByCode($location->country), 'gps_id')) { $gpsToReturn = $myGps; break; } } } elseif (count($myGpses) == 1) { // Only one city in gps databse $gpsToReturn = $myGpses[0]; } else { // No node with this name. // Take closest by latitude and longitude node. $gpsToReturn = $this->gps->getClosestNode($location->latitude, $location->longitude, $type_id); } return $gpsToReturn; }
public function message_clicked() { permissionUser(); $id = $this->input->post('id'); $f_name = getValue('sender_id', 'chat', array('id' => 'where/' . $id)); $this->db->where('sender_id', $f_name)->update($this->table_name, array('is_read' => 1)); echo base_url('message'); }
function getErrors($array, $key) { $html = ''; foreach (getValue($array, $key, []) as $error) { $html .= sprintf('<span>%s</span>', $error); } return $html; }
function addGold() { $response = getSessionValue("totalGold", 0); $addThis = getValue("gold"); $response = $response + $addThis; setSessionValue("totalGold", $response); return $response; }
public function list_clicked() { permissionUser(); $id = $this->input->post('id'); $url = getValue('url', $this->table_name, array('id' => 'where/' . $id)); $this->db->where('id', $id)->update($this->table_name, array('is_read' => 1)); echo $url; }
function getFieldErrors($errors, $fieldName) { $html = ''; foreach (getValue($errors, $fieldName, []) as $error) { $html .= "<p class=\"error\">{$error}</p>"; } return $html; }
function getFieldErrors($error, $fieldName) { $html = ''; foreach (getValue($error, $fieldName, []) as $error) { $html .= "<p>{$error}<p>"; } return $html; }
function addColor() { $response = getSessionValue("listOfColors", []); $color = getValue("color"); $response[] = $color; setSessionValue("listOfColors", $response); return $response; }
function getFieldErrors($errors, $fieldName) { $html = ''; foreach (getValue($errors, $fieldName, []) as $error) { $html .= sprintf('<p>%s</p>', $error); } return $html; }
function renderYouTube($input) { getValue($videoWidth, $input, "width"); getValue($videoHeight, $input, "height"); getValue($videoSRC, $input, "source"); $output = ""; $output .= "<object width=" . $videoWidth . " height=" . $videoHeight . "><param name='movie' value=\"" . $videoSRC . "\"></param><embed src=" . $videoSRC . " type=\"application/x-shockwave-flash\" width=" . $videoWidth . " height=" . $videoHeight . "></embed></object>"; return $output; }
function deleteFileByCommentId($iCommentId) { global $sModule; $sDBModule = DB_PREFIX . ucfirst($sModule); $iId = (int) getValue("SELECT `ID` FROM `" . $sDBModule . "Files` WHERE `Description`='" . $iCommentId . "' LIMIT 1"); if ($iId > 0) { _deleteFile($iId); } }
function getPassword($fEmail, $sqlconn) { $table = 'UserInfo'; $queryType = 'Select'; $condition = array('Email', $fEmail, 'text'); $types = array('text'); $columns = array('Password'); $values = array(null); $args = array('column' => $columns, 'value' => $values, 'type' => $types); $xml = createXML($table, $args); $res = $sqlconn->query($xml, $queryType, $condition); $thepassword = getValue($res); if ($thepassword == '') { echo 'Account does not exist'; } else { $mail = new PHPMailer(true); //New instance, with exceptions enabled $body = "Password: "******"\r\nReturn to site: http://www.you-mix.com"; $body = preg_replace('/\\\\/', '', $body); //Strip backslashes $mail->IsSMTP(); // telling the class to use SMTP //$mail->Host = "mail.you-mix.com"; // SMTP server $mail->Host = "smtp.sendgrid.net"; //$mail->Host = "smtp.mail.me.com"; // SMTP server $mail->SMTPDebug = 1; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only // tell the class to use SMTP $mail->SMTPAuth = true; // enable SMTP authentication $mail->Port = 25; // set the SMTP server port //$mail->Port = 587; // set the SMTP server port $mail->Username = "******"; // SMTP server username //$mail->Username = "******"; // SMTP server username $config = new config(); $mail->Password = $config->getSMTPPass(); // SMTP server password $mail->AddReplyTo("*****@*****.**", "YouMix"); $mail->From = "*****@*****.**"; $mail->FromName = "YouMix"; //$to = "*****@*****.**"; $mail->AddAddress($fEmail); $mail->Subject = "you-mix.com: Password retrieval"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->WordWrap = 80; // set word wrap $mail->MsgHTML($body); $mail->IsHTML(true); // send as HTML $mail->Send(); echo 'Password has been sent.'; } }
function displayErrors($errors, $field) { $fieldErrors = getValue($errors, $field, []); $output = ''; foreach ($fieldErrors as $value) { $output .= sprintf('<p class="error">%s</p>', htmlentities($value)); } return $output; }
function renderUserStats($input) { global $wgUser; purgePage(); getValue($username, $input, "user"); $userstats = new UserStats(); $userstats->setUsername($username); $output = $userstats->displayUserStats(); return $output; }
public function Base_Render_before($Sender) { if (C('Plugins.DiscussionEvent.DisplayInSidepanel')) { // only add the module if we are in the panel asset and NOT in the dashboard if (getValue('Panel', $Sender->Assets) && $Sender->MasterView != 'admin') { $DiscussionEventModule = new DiscussionEventModule($Sender); $Sender->addModule($DiscussionEventModule); } } }
function __get($name) { if (isset($this->{$name})) { return $this->{$name}; } if (isset($this->fields[$name])) { return getValue($name); } return false; }
/** * Function to connect to Exact, this creates the client and automatically retrieves oAuth tokens if needed * * @return \Picqer\Financials\Exact\Connection * @throws Exception */ function connect() { $connection = new \Picqer\Financials\Exact\Connection(); $connection->setRedirectUrl('__REDIRECT_URL__'); $connection->setExactClientId('__CLIENT_ID__'); $connection->setExactClientSecret('__CLIENT_SECRET__'); if (getValue('authorizationcode')) { $connection->setAuthorizationCode(getValue('authorizationcode')); } if (getValue('accesstoken')) { $connection->setAccessToken(getValue('accesstoken')); } if (getValue('refreshtoken')) { $connection->setRefreshToken(getValue('refreshtoken')); } if (getValue('expires_in')) { $connection->setTokenExpires(getValue('expires_in')); } // Make the client connect and exchange tokens try { $connection->connect(); } catch (\Exception $e) { throw new Exception('Could not connect to Exact: ' . $e->getMessage()); } // Save the new tokens for next connections setValue('accesstoken', $connection->getAccessToken()); setValue('refreshtoken', $connection->getRefreshToken()); // Save expires time for next connections setValue('expires_in', $connection->getTokenExpires()); return $connection; }