コード例 #1
0
ファイル: AdminUtils.php プロジェクト: vberzsin/2014
 public static function getInstance()
 {
     if (null == self::$instance) {
         self::$instance = new AdminUtils();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: MMenu.php プロジェクト: elijahGraff/stoma-dental
 private function renderRightBlock()
 {
     $content = "<div style='border:1px solid #000; padding:5px; width:30%; float:left;'>\n";
     $items = AdminUtils::getMenuItemsList();
     foreach ($items as $id => $title) {
         $content .= "- {$title} <br />\n";
     }
     $content .= "</div>\n";
     $this->data["content"] .= $content;
 }
コード例 #3
0
ファイル: Lister.php プロジェクト: featherbb/featherbb
 /**
  * Get all official plugins using GitHub API
  */
 public static function getOfficialPlugins()
 {
     $plugins = array();
     // Get the official list from the website
     $content = json_decode(AdminUtils::get_content('http://featherbb.org/plugins.json'));
     // If internet is available
     if (!is_null($content)) {
         foreach ($content as $plugin) {
             // Get information from each repo
             // TODO: cache
             $plugins[] = json_decode(AdminUtils::get_content('https://raw.githubusercontent.com/featherbb/' . $plugin . '/master/featherbb.json'));
         }
     }
     return $plugins;
 }
コード例 #4
0
 /**
  * Change status
  *
  * @param   string  $what field to change
  * @param   integer $id ID of the item to change
  * @param   integer $value value to set (0 = off, 1 = on)
  * @return  void
  */
 public function set($what, $id, $value = 0)
 {
     $msg = null;
     $mod = new Widget_model();
     $id_user = $mod->get_var($id, 'widgets', 'id_user');
     if ($id_user != $_SESSION['xuid']) {
         $msg = AdminUtils::set_msg(false, '', $this->dict->get_word('_NOT_PERMITTED', 'msg'));
     }
     if (is_null($msg)) {
         $qs = X4Route_core::get_query_string();
         // do action
         $mod = new Widget_model();
         $result = $mod->update($id, array($what => $value));
         // set message
         $this->dict->get_words();
         $msg = AdmUtils_helper::set_msg($result);
         // set update
         if ($result[1]) {
             $msg->update[] = array('element' => $qs['div'], 'url' => urldecode($qs['url']), 'title' => null);
         }
     }
     $this->response($msg);
 }
コード例 #5
0
ファイル: log_config.php プロジェクト: stgrandet/logkafka
 function __construct($zookeeper_connect)
 {
     $this->zookeeper_connect_ = $zookeeper_connect;
     list($this->zookeeper_urls_, $this->kafka_chroot_path_) = AdminUtils::splitZookeeperConnect($zookeeper_connect);
     $this->log_collect_config_path_ = $this->kafka_chroot_path_ . "/logkafka/config";
     $this->log_collect_client_path_ = $this->kafka_chroot_path_ . "/logkafka/client";
 }
コード例 #6
0
ファイル: index.php プロジェクト: vberzsin/2014
function detectMessage($app)
{
    // sets up utils
    $utils = Utils::getInstance();
    $wmUtils = WatermarkUtils::getInstance();
    $adminUtils = AdminUtils::getInstance();
    $session = Session::getInstance();
    $user = User::getInstance();
    // reads incoming
    $type = $utils->iStr($app->request()->post('type'), 64);
    //
    $mid = $wmUtils->getStoredMid();
    $midLen = $wmUtils->getStoredMidLen();
    // evals message
    $message = $utils->getDecBinFromInt($mid, $midLen);
    // reads incoming song-id and user-id
    $sid = $utils->iStr($app->request()->post('sid'), 64);
    $uid = $utils->iStr($app->request()->post('uid'), 64);
    if (-1 == $uid) {
        $uid = $user->getId();
    }
    // evals user by given user-id
    $targetUser = new User($uid);
    $bucket = $targetUser->getBucket();
    // evals song record by the given user and song ids
    $exc = $adminUtils->loadSong($uid, $sid);
    // evals *real path of the song
    $path = '';
    if (false != $exc) {
        $path = $exc[0]['path'];
    }
    // starts detect proc
    $res = $wmUtils->detectMark($bucket, $path, $message);
    // sets up a result
    $err = false == $res ? $session->flushError() : '';
    $res = false == $res ? 'false' : $res;
    //
    $pid = 0;
    if (false != $res) {
        $pid = $res[0];
    }
    //
    $path = $wmUtils->getDetectProcLogpath();
    $path = false == $path ? 'false' : $path;
    //
    $res = array('req' => 'detectMessage', 'uid' => $uid, 'sid' => $sid, 'pid' => $pid, 'res' => $res, 'err' => $err, 'path' => $path);
    return $res;
}
コード例 #7
0
             case "c_small":
                 $new_width = 40;
                 $new_height = 40;
                 break;
             case "c_medium":
             default:
                 $new_width = 270;
                 $new_height = 180;
                 break;
             case "c_large":
                 $new_width = 0;
                 $new_height = 0;
                 break;
         }
         G::logMessage("CROP :: " . $filename);
         $data = AdminUtils::cropProductImage($filename, $width, $height, $x, $y, $new_width, $new_height);
     } else {
         $data = array();
         $data["result"] = false;
         $data["errors"] = array(RenderUtils::renderError("Access denied!"));
     }
     break;
 case COPY_IMAGE_TMP:
     init("admin/images");
     $errors = array();
     $result = false;
     if (G::$user->isOrHigher(U_MODERATOR)) {
         $filename = $_POST["img_filename"];
         $type = $_POST["image_type"];
         $new_filename = trim($_POST["filename"]);
         $new_filename = G::$db->quote(strip_tags($new_filename));
コード例 #8
0
ファイル: index.php プロジェクト: druus/oscar
     $invoices = $utils->searchInvoices($values['search_supplier']);
     //$invoices = array( $values['search_supplier'], 'HP ProLiant server plus memory', 'druus', '23177401', '2013-12-19' );
     $template = $twig->loadTemplate('invoices.tmpl');
     echo $template->render(array('pageTitle' => $data01, 'cfgData' => $cfgData, 'suppliers' => $supArray, 'invoices' => $invoices, 'choosenSuppliers' => $values['search_supplier'], 'startdate' => $values['startdate'], 'enddate' => $values['enddate']));
     break;
     /***************************************/
     /**     Deal with admin functions      */
     /***************************************/
 /***************************************/
 /**     Deal with admin functions      */
 /***************************************/
 case "admin-suppliers":
     $formCmd = "";
     // Create an instance of AdminUtils
     try {
         $adminUtils = new AdminUtils($DBNAME, $DBUSER, $DBPASSWD, $DBTYPE, $DBSERVER);
         if ($values['subcmd'] == "edit" && $values['suppid'] > 0) {
             $suppliers = $adminUtils->getSupplier($values['suppid']);
             $suppliers = $suppliers[0];
             $formCmd = "update";
             $template = $twig->loadTemplate('admin-suppliers_edit.tmpl');
         } else {
             if ($values['subcmd'] == "new") {
                 $formCmd = "create";
                 $template = $twig->loadTemplate('admin-suppliers_edit.tmpl');
             } else {
                 if ($values['subcmd'] == "delete" && $values['suppid'] > 0) {
                     $adminUtils->deleteSupplier($values['suppid']);
                     $suppliers = $adminUtils->getSuppliers();
                     $template = $twig->loadTemplate('admin-suppliers_list.tmpl');
                 } else {
コード例 #9
0
ファイル: add_user.php プロジェクト: eguicciardi/ada
         $userObj = new ADAPractitioner($user_dataAr);
         break;
     case AMA_TYPE_SWITCHER:
         $userObj = new ADASwitcher($user_dataAr);
         break;
     case AMA_TYPE_ADMIN:
         $userObj = new ADAAdmin($user_dataAr);
         break;
 }
 $userObj->setPassword($_POST['user_password']);
 $result = MultiPort::addUser($userObj, array($_POST['user_tester']));
 if ($result > 0) {
     if ($userObj instanceof ADAAuthor) {
         AdminUtils::performCreateAuthorAdditionalSteps($userObj->getId());
     } elseif ($userObj instanceof ADASwitcher || $userObj instanceof ADAPractitioner) {
         AdminUtils::createUploadDirForUser($userObj->getId());
     }
     $message = translateFN("Utente aggiunto con successo");
     header('Location: ' . $userObj->getHomePage($message));
     exit;
 } else {
     /*
      * Qui bisogna ricreare il form per la registrazione passando in $errorsAr['registration_error'] 
      * $result e portando li' dentro lo switch su $result
      */
     $errorsAr['registration_error'] = $result;
     unset($_POST['submit']);
     $user_dataAr = $_POST;
     $testers_dataAr = $common_dh->get_all_testers(array('id_tester', 'nome'));
     if (AMA_Common_DataHandler::isError($testers_dataAr)) {
         $errObj = new ADA_Error($testersAr, translateFN("Errore nell'ottenimento delle informazioni sui tester"));
コード例 #10
0
ファイル: log_config.php プロジェクト: hjxhjh/logkafka
 static function listConfig($zkClient, $configs)
 {
     /*{{{*/
     if (empty($configs)) {
         throw new LogConfException("configs empty! \n");
     }
     if (array_key_exists('hostname', $configs) && !empty($configs['hostname'])) {
         // get logkafka/conf/$hostname znode value
         $hostname = $configs['hostname'];
         $tmp_ret = AdminUtils::getLogCollectionConf($zkClient, $hostname);
         if ($tmp_ret['errno'] == 0) {
             $lk_host_confs = $tmp_ret['data'];
         } else {
             echo $tmp_ret['errmsg'];
         }
         $tmp_ret = AdminUtils::getLogCollectionState($zkClient, $hostname);
         if ($tmp_ret['errno'] == 0) {
             $lk_host_stats = $tmp_ret['data'];
         } else {
             echo $tmp_ret['errmsg'];
         }
         if (empty($lk_host_confs)) {
             echo "No logkafka configurations for hostname({$hostname}).\n";
             return;
         }
         if (array_key_exists('log_path', $configs) && !empty($configs['log_path'])) {
             AdminUtils::listConfigByHostAndPath($zkClient, $lk_host_confs, $lk_host_stats, $hostname, $configs['log_path']);
         } else {
             $paths = array_keys($lk_host_confs);
             foreach ($paths as $path) {
                 AdminUtils::listConfigByHostAndPath($zkClient, $lk_host_confs, $lk_host_stats, $hostname, $path);
             }
         }
     } else {
         // get logkafka/conf/<all hostname> znode value
         $tmp_ret = AdminUtils::getLogkafkaHosts($zkClient);
         if ($tmp_ret['errno'] == 0) {
             $hosts = $tmp_ret['data'];
         } else {
             echo $tmp_ret['errmsg'];
         }
         if (empty($hosts)) {
             echo "No logkafka configurations.\n";
             return;
         }
         foreach ($hosts as $host) {
             $tmp_ret = AdminUtils::getLogCollectionConf($zkClient, $host);
             if ($tmp_ret['errno'] == 0) {
                 $lk_host_confs = $tmp_ret['data'];
             } else {
                 echo $tmp_ret['errmsg'];
             }
             $tmp_ret = AdminUtils::getLogCollectionState($zkClient, $host);
             if ($tmp_ret['errno'] == 0) {
                 $lk_host_stats = $tmp_ret['data'];
             } else {
                 echo $tmp_ret['errmsg'];
             }
             if (empty($lk_host_confs)) {
                 echo "No logkafka configurations for host({$host}).\n";
                 continue;
             }
             if (array_key_exists('log_path', $configs) && !empty($configs['log_path'])) {
                 AdminUtils::listConfigByHostAndPath($zkClient, $lk_host_confs, $lk_host_stats, $host, $configs['log_path']);
             } else {
                 $paths = array_keys($lk_host_confs);
                 foreach ($paths as $path) {
                     AdminUtils::listConfigByHostAndPath($zkClient, $lk_host_confs, $lk_host_stats, $host, $path);
                 }
             }
         }
     }
 }
コード例 #11
0
ファイル: add_user.php プロジェクト: eguicciardi/ada
            case AMA_TYPE_SUPERTUTOR:
            case AMA_TYPE_TUTOR:
                $userObj = new ADAPractitioner($user_dataAr);
                break;
            case AMA_TYPE_SWITCHER:
                $userObj = new ADASwitcher($user_dataAr);
                break;
            case AMA_TYPE_ADMIN:
                $userObj = new ADAAdmin($user_dataAr);
                break;
        }
        $userObj->setPassword($_POST['password']);
        $result = MultiPort::addUser($userObj, array($sess_selected_tester));
        if ($result > 0) {
            if ($userObj instanceof ADAAuthor) {
                AdminUtils::performCreateAuthorAdditionalSteps($userObj->getId());
            }
            $message = translateFN('Utente aggiunto con successo');
            header('Location: ' . $userObj->getHomePage($message));
            exit;
        } else {
            $form = new CText(translateFN('Si sono verificati dei problemi durante la creazione del nuovo utente'));
        }
    } else {
        $form = new CText(translateFN('I dati inseriti nel form non sono validi'));
    }
} else {
    $form = new UserSubscriptionForm();
}
$label = translateFN('Aggiunta utente');
$help = translateFN('Da qui il provider admin può creare un nuovo utente');
コード例 #12
0
ファイル: AdminUtilsTest.php プロジェクト: vberzsin/2014
 public function __construct()
 {
     $this->session = Session::getInstance();
     $this->adminUtils = AdminUtils::getInstance();
     $this->webDBUtils = WebDBUtils::getInstance();
 }