Exemplo n.º 1
0
function log_list() {
    $ajax = new AjaxFilter("modules/imaging/imaging/ajaxLogs.php", "container", getParams());
    //$ajax->setRefresh(10000);
    $ajax->display();
    echo '<br/><br/><br/>';
    $ajax->displayDivToUpdate();
}
Exemplo n.º 2
0
 /**
  * 添加商家
  * http://localhost/beauty/index.php?m=shop&c=index&a=create
  */
 public function create()
 {
     $data = getParams("data", '');
     $data['created'] = strtotime(date('Y-m-d H:i:s'));
     $result = parent::save($data);
     echo json_encode(array('code' => '0', 'message' => '成功', 'data' => $result));
 }
Exemplo n.º 3
0
function image_add($type, $target_uuid)
{
    $params = getParams();
    $item_uuid = $_GET['itemid'];
    $label = urldecode($_GET['itemlabel']);
    $f = new PopupForm(sprintf(_T("Add the image <b>%s</b> to <b>%s</b>", "imaging"), $label, $params['hostname']));
    # Need to get the name of the target
    $f->push(new Table());
    // form preseeding
    $f->add(new HiddenTpl("itemid"), array("value" => $item_uuid, "hide" => True));
    $f->add(new HiddenTpl("itemlabel"), array("value" => $label, "hide" => True));
    $f->add(new HiddenTpl("gid"), array("value" => $_GET['gid'], "hide" => True));
    $f->add(new HiddenTpl("uuid"), array("value" => $_GET['uuid'], "hide" => True));
    /*$input = new TrFormElement(_T('Default menu item label', 'imaging'),        new InputTpl("default_mi_label"));
      $f->add($input,                                         array("value" => ''));
       */
    $check = new TrFormElement(_T('Selected by default', 'imaging'), new CheckboxTpl("do_default"));
    $f->add($check, array("value" => web_def_image_default() ? "checked" : ""));
    $check = new TrFormElement(_T('Displayed', 'imaging'), new CheckboxTpl("do_display"));
    $f->add($check, array("value" => web_def_image_hidden() ? "checked" : ""));
    $check = new TrFormElement(_T('Selected by default on WOL', 'imaging'), new CheckboxTpl("do_default_WOL"));
    $f->add($check, array("value" => web_def_image_default_WOL() ? "checked" : ""));
    $check = new TrFormElement(_T('Displayed on WOL', 'imaging'), new CheckboxTpl("do_display_WOL"));
    $f->add($check, array("value" => web_def_image_hidden_WOL() ? "checked" : ""));
    $f->addValidateButton("bconfirm");
    $f->addCancelButton("bback");
    $f->display();
}
 public function deleteAction(){
     $params = getParams();
     $podcast = $params['podcast'];
     $oldPath = $this -> Podcast -> Config -> get('path_data_podcast').$podcast.'.json';
     if(file_exists($oldPath))
         unlink($oldPath);
 }
Exemplo n.º 5
0
 public function getList()
 {
     $typeList = array();
     $typeList['catering'] = "餐饮";
     $typeList['variety'] = "便利店";
     $type = getParams('type', '');
     $name = $typeList[$type];
     $searchType = "3";
     $key = isset($_GET['key']) ? trim($_GET['key']) : null;
     //这里是一个坐标值
     $pageNum = isset($_GET['page']) ? trim($_GET['page']) - 1 : 0;
     $res = $this->poi->get_place_search($name, $searchType, $key, $pageNum);
     if ($res['status'] != 0) {
         return print json_encode(array('code' => '-1', 'message' => $res['message']));
     }
     // 返回错误信息.同时记录日志 message
     $list = array();
     $data = $res['results'];
     foreach ($data as $key => $val) {
         $location = $val['location'];
         $item = $value;
         unset($item['location']);
         $item['location'] = $location['lat'] . ',' . $location['lng'];
         $list[$key] = $item;
     }
     echo json_encode(array('code' => '0', 'message' => '成功', 'data' => $list));
 }
Exemplo n.º 6
0
function service_add($location)
{
    $params = getParams();
    $item_uuid = $_GET['itemid'];
    $label = urldecode($_GET['itemlabel']);
    $f = new PopupForm(sprintf(_T("Add the boot service <b>%s</b> to the default boot menu", "imaging"), $label));
    $f->push(new Table());
    // form preseeding
    $f->add(new HiddenTpl("location"), array("value" => $location, "hide" => True));
    $f->add(new HiddenTpl("itemlabel"), array("value" => $label, "hide" => True));
    $f->add(new HiddenTpl("itemid"), array("value" => $item_uuid, "hide" => True));
    $f->add(new HiddenTpl("default_mi_label"), array("value" => $label, "hide" => True));
    #    $input = new TrFormElement(_T('Default menu item label', 'imaging'),        new InputTpl("default_mi_label"));
    #$f->add($input,                                         array("value" => ''));
    $check = new TrFormElement(_T('Selected by default', 'imaging'), new CheckboxTpl("do_default"));
    $f->add($check, array("value" => web_def_service_default() ? "checked" : ""));
    $check = new TrFormElement(_T('Displayed', 'imaging'), new CheckboxTpl("do_display"));
    $f->add($check, array("value" => web_def_service_hidden() ? "checked" : ""));
    $check = new TrFormElement(_T('Selected by default on WOL', 'imaging'), new CheckboxTpl("do_default_WOL"));
    $f->add($check, array("value" => web_def_service_default_WOL() ? "checked" : ""));
    $check = new TrFormElement(_T('Displayed on WOL', 'imaging'), new CheckboxTpl("do_display_WOL"));
    $f->add($check, array("value" => web_def_service_hidden_WOL() ? "checked" : ""));
    $f->addValidateButton("bconfirm");
    $f->addCancelButton("bback");
    $f->display();
}
Exemplo n.º 7
0
 function __construct()
 {
     $dbconnect = getParams();
     $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8");
     $this->bdd = new PDO("mysql:host=" . $dbconnect[0] . ";dbname=" . $dbconnect[1], $dbconnect[2], $dbconnect[3], $options);
     $this->bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $this->bdd->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
 }
 public function setdateAction(){
     $params = getParams('configFormDate');
     
     foreach($params as $k => $p)
         $params[$k] = intval($p);
     
     $cmd = 'sudo date --set="'.$params['year'].'-'.$params['month'].'-'.$params['day'].' '.$params['hour'].':'.$params['minute'].':00.000"';
     shell_exec($cmd);
 }
Exemplo n.º 9
0
 public function loginAction()
 {
     global $_u;
     $params = getParams('login');
     if (trim($params['secret']) == USER_SECRET) {
         $_u->login();
         redirect('monitor');
     }
 }
 public function previewAction()
 {
     $params = getParams();
     $showFileName = $params['show'];
     $show = $this->Radio->getShow($showFileName);
     $playlist = $this->Radio->buildPlaylist($show);
     shell_exec('sh /data/radio/script/schedule.sh');
     return array('playlist' => $playlist);
 }
Exemplo n.º 11
0
 public function saveConfig(){
     $params = getParams('configForm');
     $save = json_encode($params);
     $filePath = PATH_DATA . "" . STATION_CONFIG;
     $fh = fopen($filePath,'w+');
     fwrite($fh,$save);
     fclose($fh);
     
     $this->getConfig();
 }
 public function loginAction()
 {
     global $_u;
     if ($_u->isAuth()) {
         redirect('admin');
     }
     $params = getParams('login');
     if (trim($params['secret']) == USER_SECRET) {
         $_u->login();
         redirect('admin/show');
     }
 }
Exemplo n.º 13
0
    function service_list($type, $target_uuid, $target_name) {
        $params = getParams();
        $params['target_uuid'] = $target_uuid;
        $params['target_type'] = $type;
        $params['target_name'] = $target_name;

        $ajax = new AjaxFilter("modules/imaging/imaging/ajaxServices.php", "Level2", $params, "Level2");
        //$ajax->setRefresh(10000);
        $ajax->display();
        echo '<br/><br/><br/>';
        $ajax->displayDivToUpdate();
    }
Exemplo n.º 14
0
function getParams($classReflection, $class)
{
    $command = file_get_contents(__DIR__ . '/../library/Rediska/Command/' . substr($class, 16) . '.php');
    preg_match('/public function create\\((.+)/i', $command, $matches);
    if (isset($matches[1])) {
        return trim($matches[1]);
    } else {
        if ($classReflection->getParentClass()) {
            return getParams($classReflection, $classReflection->getParentClass()->getName());
        } else {
            die("{$class} doesnot have a create method");
        }
    }
}
Exemplo n.º 15
0
function dispatch($data, $filePath)
{
    $params = getParams();
    if (count($params) > 0) {
        $response = save($data, $params, $filePath);
    } else {
        $id = getIdParam();
        if ($id) {
            $response = detail($data, $id);
        } else {
            $response = $data;
        }
    }
    return $response;
}
Exemplo n.º 16
0
function item_list()
{
    if (isset($_GET['gid'])) {
        $type = 'group';
        list($count, $menu) = xmlrpc_getProfileBootMenu($_GET['gid']);
    } else {
        $type = '';
        list($count, $menu) = xmlrpc_getComputerBootMenu($_GET['uuid']);
    }
    $params = getParams();
    // forge params
    if ($type == 'group') {
        $module = "imaging";
        $submod = "manage";
    } else {
        $module = "base";
        $submod = "computers";
    }
    $upAction = new ActionItem(_T("Move Up"), $type . "imgtabs", "up", "item", $module, $submod, $type . "tabbootmenu", "up");
    $downAction = new ActionItem(_T("Move down"), $type . "imgtabs", "down", "item", $module, $submod, $type . "tabbootmenu", "down");
    $editAction = new ActionItem(_T("Edit"), $type . "imgtabs", "edit", "item", $module, $submod, $type . "tabbootmenu", "edit");
    $deleteAction = new ActionPopupItem(_T("Delete"), $type . "bootmenu_remove", "delete", "item", $module, $submod, $type . "tabbootmenu", 300, "delete");
    $emptyAction = new EmptyActionItem();
    $actionUp = array();
    $actionDown = array();
    $actionEdit = array();
    $actionDelete = array();
    $nbItems = $count;
    $a_label = array();
    $a_desc = array();
    $a_default = array();
    $a_display = array();
    $a_defaultWOL = array();
    $a_displayWOL = array();
    $params['from'] = 'tabbootmenu';
    $i = -1;
    $root_len = 0;
    foreach ($menu as $entry) {
        $i = $i + 1;
        $is_image = False;
        if (isset($entry['image'])) {
            $is_image = True;
        }
        if ($is_image) {
            # TODO $entry has now a cache for desc.
            $a_desc[] = $entry['image']['desc'];
            $entry['default_name'] = $entry['image']['name'];
            $kind = 'IM';
            if ($entry['read_only']) {
                $url = '<img src="modules/imaging/graph/images/imaging-action-ro.png" style="vertical-align: middle" alt="' . _T('master from the profile', 'imaging') . '"/> ';
            } else {
                $url = '<img src="modules/imaging/graph/images/imaging-action.png" style="vertical-align: middle" alt="' . _T('master', 'imaging') . '"/> ';
            }
        } else {
            $a_desc[] = $entry['boot_service']['default_desc'];
            $entry['default_name'] = $entry['boot_service']['default_name'];
            $kind = 'BS';
            if ($entry['read_only']) {
                $url = '<img src="modules/imaging/graph/images/service-action-ro.png" style="vertical-align: middle" alt="' . _T('boot service from profile', 'imaging') . '"/> ';
            } else {
                $url = '<img src="modules/imaging/graph/images/service-action.png" style="vertical-align: middle" alt="' . _T('boot service', 'imaging') . '"/> ';
            }
        }
        $list_params[$i] = $params;
        $list_params[$i]["itemid"] = $entry['imaging_uuid'];
        $list_params[$i]["itemlabel"] = urlencode($entry['default_name']);
        if ($entry['read_only']) {
            $actionsDown[] = $emptyAction;
            $actionsUp[] = $emptyAction;
            $root_len += 1;
            $actionEdit[] = $emptyAction;
            $actionDelete[] = $emptyAction;
        } else {
            $actionEdit[] = $editAction;
            $actionDelete[] = $deleteAction;
            if ($i == $root_len) {
                if ($count == 1 || $root_len == $count - 1) {
                    $actionsDown[] = $emptyAction;
                    $actionsUp[] = $emptyAction;
                } else {
                    $actionsDown[] = $downAction;
                    $actionsUp[] = $emptyAction;
                }
            } elseif ($i > $root_len && $i == $nbItems - 1) {
                $actionsDown[] = $emptyAction;
                $actionsUp[] = $upAction;
            } elseif ($i > $root_len) {
                $actionsDown[] = $downAction;
                $actionsUp[] = $upAction;
            }
        }
        $a_label[] = sprintf("%s%s", $url, $entry['default_name']);
        # should be replaced by the label in the good language
        $a_default[] = $entry['default'];
        $a_display[] = $entry['hidden'] ? False : True;
        $a_defaultWOL[] = $entry['default_WOL'];
        $a_displayWOL[] = $entry['hidden_WOL'] ? False : True;
    }
    $firstp = "<p>" . _T("Use \"Preselected choice\" or \"Preselected choice on WOL\" to define the default boot entry.", "imaging") . "</p>";
    /* Build tooltip text on column name */
    if ($type == "") {
        $text = $firstp . "<p>" . _T("If the default entry is an image creation or restore, the following network boots will fall back to the first menu entry.", "imaging") . "</p>";
    } else {
        $text = $firstp . "<p>" . _T("When changing \"Preselected choice\" or \"Preselected choice on WOL\" entry, this value will be set on all the computers in this group.", "imaging") . "</p>" . "<p>" . _T("If the default entry is an image creation or restore, the following network boots will fall back to the first menu entry.", "imaging") . "</p>";
    }
    $l = new ListInfos($a_label, _T("Label"));
    $l->setParamInfo($list_params);
    $l->addExtraInfo($a_desc, _T("Description", "imaging"));
    $l->addExtraInfo($a_default, _T("Preselected choice", "imaging"), "", $text);
    $l->addExtraInfo($a_display, _T("Displayed", "imaging"));
    $l->addExtraInfo($a_defaultWOL, _T("Preselected choice on WOL", "imaging"), "", $text);
    $l->addExtraInfo($a_displayWOL, _T("Displayed on WOL", "imaging"));
    $l->addActionItemArray($actionsUp);
    $l->addActionItemArray($actionsDown);
    $l->addActionItemArray($actionEdit);
    if ($count > 1) {
        $l->addActionItemArray($actionDelete);
    }
    $l->disableFirstColumnActionLink();
    $l->setTableHeaderPadding(19);
    $l->display();
}
Exemplo n.º 17
0
/**
 * Функция переопределяет параметры скрипта
 */
function setParams()
{
    // Явное указание на использование глобальных переменных
    global $maxMailSend, $logFileMaxSize;
    // Получение параметров компонента
    $parameters = getParams();
    // Если запрос в БД вернул ошибку
    if (empty($parameters) || $parameters === false) {
        // Возвращаем отрицательный результат выполнения функции
        return false;
    }
    // Переопределение значений параметра скрипта значениями компонента
    $maxMailSend = $parameters['mailSendKolLimit'] != '' && (int) $parameters['mailSendKolLimit'] > 0 ? $parameters['mailSendKolLimit'] : $maxMailSend;
    // Переопределение значений параметра скрипта значениями компонента
    $logFileMaxSize = $parameters['logFileMaxSize'] != '' && (int) $parameters['logFileMaxSize'] > 1 ? 1024 * 1024 * $parameters['logFileMaxSize'] : $logFileMaxSize;
    // Возвращаем положительный результат выполнения функции
    return true;
}
Exemplo n.º 18
0
                $html = str_replace("<!--SO_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[1]) ? "none" : "", $html);
                $html = str_replace("<!--PR_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[2]) ? "none" : "", $html);
                $html = str_replace("<!--FV_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[4]) ? "none" : "", $html);
                $html = str_replace("<!--FU_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[5]) || !empty($_GET[GET_EXTERN_DYNAMIC_GROUP]) ? "none" : "", $html);
                $html = str_replace("<!--post_chat_js-->", base64_encode(Server::$Groups[$groupid]->PostJS), $html);
            }
            $html = str_replace("<!--TR_HIDDEN-->", strlen(Server::$Configuration->File["gl_otrs"]) > 1 ? "" : "none", $html);
            $html = str_replace("<!--ET_HIDDEN-->", !empty(Server::$Configuration->File["gl_retr"]) && !empty(Server::$Configuration->File["gl_soct"]) ? "" : "none", $html);
        }
    }
}
$header = IOStruct::GetFile(PATH_TEMPLATES . "header.tpl");
if (isset($_GET[GET_EXTERN_USER_HEADER]) && !empty($_GET[GET_EXTERN_USER_HEADER])) {
    $header = str_replace("<!--logo-->", "<img src=\"" . Encoding::Base64UrlDecode($_GET[GET_EXTERN_USER_HEADER]) . "\" border=\"0\"><br>", $header);
} else {
    if (!empty(Server::$Configuration->File["gl_cali"])) {
        $header = str_replace("<!--logo-->", "<img src=\"" . Server::$Configuration->File["gl_cali"] . "\" border=\"0\"><br>", $header);
    }
}
if (!empty(Server::$Configuration->File["gl_cahi"])) {
    $header = str_replace("<!--background-->", "<img src=\"" . Server::$Configuration->File["gl_cahi"] . "\" border=\"0\"><br>", $header);
}
$html = str_replace("<!--param-->", @Server::$Configuration->File["gl_cpar"], $html);
$html = str_replace("<!--header-->", $header, $html);
$html = str_replace("<!--server-->", LIVEZILLA_URL, $html);
$html = str_replace("<!--html-->", "<html dir=\"" . LocalizationManager::$Direction . "\">", $html);
$html = str_replace("<!--rtl-->", To::BoolString(LocalizationManager::$Direction == "rtl"), $html);
$html = str_replace("<!--dir-->", LocalizationManager::$Direction, $html);
$html = str_replace("<!--url_get_params-->", getParams(), $html);
Server::UnloadDataProvider();
exit(Server::Replace($html));
Exemplo n.º 19
0
    http_response_code(400);
    $data = array('code' => 400, 'error' => 'invalid_token', 'error_description' => 'Field \'token\' is not set or is invalid.');
    echo json_encode($data);
    exit;
} else {
    $token = $_GET["token"];
}
if (!isset($data["code"]) && (!isset($_GET["action"]) || $_GET["action"] === "")) {
    http_response_code(400);
    $data = array('code' => 400, 'error' => 'invalid_action', 'error_description' => 'Field \'action\' is not set or is invalid.');
    echo json_encode($data);
    exit;
} else {
    $action = $_GET["action"];
}
$params = getParams($action);
$paramVals = array();
if (!isset($data["code"])) {
    foreach ($params as $param) {
        if (!isset($_GET[$param]) || $_GET[$param] === "") {
            http_response_code(400);
            $data = array('code' => 400, 'error' => 'invalid_param', 'error_description' => 'Field \'' . $param . '\' is not set.');
            echo json_encode($data);
            exit;
            break;
        } else {
            array_push($paramVals, $_GET[$param]);
        }
    }
}
if (!isset($data["code"])) {
Exemplo n.º 20
0
    print_r($allGetVars);
    foreach ($allGetVars as $key => $param) {
        //GET parameters list
    }
    //POST or PUT
    $allPostPutVars = $request->getParsedBody();
    print_r($allPostPutVars);
    if (!empty($allPostPutVars)) {
        foreach ($allPostPutVars as $key => $param) {
            //POST or PUT parameters list
        }
    }
});
$app->any('/auth', function ($request, $response, $args) {
    // GET, POST or PUT
    $params = getParams($request);
    // Check for required params
    verifyRequired(array('email', 'password'), $params);
    // Validating email address
    validateEmail($params['email']);
    if ($params['email'] == '*****@*****.**' && $params['password'] == '123456') {
        // CSRF token name and value
        $nameKey = $this->csrf->getTokenNameKey();
        $valueKey = $this->csrf->getTokenValueKey();
        $name = $request->getAttribute($nameKey);
        $value = $request->getAttribute($valueKey);
        $tokenArray = [$nameKey => $name, $valueKey => $value];
        return json_encode(array('success' => true, 'token' => $tokenArray));
    } else {
        return json_encode(array('success' => false, 'message' => 'Email o password invalid.'));
    }
Exemplo n.º 21
0
function twitter_oauth()
{
    // date_default_timezone_set("UTC");
    $twitter_api_key = 'ytlTixe6MRJ5hLqnKN5ZN1jbc';
    $twitter_api_secret = 'YjewpVpx76ouBpvgQnHwTHMc6LLZ1FOK92skB3odQWXBd0e3Ym';
    $twitter_token = '531932164-xZGKqSmdpJAitdJ8bpP1llRkF6uXNw8Tcfq74kZ6';
    $twitter_token_secret = 'MAP3ZmXlBCxfIhC7lzG6DqvdFEWR1aDbaVdVGQ2cwCHU1';
    $current_unix_timestamp = time();
    $oauth_nonce = trim(base64_encode($current_unix_timestamp), '=');
    $redirect_url = 'http://www.google.com';
    /*
     *	Build a valid OAuth signature
     *	docs: https://dev.twitter.com/docs/auth/creating-signature
     */
    $signature_http_method = 'POST';
    $signature_base_url = 'https://api.twitter.com/oauth/request_token';
    $signature_param_string = rawurlencode('oauth_callback') . '=' . rawurlencode($redirect_url);
    $signature_param_string .= '&' . rawurlencode('oauth_consumer_key') . '=' . rawurlencode($twitter_api_key);
    $signature_param_string .= '&' . rawurlencode('oauth_nonce') . '=' . rawurlencode($oauth_nonce);
    $signature_param_string .= '&' . rawurlencode('oauth_signature_method') . '=' . rawurlencode('HMAC-SHA1');
    $signature_param_string .= '&' . rawurlencode('oauth_timestamp') . '=' . rawurlencode($current_unix_timestamp);
    $signature_param_string .= '&' . rawurlencode('oauth_token') . '=' . rawurlencode($twitter_token);
    $signature_param_string .= '&' . rawurlencode('oauth_version') . '=' . rawurlencode('1.0');
    $signature_base_string = $signature_http_method . '&' . rawurlencode($signature_base_url);
    $signature_base_string .= '&' . rawurlencode($signature_param_string);
    $signature_signing_key = rawurlencode($twitter_api_secret) . '&';
    // . rawurlencode( $twitter_token_secret );
    $oauth_signature = base64_encode(hash_hmac('sha1', $signature_base_string, $signature_signing_key, true));
    //return $oauth_signature;
    //////////////////// f**k this - try the following: https://github.com/themattharris/tmhOAuth ///////////////////////
    /*
     *	Build an HTTP authorization header
     *	docs: https://dev.twitter.com/docs/auth/authorizing-request
     */
    $oauth_http_header = 'oauth_callback="' . rawurlencode($redirect_url) . '", ';
    $oauth_http_header .= 'oauth_consumer_key="' . rawurlencode($twitter_api_key) . '", ';
    $oauth_http_header .= 'oauth_nonce="' . rawurlencode($oauth_nonce) . '", ';
    $oauth_http_header .= 'oauth_signature="' . rawurlencode($oauth_signature) . '", ';
    $oauth_http_header .= 'oauth_signature_method="' . rawurlencode('HMAC-SHA1') . '", ';
    $oauth_http_header .= 'oauth_timestamp="' . rawurlencode($current_unix_timestamp) . '", ';
    //$oauth_http_header .= 'oauth_token="' . rawurlencode( $twitter_token ) . '", ';
    $oauth_http_header .= 'oauth_version="' . rawurlencode('1.0') . '"';
    //return $oauth_http_header;
    $params = array('oauth_callback' => rawurlencode($redirect_url));
    /*
     *	Make an HTTP request via cURL
     */
    $options = array(CURLOPT_URL => $signature_base_url, CURLOPT_HEADER => false, CURLOPT_HTTPHEADER => array('Authorization: OAuth ' . $oauth_http_header, 'Expect:'), CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POST => count($params), CURLOPT_POSTFIELDS => getParams($params));
    //return getParams($params);
    $c = curl_init();
    //curl_setopt($c, CURLOPT_POST, 1);
    curl_setopt($c, CURLOPT_HEADER, 1);
    curl_setopt($c, CURLINFO_HEADER_OUT, true);
    curl_setopt_array($c, $options);
    $response = curl_exec($c);
    //curl_close($c);
    return array('response' => var_dump($response), 'request headers' => var_dump(curl_getinfo($c)));
}
Exemplo n.º 22
0
function Html_edit_catalog($catalogsInAlbumArray, $allAlbumsArray, $catalogAlbumIdesArray, $ord_elem, $count_ord, $images, $row, $cat_row, $rowim, $rowsld, $paramssld, $rowsposts, $rowsposts8, $postsbycat)
{
    //    var_dump($catalogAlbumIdesArray);
    global $wpdb;
    if (isset($_GET["addslide"])) {
        if ($_GET["addslide"] == 1) {
            header('Location: admin.php?page=catalogs_huge_it_catalog&id=' . $row->id . '&task=apply');
        }
    }
    ?>
<script type="text/javascript">
function submitbutton(pressbutton) 
{
	if(!document.getElementById('name').value){
	alert("Name is required.");
	return;
	
	}
	
	document.getElementById("adminForm").action=document.getElementById("adminForm").action+"&task="+pressbutton;
	document.getElementById("adminForm").submit();
}

var  name_changeRight = function(e) {
	document.getElementById("name").value = e.value;
}
var  name_changeTop = function(e) {
		document.getElementById("huge_it_catalog_name").value = e.value;
		//alert(e);
};

function change_select()
{
		submitbutton('apply'); 
	
}
jQuery(function() {
    jQuery( "#images-list" ).sortable({
	  stop: function() {
              jQuery("#images-list > li").removeClass('has-background');
              count=jQuery("#images-list > li").length;
              for(var i=0;i<=count;i+=2){
                              jQuery("#images-list > li").eq(i).addClass("has-background");
              }
              jQuery("#images-list > li").each(function(){
                      jQuery(this).find('.order_by').val(jQuery(this).index());
              });
	  },
	  revert: true
	});
// jQuery( "ul, li" ).disableSelection();
});
</script>

<!-- GENERAL PAGE, ADD IMAGES PAGE -->

	
<div class="">
<?php 
    $path_site2 = plugins_url("../images", __FILE__);
    ?>
    <style>
		.free_version_banner {
			position:relative;
			display:block;
			background-image:url(<?php 
    echo $path_site2;
    ?>
/wp_banner_bg.jpg);
			background-position:top left;
			backround-repeat:repeat;
			overflow:hidden;
		}
		
		.free_version_banner .manual_icon {
			position:absolute;
			display:block;
			top:15px;
			left:15px;
		}
		
		.free_version_banner .usermanual_text {
                        font-weight: bold !important;
			display:block;
			float:left;
			width:270px;
			margin-left:75px;
			font-family:'Open Sans',sans-serif;
			font-size:12px;
			font-weight:300;
			font-style:italic;
			color:#ffffff;
			line-height:10px;
                        margin-top: 0;
                        padding-top: 15px;
		}
		
		.free_version_banner .usermanual_text a,
		.free_version_banner .usermanual_text a:link,
		.free_version_banner .usermanual_text a:visited {
			display:inline-block;
			font-family:'Open Sans',sans-serif;
			font-size:17px;
			font-weight:600;
			font-style:italic;
			color:#ffffff;
			line-height:30.5px;
			text-decoration:underline;
		}
		
		.free_version_banner .usermanual_text a:hover,
		.free_version_banner .usermanual_text a:focus,
		.free_version_banner .usermanual_text a:active {
			text-decoration:underline;
		}
		
		.free_version_banner .get_full_version,
		.free_version_banner .get_full_version:link,
		.free_version_banner .get_full_version:visited {
                        padding-left: 60px;
                        padding-right: 4px;
			display: inline-block;
                        position: absolute;
                        top: 15px;
                        right: calc(50% - 167px);
                        height: 38px;
                        width: 268px;
                        border: 1px solid rgba(255,255,255,.6);
                        font-family: 'Open Sans',sans-serif;
                        font-size: 23px;
                        color: #ffffff;
                        line-height: 43px;
                        text-decoration: none;
                        border-radius: 2px;
		}
		
		.free_version_banner .get_full_version:hover {
			background:#ffffff;
			color:#bf1e2e;
			text-decoration:none;
			outline:none;
		}
		
		.free_version_banner .get_full_version:focus,
		.free_version_banner .get_full_version:active {
			
		}
		
		.free_version_banner .get_full_version:before {
			content:'';
			display:block;
			position:absolute;
			width:33px;
			height:23px;
			left:25px;
			top:9px;
			background-image:url(<?php 
    echo $path_site2;
    ?>
/wp_shop.png);
			background-position:0px 0px;
			background-repeat:repeat;
		}
		
		.free_version_banner .get_full_version:hover:before {
			background-position:0px -27px;
		}
		
		.free_version_banner .huge_it_logo {
			float:right;
			margin:15px 15px;
		}
		
		.free_version_banner .description_text {
                        padding:0 0 13px 0;
			position:relative;
			display:block;
			width:100%;
			text-align:center;
			float:left;
			font-family:'Open Sans',sans-serif;
			color:#fffefe;
			line-height:inherit;
		}
                .free_version_banner .description_text p{
                        margin:0;
                        padding:0;
                        font-size: 14px;
                }
		</style>
	<div class="free_version_banner">
		<img class="manual_icon" src="<?php 
    echo $path_site2;
    ?>
/icon-user-manual.png" alt="user manual" />
		<p class="usermanual_text">If you have any difficulties in using the options, Follow the link to <a href="http://huge-it.com/wordpress-product-catalog-user-manual/" target="_blank">User Manual</a></p>
		<a class="get_full_version" href="http://huge-it.com/product-catalog/" target="_blank">GET THE FULL VERSION</a>
                <a href="http://huge-it.com" target="_blank"><img class="huge_it_logo" src="<?php 
    echo $path_site2;
    ?>
/Huge-It-logo.png"/></a>
                <div style="clear: both;"></div>
		<div  class="description_text"><p>This is the free version of the plugin. Click "GET THE FULL VERSION" for more advanced options.   We appreciate every customer.</p></div>
	</div>
    <div style="clear:both;"></div>
<form action="admin.php?page=catalogs_huge_it_catalog&id=<?php 
    echo $row->id;
    ?>
" method="post" name="adminForm" id="adminForm">
	<div id="poststuff" >
	<div id="catalog-header">
		<ul id="catalogs-list">
			
			<?php 
    foreach ($rowsld as $rowsldires) {
        if ($rowsldires->id != $row->id) {
            ?>
					<li>
                                            <a href="#" onclick="window.location.href='admin.php?page=catalogs_huge_it_catalog&task=edit_cat&id=<?php 
            echo $rowsldires->id;
            ?>
'" ><?php 
            echo $rowsldires->name;
            ?>
</a>
					</li>
				<?php 
        } else {
            ?>
					<li class="active" style="background-image:url(<?php 
            echo plugins_url('../images/edit.png', __FILE__);
            ?>
)">
                                            <input class="text_area" onkeyup = "name_changeTop(this)" onfocus="this.style.width = ((this.value.length + 1) * 8) + 'px'" type="text" name="name" id="name" maxlength="250" value="<?php 
            echo esc_html(stripslashes($row->name));
            ?>
" />
					</li>
				<?php 
        }
    }
    ?>
			<li class="add-new">
				<a onclick="window.location.href='admin.php?page=catalogs_huge_it_catalog&amp;task=add_cat'">+</a>
			</li>
		</ul>
		</div>
		<div id="post-body" class="metabox-holder columns-2">
			<!-- Content -->
			<div id="post-body-content">


			<?php 
    add_thickbox();
    ?>

				<div id="post-body">
					<div id="post-body-heading">
						<h3><?php 
    echo __("Products", "product-catalog");
    ?>
</h3>
							<script>
jQuery(document).ready(function($){


	 

  jQuery('.huge-it-newuploader .button').click(function(e) {
    var send_attachment_bkp = wp.media.editor.send.attachment;
	
    var button = jQuery(this);
    var id = button.attr('id').replace('_button', '');
    _custom_media = true;

	jQuery("#"+id).val('');
	wp.media.editor.send.attachment = function(props, attachment){
      if ( _custom_media ) {
	     jQuery("#"+id).val(attachment.url+';;;'+jQuery("#"+id).val());
		 jQuery("#save-buttom").click();
      } else {
        return _orig_send_attachment.apply( this, [props, attachment] );
      };
    }
  
    wp.media.editor.open(button);
	 
    return false;
  });
  
  	/*#####HIDE NEW UPLOADER'S LEFT MENU######*/  
										jQuery(".wp-media-buttons-icon").click(function() {
											jQuery(".media-menu .media-menu-item").css("display","none");
											jQuery(".media-menu-item:first").css("display","block");
											jQuery(".separator").next().css("display","none");
											jQuery('.attachment-filters').val('image').trigger('change');
											jQuery(".attachment-filters").css("display","none");
										});

});
</script>

						<input type="hidden" name="imagess" id="_unique_name" />
						<span class="wp-media-buttons-icon"></span>
						<div class="huge-it-newuploader uploader button button-primary add-new-image">
						<input type="button" class="button wp-media-buttons-icon catalog-media-buttons-icon" name="_unique_name_button" id="_unique_name_button" value="Add New Product" />
						</div>
				
					</div>
					<ul id="images-list">
                                        <?php 
    $j = 2;
    $myrows = explode(",", $row->categories);
    $getAllParamsArray = getParams();
    foreach ($rowim as $key => $rowimages) {
        ?>
                                            <?php 
        //var_dump($rowimages);
        ?>
						<li <?php 
        if ($j % 2 == 0) {
            echo "class='has-background'";
        }
        $j++;
        ?>
>
							<input class="order_by" type="hidden" name="order_by_<?php 
        echo $rowimages->id;
        ?>
" value="<?php 
        echo $rowimages->ordering;
        ?>
" />
							<div class="image-container">
								<ul class="widget-images-list">
									<?php 
        $imgurl = explode(";", $rowimages->image_url);
        //                                                                        var_dump(array_pop($imgurl));
        array_pop($imgurl);
        $i = 0;
        //$imgurl = array_reverse($imgurl);
        foreach ($imgurl as $key1 => $img) {
            ?>
										<li class="editthisimage<?php 
            echo $key;
            ?>
 <?php 
            if ($i == 0) {
                echo 'first';
            }
            ?>
">
											<img src="<?php 
            echo $img;
            ?>
" />
											<input type="button" class="edit-image"  id="" value="Edit" />
											<a href="#remove" class="remove-image"><?php 
            echo __("remove", "product-catalog");
            ?>
</a>	
										</li>
									<?php 
            $i++;
        }
        ?>
                                                                        <?php 
        // var_dump($rowimages->id);
        ?>
									<li class="add-image-box">
                                                                            
										<img src="<?php 
        echo plugins_url('../images/plus.png', __FILE__);
        ?>
" class="plus" alt="" />
										<input type="hidden" name="imagess<?php 
        echo $rowimages->id;
        ?>
" id="unique_name<?php 
        echo $rowimages->id;
        ?>
" class="all-urls" value="<?php 
        echo $rowimages->image_url;
        ?>
" />
										<input type="button" class="button<?php 
        echo $rowimages->id;
        ?>
 wp-media-buttons-icon add-image"  id="unique_name_button<?php 
        echo $rowimages->id;
        ?>
" value="+" />	
									</li>
								</ul>
								<script>
									jQuery(document).ready(function($){
										function secondimageslistlisize(){
											var lisaze = jQuery('#images-list').width();
											lisaze=lisaze*0.06;
											jQuery('#images-list .widget-images-list li').not('.add-image-box').not('.first').height(lisaze);
										}
										jQuery(".wp-media-buttons-icon").click(function() {
											jQuery(".attachment-filters").css("display","none");
										});
									  var _custom_media = true,
										  _orig_send_attachment = wp.media.editor.send.attachment;
										 
										/*#####ADD NEW PROJECT######*/ 
										jQuery('.huge-it-newuploader .button').click(function(e) {
											var send_attachment_bkp = wp.media.editor.send.attachment; //  alert(send_attachment_bkp);
											var button = jQuery(this);
											var id = button.attr('id').replace('_button', '');
											_custom_media = true;

											jQuery("#"+id).val('');
											wp.media.editor.send.attachment = function(props, attachment){
											  if ( _custom_media ) {
                                                                                                 jQuery("#"+id).val(attachment.url+';;;'+jQuery("#"+id).val());
												 jQuery("#save-buttom").click();
											  } else {
												return _orig_send_attachment.apply( this, [props, attachment] );
											  };
											}
											wp.media.editor.open(button);
											return false;
										});
										  
										/*#####EDIT IMAGE######*/  
										jQuery('.widget-images-list').on('click','.edit-image',function(e) {
											var send_attachment_bkp = wp.media.editor.send.attachment;
											var button = jQuery(this);
											var id = button.parents('.widget-images-list').find('.all-urls').attr('id');
											var img= button.prev('img');
											_custom_media = true;
											jQuery(".media-menu .media-menu-item").css("display","none");
											jQuery(".media-menu-item:first").css("display","block");
											jQuery(".separator").next().css("display","none");
											jQuery('.attachment-filters').val('image').trigger('change');
											jQuery(".attachment-filters").css("display","none");
											wp.media.editor.send.attachment = function(props, attachment){
											  if ( _custom_media ) {	 
												 img.attr('src',attachment.url);
												 var allurls ='';
												 img.parents('.widget-images-list').find('img').not('.plus').each(function(){
													allurls = allurls+jQuery(this).attr('src')+';';
												 });
												 jQuery("#"+id).val(allurls);
												 secondimageslistlisize();
												 //jQuery("#save-buttom").click();
											  } else {
												return _orig_send_attachment.apply( this, [props, attachment] );
											  };
											}
											wp.media.editor.open(button);
											return false;
										});

										jQuery('.add_media').on('click', function(){
											_custom_media = false;
										});
										
										 /*#####ADD IMAGE######*/  
										jQuery('.add-image.button<?php 
        echo $rowimages->id;
        ?>
').click(function(e) {
											var send_attachment_bkp = wp.media.editor.send.attachment;

											var button = jQuery(this);
											var id = button.attr('id').replace('_button', '');
											_custom_media = true;

											wp.media.editor.send.attachment = function(props, attachment){
											  if ( _custom_media ) {
													jQuery("#"+id).parent().before('<li class="editthisimage1 "><img src="'+attachment.url+'" alt="" /><input type="button" class="edit-image"  id="" value="Edit" /><a href="#remove" class="remove-image">remove</a></li>');
													//alert(jQuery("#"+id).val());
													jQuery("#"+id).val(jQuery("#"+id).val()+attachment.url+';');
													
													secondimageslistlisize();

											  } else {
												return _orig_send_attachment.apply( this, [props, attachment] );
											  };
											}

											wp.media.editor.open(button);
											 
											return false;
										});

										
										/*#####REMOVE IMAGE######*/  
										jQuery("ul.widget-images-list").on('click','.remove-image',function () {
											jQuery(this).parent().find('img').remove();
											
											var allUrls="";
											
											jQuery(this).parents('ul.widget-images-list').find('img').not('.plus').each(function(){
//                                                                                                alert("ok");
												allUrls=allUrls+jQuery(this).attr('src')+';';
												jQuery(this).parent().parent().parent().find('input.all-urls').val(allUrls);
												secondimageslistlisize();
											});					
											jQuery(this).parent().remove();
											return false;
										});
										

										/*#####HIDE NEW UPLOADER'S LEFT MENU######*/  
										jQuery(".wp-media-buttons-icon").click(function() {
											jQuery(".media-menu .media-menu-item").css("display","none");
											jQuery(".media-menu-item:first").css("display","block");
											jQuery(".separator").next().css("display","none");
											jQuery('.attachment-filters').val('image').trigger('change');
											jQuery(".attachment-filters").css("display","none");
										});
                                                                                
                                                                                var parameters_width = jQuery(".options-container").height();    //   alert(parameters_width)
                                                                                jQuery(".category-container").height(parameters_width);
									});
                                                                        
								</script>
							</div>
							<div class="image-options">
								<div class="options-container">
									<div>
										<label for="titleimage<?php 
        echo $rowimages->id;
        ?>
"><?php 
        echo __("Title", "product-catalog");
        ?>
:</label>
										<input  class="text_area" type="text" id="titleimage<?php 
        echo $rowimages->id;
        ?>
" name="titleimage<?php 
        echo $rowimages->id;
        ?>
" id="titleimage<?php 
        echo $rowimages->id;
        ?>
"  value="<?php 
        echo $rowimages->name;
        ?>
">
									</div>
                                                                        <div>
										<label for="price<?php 
        echo $rowimages->id;
        ?>
"><?php 
        echo __("Price", "product-catalog");
        ?>
:</label>
										<input  class="text_area" type="text" id="price<?php 
        echo $rowimages->id;
        ?>
" name="price<?php 
        echo $rowimages->id;
        ?>
" id="price<?php 
        echo $rowimages->id;
        ?>
"  value="<?php 
        echo $rowimages->price;
        ?>
">
									</div>
                                                                        <div>
										<label for="market_price<?php 
        echo $rowimages->id;
        ?>
"><?php 
        echo __("Discount Price", "product-catalog");
        ?>
:</label>
										<input  class="text_area" type="text" id="market_price<?php 
        echo $rowimages->id;
        ?>
" name="market_price<?php 
        echo $rowimages->id;
        ?>
" style="margin-top: 1%;" id="market_price<?php 
        echo $rowimages->id;
        ?>
"  value="<?php 
        echo $rowimages->market_price;
        ?>
">
									</div>
                                                                        
                                                                        <div>
                                                                                <div style="position: relative;float:left;width:65%;">
                                                                                    <label for="single_product_url_type<?php 
        echo $rowimages->id;
        ?>
">Product Page Custom Link:</label>
                                                                                    <input class="text_area product_url_select" type="text" id="single_product_url_type<?php 
        echo $rowimages->id;
        ?>
" name="single_product_url_type<?php 
        echo $rowimages->id;
        ?>
" value="<?php 
        echo $rowimages->single_product_url_type;
        ?>
">
                                                                                    <img src="<?php 
        echo $path_site2;
        ?>
/close.gif" width="14" height="16" value="a" class="del_product_link">
                                                                                </div>
                                                                            <div style="float:left;width:25%;">
                                                                                    <label for="view_link_open_type<?php 
        echo $rowimages->id;
        ?>
">Product page new tab</label>
                                                                                    <input type="hidden" value="off" name="view_link_open_type<?php 
        echo $rowimages->id;
        ?>
" />
                                                                                    <input type="checkbox" id="view_link_open_type<?php 
        echo $rowimages->id;
        ?>
" name="view_link_open_type<?php 
        echo $rowimages->id;
        ?>
" <?php 
        if ($rowimages->link_target == 'on') {
            echo 'checked="checked"';
        }
        ?>
 value="on">
                                                                                </div>
                                                                        </div>
									<div class="description-block">
										<label for="im_description<?php 
        echo $rowimages->id;
        ?>
"><?php 
        echo __("Description", "product-catalog");
        ?>
:</label>
										<textarea id="im_description<?php 
        echo $rowimages->id;
        ?>
" name="im_description<?php 
        echo $rowimages->id;
        ?>
" ><?php 
        echo $rowimages->description;
        ?>
</textarea>
									</div>
                                                                        

								</div>
<div class="category-container">
    <?php 
        $allParamsAndChildsInArray = explode('@@', $rowimages->parameters);
        foreach ($allParamsAndChildsInArray as $singleParamAndChild) {
            //    var_dump($singleParamAndChild);
            if ($singleParamAndChild != "" && $singleParamAndChild != " ") {
                $separateParamAndChildsInArray = explode("@", $singleParamAndChild);
                $separateParamAndChildFirstParam = $separateParamAndChildsInArray[0];
                $separateParamAndChildWithoutParam = $separateParamAndChildsInArray;
                unset($separateParamAndChildWithoutParam[0]);
                //  var_dump($separateParamAndChildWithoutParam);   //there is a param field without param name
                $separateParamAndChildWithoutParam = array_reverse($separateParamAndChildWithoutParam);
                //  var_dump($separateParamAndChildWithoutParam);   //there is a ordered param field without param name
                $separateParamAndChildsInArrayOrdered[] = $separateParamAndChildFirstParam;
                foreach ($separateParamAndChildWithoutParam as $aaaa) {
                    if ($aaaa != "") {
                        $separateParamAndChildsInArrayOrdered[] = $aaaa;
                    }
                }
                if (count($separateParamAndChildsInArrayOrdered) != 1) {
                    foreach ($separateParamAndChildsInArrayOrdered as $paramKey => $separateParamAndChild) {
                        if ($separateParamAndChild != "") {
                            //                                var_dump($separateParamAndChild);
                            //                                echo "'&lt;a href= &gt;aaa&lt;/a&gt;'";
                            if ($paramKey == 0) {
                                ?>
                                    <ul class="full_param">
                                        <li class="new_parameter"><span><?php 
                                echo $separateParamAndChild;
                                ?>
</span>
                          <?php 
                            } else {
                                if ($paramKey == 1) {
                                    ?>
                                        <input type="text" size="" class="firstParam" added="added" val_for_editing="<?php 
                                    echo str_replace("thisisat", "@", $separateParamAndChild);
                                    ?>
" value="<?php 
                                    echo str_replace("thisisat", "@", $separateParamAndChild);
                                    ?>
">
                                        </li>
                              <?php 
                                } else {
                                    ?>
                                        <li style="">
                                            <input type="text" size="" class="firstParam" added="added" val_for_editing="<?php 
                                    echo str_replace("thisisat", "@", $separateParamAndChild);
                                    ?>
" value="<?php 
                                    echo str_replace("thisisat", "@", $separateParamAndChild);
                                    ?>
">
                                        </li>
                                    <?php 
                                }
                            }
                        }
                    }
                    ?>
                                        <!--<li style=""><input type="text" size="" class="firstParam" value=""></li>-->
                                    </ul>
    <?php 
                } else {
                    //                   exit;
                    foreach ($separateParamAndChildsInArrayOrdered as $paramKey => $separateParamAndChild) {
                        ?>
                            <ul class="full_param">
                                <li class="new_parameter"><span><?php 
                        echo $separateParamAndChild;
                        ?>
</span>
                                   <input type="text" size="" class="firstParam">
                                </li>
                            </ul>
                  <?php 
                    }
                    ?>

              <?php 
                }
            }
            unset($separateParamAndChildsInArrayOrdered);
        }
        ?>
</div>
                                                                
								<div class="remove-image-container">
                                                                        <!--<a class="button remove-image" href="admin.php?page=catalogs_huge_it_catalog&id=<?php 
        echo $row->id;
        ?>
&task=apply&removeslide=<?php 
        echo $rowimages->id;
        ?>
">-->
                                                                    <a class="button remove-image" href="admin.php?page=catalogs_huge_it_catalog&id=<?php 
        echo $row->id;
        ?>
&task=apply&removeslide=<?php 
        echo $rowimages->id;
        ?>
"><?php 
        echo __("Remove Product", "product-catalog");
        ?>
</a>
                                                                    <a href="admin.php?page=catalogs_huge_it_catalog&id=<?php 
        echo $row->id;
        ?>
&task=ratings&prod_id=<?php 
        echo $rowimages->id;
        ?>
&TB_iframe=1" class="remove-image button thickbox"><?php 
        echo __("View Ratings", "product-catalog");
        ?>
</a>
                                                                    <a href="admin.php?page=catalogs_huge_it_catalog&id=<?php 
        echo $row->id;
        ?>
&task=reviews&prod_id=<?php 
        echo $rowimages->id;
        ?>
&TB_iframe=1" class="remove-image button thickbox"><?php 
        echo __("View Comments", "product-catalog");
        ?>
</a>
								</div>
							</div>
                                                        <input type="hidden" name="parameter<?php 
        echo $rowimages->id;
        ?>
" class="parameters" value="<?php 
        echo $rowimages->parameters;
        ?>
">
                                                        <input type="hidden" name="changing_param" class="changing_param" value="">
							<div class="clear"></div>
						</li>
					<?php 
    }
    ?>
					</ul>
				</div>

			</div>
                        <script>
                                    jQuery(document).on('click', '#add_new_cat_button', function () {
                                       var newCatVal =  jQuery('.inside #add_cat_input input').val();
                                       if(newCatVal !== "") {
                                           jQuery('.parameters').each(function(){       //      alert(jQuery(this).val());
                                                var new_param_val = jQuery(this).val() + "@@" + newCatVal;
                                                jQuery(this).val(new_param_val);
                                           });
                                           
                                           var oldValue = jQuery('.inside input:hidden').val()
                                           var newValue = oldValue + newCatVal + ',';
                                           //console.log(newCatVal); console.log(newValue); console.log(oldValue);
                                           jQuery('.params_inside input:hidden').val(newValue.replace(/ /g,"_"));
                                           jQuery('.inside #add_cat_input input').val('');
                                           jQuery('.inside ul').find('#allCategories').before("\n\
                                                        <span style='display: block;'>\n\
                                                            <li class='hndle'>\n\
                                                                <input class='del_val' value='"+newCatVal+"' style=''>\n\
                                                                <span id='delete_cat' style='' value='a'>\n\
                                                                    <img src='../wp-content/plugins/product-catalog/images/delete1.png' width='9' height='9' value='a'>\n\
                                                                </span>\n\
                                                                <span id='edit_cat' style=''>\n\
                                                                    <img src='../wp-content/plugins/product-catalog/images/edit3.png' width='10' height='10'>\n\
                                                                </span>\n\
                                                            </li>\n\
                                                        </span>");
                                          
                                          jQuery('.category-container').each(function() {
                                              jQuery(this).append("<ul class='full_param'><li class='new_parameter' ><span>"+newCatVal+"  </span>\n\
                                                                       <input type='text' size='' class='firstParam' />\n\
                                                                       </li></ul>");
//                                              jQuery('.category-container ul li input').each(function(){
//                                                  alert(jQuery(this).html());
//                                              });
                                          });
                                       }
                                       else { alert("Please fill the line"); }
                                       
                                    });
                                    
                                    jQuery(document).on('keypress', '#add_cat_input input', function (e){    //alert(jQuery(this).val());
                                        if(jQuery(this).val() !== "") {
                                            if(e.keyCode == 13) {
                                                jQuery('#add_new_cat_button').click();
                                            }
                                        }
                                    });
                                    
                                    jQuery(document).on('change', '.firstParam', function (e){    //alert(jQuery(this).val());
                                        
                                        var change_val_index = jQuery(this).parent().parent().index();
                                        var hidden_input = jQuery(this).parent().parent().parent().parent().parent().find(".parameters");
                                        var params_input_old_val = jQuery(this).parent().parent().parent().parent().parent().find(".parameters").val();    //    alert(params_hidden_input);
                                        var new_child_val = jQuery(this).val();
                                            new_child_val = new_child_val.replace(/@/g, 'thisisat');

                                        var params_input_old_val_in_array = params_input_old_val.split("@@");
                                        if(params_input_old_val_in_array[0] == "")
                                            { var new_change_val_index = parseInt(change_val_index) + parseInt(1); }
                                        else
                                            { var new_change_val_index = parseInt(change_val_index); }
                                        
//                                        alert(params_input_old_val_in_array[new_change_val_index]);//param@child || param@
                                        
                                        var separate_param_and_child_in_array = params_input_old_val_in_array[new_change_val_index].split("@");
//                                        alert(separate_param_and_child_in_array[0]);
                                        if(new_child_val != ''){ var new_param_and_child = separate_param_and_child_in_array[0] + "@" + new_child_val; }
                                        else
                                        {    var new_param_and_child = separate_param_and_child_in_array[0]; }
                                        params_input_old_val_in_array[new_change_val_index] = new_param_and_child;


                                        var params_input_new_val = "";
                                        var forEach = Function.prototype.call.bind( Array.prototype.forEach );
                                        forEach( params_input_old_val_in_array, function( node ) { //            alert( node );
                                            if (node != "") {
                                                params_input_new_val = params_input_new_val + "@@" + node;
                                            }
                                        });

                                        jQuery(hidden_input).val(params_input_new_val);
                                            
                                    });
                                        
                                   
                                    jQuery(document).on('click', '#delete_cat', function (){
                                        var index_new_val = 0;
                                        jQuery(this).parent().parent().each(function(){
                                            jQuery(this).index(index_new_val);
                                            index_new_val++;
                                        });
                                        var del_val_index = jQuery(this).parent().parent().index();                //     alert(del_val_index);
                                        var all_categories_old = jQuery('.inside #allCategories').val();           //     alert(all_categories_old);
                                        var all_categories_old_in_array = all_categories_old.split(",");
                                        
//                                      ###########     <<<<   allCategories hidden input changing     ###########                                       
                                        
                                        var foreach_key = 0;
                                        var newValue = "";
                                        var forEach = Function.prototype.call.bind( Array.prototype.forEach );
                                            forEach( all_categories_old_in_array, function( node ) {               //    alert( node );
                                                if(foreach_key != del_val_index && node !=""){
                                                    newValue = newValue + node + ",";
                                                }
                                                foreach_key++;
                                            });
                                        //alert(newValue);
                                        jQuery('.inside #allCategories').val(newValue);
                                        jQuery(this).parent().parent().find('.hndle').parent().remove();
                                        
                                        
//                                        ###########   >>>>     allCategories hidden input changing       ###########  
                                                        
                                        jQuery('.category-container').each(function(){
                                            //jQuery(this).eq(index_new_val).length);
                                            jQuery(this).find('ul').eq(del_val_index).remove();
                                        });
//                                        return false;
                                        
                                        
                                        var need_to_much_index = 0;
                                        jQuery('.parameters').each(function(){
                                                                                                                                     //  alert(del_val_index);
                                            var all_params_old_val = jQuery(this).val();                                             //  alert(all_params_old_val);
                                            var all_params_old_val_in_array = all_params_old_val.split('@@');                        //  alert(all_params_old_val_in_array[del_val_index]);
                                            if(all_params_old_val_in_array[0] == "" && need_to_much_index == 0){
                                                del_val_index = parseInt(del_val_index) + parseInt(1); need_to_much_index = 1;         ////if first key is empty key = key + 1;
                                            }
                                            var old_param_and_child = "@@" + all_params_old_val_in_array[del_val_index];             //  alert(old_param_and_child);
                                            
                                            
                                            var foreach_key = 0;
                                            var all_params_new_val = "";
                                            var forEach = Function.prototype.call.bind( Array.prototype.forEach );
                                            forEach( all_params_old_val_in_array, function( node ) {                            //      alert( node );
                                                if(foreach_key != del_val_index && node != ""){
                                                    all_params_new_val = all_params_new_val + "@@" +node;              //      alert(param_for_editing);
//                                                    alert( node );
                                                }
                                                
                                                foreach_key++;
                                            });
                                            
//                                            alert(all_params_old_val);
//                                            alert(all_params_new_val);
//                                            return false;
                                            jQuery(this).val(all_params_new_val);   //    alert(all_params_new_val);
                                            
                                        });
                                    });
                                     //ok a

                                    jQuery(document).on('click', '#edit_cat', function (){
                                        jQuery(this).parent().find('.del_val').focus();
                                        var changing_val = jQuery(this).parent().find('.del_val').val().replace(/ /g, '_');
//                                        alert(changing_val);
                                        jQuery('#changing_val').removeAttr('value').attr('value',changing_val);
                                        //console.log(changing_val);
                                    });
                                    //ok a

                                    jQuery(document).on('click', '#catalogs-list .active', function (){
                                        jQuery(this).find('input').focus();
                                    });

                                    //getting category old name
                                    jQuery(document).on('focus', '.del_val', function (){ // Know which category we want to change 
                                            var changing_val = jQuery(this).parent().parent().index();  //console.log(changing_val);
                                            jQuery('#changing_val').removeAttr('value').attr('value',changing_val);
//                                            alert(jQuery(this).parent().parent().index());
                                    });

                                    jQuery(document).on('change', '.del_val', function (){
                                        //alert("ok")
                                            var input_old_val   = jQuery("#allCategories").val();
                                            var old_param_index = jQuery('#changing_val').val();
                                            var param_new_name  = jQuery(this).val();
//                                            alert(param_new_name);
                                            var input_old_val_in_array = input_old_val.split(",");
                                                input_old_val_in_array[old_param_index] = param_new_name;
                                                
                                            var new_cat = "";
                                            var forEach = Function.prototype.call.bind( Array.prototype.forEach );
                                            forEach( input_old_val_in_array, function( node ) {       //      alert( node );
                                                    if(node != ""){ new_cat = new_cat + node + ","; }
                                            });
                                            
                                            jQuery('#allCategories').val(new_cat);      //      alert(jQuery('#allCategories').val());
                                            
                                            jQuery('.parameters').each(function(){
                                                var hidden_input_old_val = jQuery(this).val();    //    all params and values in string
//                                                 alert(hidden_input_old_val);
                                                 
                                                var hidden_input_old_val_in_array = hidden_input_old_val.split("@@");
                                                if(hidden_input_old_val_in_array[0] == ""){
                                                      var new_old_param_index = parseInt(old_param_index) + parseInt(1); }
                                                else{ var new_old_param_index = old_param_index; }
                                                                                                
                                                var old_param_and_child_in_array = hidden_input_old_val_in_array[new_old_param_index].split("@");
                                                var param_old_name = old_param_and_child_in_array[0];
                                                var child_name = old_param_and_child_in_array[1];
//                                                    alert(param_old_name);
//                                                    alert(param_new_name);
//                                                    alert(child_name);
                                                    if(typeof child_name != 'undefined')
                                                    {    var new_param_and_child = param_new_name + "@" + child_name; }
                                                    else
                                                    {    var new_param_and_child = param_new_name; }
//                                                    alert(new_param_and_child);
                                                    
                                                hidden_input_old_val_in_array[new_old_param_index] = new_param_and_child;
                                                var params_input_new_val = "";
                                                var forEach = Function.prototype.call.bind( Array.prototype.forEach );
                                                forEach( hidden_input_old_val_in_array, function( node ) { //            alert( node );
                                                    if (node != "") {
                                                        params_input_new_val = params_input_new_val + "@@" + node;
                                                    }
                                                });
//                                                    alert(params_input_new_val);
                                                jQuery(this).val(params_input_new_val);
                                                
                                            });
                                            
                                            jQuery('.new_parameter').parent().each(function() {
                                                if(jQuery(this).index() == old_param_index) {
                                                    jQuery(this).find("span").text(param_new_name);
                                                }
                                            });
//                                           
                                    });
                                    
                                    jQuery(document).ready(function(){
                                        jQuery('.huge-it-catalog-thumb .button').click(function(e) {
                                            var send_attachment_bkp = wp.media.editor.send.attachment;
                                            var button = jQuery(this);  //  alert(jQuery(this).attr("id").replace('_button', ''));
                                            var id = button.attr("id").replace('_button', '');  //   alert(id);
                                            _custom_media = true;

                                                jQuery("#"+id).val('');  //   alert("#"+id);
                                                wp.media.editor.send.attachment = function(props, attachment){
                                                if ( _custom_media ) {
                                                     jQuery("#"+id).val(attachment.url+';;;');
                                                         jQuery("#save-buttom").click();
                                                }
                                                else {
                                                    return _orig_send_attachment.apply( this, [props, attachment] );
                                                };
                                            }

                                            wp.media.editor.open(button);

                                            return false;
                                       });
                                   });
                                   jQuery(document).ready(function(){
                                        jQuery('.categories_select select').change(function(){
                                            var catalog_cats_val = jQuery(this).val();
                                            jQuery(this).parent().find("#catalog_cats").val(catalog_cats_val);
                                        });
                                   });
                                   
                                   jQuery(document).ready(function(){
                                        jQuery('#pagination_type').change(function(){
                                            if(jQuery(this).val() != "show_all"){ jQuery('#count_into_page').parent().css({ "display" : "inline-block" }); }
                                            else{ jQuery('#count_into_page').parent().css({ "display" : "none" }); }
                                        });
                                   });
                                   
                                   jQuery(document).on('change', '.product_url_select', function (e){
                                        if(jQuery(this).val() == ""){
                                            jQuery(this).val("default");
                                        }
                                   });
                                   
                                   jQuery(document).on('click', '.del_product_link', function (e){
//                                        if(jQuery(this).val() == ""){
                                            jQuery(this).parent().find(".product_url_select").val("default");
//                                        }
                                   });
                                   
                                   /*   <--    IF VIEW IS A CONTENT SLIDER,ADDING NONE DISPLAY TO PAGINATIO OPTIONS    */
                                   jQuery(document).on('change', '#catalog_effects_list', function (e){
                                        var active_view = jQuery(this).val();
                                        var pagination_type = jQuery("#pagination_type").val();
                                        if(active_view == 5){
                                            jQuery("#pagination_type").parent().css({ "display" : "none" }); jQuery("#count_into_page").parent().css({ "display" : "none" });
                                        }
                                        else{
                                            jQuery("#pagination_type").parent().css({ "display" : "" });
                                            if(pagination_type != "show_all"){ jQuery("#count_into_page").parent().css({ "display" : "" }); }
                                        }
                                   });
                                   
                                   jQuery(window).load(function(){
                                       var active_view = <?php 
    echo $row->catalog_list_effects_s;
    ?>
;
                                       if(active_view == 5){ jQuery("#pagination_type").parent().css({ "display" : "none" }); jQuery("#count_into_page").parent().css({ "display" : "none" }); }
                                       
                                   });
    
                        </script>
                        
			<!-- SIDEBAR -->
			<div id="postbox-container-1" class="postbox-container">
				<div id="side-sortables" class="meta-box-sortables ui-sortable">
					<div id="catalog-unique-options" class="postbox">
					<h3 class="hndle"><span><?php 
    echo __("Select The Catalog Theme", "product-catalog");
    ?>
</span></h3>
					<ul id="catalog-unique-options-list">
						<li style="display:none;">
							<label for="sl_width"><?php 
    echo __("Width", "product-catalog");
    ?>
</label>
							<input type="text" name="sl_width" id="sl_width" value="<?php 
    echo $row->sl_width;
    ?>
" class="text_area" />
						</li>
						<li style="display:none;">
							<label for="sl_height"><?php 
    echo __("Height", "product-catalog");
    ?>
</label>
							<input type="text" name="sl_height" id="sl_height" value="<?php 
    echo $row->sl_height;
    ?>
" class="text_area" />
						</li>
						<li style="display:none;">
							<label for="pause_on_hover"><?php 
    echo __("Pause on hover", "product-catalog");
    ?>
</label>
							<input type="hidden" value="off" name="pause_on_hover" />					
							<input type="checkbox" name="pause_on_hover"  value="on" id="pause_on_hover"  <?php 
    if ($row->pause_on_hover == 'on') {
        echo 'checked="checked"';
    }
    ?>
 />
						</li>
                                                
                                                <li>
							<label for="huge_it_catalog_name"><?php 
    echo __("Catalog Name", "product-catalog");
    ?>
</label>
							<input type = "text" name="name" id="huge_it_catalog_name" value="<?php 
    echo esc_html(stripslashes($row->name));
    ?>
" onkeyup = "name_changeRight(this)">
						</li>
                                               
						<li>
							<label for="catalog_effects_list"><?php 
    echo __("Select The View", "product-catalog");
    ?>
</label>
							<select name="catalog_effects_list" id="catalog_effects_list">
									<option <?php 
    if ($row->catalog_list_effects_s == '0') {
        echo 'selected';
    }
    ?>
  value="0"><?php 
    echo __("Blocks Toggle Up/Down", "product-catalog");
    ?>
</option>
									<option <?php 
    if ($row->catalog_list_effects_s == '1') {
        echo 'selected';
    }
    ?>
  value="1"><?php 
    echo __("Full-Height Blocks", "product-catalog");
    ?>
</option>
									<option <?php 
    if ($row->catalog_list_effects_s == '2') {
        echo 'selected';
    }
    ?>
  value="2"><?php 
    echo __("Catalog/Content-Popup", "product-catalog");
    ?>
</option>
									<option <?php 
    if ($row->catalog_list_effects_s == '3') {
        echo 'selected';
    }
    ?>
  value="3"><?php 
    echo __("Full-Width Blocks", "product-catalog");
    ?>
</option>
									<option <?php 
    if ($row->catalog_list_effects_s == '5') {
        echo 'selected';
    }
    ?>
  value="5"><?php 
    echo __("Content Slider", "product-catalog");
    ?>
</option>
							</select>
						</li>
                                                
                                                <li style="">
							<label for="pagination_type"><?php 
    echo __("Displaying Content", "product-catalog");
    ?>
</label>
							<select name="pagination_type" id="pagination_type">
                                                            <option <?php 
    if ($row->pagination_type == 'show_all') {
        echo 'selected';
    }
    ?>
   value="show_all"><?php 
    echo __("Show All", "product-catalog");
    ?>
</option>
                                                            <option <?php 
    if ($row->pagination_type == 'pagination') {
        echo 'selected';
    }
    ?>
 value="pagination"><?php 
    echo __("Paginatiion", "product-catalog");
    ?>
</option>
                                                            <option <?php 
    if ($row->pagination_type == 'load_more') {
        echo 'selected';
    }
    ?>
  value="load_more"><?php 
    echo __("Load More", "product-catalog");
    ?>
</option>
							</select>
						</li>
                                                
                                                <li style=" <?php 
    if ($row->pagination_type == 'show_all') {
        echo "display:none;";
    }
    ?>
">
							<label for="count_into_page"><?php 
    echo __("Content Per Page", "product-catalog");
    ?>
</label>
							<input type="text" name="count_into_page" id="count_into_page" value="<?php 
    echo $row->count_into_page;
    ?>
" class="text_area" />
						</li>
						<li style="display:none;">
							<label for="sl_changespeed"><?php 
    echo __("Change speed", "product-catalog");
    ?>
</label>
							<input type="text" name="sl_changespeed" id="sl_changespeed" value="<?php 
    echo $row->param;
    ?>
" class="text_area" />
						</li>

					</ul>
						<div id="major-publishing-actions">
							<div id="publishing-action">
                                                            <input type="button" onclick="submitbutton('apply')" value="<?php 
    echo __("Save Catalog", "product-catalog");
    ?>
" id="save-buttom" class="button button-primary button-large">
							</div>
							<div class="clear"></div>
							<!--<input type="button" onclick="window.location.href='admin.php?page=catalogs_huge_it_catalog'" value="Cancel" class="button-secondary action">-->
						</div>
					</div>
                                    
                                        <div class="postbox" style="display: none;">
                                            <div class="inside2">
                                                <ul>
                                                    <li class="allowIsotope">
                                                        <?php 
    echo __("Show Sorting Buttons", "product-catalog");
    ?>
 :
                                                        <input type="hidden" value="off" name="ht_show_sorting" />
							<input type="checkbox" id="ht_show_sorting"  <?php 
    if ($row->ht_show_sorting == 'on') {
        echo 'checked="checked"';
    }
    ?>
  name="ht_show_sorting" value="on" />
                                                    </li>
                                                    <li class="allowIsotope">
                                                        <?php 
    echo __("Show Categorie Buttons", "product-catalog");
    ?>
 :
                                                        <input type="hidden" value="off" name="ht_show_filtering" />
							<input type="checkbox" id="ht_show_filtering"  <?php 
    if ($row->ht_show_filtering == 'on') {
        echo 'checked="checked"';
    }
    ?>
  name="ht_show_filtering" value="on" />
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    
                                    <div class="postbox">
                                            <h3 class="hndle"><span><?php 
    echo __("Parameters", "product-catalog");
    ?>
</span></h3>
                                            <div class="inside params_inside">
                                                <ul>
                                                <?php 
    $ifforempty = $row->categories;
    $ifforempty = stripslashes($ifforempty);
    $ifforempty = esc_html($ifforempty);
    $ifforempty = empty($ifforempty);
    if (!$ifforempty) {
        foreach ($myrows as $value) {
            if (!empty($value)) {
                ?>
                                                            <span>
                                                                <li class="hndle">
                                                                    <input class="del_val" value="<?php 
                echo str_replace("_", " ", $value);
                ?>
" style="">
                                                                    <span id="delete_cat" style="" value="a"><img src="<?php 
                echo $path_site2;
                ?>
/delete1.png" width="9" height="9" value="a"></span>
                                                                    <span id="edit_cat" style=""><img src="<?php 
                echo $path_site2;
                ?>
/edit3.png" width="10" height="10"></span>
                                                                </li>
                                                            </span>
                                                        <?php 
            }
        }
    }
    ?>
                                                    <input type="hidden" value="<?php 
    if (strpos($row->categories, ',,') !== false) {
        $row->categories = str_replace(",,", ",", $row->categories);
    }
    echo $row->categories;
    ?>
" id="allCategories" name="allCategories">
                                                    <li id="add_cat_input" style="">
                                                        <input type="text" size="11">
                                                        <a style="" id="add_new_cat_button">+ <?php 
    echo __("Add New Parameter", "product-catalog");
    ?>
	</a>
                                                    </li>
                                                </ul>
                                                <input type="hidden" value="" id="changing_val">
                                            </div>
                                        </div>
                                        
                                        <div class="postbox" style="display: none;">
                                            <h3 class="hndle"><span><?php 
    echo __("Select Album", "product-catalog");
    ?>
</span></h3>
                                            <div class="inside">
                                                <div class="categories_select">
                                                    <input type="hidden" name="catalog_old_cats" id="catalog_old_cats" value="<?php 
    foreach ($catalogAlbumIdesArray as $catalogAlbumId) {
        echo $catalogAlbumId->album_id . ",";
    }
    ?>
"/>
                                                    <input type="hidden" name="catalog_cats" id="catalog_cats" value="<?php 
    foreach ($catalogAlbumIdesArray as $catalogAlbumId) {
        echo $catalogAlbumId->album_id . ",";
    }
    ?>
"/>
                                                    <select multiple="multiple" style="width: 100%;" name="" class="">
                                                        <?php 
    foreach ($allAlbumsArray as $key => $album) {
        ?>
                                                        <option value="<?php 
        echo $album->id;
        ?>
 " <?php 
        foreach ($catalogAlbumIdesArray as $catalogAlbumId) {
            if ($catalogAlbumId->album_id == $album->id) {
                echo "selected='selected'";
            }
        }
        ?>
><?php 
        echo $album->name;
        ?>
</option>;
                                                        <?php 
    }
    ?>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        
                                        <div class="postbox" style="display: none;">
                                            <h3 class="hndle"><span><?php 
    echo __("Catalog Thumbnail", "product-catalog");
    ?>
</span></h3>
                                            <div class="inside">
                                                <div style="width: 200px; height: 160px;margin: 10px auto;">
                                                    <img src="<?php 
    echo esc_html(stripslashes(str_replace(";;;", "", $row->cat_thumb)));
    ?>
" style="width: 200px; height: 150px;margin: 0px auto;" />
                                                </div>
                                                <?php 
    // $row->$row->cat_thumb
    ?>
                                                <input type="hidden" name="cat_thumb" id="cat_thumb" value="<?php 
    echo $row->cat_thumb;
    ?>
"/>
                                                <div class="huge-it-catalog-thumb" style="margin: 0px auto;width: 162px;">
                                                    <input type="button" class="button wp-media-buttons-icon button-primary" name="cat_thumb_button" id="cat_thumb_button" value="<?php 
    if (esc_html(stripslashes(str_replace(";;;", "", $row->cat_thumb))) == "") {
        echo 'Add Catalog Thumbnail';
    } else {
        echo "Edit Catalog Thumbnail";
    }
    ?>
" />
                                                </div>
                                            </div>
                                        </div>                                        
                                        
                                        <div id="catalog-shortcode-box" class="postbox shortcode ms-toggle">
                                            <h3 class="hndle"><span><?php 
    echo __("Usage", "product-catalog");
    ?>
</span></h3>
                                            <div class="inside">
                                                <ul>
                                                    <li rel="tab-1" class="selected">
                                                        <h4><?php 
    echo __("Shortcode", "product-catalog");
    ?>
</h4>
                                                        <p><?php 
    echo __("Copy &amp; paste the shortcode directly into any WordPress post or page.", "product-catalog");
    ?>
</p>
                                                        <textarea class="full" readonly="readonly">[huge_it_catalog id="<?php 
    echo $row->id;
    ?>
"]</textarea>
                                                    </li>
                                                    <li rel="tab-2">
                                                        <h4><?php 
    echo __("Template Include", "product-catalog");
    ?>
</h4>
                                                        <p><?php 
    echo __("Copy &amp; paste this code into a template file to include the slideshow within your theme.", "product-catalog");
    ?>
</p>
                                                        <textarea class="full" readonly="readonly">&lt;?php echo do_shortcode("[huge_it_catalog id='<?php 
    echo $row->id;
    ?>
']"); ?&gt;</textarea>
                                                    </li>
                                                </ul>
                                            </div>
                                       </div>
				</div>
			</div>
		</div>
	</div>
	<input type="hidden" name="task" value="" />
</form>
</div>

<?php 
}
Exemplo n.º 23
0
function getLRSAuthorizationHash()
{
    $params = getParams();
    return base64_encode($params["learning-locker"]["username"] . ':' . $params["learning-locker"]["password"]);
}
Exemplo n.º 24
0
function item_list() {

    if(isset($_GET['gid'])) {
        $type = 'group';
        list($count, $menu) = xmlrpc_getProfileBootMenu($_GET['gid']);
    } else {
        $type = '';
        list($count, $menu) = xmlrpc_getComputerBootMenu($_GET['uuid']);
    }

    $params = getParams();

    // forge params
    $upAction = new ActionItem(_T("Move Up"), $type."imgtabs", "up", "item", "base", "computers", $type."tabbootmenu", "up");
    $downAction = new ActionItem(_T("Move down"), $type."imgtabs", "down", "item", "base", "computers", $type."tabbootmenu", "down");
    $editAction = new ActionItem(_T("Edit"), $type."imgtabs", "edit", "item", "base", "computers", $type."tabbootmenu", "edit");
    $deleteAction = new ActionPopupItem(_T("Delete"), "bootmenu_remove", "delete", "item", "base", "computers", $type."tabbootmenu", 300, "delete");

    $emptyAction = new EmptyActionItem();
    $actionUp = array();
    $actionDown = array();
    $actionEdit = array();
    $actionDelete = array();

    $nbItems = $count;

    $a_label = array();
    $a_desc = array();
    $a_default = array();
    $a_display = array();
    $a_defaultWOL = array();
    $a_displayWOL = array();
    $params['from'] = 'tabbootmenu';

    $i = -1;
    $root_len = 0;
    foreach ($menu as $entry) {
        $i = $i + 1;
        $is_image = False;
        if (isset($entry['image'])) {
            $is_image = True;
        }

        if ($is_image) { # TODO $entry has now a cache for desc.
            $a_desc[] = $entry['image']['desc'];
            $entry['default_name'] = $entry['image']['name'];
            $kind = 'IM';
            if ($entry['read_only']) {
                $url = '<img src="modules/imaging/graph/images/imaging-action-ro.png" style="vertical-align: middle" alt="'._T('master from the profile', 'imaging').'"/> ';
            } else {
                $url = '<img src="modules/imaging/graph/images/imaging-action.png" style="vertical-align: middle" alt="'._T('master', 'imaging').'"/> ';
            }
        } else {
            $a_desc[] = $entry['boot_service']['default_desc'];
            $entry['default_name'] = $entry['boot_service']['default_name'];
            $kind = 'BS';
            if ($entry['read_only']) {
                $url = '<img src="modules/imaging/graph/images/service-action-ro.png" style="vertical-align: middle" alt="'._T('boot service from profile', 'imaging').'"/> ';
            } else {
                $url = '<img src="modules/imaging/graph/images/service-action.png" style="vertical-align: middle" alt="'._T('boot service', 'imaging').'"/> ';
            }
        }

        $list_params[$i] = $params;
        $list_params[$i]["itemid"] = $entry['imaging_uuid'];
        $list_params[$i]["itemlabel"] = urlencode($entry['default_name']);

        if ($entry['read_only']) {
            $actionsDown[] = $emptyAction;
            $actionsUp[] = $emptyAction;
            $root_len += 1;
            $actionEdit[] = $emptyAction;
            $actionDelete[] = $emptyAction;
        } else {
            $actionEdit[] = $editAction;
            $actionDelete[] = $deleteAction;
            if ($i == $root_len) {
                if ($count == 1 || $root_len == $count - 1) {
                    $actionsDown[] = $emptyAction;
                    $actionsUp[] = $emptyAction;
                } else {
                    $actionsDown[] = $downAction;
                    $actionsUp[] = $emptyAction;
                }
            } elseif ($i > $root_len && $i == $nbItems-1) {
                $actionsDown[] = $emptyAction;
                $actionsUp[] = $upAction;
            } elseif ($i > $root_len) {
                $actionsDown[] = $downAction;
                $actionsUp[] = $upAction;
            }
        }

        $a_label[] = sprintf("%s%s", $url, $entry['default_name']); # should be replaced by the label in the good language
        $a_default[] = $entry['default'];
        $a_display[] = ($entry['hidden'] ? False:True);
        $a_defaultWOL[] = $entry['default_WOL'];
        $a_displayWOL[] = ($entry['hidden_WOL'] ? False:True);
    }
    $firstp = "<p>" . _T("\"Preselected choice\" and \"Preselected choice on WOL\" values will be used to set the default imaging client menu item to run, if no choice is made by the user on the client side prior to the menu timeout.", "imaging") . "</p>";
    /* Build tooltip text on column name */
    if ($type == "") {
        $text = $firstp . "<p>" . _T("Once the operation triggered by a choice is successfull, the preselected choice will default to the first item of the boot menu.", "imaging") . "</p>";
    } else {
        $text = $firstp . "<p>" . _T("When you modify the \"Preselected choice\" or \"Preselected choice on WOL\" values on a profile, those values will be set on all the boot menu of the computers owned by the profile.", "imaging") . "</p>" . "<p>" . _T("Then for each computer, once the operation triggered by a choice is successfull, the preselected choice will default to the first item of the boot menu.", "imaging") . "</p>";
    }
    $l = new ListInfos($a_label, _T("Label"));
    $l->setParamInfo($list_params);
    $l->addExtraInfo($a_desc, _T("Description", "imaging"));
    $l->addExtraInfo($a_default, _T("Preselected choice", "imaging")
                     , "", $text);
    $l->addExtraInfo($a_display, _T("Displayed", "imaging"));
    $l->addExtraInfo($a_defaultWOL, _T("Preselected choice on WOL", "imaging")
                     , "", $text);
    $l->addExtraInfo($a_displayWOL, _T("Displayed on WOL", "imaging"));
    $l->addActionItemArray($actionsUp);
    $l->addActionItemArray($actionsDown);
    $l->addActionItemArray($actionEdit);
    if ($count > 1) {
        $l->addActionItemArray($actionDelete);
    }
    $l->disableFirstColumnActionLink();
    $l->setTableHeaderPadding(19);
    $l->display();
}
Exemplo n.º 25
0
            $env_url = str_replace('[version]', $api_json->version, $e->url);
            if (isset($e->parameters)) {
                $env_params = "&" . $e->parameters;
            }
        }
    }
}
if (!empty($api_json->endpoints)) {
    foreach ($api_json->endpoints as $e) {
        $endpoint = str_replace('/', '-', $e->name);
        $params = "env=dev";
        $has_test = false;
        if (!empty($e->parameters)) {
            foreach ($e->parameters as $p) {
                if (!empty($p->test)) {
                    $params .= getParams($p, $e->parameters);
                    $has_test = true;
                    break;
                }
            }
            //if endpoint does not have a test then continue
            if (!$has_test) {
                continue;
            }
            //need at least one argument to pass
            if (!empty($params)) {
                if (isset($e->priority)) {
                    $file = fopen("{$features_dir}/" . str_replace('-', $e->priority . '-', $endpoint) . ".feature", "w");
                } else {
                    $file = fopen("{$features_dir}/{$endpoint}.feature", "w");
                }
Exemplo n.º 26
0
/**
*index.php?
*参数email 收件人邮箱
*title 邮件标题
*content 邮件内容
*
*日志记录在mail_log表里
*/
//0.引用
require 'function.php';
//1.判断权限
$ip = getIP();
$sig = check_ip($ip);
if ($sig) {
    //2.组装参数
    $params = getParams($_GET);
    if (!empty($params)) {
        //3.发送信息
        //send
        $send = sendMail($params);
        if ($send) {
            //mail_log($ip, 1, $params);
            response(1);
        } else {
            //mail_log($ip, 4, $params);
            response(4);
        }
    } else {
        //mail_log($ip, 3);
        response(3);
    }
Exemplo n.º 27
0
    print "<table><tr><td>";
    print _T('Click on "Force Generation" if you want to force the update of the boot menu', 'imaging');
    print "</td><td>";
    $f = new ValidatingForm();
    $f->addButton("bsync", _T("Force Generation", "imaging"));
    $f->display();
    print "</td></tr></table>";
} else {
    print "<table><tr><td>";
    print _T('This target\'s boot menu is up-to-date.', 'imaging');
    print "</td></tr></table>";
}
if ($CUSTOM_MENU == 1) {
    /* This is a machine custom menu, so we propose to restore default location
     * menu */
    print "<table><tr><td>";
    printf(_T('This computer has a <u>custom boot menu</u>. <a href="%s">Click here</a> to get back the default one.', 'imaging'), $_SERVER['REQUEST_URI'] . '&reset_defaultMenu=1');
    print "</td></tr></table>";
}
if ($IN_GROUP == 1) {
    /* This machine is in an imaging group, so we propose to leave the group */
    $params = getParams();
    $uuid = $params['uuid'];
    if (count($group = arePartOfAProfile(array($uuid)))) {
        $groupname = $group[$uuid]['groupname'];
        $groupid = $group[$uuid]['groupid'];
        print "<table><tr><td>";
        printf(_T('This computer is currently member of "%s". <a href="%s">Click here</a> to leave the group and customize the boot menu.', 'imaging'), $groupname, $_SERVER['REQUEST_URI'] . '&leave_group=1&group_uuid=' . $groupid);
        print "</td></tr></table>";
    }
}
Exemplo n.º 28
0
        global $argc, $argv;
        // --fix-lock may be only the last argument
        if ($argv[$argc - 1] == '--fix-lock') {
            // no other args are allowed
            $config['fix-lock'] = true;
        }
    } else {
        foreach (array_keys($config) as $key) {
            if (isset($_GET[$key])) {
                $config[$key] = $_GET[$key];
            }
        }
    }
    return $config;
}
$config = getParams();
// if requested, clear the lock
if ($config['fix-lock']) {
    if (Lock::release('process_mail_queue')) {
        echo "The lock file was removed successfully.\n";
    }
    exit(0);
}
if (!Lock::acquire('process_mail_queue')) {
    $pid = Lock::getProcessID('process_mail_queue');
    fwrite(STDERR, "ERROR: There is already a process (pid={$pid}) of this script running.");
    fwrite(STDERR, "If this is not accurate, you may fix it by running this script with '--fix-lock' as the only parameter.\n");
    exit(1);
}
// handle only pending emails
$limit = 50;
Exemplo n.º 29
0
            }
        }
        $ov = VisitorChat::FromCache($EXTERNALUSER->UserId, $EXTERNALUSER->UserId . "_OVL");
        if (!empty($ov->Fullname)) {
            $fullname = base64UrlEncode($ov->Fullname);
        }
        if (!empty($ov->Email)) {
            $email = base64UrlEncode($ov->Email);
        }
        $TRACKINGSCRIPT = applyReplacements($TRACKINGSCRIPT, true, false);
    }
    $TRACKINGSCRIPT = str_replace("<!--user_name-->", $fullname, $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--user_email-->", $email, $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--height-->", $CONFIG["wcl_window_height"], $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--width-->", $CONFIG["wcl_window_width"], $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--get_track_params-->", getParams("", array("ws" => true, "ecsgs" => true, "ecsge" => true, "ecsc" => true, "ecsy" => true, "ecsx" => true, "ecsb" => true, "ecsa" => true, "ecslw" => true, "echc" => true, "ecfs" => true, "ecfe" => true, "echt" => true, "echst" => true, "ecoht" => true, "ecohst" => true, "ovlto" => true, "ovlt" => true, "ovlp" => true, "ovlml" => true, "ovlmr" => true, "ovlmt" => true, "ovlmb" => true, "ovls" => true, "ovloo" => true, "ovlc" => true, "ovlapo" => true, "ovlct" => true, GET_EXTERN_GROUP => true, "intid" => true, "pref" => true, "cboo" => true, "hg" => true, "fbpos" => false, "fbw" => false, "fbh" => false, "fbshx" => false, "fbshy" => false, "fbshb" => false, "fbshc" => false, "fbmt" => false, "fbmr" => false, "fbmb" => false, "fbml" => false, "fboo" => false, "eca" => true, "ecw" => true, "ech" => true, "ecmb" => true, "ecml" => true, "cf0" => true, "cf1" => true, "cf2" => true, "cf3" => true, "cf4" => true, "cf5" => true, "cf6" => true, "cf7" => true, "cf8" => true, "cf9" => true)), $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--server-->", LIVEZILLA_URL, $TRACKINGSCRIPT);
} else {
    $TRACKINGSCRIPT = "lz_tracking_set_sessid(\"" . base64_encode(CALLER_USER_ID) . "\",\"" . base64_encode(CALLER_BROWSER_ID) . "\");";
    if (BaseURL::IsInputURL() && strpos(BaseURL::GetInputURL(), GET_INTERN_COBROWSE) !== false) {
        abortTracking(1);
    }
    $BROWSER = VisitorBrowser::FromCache(CALLER_USER_ID, CALLER_BROWSER_ID);
    $EXTERNALUSER->AddBrowser($BROWSER);
    if ($EXTERNALUSER->FirstCall && !$BROWSER->GetFirstCall()) {
        $EXTERNALUSER->FirstCall = false;
    }
    initData(array("INTERNAL", "FILTERS", "EVENTS"));
    define("IS_FILTERED", $FILTERS->Match(getIP(), formLanguages(!empty($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : ""), CALLER_USER_ID));
    define("IS_FLOOD", $BROWSER->GetFirstCall() && Filter::IsFlood(getIP(), CALLER_USER_ID));
    if (IS_FILTERED || IS_FLOOD || !empty($_GET["deactr"]) || getCookieValue(OO_TRACKING_FILTER_NAME) != null) {
Exemplo n.º 30
0
 *
 * MMC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */

/* common ajax includes */
require("../includes/ajaxcommon.inc.php");

    $t = new TitleElement(_T("Available masters", "imaging"), 3);
    $t->display();

    $ajax = new AjaxFilter("modules/imaging/manage/ajaxMasterLevel2.php", "Level2", getParams(), "formLevel2");
    //$ajax->setRefresh(10000);
    $ajax->display();
    echo '<br/><br/><br/>';
    $ajax->displayDivToUpdate();
    
require("../includes/ajaxcommon_bottom.inc.php");
    
?>