コード例 #1
0
/**
 * Возвращает select со списком городов указанной страны в для фильтра регионов в каталоге фрилансеров.
 * 
 * @param int   $country название страны транслит
 * @param array $attr    опционально. атрибуты select например: array('name'=>'pf_city', 'class'=>'flt-p-sel',...);
 *
 * @return unknown
 */
function RFGetCitysByCid($country, $attr = array())
{
    $objResponse = new xajaxResponse();
    if (!$attr) {
        $attr = array('name' => 'pf_city', 'class' => 'b-select__select');
    }
    $sAttr = '';
    foreach ($attr as $key => $val) {
        $sAttr .= ' ' . $key . '="' . $val . '"';
    }
    if ($country) {
        $cities = city::GetCities(country::getCountryIDByTranslit($country));
    }
    $objResponse->script('$("b-select__city").set("html","");');
    $objResponse->script('new Element("option", { value: "0", text: "Все города" }).inject($("b-select__city"));');
    $js = '';
    if ($cities) {
        foreach ($cities as $cityid => $city) {
            $js .= 'new Element("option", { value: "' . translit(strtolower($city)) . '", text: "' . $city . '" }).inject($("b-select__city"));' . "\n";
        }
    }
    if ($js) {
        $objResponse->script($js);
    }
    return $objResponse;
}
コード例 #2
0
ファイル: editcontent_extra.php プロジェクト: rasomu/chuza
function ajaxpreview($params)
{
    global $gCms;
    $urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY];
    $config =& $gCms->GetConfig();
    $contentops =& $gCms->GetContentOperations();
    $content_type = $params['content_type'];
    $contentops->LoadContentType($content_type);
    $contentobj = UnserializeObject($params["serialized_content"]);
    if (strtolower(get_class($contentobj)) != strtolower($content_type)) {
        copycontentobj($contentobj, $content_type, $params);
    }
    updatecontentobj($contentobj, true, $params);
    $tmpfname = createtmpfname($contentobj);
    // str_replace is because of stupid windows machines.... when will they die.
    $_SESSION['cms_preview'] = str_replace('\\', '/', $tmpfname);
    $tmpvar = substr(str_shuffle(md5($tmpfname)), -3);
    $url = $config["root_url"] . '/index.php?' . $config['query_var'] . "=__CMS_PREVIEW_PAGE__&r={$tmpvar}";
    // temporary
    $objResponse = new xajaxResponse();
    $objResponse->assign("previewframe", "src", $url);
    $objResponse->assign("serialized_content", "value", SerializeObject($contentobj));
    $count = 0;
    foreach ($contentobj->TabNames() as $tabname) {
        $objResponse->script("Element.removeClassName('editab" . $count . "', 'active');Element.removeClassName('editab" . $count . "_c', 'active');\$('editab" . $count . "_c').style.display = 'none';");
        $count++;
    }
    $objResponse->script("Element.addClassName('edittabpreview', 'active');Element.addClassName('edittabpreview_c', 'active');\$('edittabpreview_c').style.display = '';");
    return $objResponse;
}
コード例 #3
0
ファイル: mod_register.php プロジェクト: haseok86/millkencode
function reguser($form)
{
    global $db, $tablepre, $onlineip;
    $obj = new xajaxResponse();
    $usernamereg = '/^\\s*$|^c:\\con\\con$|[%,\\*\\"\\s\\t\\<\\>\\&]|\\xA1\\xA1|\\xAC\\xA3|^guest|^\\xD3\\xCE\\xBF\\xCD|\\xB9\\x43\\xAB\\xC8/i';
    $emailreg = '/^(([^<>()[\\]\\.,;:\\s@"\']+(\\.[^<>()[\\]\\.,;:\\s@"\']+)*)|("[^"\']+"))@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\])|(([a-zA-Z\\d\\-]+\\.)+[a-zA-Z]{2,}))$/';
    $username = addslashes(trim($form['username']));
    $password = trim($form['password']);
    $email = trim($form['email']);
    if (empty($username) || preg_match($usernamereg, $username) || strlen($username) < 3 || strlen($username) > 15 || preg_match("~/|\\|\\'|\"~", $password) || strlen($password) < 6 || strlen($password) > 20 || !preg_match($emailreg, $email)) {
        return $obj->redirect(WEB_URL);
    }
    $sql = "SELECT * FROM `{$tablepre}members` where username='******' or (regip='{$onlineip}' AND DATE(regdate)=CURDATE())";
    $query = $db->query($sql) or error('Unable to fetch member.', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($query)) {
        return $obj->script("\$('chk_stat').className = d_err;\$('chk_stat').setHTML('此ID已被注册或者您今天已经注册过会员,请勿多次提交申请。');\$('regbotton').disabled = 'disabled';");
    }
    $sql = "INSERT INTO `{$tablepre}members` (username,password,email,regdate,regip) VALUES ('{$username}',MD5('{$password}'),'{$email}',now(),'{$onlineip}')";
    $db->query($sql) or error('Unable to insert into member.', __FILE__, __LINE__, $db->error());
    $uid = $db->insert_id();
    $db->query("INSERT INTO `{$tablepre}box` (uid,time) VALUES ('{$uid}',now())") or error('Unable to insert into box.', __FILE__, __LINE__, $db->error());
    $db->query("INSERT INTO `{$tablepre}memberdata` (uid,username,lastloginip,lastvisit) VALUES ('{$uid}','{$username}','{$onlineip}',UNIX_TIMESTAMP())");
    $obj->script("\$('regbotton').disabled = 'disabled';alert('注册成功!');");
    return $obj;
}
コード例 #4
0
ファイル: display.php プロジェクト: sandrain/hangee
function move_to($pos)
{
    global $maxseq;
    $response = new xajaxResponse();
    if ($pos > $maxseq) {
        $response->script("alert(\"{$pos} is out of range!\")");
        return $response;
    }
    $_SESSION['testpos'] = $pos;
    $response->script("document.location.reload()");
    return $response;
}
コード例 #5
0
ファイル: promo.server.php プロジェクト: kapai69/fl-ru-damp
/**
 * возвращает отзывы сервису в промоблок Безопасной Сделки.
 */
function getPromoFeedbacks()
{
    $objResponse = new xajaxResponse();
    $feedbacksFromFrl = sbr_meta::getServiceFeedbacksFromFrl();
    $feedbacksFromEmp = sbr_meta::getServiceFeedbacksFromEmp();
    ob_start();
    include $_SERVER['DOCUMENT_ROOT'] . '/promo/sbr/new/tpl.feedbacks.php';
    $html = ob_get_clean();
    $objResponse->assign('promo-feedbacks', 'innerHTML', $html);
    $objResponse->script('PromoSBR.newFeedbacksLoaded()');
    $objResponse->script("JSScroll(\$('promo-feedbacks'), true)");
    return $objResponse;
}
コード例 #6
0
function AddUser($login)
{
    $objResponse = new xajaxResponse();
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
    $user = new users();
    $user->GetUser($login);
    if ($user->login && !is_emp($user->role) && !$user->is_banned && $user->active == 't') {
        $inner = "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n<tr>\n\t<td width=\"60\">" . view_avatar($user->login, $user->photo) . "</td>\n\t<td valign=\"top\"><a href=\"/users/" . $user->login . "\" class=\"frlname11\" title=\"" . $user->uname . " " . $user->usurname . "\">" . $user->uname . " " . $user->usurname . " [" . $user->login . "]" . "</a> \n\t<a href=\"javascript:reload_form();\" class=\"blue\">изменить</a></td>\n</tr>\n</table>";
        $objResponse->assign("usersel", "innerHTML", $inner);
        $objResponse->script("document.getElementById('next').disabled = false;document.getElementById('login').value = '" . $login . "';");
    } else {
        $objResponse->script("reload_form();\n\t\t document.getElementById('usersel').innerHTML = document.getElementById('usersel').innerHTML + '" . ref_scr(view_error("Такого фрилансера не существует")) . "';\n\t\t document.getElementById('elogin').value = '" . $login . "';");
    }
    return $objResponse;
}
コード例 #7
0
ファイル: logout.php プロジェクト: MaliahRajan/online_exam
 function logout()
 {
     $objResponse = new xajaxResponse();
     session_destroy();
     $objResponse->script("location.reload();");
     return $objResponse;
 }
コード例 #8
0
 function dojob($job, $arg1, $continue, $completedCount, $failureCount)
 {
     $this->_job = $job;
     $this->_args = array($arg1);
     $objResponse = new xajaxResponse();
     if (!is_numeric($completedCount)) {
         $completedCount = 0;
     }
     $this->_completed = $completedCount;
     $this->_failures = $failureCount;
     if ($continue !== 'false') {
         /**
          * This method will set processed, remaining, failures, but subclass
          * can also override calculateProgress
          */
         $this->__executeJob();
         $this->calculateProgress();
         if ($this->_processed == 0 && $this->_failures > 0) {
             $objResponse->assign("messageText", "className", "error");
             $objResponse->assign("progressSpinner", "className", "hidden");
             $objResponse->assign("messageText", "innerHTML", "Job Failure (Completed: " . $this->_completed . ", Failures: " . $this->_failures . ")");
         } else {
             $percentage = 0;
             if ($this->_remaining > 0) {
                 if ($this->_completed > 0) {
                     $percentage = floor($this->_completed / ($this->_totalItems / 100));
                 }
             } else {
                 $percentage = 100;
             }
             $level = 0;
             if ($percentage > 0) {
                 $level = floor($percentage / 10);
             }
             if ($level > 0) {
                 $rsimage = theme_image_src('rs.gif');
                 for ($i = 0; $i <= $level; $i++) {
                     $objResponse->assign("status{$i}", "src", $rsimage);
                 }
             }
             $objResponse->assign("percentage", "innerHTML", "{$percentage}%");
             if ($this->_remaining > 0) {
                 $objResponse->assign("messageText", "innerHTML", "Completed " . $this->_completed . " of " . $this->_totalItems . " (Failures: " . $this->_failures . ")");
                 $objResponse->assign("progressSpinner", "className", "");
                 // todo - how to get waitCursor to start again.
                 $objResponse->script("xajax_" . $this->_id . ".dojob('{$job}', '{$arg1}', document.forms['progressForm']['continue'].value, '{$this->_completed}', '" . $this->_failures . "');");
             } else {
                 $objResponse->assign("messageText", "innerHTML", "Job Complete (Completed: " . $this->_completed . ", Failures: " . $this->_failures . ")");
                 $objResponse->assign("progressSpinner", "className", "hidden");
             }
         }
     } else {
         $objResponse->assign("messageText", "innerHTML", "Job Aborted (Completed: " . $this->_completed . ", Failures: " . $this->_failures . ")");
         $objResponse->assign("progressSpinner", "className", "hidden");
     }
     if (strlen($this->_debug) > 0) {
         $objResponse->assign("debug", "innerHTML", $this->_debug);
     }
     return $objResponse;
 }
コード例 #9
0
ファイル: login.php プロジェクト: pkkann/enrollment_sys
function login($user, $pass)
{
    $objResponse = new xajaxResponse();
    $success = false;
    //$user = mysql_real_escape_string($user);
    //$pass = mysql_real_escape_string($pass);
    global $dba;
    $sql = "SELECT * FROM sysuser WHERE user = '******' AND pass = '******'";
    $stmt = $dba->query($sql);
    if ($stmt) {
        if ($stmt->rowCount() > 0) {
            $success = true;
        }
        if ($success) {
            while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                $_SESSION['user']['id'] = $row['id'];
                $_SESSION['user']['name'] = $row['name'];
                $_SESSION['user']['username'] = $row['user'];
                $_SESSION['user']['admin'] = $row['admin'];
            }
            $objResponse->call('xajax_load_main');
            $objResponse->call('xajax_do_reload_shift');
        } else {
            $objResponse->call('xajax_show_alert', 'danger', 'Ups!', 'Forkert brugernavn eller adgangskode');
        }
    } else {
        $objResponse->script('swal("FEJL 1000", "Der skete sku en fejl.. Beboeren blev ikke indskrevet :( Kontakt en administrator", "error")');
    }
    return $objResponse;
}
コード例 #10
0
function modifyValue()
{
    $objResponse = new xajaxResponse();
    $objResponse->script('if (undefined == this.value) this.value = 1; else this.value += 1;');
    $objResponse->call('this.logValue');
    return $objResponse;
}
コード例 #11
0
function quickPRJGetYandexKassaLink($payment)
{
    $objResponse = new xajaxResponse();
    $bill = new billing(get_uid(false));
    $billReserveId = $bill->checkoutOrder();
    $sum = $bill->getRealPayedSum();
    $payed_sum = $bill->getOrderPayedSum();
    if ($sum > 0) {
        $_SESSION['quickprj_is_begin'] = 1;
        $yandex_kassa = new yandex_kassa();
        $html_form = $yandex_kassa->render($sum, $bill->account->id, $payment, $billReserveId);
        $objResponse->script('$("quick_pro_div_wait_txt").set("html", \'' . $html_form . '\');');
        $objResponse->script("\$('quick_pro_div_wait_txt').getElements('form')[0].submit();");
    }
    return $objResponse;
}
コード例 #12
0
ファイル: status.server.php プロジェクト: Nikitian/fl-ru-damp
function SaveStatus($text, $statusType, $login = NULL)
{
    session_start();
    $freelancer = new freelancer();
    $text = addslashes(substr(stripslashes(trim($text)), 0, 200));
    close_tags($text, 's');
    $freelancer->status_text = antispam(htmlspecialchars(htmlspecialchars_decode(change_q_x(trim($text), true, false), ENT_QUOTES), ENT_QUOTES));
    $freelancer->status_type = intval($statusType);
    if ($freelancer->statusToStr($statusType)) {
        $stdStatus = "";
        $objResponse = new xajaxResponse();
        $uid = hasPermissions('users') && $login != $_SESSION['login'] ? $freelancer->GetUid($err, $login) : get_uid(false);
        $pro = hasPermissions('users') && $login != $_SESSION['login'] ? is_pro(true, $uid) : is_pro();
        $error = $freelancer->Update($uid, $res);
        if (!$freelancer->status_text) {
            $freelancer->status_text = $stdStatus;
        }
        $freelancer->status_text = stripslashes($freelancer->status_text);
        switch ($freelancer->status_type) {
            case 1:
                $status_cls = 'b-status b-status_busy';
                break;
            case 2:
                $status_cls = 'b-status b-status_abs';
                break;
            case -1:
                $status_cls = 'b-status b-status_no';
                break;
            default:
                $status_cls = 'b-status b-status_free';
        }
        if (!$noassign) {
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
            $stop_words = new stop_words(hasPermissions('users'));
            $sStatusText = $pro ? $freelancer->status_text : $stop_words->replace($freelancer->status_text);
            //$GLOBALS['xajax']->setCharEncoding("windows-1251");
            $jsobj = json_encode(array('data' => iconv('CP1251', 'UTF8', $freelancer->status_text)));
            $objResponse->assign("statusText", "innerHTML", $freelancer->status_text == $stdStatus ? "" : reformat($sStatusText, 40, 0, 1, 25));
            $objResponse->assign("statusTitle", "innerHTML", $freelancer->statusToStr($statusType));
            //            $objResponse->assign("statusTitle", "style.display", $statusType > -1 ? '' : 'none');
            $objResponse->script("statusType = {$statusType};\n\t\t\t                      statusTxt = document.getElementById('statusText').innerHTML;\n\t\t\t                      statusTxtSrc = {$jsobj};");
        }
        $objResponse->script("\$('bstatus').erase('class');\n             \$('bstatus').addClass('{$status_cls}');");
    }
    return $objResponse;
}
コード例 #13
0
function disminuirVisitas($source, $event, $formData)
{
    global $GSPAnel;
    $objResponse = new xajaxResponse();
    $task = newObject("example", $formData["ID"]);
    if ($task->ID < 2) {
        $objResponse->script("alert('Selecciona un ejemplo primero')");
    } else {
        $valorvisitas = $task->visita - 1;
        $task->visita = $valorvisitas;
        $task->save();
        $objResponse->script("alert('Visitas: {$task->visita}')");
        $objResponse->script("tableGrid_{$GSPAnel->dGrid->id}.refresh()");
        $objResponse->script("xajax_wForm.requestloadFromId({$task->ID},'{$GSPAnel->aForms[0]->id}','example')");
    }
    return $objResponse;
}
コード例 #14
0
function kick_user($rid)
{
    global $DB, $RAD;
    $obj = new xajaxResponse();
    $result = $RAD->disconnect_user($rid);
    $obj->script("self.location.href='?m=rad_radacct&status=open';");
    return $obj;
}
コード例 #15
0
ファイル: nodelist.php プロジェクト: patinet/lms
function setnodeblockade($idek)
{
    global $DB, $LMS;
    $obj = new xajaxResponse();
    $tmp = $DB->GetOne('SELECT blockade FROM nodes WHERE id = ? LIMIT 1 ;',array($idek));
    $tmp = intval($tmp);
    if ($tmp == 1) $tmp = 0 ; else $tmp = 1;
    
    $LMS->SetNode(array('action'=>'blockade','type'=>'node','id'=>$idek,'set'=>$tmp));
    
    if ($tmp == 0) {
      $obj->script("document.getElementById('src_blockade".$idek."').src='img/padlockoff.png';");
    } else {
      $obj->script("document.getElementById('src_blockade".$idek."').src='img/padlock.png';");
    }
  
  return $obj;
}
コード例 #16
0
ファイル: shift.php プロジェクト: pkkann/enrollment_sys
function close_shift()
{
    $objResponse = new xajaxResponse();
    if ($_SESSION['shift']['id'] != 0) {
        $sql = "CALL shift_close(" . $_SESSION['shift']['id'] . ", " . $_SESSION['user']['id'] . ")";
        global $dba;
        $stmt = $dba->query($sql);
        if ($stmt) {
            $objResponse->call('xajax_show_alert', 'success', 'Yay!', 'Vagten blev afsluttet');
        } else {
            $objResponse->script('swal("Hov!", "Der skete en fejl. Vagten blev ikke afsluttet :(", "error")');
        }
        $objResponse->call('xajax_do_reload_shift');
    } else {
        $objResponse->script('swal("what?", "Der er ingen vagt started... fejl måske?", "error")');
    }
    return $objResponse;
}
コード例 #17
0
function delete_file_annex($id)
{
    global $LMS, $SMARTY, $annex_info;
    $layout['popup'] = true;
    $obj = new xajaxResponse();
    $LMS->DeleteFile(intval($id));
    $obj->script("xajax_get_list_annex();");
    return $obj;
}
コード例 #18
0
ファイル: dict.php プロジェクト: sandrain/hangee
function search_dict($form)
{
    $key = trim($form['key']);
    if (empty($key)) {
        return;
    }
    $response = new xajaxResponse();
    $togo = "dict.php?word={$key}";
    $response->script("document.location.href='{$togo}'");
    return $response;
}
コード例 #19
0
ファイル: login.php プロジェクト: MaliahRajan/online_exam
 function login($userName, $password)
 {
     $objResponse = new xajaxResponse();
     $this->load->model('Angular_online_exam_model');
     $this->load->library('smAlgorithm/StudentManagementEncryptionAlgorithm.php');
     $smAlgorithm = new StudentManagementEncryptionAlgorithm();
     $password = $smAlgorithm->smAlgorithm($password);
     $loginStatus = $this->Angular_online_exam_model->login($userName, $password);
     if (isset($loginStatus)) {
         if ($loginStatus[0]['status'] == 'y') {
             $_SESSION['group_id'] = $loginStatus[0]['group_id'];
             $_SESSION['Name'] = $loginStatus[0]['Name'];
             $objResponse->script("location.reload();");
             return $objResponse;
         } else {
             $objResponse->script("customAlertMessage('Login Failed','Invalid Username or Password','error')");
             return $objResponse;
         }
     }
 }
コード例 #20
0
 public function doAJAXDisableClientNewsletter($datagridId, $id)
 {
     try {
         $this->disableClientNewsletter($id);
         return $this->getDatagrid()->refresh($datagridId);
     } catch (Exception $e) {
         $objResponse = new xajaxResponse();
         $objResponse->script("GF_Alert('{_('ERR_UNABLE_TO_DISABLE_USER')}', '{$e->getMessage()}');");
         return $objResponse;
     }
 }
コード例 #21
0
ファイル: sitemaps.php プロジェクト: krisldz/Gekosale2
 public function doAJAXRefreshSitemaps($datagridId, $id)
 {
     try {
         $this->refreshSitemaps($id);
         return $this->getDatagrid()->refresh($datagridId);
     } catch (Exception $e) {
         $objResponse = new xajaxResponse();
         $objResponse->script("GF_Alert('{_('ERR_UNABLE_TO_REFRESH_SITEMAPS')}', '{$e->getMessage()}');");
         return $objResponse;
     }
 }
コード例 #22
0
function streamStream($url, $size)
{
    global $smarty;
    $objResponse = new xajaxResponse();
    preg_match('/(\\d+)\\sx\\s(\\d+)/', $size, $matches);
    $width = (int) $matches[1];
    $height = (int) $matches[1];
    $objResponse->remove('ajax-gPlayer');
    $objResponse->append('ajax-contentBubble', 'innerHTML', $smarty->fetch('el-player.tpl'));
    $objResponse->script("loadFile('{$url}', {$width}, {$height}, 'true')");
    return $objResponse;
}
コード例 #23
0
 function ValidateDate($id, $event, $myDate)
 {
     global $xajax;
     $objResponse = new xajaxResponse();
     if ($this->ifFormat == "%d/%m/%Y") {
         if (text_to_int($myDate) == 3600) {
             $objResponse->script("alert('Fecha inválida -{$myDate}-')");
             $objResponse->assign($id, "value", int_to_text(time()));
         } else {
             $objResponse->assign($id, "value", int_to_text(text_to_int($myDate)));
         }
     } else {
         if (date_parse_from_format($this->ifFormat, $myDate)) {
             $objResponse->assign($id, "value", $myDate);
         } else {
             $objResponse->script("alert('Fecha inválida -{$myDate}-')");
             $objResponse->assign($id, "value", strftime($this->ifFormat, time()));
         }
     }
     return $objResponse;
 }
コード例 #24
0
ファイル: adduser.server.php プロジェクト: kapai69/fl-ru-damp
function AddUser($login)
{
    $objResponse = new xajaxResponse();
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer.php';
    $user = new users();
    $user->GetUser($login);
    if ($user->login && !is_emp($user->role) && !$user->is_banned && $user->active == 't') {
        $inner = '<table cellspacing="0" cellpadding="0" border="0">
<tr>
	<td width="60">' . view_avatar($user->login, $user->photo) . '</td>
	<td valign="top"><a href="/users/' . $user->login . '" class="frlname11" title="' . $user->uname . ' ' . $user->usurname . '">' . $user->uname . ' ' . $user->usurname . ' [' . $user->login . ']' . '</a> 
	<a href="javascript:reload_form();" class="blue">изменить</a></td>
</tr>
</table>';
        $objResponse->assign('usersel', 'innerHTML', $inner);
        $objResponse->script("document.getElementById('next').disabled = false;document.getElementById('login').value = '" . $login . "';");
    } else {
        $objResponse->script("reload_form();\n\t\t document.getElementById('usersel').innerHTML = document.getElementById('usersel').innerHTML + '" . ref_scr(view_error('Такого фрилансера не существует')) . "';\n\t\t document.getElementById('elogin').value = '" . $login . "';");
    }
    return $objResponse;
}
コード例 #25
0
ファイル: news.php プロジェクト: krisldz/Gekosale2
 public function doAJAXDisableNews($datagridId, $id)
 {
     try {
         $this->disableNews($id);
         $this->flushCache();
         return $this->getDatagrid()->refresh($datagridId);
     } catch (Exception $e) {
         $objResponse = new xajaxResponse();
         $objResponse->script("GF_Alert('{_('ERR_UNABLE_TO_DISABLE_STATICBLOCKS')}', '{$e->getMessage()}');");
         return $objResponse;
     }
 }
コード例 #26
0
ファイル: xajax.php プロジェクト: alphashuro/audeprac
function jdStartScan($log)
{
    require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'controllers' . DS . 'scan.php';
    $objResponse = new xajaxResponse();
    JD_Scan_Helper::cleanUpState();
    JD_Scan_Helper::setLogging($log);
    $controller = new JDefenderControllerScan();
    // Create file list
    $info = $controller->createScanFileList();
    $objResponse->script('onStartScanComplete(' . (int) $info[0] . ', ' . (int) $info[1] . ');');
    return $objResponse;
}
コード例 #27
0
function get_more_tags($offset, $maxRecords)
{
    global $freetaglib, $smarty;
    $objResponse = new xajaxResponse();
    $last_tag = array_pop($freetaglib->get_distinct_tag_suggestion('', $offset - $maxRecords, $maxRecords));
    $smarty->assign('tag_suggestion', $freetaglib->get_distinct_tag_suggestion('', $offset, $maxRecords));
    $objResponse->script("document.getElementById('{$last_tag}-v').style.display='inline'");
    $objResponse->append("ajax-gUpTagListItem", "innerHTML", $smarty->fetch("el-tag_suggest_list.tpl"));
    if ($offset + $maxRecords > $freetaglib->count_distinct_tags()) {
        $objResponse->assign("ajax-gUpTagSuggestMore", "style.display", "none");
    }
    return $objResponse;
}
コード例 #28
0
ファイル: Raspberry.php プロジェクト: maxwroc/PHP
 public function updateStatusAjax($sService)
 {
     $oResp = new xajaxResponse();
     $oService = $this->getServerManager()->getService($sService);
     if ($oService != null) {
         // make sure that we will get correct actions (not cached)
         $oService->ResetStatus();
         $oResp->script(sprintf('ServiceManager.update("%s", %s)', $sService, $oService->IsActiveForceCheck() ? 'true' : 'false'));
         $aData['oService'] = $oService;
         $oResp->assign($oService->getSystemServiceName() . 'Actions', "innerHTML", (string) View::factory('raspberry/services/actions', $aData));
     }
     return $oResp;
 }
コード例 #29
0
/**
 * возвращает отзывы сервису в промоблок Безопасной Сделки.
 */
function checkPromoCode($popup, $code, $service_id, $type = 'id')
{
    $objResponse = new xajaxResponse();
    $promoCodes = new PromoCodes();
    $services = strpos($service_id, '|') ? explode('|', $service_id) : $service_id;
    $codeInfo = $promoCodes->check($code, $services);
    $classAction = $codeInfo['success'] ? 'remove' : 'add';
    $inputSelector = '';
    switch ($type) {
        case 'pro':
            $scriptSelector = "info_block = \$('quick_pro_win_main').getElement('.promo_code_info');";
            $inputSelector = "code_input = \$('quick_pro_win_main').getElement('.promo_code_input');";
            $scriptRecalc = 'quickPRO_applyPromo();';
            break;
        case 'prj':
            $scriptSelector = "info_block = \$('quick_pro_win_main').getElement('.promo_code_info');";
            $inputSelector = "code_input = \$('quick_pro_win_main').getElement('.promo_code_input');";
            $scriptRecalc = '';
            $projectServices = array('contest' => PromoCodes::SERVICE_CONTEST, 'vacancy' => PromoCodes::SERVICE_VACANCY, 'project' => PromoCodes::SERVICE_PROJECT);
            foreach ($projectServices as $key => $value) {
                $use_discount = (int) (is_array($codeInfo['services']) && in_array($value, $codeInfo['services']));
                $scriptRecalc .= "info_block.set('data-service-{$key}', {$use_discount});\n                ";
            }
            $scriptRecalc .= 'quickPRJ_applyPromo();';
            break;
        case 'mas':
            $scriptSelector = "info_block = \$('quick_mas_win_main').getElement('.promo_code_info');";
            $inputSelector = "code_input = \$('quick_mas_win_main').getElement('.promo_code_input');";
            $scriptRecalc = 'quickMAS_applyPromo();';
            break;
        case 'autoresponse':
            $scriptSelector = "info_block = \$('quick_payment_autoresponse').getElement('.promo_code_info');";
            $inputSelector = "code_input = \$('quick_payment_autoresponse').getElement('.promo_code_input');";
            $scriptRecalc = 'autoresponseApplyPromo();';
            break;
        case 'ext':
            $scriptSelector = " var qp = window.quick_ext_payment_factory.getQuickPayment('" . $popup . "');\n            if(qp) {\n                info_block = qp.promo_code_info;\n                code_input = qp.promo_code_input;\n            }";
            $scriptRecalc = 'qp.applyPromo();';
            break;
        default:
            $scriptSelector = " var qp = window.quick_payment_factory.getQuickPayment('" . $popup . "');\n            if(qp) {\n                info_block = qp.promo_code_info;\n                code_input = qp.promo_code_input;\n            }";
            $scriptRecalc = 'qp.applyPromo();';
            break;
    }
    if ($popup == 'tservicebind') {
        $scriptSelector = "var qp = window.quick_payment_factory.getQuickPaymentById('tservicebind', '" . $type . "');\n        if(qp) {\n            info_block = qp.promo_code_info;\n            code_input = qp.promo_code_input;\n        }";
    }
    $objResponse->script("\n            var info_block;\n            var code_input;\n            {$scriptSelector}\n            {$inputSelector}\n            if (code_input.get('value') == '{$code}') {\n                info_block.set('text', '{$codeInfo['message']}');\n                info_block.set('data-discount-percent', '{$codeInfo['discount_percent']}');\n                info_block.set('data-discount-price', '{$codeInfo['discount_price']}');\n                info_block.{$classAction}Class('b-layout__txt_color_c10600');\n                {$scriptRecalc}\n            }\n        ");
    return $objResponse;
}
コード例 #30
0
function updateCitys($country)
{
    $objResponse = new xajaxResponse();
    $banners = new banners();
    $citys = $banners->GetCitys($country);
    if ($citys) {
        $str .= "document.getElementById('scity').options.length=0; document.getElementById('scity').options[0] = new Option( 'ВСЕ', '0' );";
        foreach ($citys as $city) {
            $str .= "document.getElementById('scity').options[document.getElementById('scity').options.length] = new Option( '" . $city['cname'] . "', '" . $city['id'] . "' );";
        }
        $objResponse->script($str . "document.getElementById('scity').disabled=false");
    }
    return $objResponse;
}