Current File : //root/panel/dryden/ctrl/hrpanel.class.php
<?php

/**
 * @copyright 2014-2015 Sentora Project (http://www.sentora.org/) 
 * Sentora is a GPL fork of the ZPanel Project whose original header follows:
 *
 * Options class communicates with the ZPanel database and can read and write system options.
 * @package zpanelx
 * @subpackage dryden -> controller
 * @version 1.0.0
 * @author Bobby Allen (ballen@bobbyallen.me)
 * @copyright ZPanel Project (http://www.zpanelcp.com/)
 * @link http://www.zpanelcp.com/
 * @license GPL (http://www.gnu.org/licenses/gpl.html)
 */
class ctrl_hrpanel 
{
    static function isIndexFileExists($domain_name)
    {
        $full_path=self::getFullPathOfDomain($domain_name);
        if(file_exists($full_path."index.html"))
            return "index.html";
        if(file_exists($full_path."index.php"))
            return "index.php";
        if(file_exists($full_path."index.htm"))
            return "index.htm";
        else
            return false;
    }

    public function getFullPathOfDomain($domain_name)
    {
        global $zdbh;
        $username = self::getusernamebasedonDomain($domain_name);
        $rows = $zdbh->prepare("SELECT vh_directory_vc FROM x_vhosts WHERE vh_name_vc='".$domain_name."' AND vh_deleted_ts IS NULL");
        $rows->execute();
        $dbvals = $rows->fetch();
        $path=ltrim($dbvals['vh_directory_vc'],"/");
        $vhost_path = rtrim( ctrl_options::GetSystemOption('hosted_dir') . $username . "/".$path, "/")."/"; // by nandhini
        return $vhost_path;
    }
        
    public function getusernamebasedonDomain($domain_name)
    {
        global $zdbh;
        $rows = $zdbh->prepare("SELECT ac_user_vc FROM x_accounts WHERE ac_id_pk=(SELECT vh_acc_fk FROM x_vhosts WHERE vh_name_vc='".$domain_name."' AND vh_deleted_ts IS NULL);");
        $rows->execute();
        $dbvals = $rows->fetch();
        $username=$dbvals['ac_user_vc'];
        return $username;
    }

}